Index: releng/4.8/UPDATING =================================================================== --- releng/4.8/UPDATING (revision 127116) +++ releng/4.8/UPDATING (revision 127117) @@ -1,1214 +1,1217 @@ Updating Information for FreeBSD STABLE users This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the COMMON ITEMS: section later in the file. A reverse chronology since 4.0 was released is included, followed by the common items quick how-tos, followed by entries for versions of -current prior to 4.0 Release. This is for the 4.8 release branch. All entries since 4.8 are an itemized list of commits to this branch, numbered from the beginning. The security advisories related to various patches contain information on how to build/install a minimal set of binaries and start/stop a minimal number of processes, if possible, for that patch. For those updates that don't have an advisory, or to be safe, you can do a full build and install as described in the COMMON ITEMS section. +20040317: p17 FreeBSD-SA-04:05.openssl + Correct a denial-of-service vulnerability in OpenSSL. + 20040302: p16 FreeBSD-SA-04:04.tcp Limit TCP segment reassembly queue size. 20040205: p15 FreeBSD-SA-04:02.shmat Correct a reference counting bug in shmat(2). 20040202: Fixed a syntax issue in gensetdefs(8) sources which tripped up newer compilers. This has no impact on security, but allows cross-building 4.8 on a 5.x system. 20031126: p14 FreeBSD-SA-03:19.bind Corrected remote denial-of-service vulnerability in named(8). 20031003: p13 FreeBSD-SA-03:18.openssl Corrected vulnerabilities in OpenSSL ASN.1 parsing. 20031003: p12 FreeBSD-SA-03:17.procfs Correct integer underflows/overflows in procfs(5) and linprocfs(5). 20031002: p11 FreeBSD-SA-03:16.filedesc Correct a reference counting bug in readv(2). 20030924: p10 FreeBSD-SA-03:14.arp Updated fix for arplookup bug. 20030924: p9 FreeBSD-SA-03:15.openssh Fix PAM-related bugs in OpenSSH's challenge/response code. 20030923: p8 FreeBSD-SA-03:14.arp Fix a bug in arplookup(), whereby a hostile party on a locally attached network could exhaust kernel memory, and cause a system panic, by sending a flood of spoofed ARP requests. 20030917: p7 FreeBSD-SA-03:13.sendmail Fix another address parsing buffer overflow. 20030916: p6 FreeBSD-SA-03:12.openssh Follow-up fixes for OpenSSH oversized packet buffer handling. 20030916: p5 FreeBSD-SA-03:12.openssh OpenSSH oversized packet buffer handling corrected. 20030825: p4 FreeBSD-SA-03:11.sendmail Sendmail DNS map problem corrected. 20030810: p3 FreeBSD-SA-03:10.iBCS2 iBCS2 system call translator for statfs leaked information. 20030810: p2 FreeBSD-SA-03:09.signal Repair range-checking errors in signal handling. 20030804: p1 FreeBSD-SA-03:08.realpath Correct a single byte buffer overflow in realpath(3). 20030403: FreeBSD 4.8-RELEASE. 20030214: OpenSSL 0.97 has been imported, and the libcrypto/libssl library versions have been bumped. 20030213: sendmail 8.12.7 has been imported. It has one important change for IPv6 users. The default submit.mc now uses '[127.0.0.1]' instead of 'localhost' meaning only IPv4 is used to connect to the MTA. Users on IPv6-only machines will need to edit /etc/mail/submit.mc appropriately. 20021110: The definitions of the standard file streams (stdin, stdout, and stderr) have changed so that they are no longer compile-time constants. Some older binaries may require updated 3.X compatability libraries (for example, by setting COMPAT3X=yes for a buildworld/installworld). 20021010: FreeBSD 4.7-RELEASE. 20020807: COPY is being deprecated. The 20020703 change was reverted, as it causes far more pain than was expected, and to always compare before installing, please use INSTALL="install -C" again. The -C option is now silently ignored when used with the -d option. 20020704: OpenSSH has been upgraded to 3.4p1 and fully PAMified. Note that the protocol version now defaults to 2 rather than 1, which means clients might get warnings about unknown host keys their hostfiles only list the ssh1 RSA key. See ssh_config(5) and sshd_config(5) for more information on configuring ssh and sshd. 20020703: The install(1) utility no longer allows the -d and -C options to be specified together. "INSTALL=install -C" in make.conf should be replaced with "COPY=-C". 20020615: FreeBSD 4.6-RELEASE. 20020515: The k5su utility installed as part of Kerberos 5 is no longer installed with the set-user-ID bit set by default. Add ENABLE_SUID_K5SU=yes to /etc/make.conf to have it installed with the set-user-ID bit set. 20020501: The ephemeral port range change that was previously mentioned in this document has been reverted, so any changes it required to your system may be reverted as well. Those who missed the change should ignore this notice. 20020421: inetd_enable was changed back to YES, to match the defaults earlier in the 4.0-stable branch. This change restores the daemons that were enabled prior to April 15th. When exec'ing set[ug]id executables, the kernel now ensures that the stdio file descriptors (0..2) are open. See FreeBSD-SA-02:23.stdio. 20020420: sendmail_enable was changed back to YES, to match the defaults earlier in the 4.0-stable branch. 20020415: Many denizens of /etc were MFC'ed. While most of the changes are very benign, some of them have created a bit of a stir. Use the new version of mergemaster to update /etc, either by updating /etc after installworld, or by doing: cd /usr/src/usr.sbin/mergemaster; make -m /usr/src/share/mk all install before you run installworld. Then use the new -C option to double-check your rc.conf settings. You should also double-check settings in [defaults/]rc.conf, syslog.conf, newsyslog.conf, and anything else important to your system. The two most important changes to note: sendmail and inetd were turned off by default. If you need them, please turn them back on by adding sendmail_enable=YES and/or inetd_enable=YES to /etc/rc.conf. 20020411: New sendmail startup scripts have been installed to make it easier to use alternative MTAs with FreeBSD. The rc.conf variable mta_start_script can be set to a script for starting an alternative MTA or to "" to prevent any MTA from being started at boot. 20020404: The sendmail startup code in /etc/rc has been changed to deal with a non-set-user-ID sendmail binary. Setting the rc.conf variable sendmail_enable to "NO" no longer prevents any sendmail daemons from starting. Instead, set sendmail_enable to "NONE" to prevent any MTA from being started at boot. 20020404: Due to the import of sendmail 8.12.2 (see 20020325 entry), a new user and group are required in order for sendmail to run as a set-group-ID binary. A 'make installworld' will use the new user and group to set the owner and group of /var/spool/clientmqueue and will fail if the new user and group do not exist. The 'smmsp' user and group must be merged from src/etc/group and src/etc/master.passwd before using 'make installworld'. 'mergemaster -p' will do this. You may need to install mergemaster before this will work if you are updating from a very old version of stable. This can be done with: cd /usr/src/usr.sbin/mergemaster; make -m /usr/src/share/mk all install 20020325: sendmail 8.12.2 has been imported. The sendmail binary is no longer a set-user-ID root binary and the infrastructure to support command line mail submission has changed. Be sure to run mergemaster (especially for updating /etc/rc, /etc/defaults/rc.conf, and /etc/mail) and read /etc/mail/README for more details. 20020318: The ata(4) driver has been updated from the version in -CURRENT. As a result, some device nodes in /dev have changed; it will be necessary to update MAKEDEV and re-make the device nodes. mergemaster(8) will offer to do this as a part of its upgrade procedure. 20020129: FreeBSD 4.5-RELEASE. 20020105: The locale names have been renamed in -stable to match -current: 1. ISO_* -> ISO* 2. ru_SU* -> ru_RU* 3. DIS_* -> ISO*-15 4. *.ASCII -> *.US-ASCII 20011202: A security hole in OpenSSH involving `UseLogin yes' has been patched. 20011110: Some linux module changes, merged from current, require that you clean out the old compile directory. If you are building with MODULES_WITH_WORLD=yes, then you need to cd to src/sys/modules/linux and run "make cleandir". If not, then you need to cd src/sys/compile/$KERNCONF and do a make modules-clean. 20011102: ipfw/bridge/dummynet features merged from current. 20011018: The kernel Makefile was enhanced to pass -g to modules builds when it is used for kernel building (eg, when the config file has DEBUG=-g). People that have enabled debugging kernels will find they need significantly more disk space in their slash (/) partition. 20010928: The OpenSSH `ChallengeResponseAuthentication' option now defaults to `yes'. This enables S/Key authentication, which can result in users receiving an S/Key challenge when logging in interactively. To disable this behavior, add a line to your /etc/ssh/sshd_config file: `ChallengeResponseAuthentication no' 20010914: 4.4 Released. 20010814: The pci attachment for pcic device was merged from current. You should update your pccardd at the same time as you update your kernel. Note: Interrupts will now be shared between the CardBus bridge and the cards. This is a change over the hand configuration before. 20010811: isdn4bsd was updated to version 1.00.1. for users of the isp (kernel PPP over ISDN) devices, this means that they now _must_ use ispppcontrol instead of spppcontrol to configure and control their isp devices. see /usr/share/examples/isdn for more info. 20010725: The ed driver has been updated. It now allows mii attachments, which means that you must include the miibus in your kernel if you use the ed driver. 20010724: The gif(4) interface has been converted to use cloning rather then allocating a static number of devices a compile time. If you use gif interfaces and configure them by any method other then setting standard variables in /etc/rc.conf you will need to update your system to create devices with "ifconfig gifX create" before attempting to configure them. See the ifconfig(8) man page and /etc/rc.network for more information. 20010611: The TCP_RESTRICT_RST option has been removed. You should entirely remove it from your kernel configuration. The same functionality is available from the blackhole(4) MIB. 20010531: The wd compat devices were removed from the ata driver. Kernels after this date will fail to work with /dev/ nodes that you may have on your disk. /etc/fstab is a common place to find these files hanging out, as are dump devices in /etc/rc.conf. 20010521: Minor repo damange has happened. This may cause problems with cvsup of ports. If you get errors, please see http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27495 at the bottom for details on a workaround. The error message is Updater failed: Cannot delete "/usr/ports/www/jakarta-tomcat/files": Directory not empty 20010516: Size changes in the cred structures introduced a binary incompatibility for modules using the crhold() macro. Modules should be recompiled for kernel later than this date. 20010510: The fxp driver from current has been ported to -stable. This requires kernels that include fxp to also include mii bus devices. See GENERIC for details. 20010421: FreeBSD 4.3 RELEASE 20010402: It appears that PERL_THREADED=true in /etc/make.conf is not compatible with mod_perl. Not sure the exact date of this problem, but it post dates 4.2 and predates 4.3. 20010202: The KERNEL variable for buildkernel and installkernel has been deprecated in favor of KERNCONF. make kernel now combines these two steps. 20010117: Linksys Fast Ethernet PCCARD cards supported by the ed driver now require the addition of flag 0x80000 to their config line in pccard.conf(5). This flag is not optional. These Linksys cards will not be recognized without it. 20010112: Important new FreeBSD-version stuff: PAM support has been worked in, partially from the "Unix" OpenSSH version. This requires adding the following in pam.conf: sshd auth sufficient pam_skey.so sshd auth required pam_unix.so try_first_pass sshd session required pam_permit.so 20010109: ipfw interface changed. Make sure that the userland and kernel match or you won't have the firewall rules you think you do. 20001120: FreeBSD 4.2 RELEASE. 20001020: ****************************** WARNING ****************************** Sendmail has been updated. ****************************** WARNING ****************************** o mail.local(8) is no longer installed as a set-user-id binary. o sendmail(8) is now built with STARTTLS support unless NO_OPENSSL is set. o The default /etc/mail/sendmail.cf disables the SMTP EXPN and VRFY commands. o Now using sendmail's version of vacation(1). o The sendmail cf building tools (contrib/sendmail/cf) are installed in /usr/share/sendmail/cf. o sendmail.cw changed to local-host-names More details can be found at http://people.freebsd.org/~imp/UPDATING/sendmail-20001010 20001009: The ports tree's new layout is in place. Be sure to update your entire ports tree, or you will have problems. 20001006: The perl build procedure no longer installs miniperl, nor uses the installed miniperl. It is recommended that you delete /usr/bin/miniperl. 20000925: FreeBSD 4.1.1 RELEASE. 20000907: Changes to libkvm requires a recompile of the usual suspects. (find /usr/src -name Makefile | xargs egrep -l LIBKVM) This means that your world must match your kernel around this point. 20000904: A new issue with the sendmail upgrade has come to light. /etc/aliases has moved to /etc/mail/aliases. Mergemaster will incorrectly install the default aliases in /etc/mail rather than move the old one from /etc. So you'll need to manually move the file, create a symbolic link, remove the old /etc/aliases.db and run newaliases. For safety sake, you should stop sendmail while doing this and run the upgrade when locally sourced email is not likely to be generated. 20000827: sendmail has been updated from 8.9.3 to 8.11.0. Some of the more visible changes that may immediately affect your configuration include: - New default file locations from src/contrib/sendmail/cf/README - newaliases limited to root and trusted users - MSA port (587) turned on by default - New queue file naming system so can't go from 8.11 -> 8.9 - FEATURE(`rbl') renamed to FEATURE(`dnsbl') - FEATURE(`nullclient') is more full featured - FEATURE(`nouucp') requires an argument: `reject' or `nospecial' - mail.local FreeBSD-only -b option changed to -B - See src/contrib/sendmail/RELEASE_NOTES for more info 20000803: The "installkernel" target has changed slightly. Now even if you override KERNEL e.g. 'make installkernel KERNEL=MYKERNEL' it will install the MYKERNEL file (built with the buildkernel target) as /kernel rather than /MYKERNEL. Those who have updated their /boot/loader.conf files to point to /MYKERNEL should remove that entry or perform manual rename of /kernel to /MYKERNEL. 20000724: FreeBSD 4.1 RELEASE 20000711: If you use CVSUP or CTM to get CVS trees, AND you used to get the old crypto files from internat.freebsd.org AND you check out files from the CVS tree with the cvs command, please read http://people.freebsd.org/~imp/internat.txt for details on potential problems that you might have and how to get around them. If you are merely a mirror, or don't answer yes to each of the clauses above, you needn't worry. 20000707: We started building modules here. IF you don't wish to follow the documented procedure for building kernels, then you'll have to install new mk files from src/share/mk, or define NO_MODULES. 20000706: Binutils were updated. In order to build a kernel after this date, you must follow the updating procedure for building kernels exactly as presented here. You may be able to get away with doing it the old way, but if it breaks, make sure that you've tried the "To build a kernel" section with a fresh /usr/obj first. 20000622: The license on the softupdates is now a standard 2 clause BSD license. You may need to remove your symbolic links that used to be required when updating. 20000501: At approximately this date, an incompatible kernel change was made which means that if you update kernels accross this boundary, you also have to update modules, and vice versa. 20000315: FreeBSD 4.0 RELEASE. Historical entries follow the common items. ****************************** 4.0 RELEASE ****************************** COMMON ITEMS: To build a kernel ----------------- cd /usr/src # If you have not already done so, please buildworld here # You will also need to update your config file to 4.x. Usually # people tend to start with GENERIC from 4.x and hack from there. make buildkernel KERNCONF= make installkernel KERNCONF= # Verify that the new kernel works, it will be installed as # /kernel To rebuild disk /dev entries ---------------------------- MAKEDEV should be copied from src/etc/MAKEDEV to /dev before starting the following: For N in the list of disks MAKEDEV N # eg ad0 for M in the list of slices MAKEDEV NsMa # eg ad0s1a To rebuild everything --------------------- make world Except when it doesn't work :-) To update from 3.x to 4.x stable -------------------------------- *********************************************************** READ -STABLE ARCHIVES FOR THE LAST WEEK OR TWO BEFORE STARTING THIS PROCESS. UPDATING MAY LAG BEHIND A LITTLE A GOTCHAS ARE OFTEN REPORTED IN FREEBSD-STABLE@FREEBSD.ORG BEFORE BEING INCLUDED HERE. IF YOU ARE GOING TO DO REMOTE MACHINES, MAKE SURE THAT THE EXACT VERSION YOU ARE UPDATING THEM TO WORKS ON LOCAL MACHINES BEFORE PROCEEDING. *********************************************************** [3] cd /usr/src [2] make buildworld -DNOPERL cd /usr/src/sbin/mknod make install [1] reboot [6] cd /usr/src cd gnu/usr.bin/texinfo/install-info make install cd ../../../.. ldconfig -R /usr/obj/usr/src/lib/libc make installworld -DNOPERL [5] mergemaster [4] reboot [1] You may need to switch from wd to ad ala 19991210. In addition, you should disable any third party modules such as vmware so that you don't crash your system on reboot. [2] If you have any of the following in your /etc/make.conf, please comment them out before following these instructions and then do a make buildworld + make installworld after you are back to above: MAKE_KERBEROS4 [3] Update to 4.x-stable sources. Make sure that you get all the parts. If you are using cvsup files that are older than a couple of months, be sure they have all the components listed in /usr/share/examples/cvsup. Crypto and secure are now required. [4] This step is not optional. If you fail to do this, you will not have critical system config files updated for their 4.x functionality. This will lead to reduced system functionality, the biggest problem being with /etc/pam.conf not having the entries necessary to allow remote ssh access. [5] Note: This won't upgrade your perl install. You will need to rebuild the world on 4.x to update perl. [6] From the bootblocks, boot -s, and then do fsck -p mount -u / mount -a cd /usr/src adjkerntz -i # if CMOS is wall time To update from 4.0-RELEASE or later to the most current 4.x-STABLE ---------- make buildworld make buildkernel KERNCONF=YOUR_KERNEL_HERE make installkernel KERNCONF=YOUR_KERNEL_HERE reboot (in single user) [1] make installworld mergemaster [2] reboot [1] You can often get away without doing this step as the system will be properly updated. During the running of the installworld, however, system components may break and other oddities may happen. Don't do this on systems that aren't otherwise quiet as unpredictable results may happen. If in doubt, reboot into single user. For remote installs, keep a separate kernel around and use a serial console if at all possible. See also note [6] above. [2] If you do not run mergemaster, you will likely hit a number of show stopper problems. The biggest one is that your /etc/pam.conf won't let you log in using ssh. What follows are older entries for those people upgrading from earlier versions of -stable/-current. 20000308: The binary interface of perl to its modules changed. You will need to recompile any perl moudles after an installworld. This includes all ports matching the pattern /usr/ports/*/p5-*. 20000303: CMSG_XXX macros offset in has changed to conform RFC-2292. All affected applications have been corrected. The i386 platform's offsets haven't changed, but the alpha's did. When you build and install new kernel on FreeBSD/alpha, you must also do a make world. 20000225: OpenSSH has been added to FreeBSD. This may conflict with the ports/security/ssh port since it installs binaries into /usr/bin and the port goes into /usr/local/bin. Most paths have /usr/bin in the path before /usr/local/bin, so problems may arise. If you don't want OpenSSH, add NO_OPENSSH=yes to your make.conf. You will also need to enable OpenSSH in /etc/rc.conf if you want to run the new servers. You may need to move your host key and other config files from /usr/local/etc to /etc/ssh. OpenSSH's command line parsing, available options and default settings aren't the same as ssh, so some care needs to be taken in its operation. One should do a full audit of all configuration settings. 20000205: The xinstall problem has kinda sorta been corrected. The following is known to work by the author of UPDATING. It is what he did to update his laptop. It is likely the same effect as the work around listed in 20000129. make buildworld make installworld This will fail cd usr.bin/xinstall make clean all install NOSHARED=YES cd ../.. make installworld If it doesn't work for you, then I'm sure that there will be another 100 messages in -current. 20000204: libipsec version number changed from 2 to 0. The original commit of Jan 6 incorrectly set this to 2. Remove /usr/lib/libipsec.so.2* before the buildworld and rebuild anything that uses libipsec.so after you install the new version. 20000201: The rcmd related functions have been aligned with other BSD implementations. rlogind and rshd have been changed to use the new API. A make world is recommended to keep them in sync with the libraries they use. http://www.FreeBSD.org/cgi/cvsweb.cgi/src/lib/libc/net/rcmd.c has the details. 20000129: {set,get}flags have been added to the tree for rather dubious reasons. IF AND ONLY IF installworld fails: make -k -DNOFSCHG installworld make installworld This issue was resolved Feb 5, 2000. 20000125: rcmd_af() is added for multiple address family support. rsh and rlogin have been updated to use this to support INET6. A make world is recommended to keep them in sync with the libraries they use. 20000124: The default way that virtual tables in our default C++ compiler has changed. We used to use THUNKS for virtual inheritance. Unfortunately there are bugs that The GCC developers thought would be fixed in GCC 2.95. However it isn't. After this change existing applications written in C++ may give errors like below when you try to run them: /usr/libexec/ld-elf.so.1: /usr/lib/libstdc++.so.3: Undefined symbol "__vt_7filebuf" The only fix is to rebuild the application and any C++ libraries used. 20000124: The management of next_writeable has been move from the kernel to userspace. This means that the burncd command must be in sync with the kernel. So make world is your friend. 20000117: GNU texinfo upgraded to 4.0. It is recommended that you use make buildworld to update. 20000117: CAM_VERSION has been increased. Recompile all programs that depend on it (tosha, camcontrol, etc) when moving to kernels past this date. 20000115: pccard ioctls changed with a commit to have the kernel tell pccardd which device it created, rather than having pccardd dictate it to the kernel. Recompile kernel and pccardd/pccardc together. pccardd/pccardc rely on a kernel Makefile that must be installed prior to building them. Make world will automatically take care of this issue, but you need to know if you are building by hand. 20000109: Your kernel config files need to be changed to s/controller/device/ in them. You will need a new version of config to do this. 20000107: chown & chgrp moved again This is a heads up to let you know that you need to rm -f /sbin/chown /bin/chgrp after your next `make world'. Additionally you need to install a new /dev/MAKEDEV (mergemaster(8) will assist you in this). 20000107: SHA-1 password support gone As warned yesterday, I've just removed the ability for libcrypt to understand SHA-1 passwords. This was present but undocumented in the tree for the past few months and was removed so it can be reimplemented properly as part of a revamped libcrypt at a later date. Anyone who was actually making use of the feature will have to update their passwords back to MD5 before they reinstall the library. 20000106: ioctl numbers changed for dvdio ioctls. You will need to recompile anything that uses them. wormcontrol has been deprecated in favor of burncd. 19991223: Building linux and svr4 compatibility into the kernel now requires /usr/bin/genassym. Go to /usr/src/usr.bin/genassym, do "make obj ; make clean depend all install" before building your kernel. 19991218: sendmail.cf has moved from /etc/sendmail.cf to /etc/mail/sendmail.cf. You may need to adjust /etc/rc.conf and /etc/rc to cope as well as moving sendmail.cf. 19991216: ntp 4.0.98 has replaced the ancient xntpd. The daemon name changed from xntpd to ntpd, so you may need to update your /etc/rc.conf file. The ntp.conf files are compatible with the old release, unless you are using a local reference clock. Details about ntp4 can be found at http://www.ntp.org/. xntpd will be cvs removed from the repo in about a week. 19991213: Soren updated the ata driver. Please update to at least this version before submitting bug reports. 19991210: The ata driver has become the primary ata/ide/atapi driver in the kernel. The wd driver is obsolete. You should upgrade your machine to the new ata driver. You will need to follow the directions for updating the devices in the 19991205 entry. You will need to update all occurances of wd to ad in your config files (/etc/rc.conf, /etc/fstab, etc). A compatibility device exists for wd for the time being, but once you have determined that ata is working for you, transition to the new ad devices. 19991205: Block devices are going away. You will need to update your /dev tree with a fresh copy of MAKEDEV for things to always work in the future. fsck is unable to cope with dirty file systems after this change, so it may work for you or it may not. See "To rebuild disk /dev entries" at the end of the file. *** All uses of block devices must be converted to char devices. *** Likely the only thing impacted is dumpdev in /etc/rc.conf 19991204: The dc interface has replaced al, ax, dm, pn and mx. The former have been removed. 19991204: Support for the old 'sd' device names has been removed in favor of 'da'. Please update your /etc/fstab, /etc/rc.conf and any other places you might have sd names cached. Generally these changes are as simple as s=/dev/sd=/dev/da=g, but be careful to make sure that things are really that simple. You may also need to create /dev entries for the da devices as well. See "To rebuild disk /dev entries" at the end of the file. 19991203: BAD144 support has been removed. Cope or replace the hardware. 19991129: ALPHA users take note. All klds will need to be recompiled for kernels build after this date. It is a good time to update since pal.s will be going away soon. 19991126: MFS_ROOT and MFS_ROOT_SIZE are gone, replaced by MD_ROOT and MD_ROOT_SIZE options in the md driver. md driver now deals with the hacks. You should add md driver to kerneles that have MFS_ROOT, et al. See GENERIC or LINT for details. 19991125: The ep changed a while ago and can no longer be used with hard wired addresses in the config file. 19991122: The bridge drivers for sound cards have been committed. Please see LINT for instructions for your card, if it still works at all. 19991113: Gcc 2.95.2 is now the default compiler. 19991030: /etc/radius.conf file format has changed.The format change is as follows. Each server line in the file should now begin with a new field containing either "auth" for RADIUS authentication, or "acct" for RADIUS accounting. Formerly only authentication was supported. If the first field isn't "auth" or "acct" then the code assumes that "auth" is intended. (That's the compatibility hack.) 19991015: PCCARD has been updated to attach pcic to the isa bus. Therefore you will need to modify kernel config files that have pcic/card in them as follows: controller pcic0 at isa? controller pcic1 at isa? controller card0 19990929: The sigset_t datatype has been changed from an integral type to a compound type and can hold 128 signals. Syscalls directly or indirectly using the new sigset_t have been added as to maintain compatibility with existing binaries. A new kernel must be made and installed and booted with before a make world can be done. *************************************************************** RECOMPILE AND REINSTALL KERNEL BEFORE MAKEWORLD *************************************************************** 19990919: New jail syscall format requires recompilation of jail(8) with fresh headers installed (or a make world will do it for you). 19990914: Matt Dillon checked in many vm related things and sent a heads up to -current urging caution and to report vm problems to him. As of the 19th, no killer problems have been reported, but you have been warned. 19990908: The new miibus has been added to the system. If you are using the dm, rl, sf, sis, ste, tl, wb or xl drivers, you need to add "controller miibus0" to your config file. 19990905: /var/cron/log has been moved to /var/log/cron to get all the log files in one place. 19990831: tn3270 has been removed from the base system and added as a port. 19990830: User-visible TCP timers are now expressed in units of 1ms, instead of 500ms, so if you've customized any timer values under ``net.inet.tcp'', multiply them by 500 to preserve TCP's behavior. 19990828: RCS Id tags changed to FreeBSD. This will cause huge cvsup updates. 19990821: On 28-May-1999 libreadline was upgraded from readline-2.2 to readline-4.0. At that time the shared library major version number was bumped from "3" to "4". It has been deemed that the interface change between readline-2.2 and readline-4.0 was not sufficient to warrant the version number bump. Thus I have reverted it back to "3". You will need to perform the below immediately before your next ``make world'': cd /usr/lib ls -l libreadline.so.4 (if you have /usr/lib/libreadline.so.4) mv libreadline.so.4 libreadline.so.3 rm -f libreadline.so ln -s libreadline.so.3 libreadline.so 19990801: Changes to the pccardd kernel interface require that you recompile pccardd for new kernel. 19980725: The ipfw interface to the kernel has changed. You will need to recompile ipfw programs for the new kernel. 19990715: The bpfilter device has been renamed to bpf. You will need to change your config files in order to enable this in newer kernels. 19990704: src/contrib/sys/softupdates is moving to src/sys/contrib/softupdates. Update your symbolic links/etc. 19990702: Major changes have been made to vinum and its interface. See the man page (vinum(8)) for details. Look at the concat, mirror and stripe commands, as well as the SIMPLIFIED CONFIGURATION section. 19990628: Newsyslog.conf has had a minor, but potentially dangerous, change to its username/group syntax. The old syntax was user.group, while the new syntax is user:group. 19990627: Inetd wrapping default has changed. Please see the updated man page for details. 19990623: Compaq Smart Raid driver committed as ida. 19990622: The second phase of syscons cleanup has happened. Some functionality has been made optional. For details, see http://www.freebsd.org/~yokota/sc_update-June.txt Everyone will need to re-config(8) their kernels, but old binaries will work with the new kernel. 19990620: IPFW uid/gid-based filtering support has been committed. This breaks binary compatibility with previous copies of ipfw(8). Any utilities using the ioctl()s of ipfw (especially ipfw(8)) need to be recompiled with the newest headers installed. 19990618: Inetd now wraps all stream-based services, including internals. Syslog "severity" options are honoured. Installed syslog.conf and hosts.allow should be checked. 19990509: Most of the problems with newbus have been corrected, but it is still current and evolving. libcam's ABI has changed. You must recompile the world and any ports that use it. 19990427: Massive changes to SMP went into the tree that should speed things up. However, if you experience problems with SMP machines, you can back off to the PRE_SMP_VMSHARE tag in the CVS repository (or run an MP kernel). 19990420: Pccardd and the pccard bus in general seem to be broken or most people. Soren has patches to make it better for some, but not all people. Work is underway to make it better for all people. 19990416: new bus changes integrated into -current. Many problems were initially reported, but most have been fixed. You'll need a new config and to tweak your kernel config file the way that GENERIC was tweaked. Keep a copy of your old kernel when upgrading in case your new kernel doesn't work (and report the breakage to current@freebsd.org). As of 19990421 the remaining problems/quirks are o sio no longer supports pnp nor pccard. This will be corrected, but the new pccard code needs to be completed. o Some of the sound drivers broke for some people. It seems inconsistent as to who/what/when/where things broke. o Duplicate device entries in your config do not work. Previously they were silently ignored. psm0 seems to be the most common duplicate choice, although some reports have come in from people that wired their scsi disk entries. o You must move the keyboard and mouse attachments from the isa bus to the atkbdc bus. See GENERIC for details. o Machines with multiple host-pci bridges (Intel 450NX) will not probe the second pci bus. o Some probe ordering may have changed, so device naming may change with the new kernel. If you have multiple devices, please double check to make sure they didn't move. This is especially true for cards on different buses. o The bus attachment for vga0 is always isa0 and never pci0 when it is in fact a pci card. It is safe to ignore this. o The format of the boot messages has changed (and is not guaranteed to be constant for a while) so you may see this in some shell scripts that diff dmesg from day to day as well as scripts that parse dmesg output. 19990414: cc -aout sometimes has problems compiling with -g, remove -g from those compilation units affected until this is corrected. cc -aout has problems with producing some threaded libraries, so make world -DWANT_AOUT is not functional at this time. Since make world for a.out isn't functional, you cannot do make aout-to-elf from a pre-egcs a.out system. To work around this problem, make aout-to-elf using 3.1-stable first (or a pre egcs -current) and then a simple make world will take you the rest of the way with a -current source base. 19990413: Make -j works again for make world. As always, use it with care, and be sure to try a make world w/o -j before reporting problems (that is, know if the problem exists w/o -j before reporting the problem with -j). 19990413: Note cc -aout, which had been broken since the conversion to egcs, now supposedly works. If you have rebuilt things like XFree86 a.out libraries, you should rebuild them again or progams that use them, including netscape, will fail to work. 19990409: NOTE: New c++ compiler cannot be used with c++ binaries from the old compiler and vice versa. 19990408: In recent days egcs has been imported into the tree. A number of problems have been discussed in -current. Here is a highlight of a few of the more common ones. With the exception of make -j n, they have been claimed to have been fixed. c++ is broken after make world: This is correct. Because we changed compilers two make worlds are necessary to get C++ working again. The code generated by the old compiler and new compiler are not compatible, so things wind up being undefined. cpp is broken in make world: There was a window where cpp would be built incorrectly. The fix for this is cd src/gnu/usr.bin/cc make clean make all make install and this should correct your problems. See the -current archives for a version of this that does moer cleaning. Make -j n doesn't work. Work contiunes to make this work, I've seen no reports of success as of April 7th. 19990329: Previously, one would define "NOAOUT" to keep from building the legacy a.out bits. Now one would define "WANT_AOUT" to build them. 19990316: The name of the old wd.c and atapi.c based CDROM driver has been changed back to wcd. So update your config file to use "device wcd" instead of "device acd". 19990314: For those of you using the VN device as a loadable module, please be aware that the new VN device has been committed to -4.x and cannot yet be used as a loadable module. This will be fixed in the future. 19990309: New loader.rc mechanism. Please see src/sys/boot/README for details. 19990225: struct proc size changed. Recompile kernel and the usual suspects. Make world if in doubt. 19990214: The nlpt driver has changed names back to be the lpt driver. See ppbus(4) or http://www.freebsd.org/~nsouch/ppbus.html for proper configuration details. 19990210: The 'lpt' driver is now obsolete. Replace it with the 'nlpt' driver and 'ppbus' controller combination. 19990209: New devstat API requires recompilation of libdevstat, systat, iostat, vmstat and rpc.rstatd. A new kernel is also required. make world + building a kernel should do all of this. Any ports that use devstat need to be recompiled as well. 19990125: Linux threads options has gone away (they are now standard in the FreeBSD kernel). A recompile of all libkvm using programs is in order (or better yet a make world). 19990122: On or about this date there was a small window when the boot blocks had some minor problems which seemed to force one to edit /etc/fstab. This has been corrected, if you are seeing this problem, please rebuild and reinstall your boot blocks. 19990121: Vinum has changed. The "vinum read" command has changed. For updates, please see http://www.freebsd.org/cgi/getmsg.cgi?fetch=800363+0+current/freebsd-current for details. Matt Dillon committed a boatload of VM changes, for information please see http://www.freebsd.org/cgi/getmsg.cgi?fetch=886676+0+current/freebsd-current or http://www.freebsd.org/cgi/getmsg.cgi?fetch=827400+0+current/freebsd-current for details. These changes will likely not impact anybody, but large chagnes to the VM need at least a heads up. 19990120: Stable branch created. You might want to consider using this branch. It is tagged with RELENG_3. 19990119: More work on the syscons driver has been committed. Since files moved around, you will need to reconfigure your kernel, and make clean; make depend before rebuilding the kernel. No config file changes are needed. 19990111: New keyboard and video card drivers are introduced as the first stage of console driver reorganization. You are required to update the kernel configuration file and rebuild the kernel. kbdcontrol, vidcontrol, and screen savers also need recompilation. The instruction can be found in http://www.freebsd.org/~yokota/sc_update.txt It has notes on splash screen too. 19990106: Robert Nordier was kind enough to make this page to enable people to install the new bootblocks: http://www.freebsd.org/~rnordier/boot.txt When updating to ELF, make sure that you have updated your /etc/rc files which have different ldconfig invocations for elf and aout. Otherwise things like X will stop working with messages about being unable to find library files. The mergemaster utility in ports/sysutils/mergemaster helps to keep critical files like this in sync, and its use is recommended. 19990104: Information about ELF day (see 19981230) can be found in http://www.freebsd.org/~peter/elfday.html about the upcoming change, its motivations and instructions for doing the upgrade. 19981230: You should install new bootblocks now. The ELF kernel will become default soon. In addition, you'll need to upgrade your userland programs to ELF before then as well. Use make aout-to-elf to upgrade your userland programs (old a.out programs in, for example, /usr/local/bin will continue to work, even after the upgrade). See src/Makefile for more details. 19981224: The old wcd driver has been deleted from the kernel. The driver that replaces it is named acd. You'll need to change this in your configuration files. Failure to do this will result in "ATAPI CD-ROMs not configured" at boot time. The floppy tape driver (ft) has been removed from the kernel, with no replacement driver. 19981202: New groups from 19981201 commented out of mtree, so they aren't strictly needed, but still a good idea to have. 19981201: New user/group added: bind. From src/etc/master.passwd and src/etc/group: % grep /usr/src/etc/group bind:*:53: % grep /usr/src/etc/master.passwd tty:*:4:65533::0:0:Tty Sandbox:/:/sbin/nologin kmem:*:5:65533::0:0:KMem Sandbox:/:/sbin/nologin bind:*:53:53::0:0:Bind Sandbox:/:/sbin/nologin 19981118: PAM integrated into the tree. Requires new /etc/pam.conf file to silence warnings from authentication programs (login, etc). See src/etc/pam.conf for a sample. FORMAT: This file contains a list, in reverse chronologocal order, of major breakages in tracking -stable. Not all things will be listed here, and it only starts on November 18, 1998. If you have an earlier version of FreeBSD, you are on your own to get to November 18, 1998. Please filter your entries through Warner Losh (imp@village.org) so that the style, formatting, etc of this file can be maintained. Copyright information: Copyright 1998-2002 M. Warner Losh. All Rights Reserved. Redistribution, translation and use, with or without modification, in full or in part, are permitted provided that the above copyright notice is retained. THIS DOCUMENT IS PROVIDED BY WARNER LOSH ``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 WARNER LOSH 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. If you find this document useful, and you want to, you may buy the author a beer. $FreeBSD$ Index: releng/4.8/crypto/openssl/crypto/opensslv.h =================================================================== --- releng/4.8/crypto/openssl/crypto/opensslv.h (revision 127116) +++ releng/4.8/crypto/openssl/crypto/opensslv.h (revision 127117) @@ -1,85 +1,85 @@ #ifndef HEADER_OPENSSLV_H #define HEADER_OPENSSLV_H /* Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ #define OPENSSL_VERSION_NUMBER 0x0090701fL -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7a Feb 19 2003" +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7a-p1 Feb 19 2003" #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT /* The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major verson number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ #define SHLIB_VERSION_HISTORY "" #define SHLIB_VERSION_NUMBER "0.9.7" #endif /* HEADER_OPENSSLV_H */ Index: releng/4.8/crypto/openssl/ssl/s3_pkt.c =================================================================== --- releng/4.8/crypto/openssl/ssl/s3_pkt.c (revision 127116) +++ releng/4.8/crypto/openssl/ssl/s3_pkt.c (revision 127117) @@ -1,1302 +1,1310 @@ /* ssl/s3_pkt.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * 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@cryptsoft.com). * * 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 attribution * 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. * * 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@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * 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 PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * 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. * * 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@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 product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include #define USE_SOCKETS #include "ssl_locl.h" #include #include static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment); static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len); static int ssl3_get_record(SSL *s); static int do_compress(SSL *ssl); static int do_uncompress(SSL *ssl); static int do_change_cipher_spec(SSL *ssl); /* used only by ssl3_get_record */ static int ssl3_read_n(SSL *s, int n, int max, int extend) { /* If extend == 0, obtain new n-byte packet; if extend == 1, increase * packet by another n bytes. * The packet will be in the sub-array of s->s3->rbuf.buf specified * by s->packet and s->packet_length. * (If s->read_ahead is set, 'max' bytes may be stored in rbuf * [plus s->packet_length bytes if extend == 1].) */ int i,off,newb; if (!extend) { /* start with empty packet ... */ if (s->s3->rbuf.left == 0) s->s3->rbuf.offset = 0; s->packet = s->s3->rbuf.buf + s->s3->rbuf.offset; s->packet_length = 0; /* ... now we can act as if 'extend' was set */ } /* if there is enough in the buffer from a previous read, take some */ if (s->s3->rbuf.left >= (int)n) { s->packet_length+=n; s->s3->rbuf.left-=n; s->s3->rbuf.offset+=n; return(n); } /* else we need to read more data */ if (!s->read_ahead) max=n; { /* avoid buffer overflow */ int max_max = s->s3->rbuf.len - s->packet_length; if (max > max_max) max = max_max; } if (n > max) /* does not happen */ { SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR); return -1; } off = s->packet_length; newb = 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 != s->s3->rbuf.buf) { /* off > 0 */ memmove(s->s3->rbuf.buf, s->packet, off+newb); s->packet = s->s3->rbuf.buf; } while (newb < 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) */ clear_sys_error(); if (s->rbio != NULL) { s->rwstate=SSL_READING; i=BIO_read(s->rbio, &(s->s3->rbuf.buf[off+newb]), max-newb); } else { SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET); i = -1; } if (i <= 0) { s->s3->rbuf.left = newb; return(i); } newb+=i; } /* done reading, now the book-keeping */ s->s3->rbuf.offset = off + n; s->s3->rbuf.left = newb - n; s->packet_length += n; s->rwstate=SSL_NOTHING; return(n); } /* Call this to get a new input record. * It will return <= 0 if more data is needed, normally due to an error * or non-blocking IO. * When it finishes, one packet has been decoded and can be found in * ssl->s3->rrec.type - is the type of record * ssl->s3->rrec.data, - data * ssl->s3->rrec.length, - number of bytes */ /* used only by ssl3_read_bytes */ static int ssl3_get_record(SSL *s) { int ssl_major,ssl_minor,al; int enc_err,n,i,ret= -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned int mac_size; int clear=0; size_t extra; int decryption_failed_or_bad_record_mac = 0; unsigned char *mac = NULL; rr= &(s->s3->rrec); sess=s->session; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) extra=SSL3_RT_MAX_EXTRA; else extra=0; if (extra != s->s3->rbuf.len - SSL3_RT_MAX_PACKET_SIZE) { /* actually likely 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; } again: /* check if we have the header */ if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); if (n <= 0) return(n); /* error or non-blocking */ s->rstate=SSL_ST_READ_BODY; p=s->packet; /* Pull apart the header into the SSL3_RECORD */ rr->type= *(p++); ssl_major= *(p++); ssl_minor= *(p++); version=(ssl_major<<8)|ssl_minor; n2s(p,rr->length); /* Lets check version */ if (s->first_packet) { s->first_packet=0; } else { if (version != s->version) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); /* Send back error using their * version number :-) */ s->version=version; al=SSL_AD_PROTOCOL_VERSION; goto f_err; } } if ((version>>8) != SSL3_VERSION_MAJOR) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); goto err; } if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG); goto f_err; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length-SSL3_RT_HEADER_LENGTH) { /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ i=rr->length; n=ssl3_read_n(s,i,i,1); if (n <= 0) return(n); /* error or non-blocking io */ /* now n == rr->length, * and s->packet_length == SSL3_RT_HEADER_LENGTH + rr->length */ } s->rstate=SSL_ST_READ_HEADER; /* set state for later operations */ /* At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, * and we have that many bytes in s->packet */ rr->input= &(s->packet[SSL3_RT_HEADER_LENGTH]); /* ok, we can now read from 's->packet' data into 'rr' * rr->input points at rr->length bytes, which * need to be copied into rr->data by either * the decryption or by the decompression * When the data is 'copied' into the rr->data buffer, * rr->input will be pointed at the new buffer */ /* We now have - encrypted [ MAC [ compressed [ plain ] ] ] * rr->length bytes of encrypted compressed stuff. */ /* check is not needed I believe */ if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_ENCRYPTED_LENGTH_TOO_LONG); goto f_err; } /* decrypt in place in 'rr->input' */ rr->data=rr->input; enc_err = s->method->ssl3_enc->enc(s,0); if (enc_err <= 0) { if (enc_err == 0) /* SSLerr() and ssl3_send_alert() have been called */ goto err; /* Otherwise enc_err == -1, which indicates bad padding * (rec->length has not been changed in this case). * To minimize information leaked via timing, we will perform * the MAC computation anyway. */ decryption_failed_or_bad_record_mac = 1; } #ifdef TLS_DEBUG printf("dec %d\n",rr->length); { unsigned int z; for (z=0; zlength; z++) printf("%02X%c",rr->data[z],((z+1)%16)?' ':'\n'); } printf("\n"); #endif /* r->length is now the compressed data plus mac */ if ( (sess == NULL) || (s->enc_read_ctx == NULL) || (s->read_hash == NULL)) clear=1; if (!clear) { mac_size=EVP_MD_size(s->read_hash); if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) { #if 0 /* OK only for stream ciphers (then rr->length is visible from ciphertext anyway) */ al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PRE_MAC_LENGTH_TOO_LONG); goto f_err; #else decryption_failed_or_bad_record_mac = 1; #endif } /* check the MAC for rr->input (it's in mac_size bytes at the tail) */ if (rr->length >= mac_size) { rr->length -= mac_size; mac = &rr->data[rr->length]; } else { /* record (minus padding) is too short to contain a MAC */ #if 0 /* OK only for stream ciphers */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); goto f_err; #else decryption_failed_or_bad_record_mac = 1; rr->length = 0; #endif } i=s->method->ssl3_enc->mac(s,md,0); if (mac == NULL || memcmp(md, mac, mac_size) != 0) { decryption_failed_or_bad_record_mac = 1; } } if (decryption_failed_or_bad_record_mac) { /* A separate 'decryption_failed' alert was introduced with TLS 1.0, * SSL 3.0 only has 'bad_record_mac'. But unless a decryption * failure is directly visible from the ciphertext anyway, * we should not reveal which kind of error occured -- this * might become visible to an attacker (e.g. via a logfile) */ al=SSL_AD_BAD_RECORD_MAC; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); goto f_err; } /* r->length is now just compressed */ if (s->expand != NULL) { if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_COMPRESSED_LENGTH_TOO_LONG); goto f_err; } if (!do_uncompress(s)) { al=SSL_AD_DECOMPRESSION_FAILURE; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BAD_DECOMPRESSION); goto f_err; } } if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } rr->off=0; /* So at this point the following is true * ssl->s3->rrec.type is the type of record * ssl->s3->rrec.length == number of bytes in record * ssl->s3->rrec.off == offset to first valid byte * ssl->s3->rrec.data == where to take bytes from, increment * after use :-). */ /* we have pulled in a full packet so zero things */ s->packet_length=0; /* just read a 0 length packet */ if (rr->length == 0) goto again; return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(ret); } static int do_uncompress(SSL *ssl) { int i; SSL3_RECORD *rr; rr= &(ssl->s3->rrec); i=COMP_expand_block(ssl->expand,rr->comp, SSL3_RT_MAX_PLAIN_LENGTH,rr->data,(int)rr->length); if (i < 0) return(0); else rr->length=i; rr->data=rr->comp; return(1); } static int do_compress(SSL *ssl) { int i; SSL3_RECORD *wr; wr= &(ssl->s3->wrec); i=COMP_compress_block(ssl->compress,wr->data, SSL3_RT_MAX_COMPRESSED_LENGTH, wr->input,(int)wr->length); if (i < 0) return(0); else wr->length=i; wr->input=wr->data; return(1); } /* Call this to write data in records of type 'type' * It will return <= 0 if not all data has been sent or non-blocking IO. */ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) { const unsigned char *buf=buf_; unsigned int tot,n,nw; int i; s->rwstate=SSL_NOTHING; tot=s->s3->wnum; s->s3->wnum=0; if (SSL_in_init(s) && !s->in_handshake) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return -1; } } n=(len-tot); for (;;) { if (n > SSL3_RT_MAX_PLAIN_LENGTH) nw=SSL3_RT_MAX_PLAIN_LENGTH; else nw=n; i=do_ssl3_write(s, type, &(buf[tot]), nw, 0); if (i <= 0) { s->s3->wnum=tot; return i; } if ((i == (int)n) || (type == SSL3_RT_APPLICATION_DATA && (s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE))) { /* next chunk of data should get another prepended empty fragment * in ciphersuites with known-IV weakness: */ s->s3->empty_fragment_done = 0; return tot+i; } n-=i; tot+=i; } } static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) { unsigned char *p,*plen; int i,mac_size,clear=0; int prefix_len = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb; SSL_SESSION *sess; /* first check if there is a SSL3_BUFFER still being written * out. This will happen with non blocking IO */ if (s->s3->wbuf.left != 0) return(ssl3_write_pending(s,type,buf,len)); /* If we have an alert to send, lets send it */ if (s->s3->alert_dispatch) { i=ssl3_dispatch_alert(s); if (i <= 0) return(i); /* if it went, fall through and send more stuff */ } if (len == 0 && !create_empty_fragment) return 0; wr= &(s->s3->wrec); wb= &(s->s3->wbuf); sess=s->session; if ( (sess == NULL) || (s->enc_write_ctx == NULL) || (s->write_hash == NULL)) clear=1; if (clear) mac_size=0; else mac_size=EVP_MD_size(s->write_hash); /* 'create_empty_fragment' is true only when this function calls itself */ if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done) { /* countermeasure against known-IV weakness in CBC ciphersuites * (see http://www.openssl.org/~bodo/tls-cbc.txt) */ if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA) { /* recursive function call with 'create_empty_fragment' set; * this prepares and buffers the data for an empty fragment * (these 'prefix_len' bytes are sent out later * together with the actual payload) */ prefix_len = do_ssl3_write(s, type, buf, 0, 1); if (prefix_len <= 0) goto err; if (s->s3->wbuf.len < (size_t)prefix_len + SSL3_RT_MAX_PACKET_SIZE) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR); goto err; } } s->s3->empty_fragment_done = 1; } p = wb->buf + prefix_len; /* write the header */ *(p++)=type&0xff; wr->type=type; *(p++)=(s->version>>8); *(p++)=s->version&0xff; /* field where we are to write out packet length */ plen=p; p+=2; /* lets setup the record stuff. */ wr->data=p; wr->length=(int)len; wr->input=(unsigned char *)buf; /* we now 'read' from wr->input, wr->length bytes into * wr->data */ /* first we compress */ if (s->compress != NULL) { if (!do_compress(s)) { SSLerr(SSL_F_DO_SSL3_WRITE,SSL_R_COMPRESSION_FAILURE); goto err; } } else { memcpy(wr->data,wr->input,wr->length); wr->input=wr->data; } /* we should still have the output to wr->data and the input * from wr->input. Length should be wr->length. * wr->data still points in the wb->buf */ if (mac_size != 0) { s->method->ssl3_enc->mac(s,&(p[wr->length]),1); wr->length+=mac_size; wr->input=p; wr->data=p; } /* ssl3_enc can only have an error on read */ s->method->ssl3_enc->enc(s,1); /* record length after mac and block padding */ s2n(wr->length,plen); /* we should now have * wr->data pointing to the encrypted data, which is * wr->length long */ wr->type=type; /* not needed but helps for debugging */ wr->length+=SSL3_RT_HEADER_LENGTH; if (create_empty_fragment) { /* we are in a recursive call; * just return the length, don't write out anything here */ return wr->length; } /* now let's set up wb */ wb->left = prefix_len + wr->length; wb->offset = 0; /* memorize arguments so that ssl3_write_pending can detect bad write retries later */ s->s3->wpend_tot=len; s->s3->wpend_buf=buf; s->s3->wpend_type=type; s->s3->wpend_ret=len; /* we now just need to write the buffer */ return ssl3_write_pending(s,type,buf,len); err: return -1; } /* if s->s3->wbuf.left != 0, we need to call this */ static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; /* XXXX */ if ((s->s3->wpend_tot > (int)len) || ((s->s3->wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->s3->wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BAD_WRITE_RETRY); return(-1); } for (;;) { clear_sys_error(); if (s->wbio != NULL) { s->rwstate=SSL_WRITING; i=BIO_write(s->wbio, (char *)&(s->s3->wbuf.buf[s->s3->wbuf.offset]), (unsigned int)s->s3->wbuf.left); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BIO_NOT_SET); i= -1; } if (i == s->s3->wbuf.left) { s->s3->wbuf.left=0; s->rwstate=SSL_NOTHING; return(s->s3->wpend_ret); } else if (i <= 0) return(i); s->s3->wbuf.offset+=i; s->s3->wbuf.left-=i; } } /* Return up to 'len' payload bytes received in 'type' records. * 'type' is one of the following: * * - SSL3_RT_HANDSHAKE (when ssl3_get_message calls us) * - SSL3_RT_APPLICATION_DATA (when ssl3_read calls us) * - 0 (during a shutdown, no data has to be returned) * * If we don't have stored data to work from, read a SSL/TLS record first * (possibly multiple records if we still don't have anything to return). * * This function must handle any surprises the peer may have for us, such as * Alert records (e.g. close_notify), ChangeCipherSpec records (not really * a surprise, but handled as if it were), or renegotiation requests. * Also if record payloads contain fragments too small to process, we store * them until there is enough for the respective protocol (the record protocol * may use arbitrary fragmentation and even interleaving): * Change cipher spec protocol * just 1 byte needed, no need for keeping anything stored * Alert protocol * 2 bytes needed (AlertLevel, AlertDescription) * Handshake protocol * 4 bytes needed (HandshakeType, uint24 length) -- we just have * to detect unexpected Client Hello and Hello Request messages * here, anything else is handled by higher layers * Application data protocol * none of our business */ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) { int al,i,j,ret; unsigned int n; SSL3_RECORD *rr; void (*cb)(const SSL *ssl,int type2,int val)=NULL; if (s->s3->rbuf.buf == NULL) /* Not initialized yet */ if (!ssl3_setup_buffers(s)) return(-1); if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->s3->handshake_fragment_len; k++) s->s3->handshake_fragment[k] = *src++; return n; } /* Now s->s3->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!s->in_handshake && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } start: s->rwstate=SSL_NOTHING; /* s->s3->rrec.type - is the type of record * s->s3->rrec.data, - data * s->s3->rrec.off, - offset into 'data' for next read * s->s3->rrec.length, - number of bytes. */ rr = &(s->s3->rrec); /* get new packet if necessary */ if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret=ssl3_get_record(s); if (ret <= 0) return(ret); } /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (rr->type != SSL3_RT_HANDSHAKE)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto err; } /* If the other end has shut down, throw anything we read away * (even in 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length=0; s->rwstate=SSL_NOTHING; return(0); } if (type == rr->type) /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ { /* make sure that we are not getting application data when we * are doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return(len); if ((unsigned int)len > rr->length) n = rr->length; else n = (unsigned int)len; memcpy(buf,&(rr->data[rr->off]),n); if (!peek) { rr->length-=n; rr->off+=n; if (rr->length == 0) { s->rstate=SSL_ST_READ_HEADER; rr->off=0; } } return(n); } /* If we get here, then type != rr->type; if we have a handshake * message, then it was unexpected (Hello Request or Client Hello). */ /* In case of record types for which we have 'fragment' storage, * fill that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (rr->length < n) n = rr->length; /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; /* fragment was too small */ } } /* s->s3->handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->s3->alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); goto err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } } } /* we either finished a handshake or ignored the request, * now try again to obtain the (application) data we were asked for */ goto start; } if (s->s3->alert_fragment_len >= 2) { int alert_level = s->s3->alert_fragment[0]; int alert_descr = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->s3->alert_fragment, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == 1) /* warning */ { s->s3->warn_alert = alert_descr; if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return(0); } } else if (alert_level == 2) /* fatal */ { char tmp[16]; s->rwstate=SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp,sizeof tmp,"%d",alert_descr); ERR_add_error_data(2,"SSL alert number ",tmp); s->shutdown|=SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx,s->session); return(0); } else { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) /* but we have not received a shutdown */ { s->rwstate=SSL_NOTHING; rr->length=0; return(0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { /* 'Change Cipher Spec' is just a single byte, so we know * exactly what the record payload has to look like */ if ( (rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { i=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); goto err; } + /* Check we have a cipher to change to */ + if (s->s3->tmp.new_cipher == NULL) + { + i=SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); + goto err; + } + rr->length=0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, s->msg_callback_arg); s->s3->change_cipher_spec=1; if (!do_change_cipher_spec(s)) goto err; else goto start; } /* Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { #if 0 /* worked only because C operator preferences are not as expected (and * because this is not really needed for clients except for detecting * protocol violations): */ s->state=SSL_ST_BEFORE|(s->server) ?SSL_ST_ACCEPT :SSL_ST_CONNECT; #else s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #endif s->new_session=1; } i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } goto start; } switch (rr->type) { default: #ifndef OPENSSL_NO_TLS /* TLS just ignores unknown message types */ if (s->version == TLS1_VERSION) { rr->length = 0; goto start; } #endif al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* we already handled all of these, with the possible exception * of SSL3_RT_HANDSHAKE when s->in_handshake is set, but that * should not happen when type != rr->type */ al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* At this point, we were expecting handshake data, * but have application data. If the library was * running inside ssl3_read() (i.e. in_read_app_data * is set) and it makes sense to read application data * at this point (session renegotiation not yet started), * we will indulge it. */ if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (( (s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ( (s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data=2; return(-1); } else { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(-1); } static int do_change_cipher_spec(SSL *s) { int i; const char *sender; int slen; if (s->state & SSL_ST_ACCEPT) i=SSL3_CHANGE_CIPHER_SERVER_READ; else i=SSL3_CHANGE_CIPHER_CLIENT_READ; if (s->s3->tmp.key_block == NULL) { s->session->cipher=s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) return(0); } if (!s->method->ssl3_enc->change_cipher_state(s,i)) return(0); /* we have to record the message digest at * this point so we can get it before we read * the finished message */ if (s->state & SSL_ST_CONNECT) { sender=s->method->ssl3_enc->server_finished_label; slen=s->method->ssl3_enc->server_finished_label_len; } else { sender=s->method->ssl3_enc->client_finished_label; slen=s->method->ssl3_enc->client_finished_label_len; } s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, &(s->s3->finish_dgst1), &(s->s3->finish_dgst2), sender,slen,s->s3->tmp.peer_finish_md); return(1); } void ssl3_send_alert(SSL *s, int level, int desc) { /* Map tls/ssl alert value to correct one */ desc=s->method->ssl3_enc->alert_value(desc); if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION) desc = SSL_AD_HANDSHAKE_FAILURE; /* SSL 3.0 does not have protocol_version alerts */ if (desc < 0) return; /* If a fatal one, remove from cache */ if ((level == 2) && (s->session != NULL)) SSL_CTX_remove_session(s->ctx,s->session); s->s3->alert_dispatch=1; s->s3->send_alert[0]=level; s->s3->send_alert[1]=desc; if (s->s3->wbuf.left == 0) /* data still being written out? */ ssl3_dispatch_alert(s); /* else data is still being written out, we will get written * some time in the future */ } int ssl3_dispatch_alert(SSL *s) { int i,j; void (*cb)(const SSL *ssl,int type,int val)=NULL; s->s3->alert_dispatch=0; i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], 2, 0); if (i <= 0) { s->s3->alert_dispatch=1; } else { /* Alert sent to BIO. If it is important, flush it now. * If the message does not get sent due to non-blocking IO, * we will not worry too much. */ if (s->s3->send_alert[0] == SSL3_AL_FATAL) (void)BIO_flush(s->wbio); if (s->msg_callback) s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j=(s->s3->send_alert[0]<<8)|s->s3->send_alert[1]; cb(s,SSL_CB_WRITE_ALERT,j); } } return(i); } Index: releng/4.8/sys/conf/newvers.sh =================================================================== --- releng/4.8/sys/conf/newvers.sh (revision 127116) +++ releng/4.8/sys/conf/newvers.sh (revision 127117) @@ -1,99 +1,99 @@ #!/bin/sh - # # Copyright (c) 1984, 1986, 1990, 1993 # The Regents of the University of California. 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 acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # 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 PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. # # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # $FreeBSD$ TYPE="FreeBSD" REVISION="4.8" -BRANCH="RELEASE-p16" +BRANCH="RELEASE-p17" RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) else RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ $(dirname $0)/../sys/param.h) fi b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b do if [ -r "$bsd_copyright" ]; then COPYRIGHT=`sed \ -e "s/\[year\]/$year/" \ -e 's/\[your name here\]\.* /FreeBSD Inc./' \ -e 's/\[your name\]\.*/FreeBSD Inc./' \ -e '/\[id for your version control system, if any\]/d' \ $bsd_copyright` break fi done # no copyright found, use a dummy if [ X"$COPYRIGHT" = X ]; then COPYRIGHT="/* * Copyright (c) $year * FreeBSD Inc. All rights reserved. * */" fi # add newline COPYRIGHT="$COPYRIGHT " LC_ALL=C; export LC_ALL if [ ! -r version ] then echo 0 > version fi touch version v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` cat << EOF > vers.c $COPYRIGHT char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; char sccs[4] = { '@', '(', '#', ')' }; char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}"; int osreldate = ${RELDATE}; EOF echo `expr ${v} + 1` > version Index: releng/4.9/UPDATING =================================================================== --- releng/4.9/UPDATING (revision 127116) +++ releng/4.9/UPDATING (revision 127117) @@ -1,1206 +1,1209 @@ Updating Information for FreeBSD STABLE users This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the COMMON ITEMS: section later in the file. A reverse chronology since 4.0 was released is included, followed by the common items quick how-tos, followed by entries for versions of -current prior to 4.0 Release. This is for the 4.9 release branch. All entries since 4.9 are an itemized list of commits to this branch, numbered from the beginning. The security advisories related to various patches contain information on how to build/install a minimal set of binaries and start/stop a minimal number of processes, if possible, for that patch. For those updates that don't have an advisory, or to be safe, you can do a full build and install as described in the COMMON ITEMS section. +20040317: p4 FreeBSD-SA-04:05.openssl + Correct a denial-of-service vulnerability in OpenSSL. + 20040302: p3 FreeBSD-SA-04:04.tcp Limit TCP segment reassembly queue size. 20040205: p2 FreeBSD-SA-04:02.shmat Correct a reference counting bug in shmat(2). 20031126: p1 FreeBSD-SA-03:19.bind Corrected remote denial-of-service vulnerability in named(8). 20031028: FreeBSD 4.9-RELEASE. 20031022: Support for HyperThread logical CPUs has now been enabled by default. As a result, the HTT kernel option no longer exists. Instead, the logical CPUs are always started so that they can handle interrupts. However, the extra logical CPUs are prevented from executing user processes by default. To enable the logical CPUs, change the value of the machdep.hlt_logical_cpus from 1 to 0. This value can also be set from the loader as a tunable of the same name. 20030923: Fix a bug in arplookup(), whereby a hostile party on a locally attached network could exhaust kernel memory, and cause a system panic, by sending a flood of spoofed ARP requests. See FreeBSD-SA-03:14.arp. 20030904: If you get errors regarding sendmail.cf files while trying to run mergemaster, you should either install the new version, or run /usr/src/usr.sbin/mergemaster/mergemaster.sh. This is a one-time issue to fix a Makefile compatibility problem. 20030904: Between August 9th and August 30th, a bug existed in the i386 virtual memory system which could cause panics under load. Anyone running a kernel built between those dates is advised to update at the earliest possible convenience. 20030806: All current USB quirks in da(4) have been deprecated and will be removed for 4.9. If this causes failure for your umass(4) devices, enable "options DA_OLD_QUIRKS" in your kernel and send the output of "camcontrol inquiry da0" to scsi@freebsd.org so the quirk can be re-enabled. 20030403: FreeBSD 4.8-RELEASE. 20030214: OpenSSL 0.97 has been imported, and the libcrypto/libssl library versions have been bumped. 20030213: sendmail 8.12.7 has been imported. It has one important change for IPv6 users. The default submit.mc now uses '[127.0.0.1]' instead of 'localhost' meaning only IPv4 is used to connect to the MTA. Users on IPv6-only machines will need to edit /etc/mail/submit.mc appropriately. 20021110: The definitions of the standard file streams (stdin, stdout, and stderr) have changed so that they are no longer compile-time constants. Some older binaries may require updated 3.X compatability libraries (for example, by setting COMPAT3X=yes for a buildworld/installworld). 20021010: FreeBSD 4.7-RELEASE. 20020807: COPY is being deprecated. The 20020703 change was reverted, as it causes far more pain than was expected, and to always compare before installing, please use INSTALL="install -C" again. The -C option is now silently ignored when used with the -d option. 20020704: OpenSSH has been upgraded to 3.4p1 and fully PAMified. Note that the protocol version now defaults to 2 rather than 1, which means clients might get warnings about unknown host keys their hostfiles only list the ssh1 RSA key. See ssh_config(5) and sshd_config(5) for more information on configuring ssh and sshd. 20020703: The install(1) utility no longer allows the -d and -C options to be specified together. "INSTALL=install -C" in make.conf should be replaced with "COPY=-C". 20020615: FreeBSD 4.6-RELEASE. 20020515: The k5su utility installed as part of Kerberos 5 is no longer installed with the set-user-ID bit set by default. Add ENABLE_SUID_K5SU=yes to /etc/make.conf to have it installed with the set-user-ID bit set. 20020501: The ephemeral port range change that was previously mentioned in this document has been reverted, so any changes it required to your system may be reverted as well. Those who missed the change should ignore this notice. 20020421: inetd_enable was changed back to YES, to match the defaults earlier in the 4.0-stable branch. This change restores the daemons that were enabled prior to April 15th. When exec'ing set[ug]id executables, the kernel now ensures that the stdio file descriptors (0..2) are open. See FreeBSD-SA-02:23.stdio. 20020420: sendmail_enable was changed back to YES, to match the defaults earlier in the 4.0-stable branch. 20020415: Many denizens of /etc were MFC'ed. While most of the changes are very benign, some of them have created a bit of a stir. Use the new version of mergemaster to update /etc, either by updating /etc after installworld, or by doing: cd /usr/src/usr.sbin/mergemaster; make -m /usr/src/share/mk all install before you run installworld. Then use the new -C option to double-check your rc.conf settings. You should also double-check settings in [defaults/]rc.conf, syslog.conf, newsyslog.conf, and anything else important to your system. The two most important changes to note: sendmail and inetd were turned off by default. If you need them, please turn them back on by adding sendmail_enable=YES and/or inetd_enable=YES to /etc/rc.conf. 20020411: New sendmail startup scripts have been installed to make it easier to use alternative MTAs with FreeBSD. The rc.conf variable mta_start_script can be set to a script for starting an alternative MTA or to "" to prevent any MTA from being started at boot. 20020404: The sendmail startup code in /etc/rc has been changed to deal with a non-set-user-ID sendmail binary. Setting the rc.conf variable sendmail_enable to "NO" no longer prevents any sendmail daemons from starting. Instead, set sendmail_enable to "NONE" to prevent any MTA from being started at boot. 20020404: Due to the import of sendmail 8.12.2 (see 20020325 entry), a new user and group are required in order for sendmail to run as a set-group-ID binary. A 'make installworld' will use the new user and group to set the owner and group of /var/spool/clientmqueue and will fail if the new user and group do not exist. The 'smmsp' user and group must be merged from src/etc/group and src/etc/master.passwd before using 'make installworld'. 'mergemaster -p' will do this. You may need to install mergemaster before this will work if you are updating from a very old version of stable. This can be done with: cd /usr/src/usr.sbin/mergemaster; make -m /usr/src/share/mk all install 20020325: sendmail 8.12.2 has been imported. The sendmail binary is no longer a set-user-ID root binary and the infrastructure to support command line mail submission has changed. Be sure to run mergemaster (especially for updating /etc/rc, /etc/defaults/rc.conf, and /etc/mail) and read /etc/mail/README for more details. 20020318: The ata(4) driver has been updated from the version in -CURRENT. As a result, some device nodes in /dev have changed; it will be necessary to update MAKEDEV and re-make the device nodes. mergemaster(8) will offer to do this as a part of its upgrade procedure. 20020129: FreeBSD 4.5-RELEASE. 20020105: The locale names have been renamed in -stable to match -current: 1. ISO_* -> ISO* 2. ru_SU* -> ru_RU* 3. DIS_* -> ISO*-15 4. *.ASCII -> *.US-ASCII 20011202: A security hole in OpenSSH involving `UseLogin yes' has been patched. 20011110: Some linux module changes, merged from current, require that you clean out the old compile directory. If you are building with MODULES_WITH_WORLD=yes, then you need to cd to src/sys/modules/linux and run "make cleandir". If not, then you need to cd src/sys/compile/$KERNCONF and do a make modules-clean. 20011102: ipfw/bridge/dummynet features merged from current. 20011018: The kernel Makefile was enhanced to pass -g to modules builds when it is used for kernel building (eg, when the config file has DEBUG=-g). People that have enabled debugging kernels will find they need significantly more disk space in their slash (/) partition. 20010928: The OpenSSH `ChallengeResponseAuthentication' option now defaults to `yes'. This enables S/Key authentication, which can result in users receiving an S/Key challenge when logging in interactively. To disable this behavior, add a line to your /etc/ssh/sshd_config file: `ChallengeResponseAuthentication no' 20010914: 4.4 Released. 20010814: The pci attachment for pcic device was merged from current. You should update your pccardd at the same time as you update your kernel. Note: Interrupts will now be shared between the CardBus bridge and the cards. This is a change over the hand configuration before. 20010811: isdn4bsd was updated to version 1.00.1. for users of the isp (kernel PPP over ISDN) devices, this means that they now _must_ use ispppcontrol instead of spppcontrol to configure and control their isp devices. see /usr/share/examples/isdn for more info. 20010725: The ed driver has been updated. It now allows mii attachments, which means that you must include the miibus in your kernel if you use the ed driver. 20010724: The gif(4) interface has been converted to use cloning rather then allocating a static number of devices a compile time. If you use gif interfaces and configure them by any method other then setting standard variables in /etc/rc.conf you will need to update your system to create devices with "ifconfig gifX create" before attempting to configure them. See the ifconfig(8) man page and /etc/rc.network for more information. 20010611: The TCP_RESTRICT_RST option has been removed. You should entirely remove it from your kernel configuration. The same functionality is available from the blackhole(4) MIB. 20010531: The wd compat devices were removed from the ata driver. Kernels after this date will fail to work with /dev/ nodes that you may have on your disk. /etc/fstab is a common place to find these files hanging out, as are dump devices in /etc/rc.conf. 20010521: Minor repo damange has happened. This may cause problems with cvsup of ports. If you get errors, please see http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27495 at the bottom for details on a workaround. The error message is Updater failed: Cannot delete "/usr/ports/www/jakarta-tomcat/files": Directory not empty 20010516: Size changes in the cred structures introduced a binary incompatibility for modules using the crhold() macro. Modules should be recompiled for kernel later than this date. 20010510: The fxp driver from current has been ported to -stable. This requires kernels that include fxp to also include mii bus devices. See GENERIC for details. 20010421: FreeBSD 4.3 RELEASE 20010402: It appears that PERL_THREADED=true in /etc/make.conf is not compatible with mod_perl. Not sure the exact date of this problem, but it post dates 4.2 and predates 4.3. 20010202: The KERNEL variable for buildkernel and installkernel has been deprecated in favor of KERNCONF. make kernel now combines these two steps. 20010117: Linksys Fast Ethernet PCCARD cards supported by the ed driver now require the addition of flag 0x80000 to their config line in pccard.conf(5). This flag is not optional. These Linksys cards will not be recognized without it. 20010112: Important new FreeBSD-version stuff: PAM support has been worked in, partially from the "Unix" OpenSSH version. This requires adding the following in pam.conf: sshd auth sufficient pam_skey.so sshd auth required pam_unix.so try_first_pass sshd session required pam_permit.so 20010109: ipfw interface changed. Make sure that the userland and kernel match or you won't have the firewall rules you think you do. 20001120: FreeBSD 4.2 RELEASE. 20001020: ****************************** WARNING ****************************** Sendmail has been updated. ****************************** WARNING ****************************** o mail.local(8) is no longer installed as a set-user-id binary. o sendmail(8) is now built with STARTTLS support unless NO_OPENSSL is set. o The default /etc/mail/sendmail.cf disables the SMTP EXPN and VRFY commands. o Now using sendmail's version of vacation(1). o The sendmail cf building tools (contrib/sendmail/cf) are installed in /usr/share/sendmail/cf. o sendmail.cw changed to local-host-names More details can be found at http://people.freebsd.org/~imp/UPDATING/sendmail-20001010 20001009: The ports tree's new layout is in place. Be sure to update your entire ports tree, or you will have problems. 20001006: The perl build procedure no longer installs miniperl, nor uses the installed miniperl. It is recommended that you delete /usr/bin/miniperl. 20000925: FreeBSD 4.1.1 RELEASE. 20000907: Changes to libkvm requires a recompile of the usual suspects. (find /usr/src -name Makefile | xargs egrep -l LIBKVM) This means that your world must match your kernel around this point. 20000904: A new issue with the sendmail upgrade has come to light. /etc/aliases has moved to /etc/mail/aliases. Mergemaster will incorrectly install the default aliases in /etc/mail rather than move the old one from /etc. So you'll need to manually move the file, create a symbolic link, remove the old /etc/aliases.db and run newaliases. For safety sake, you should stop sendmail while doing this and run the upgrade when locally sourced email is not likely to be generated. 20000827: sendmail has been updated from 8.9.3 to 8.11.0. Some of the more visible changes that may immediately affect your configuration include: - New default file locations from src/contrib/sendmail/cf/README - newaliases limited to root and trusted users - MSA port (587) turned on by default - New queue file naming system so can't go from 8.11 -> 8.9 - FEATURE(`rbl') renamed to FEATURE(`dnsbl') - FEATURE(`nullclient') is more full featured - FEATURE(`nouucp') requires an argument: `reject' or `nospecial' - mail.local FreeBSD-only -b option changed to -B - See src/contrib/sendmail/RELEASE_NOTES for more info 20000803: The "installkernel" target has changed slightly. Now even if you override KERNEL e.g. 'make installkernel KERNEL=MYKERNEL' it will install the MYKERNEL file (built with the buildkernel target) as /kernel rather than /MYKERNEL. Those who have updated their /boot/loader.conf files to point to /MYKERNEL should remove that entry or perform manual rename of /kernel to /MYKERNEL. 20000724: FreeBSD 4.1 RELEASE 20000711: If you use CVSUP or CTM to get CVS trees, AND you used to get the old crypto files from internat.freebsd.org AND you check out files from the CVS tree with the cvs command, please read http://people.freebsd.org/~imp/internat.txt for details on potential problems that you might have and how to get around them. If you are merely a mirror, or don't answer yes to each of the clauses above, you needn't worry. 20000707: We started building modules here. IF you don't wish to follow the documented procedure for building kernels, then you'll have to install new mk files from src/share/mk, or define NO_MODULES. 20000706: Binutils were updated. In order to build a kernel after this date, you must follow the updating procedure for building kernels exactly as presented here. You may be able to get away with doing it the old way, but if it breaks, make sure that you've tried the "To build a kernel" section with a fresh /usr/obj first. 20000622: The license on the softupdates is now a standard 2 clause BSD license. You may need to remove your symbolic links that used to be required when updating. 20000501: At approximately this date, an incompatible kernel change was made which means that if you update kernels accross this boundary, you also have to update modules, and vice versa. 20000315: FreeBSD 4.0 RELEASE. Historical entries follow the common items. ****************************** 4.0 RELEASE ****************************** COMMON ITEMS: To build a kernel ----------------- cd /usr/src # If you have not already done so, please buildworld here # You will also need to update your config file to 4.x. Usually # people tend to start with GENERIC from 4.x and hack from there. make buildkernel KERNCONF= make installkernel KERNCONF= # Verify that the new kernel works, it will be installed as # /kernel To rebuild disk /dev entries ---------------------------- MAKEDEV should be copied from src/etc/MAKEDEV to /dev before starting the following: For N in the list of disks MAKEDEV N # eg ad0 for M in the list of slices MAKEDEV NsMa # eg ad0s1a To rebuild everything --------------------- make world Except when it doesn't work :-) To update from 3.x to 4.x stable -------------------------------- *********************************************************** READ -STABLE ARCHIVES FOR THE LAST WEEK OR TWO BEFORE STARTING THIS PROCESS. UPDATING MAY LAG BEHIND A LITTLE A GOTCHAS ARE OFTEN REPORTED IN FREEBSD-STABLE@FREEBSD.ORG BEFORE BEING INCLUDED HERE. IF YOU ARE GOING TO DO REMOTE MACHINES, MAKE SURE THAT THE EXACT VERSION YOU ARE UPDATING THEM TO WORKS ON LOCAL MACHINES BEFORE PROCEEDING. *********************************************************** [3] cd /usr/src [2] make buildworld -DNOPERL cd /usr/src/sbin/mknod make install [1] reboot [6] cd /usr/src cd gnu/usr.bin/texinfo/install-info make install cd ../../../.. ldconfig -R /usr/obj/usr/src/lib/libc make installworld -DNOPERL [5] mergemaster [4] reboot [1] You may need to switch from wd to ad ala 19991210. In addition, you should disable any third party modules such as vmware so that you don't crash your system on reboot. [2] If you have any of the following in your /etc/make.conf, please comment them out before following these instructions and then do a make buildworld + make installworld after you are back to above: MAKE_KERBEROS4 [3] Update to 4.x-stable sources. Make sure that you get all the parts. If you are using cvsup files that are older than a couple of months, be sure they have all the components listed in /usr/share/examples/cvsup. Crypto and secure are now required. [4] This step is not optional. If you fail to do this, you will not have critical system config files updated for their 4.x functionality. This will lead to reduced system functionality, the biggest problem being with /etc/pam.conf not having the entries necessary to allow remote ssh access. [5] Note: This won't upgrade your perl install. You will need to rebuild the world on 4.x to update perl. [6] From the bootblocks, boot -s, and then do fsck -p mount -u / mount -a cd /usr/src adjkerntz -i # if CMOS is wall time To update from 4.0-RELEASE or later to the most current 4.x-STABLE ---------- make buildworld make buildkernel KERNCONF=YOUR_KERNEL_HERE make installkernel KERNCONF=YOUR_KERNEL_HERE reboot (in single user) [1] make installworld mergemaster [2] reboot [1] You can often get away without doing this step as the system will be properly updated. During the running of the installworld, however, system components may break and other oddities may happen. Don't do this on systems that aren't otherwise quiet as unpredictable results may happen. If in doubt, reboot into single user. For remote installs, keep a separate kernel around and use a serial console if at all possible. See also note [6] above. [2] If you do not run mergemaster, you will likely hit a number of show stopper problems. The biggest one is that your /etc/pam.conf won't let you log in using ssh. What follows are older entries for those people upgrading from earlier versions of -stable/-current. 20000308: The binary interface of perl to its modules changed. You will need to recompile any perl moudles after an installworld. This includes all ports matching the pattern /usr/ports/*/p5-*. 20000303: CMSG_XXX macros offset in has changed to conform RFC-2292. All affected applications have been corrected. The i386 platform's offsets haven't changed, but the alpha's did. When you build and install new kernel on FreeBSD/alpha, you must also do a make world. 20000225: OpenSSH has been added to FreeBSD. This may conflict with the ports/security/ssh port since it installs binaries into /usr/bin and the port goes into /usr/local/bin. Most paths have /usr/bin in the path before /usr/local/bin, so problems may arise. If you don't want OpenSSH, add NO_OPENSSH=yes to your make.conf. You will also need to enable OpenSSH in /etc/rc.conf if you want to run the new servers. You may need to move your host key and other config files from /usr/local/etc to /etc/ssh. OpenSSH's command line parsing, available options and default settings aren't the same as ssh, so some care needs to be taken in its operation. One should do a full audit of all configuration settings. 20000205: The xinstall problem has kinda sorta been corrected. The following is known to work by the author of UPDATING. It is what he did to update his laptop. It is likely the same effect as the work around listed in 20000129. make buildworld make installworld This will fail cd usr.bin/xinstall make clean all install NOSHARED=YES cd ../.. make installworld If it doesn't work for you, then I'm sure that there will be another 100 messages in -current. 20000204: libipsec version number changed from 2 to 0. The original commit of Jan 6 incorrectly set this to 2. Remove /usr/lib/libipsec.so.2* before the buildworld and rebuild anything that uses libipsec.so after you install the new version. 20000201: The rcmd related functions have been aligned with other BSD implementations. rlogind and rshd have been changed to use the new API. A make world is recommended to keep them in sync with the libraries they use. http://www.FreeBSD.org/cgi/cvsweb.cgi/src/lib/libc/net/rcmd.c has the details. 20000129: {set,get}flags have been added to the tree for rather dubious reasons. IF AND ONLY IF installworld fails: make -k -DNOFSCHG installworld make installworld This issue was resolved Feb 5, 2000. 20000125: rcmd_af() is added for multiple address family support. rsh and rlogin have been updated to use this to support INET6. A make world is recommended to keep them in sync with the libraries they use. 20000124: The default way that virtual tables in our default C++ compiler has changed. We used to use THUNKS for virtual inheritance. Unfortunately there are bugs that The GCC developers thought would be fixed in GCC 2.95. However it isn't. After this change existing applications written in C++ may give errors like below when you try to run them: /usr/libexec/ld-elf.so.1: /usr/lib/libstdc++.so.3: Undefined symbol "__vt_7filebuf" The only fix is to rebuild the application and any C++ libraries used. 20000124: The management of next_writeable has been move from the kernel to userspace. This means that the burncd command must be in sync with the kernel. So make world is your friend. 20000117: GNU texinfo upgraded to 4.0. It is recommended that you use make buildworld to update. 20000117: CAM_VERSION has been increased. Recompile all programs that depend on it (tosha, camcontrol, etc) when moving to kernels past this date. 20000115: pccard ioctls changed with a commit to have the kernel tell pccardd which device it created, rather than having pccardd dictate it to the kernel. Recompile kernel and pccardd/pccardc together. pccardd/pccardc rely on a kernel Makefile that must be installed prior to building them. Make world will automatically take care of this issue, but you need to know if you are building by hand. 20000109: Your kernel config files need to be changed to s/controller/device/ in them. You will need a new version of config to do this. 20000107: chown & chgrp moved again This is a heads up to let you know that you need to rm -f /sbin/chown /bin/chgrp after your next `make world'. Additionally you need to install a new /dev/MAKEDEV (mergemaster(8) will assist you in this). 20000107: SHA-1 password support gone As warned yesterday, I've just removed the ability for libcrypt to understand SHA-1 passwords. This was present but undocumented in the tree for the past few months and was removed so it can be reimplemented properly as part of a revamped libcrypt at a later date. Anyone who was actually making use of the feature will have to update their passwords back to MD5 before they reinstall the library. 20000106: ioctl numbers changed for dvdio ioctls. You will need to recompile anything that uses them. wormcontrol has been deprecated in favor of burncd. 19991223: Building linux and svr4 compatibility into the kernel now requires /usr/bin/genassym. Go to /usr/src/usr.bin/genassym, do "make obj ; make clean depend all install" before building your kernel. 19991218: sendmail.cf has moved from /etc/sendmail.cf to /etc/mail/sendmail.cf. You may need to adjust /etc/rc.conf and /etc/rc to cope as well as moving sendmail.cf. 19991216: ntp 4.0.98 has replaced the ancient xntpd. The daemon name changed from xntpd to ntpd, so you may need to update your /etc/rc.conf file. The ntp.conf files are compatible with the old release, unless you are using a local reference clock. Details about ntp4 can be found at http://www.ntp.org/. xntpd will be cvs removed from the repo in about a week. 19991213: Soren updated the ata driver. Please update to at least this version before submitting bug reports. 19991210: The ata driver has become the primary ata/ide/atapi driver in the kernel. The wd driver is obsolete. You should upgrade your machine to the new ata driver. You will need to follow the directions for updating the devices in the 19991205 entry. You will need to update all occurances of wd to ad in your config files (/etc/rc.conf, /etc/fstab, etc). A compatibility device exists for wd for the time being, but once you have determined that ata is working for you, transition to the new ad devices. 19991205: Block devices are going away. You will need to update your /dev tree with a fresh copy of MAKEDEV for things to always work in the future. fsck is unable to cope with dirty file systems after this change, so it may work for you or it may not. See "To rebuild disk /dev entries" at the end of the file. *** All uses of block devices must be converted to char devices. *** Likely the only thing impacted is dumpdev in /etc/rc.conf 19991204: The dc interface has replaced al, ax, dm, pn and mx. The former have been removed. 19991204: Support for the old 'sd' device names has been removed in favor of 'da'. Please update your /etc/fstab, /etc/rc.conf and any other places you might have sd names cached. Generally these changes are as simple as s=/dev/sd=/dev/da=g, but be careful to make sure that things are really that simple. You may also need to create /dev entries for the da devices as well. See "To rebuild disk /dev entries" at the end of the file. 19991203: BAD144 support has been removed. Cope or replace the hardware. 19991129: ALPHA users take note. All klds will need to be recompiled for kernels build after this date. It is a good time to update since pal.s will be going away soon. 19991126: MFS_ROOT and MFS_ROOT_SIZE are gone, replaced by MD_ROOT and MD_ROOT_SIZE options in the md driver. md driver now deals with the hacks. You should add md driver to kerneles that have MFS_ROOT, et al. See GENERIC or LINT for details. 19991125: The ep changed a while ago and can no longer be used with hard wired addresses in the config file. 19991122: The bridge drivers for sound cards have been committed. Please see LINT for instructions for your card, if it still works at all. 19991113: Gcc 2.95.2 is now the default compiler. 19991030: /etc/radius.conf file format has changed.The format change is as follows. Each server line in the file should now begin with a new field containing either "auth" for RADIUS authentication, or "acct" for RADIUS accounting. Formerly only authentication was supported. If the first field isn't "auth" or "acct" then the code assumes that "auth" is intended. (That's the compatibility hack.) 19991015: PCCARD has been updated to attach pcic to the isa bus. Therefore you will need to modify kernel config files that have pcic/card in them as follows: controller pcic0 at isa? controller pcic1 at isa? controller card0 19990929: The sigset_t datatype has been changed from an integral type to a compound type and can hold 128 signals. Syscalls directly or indirectly using the new sigset_t have been added as to maintain compatibility with existing binaries. A new kernel must be made and installed and booted with before a make world can be done. *************************************************************** RECOMPILE AND REINSTALL KERNEL BEFORE MAKEWORLD *************************************************************** 19990919: New jail syscall format requires recompilation of jail(8) with fresh headers installed (or a make world will do it for you). 19990914: Matt Dillon checked in many vm related things and sent a heads up to -current urging caution and to report vm problems to him. As of the 19th, no killer problems have been reported, but you have been warned. 19990908: The new miibus has been added to the system. If you are using the dm, rl, sf, sis, ste, tl, wb or xl drivers, you need to add "controller miibus0" to your config file. 19990905: /var/cron/log has been moved to /var/log/cron to get all the log files in one place. 19990831: tn3270 has been removed from the base system and added as a port. 19990830: User-visible TCP timers are now expressed in units of 1ms, instead of 500ms, so if you've customized any timer values under ``net.inet.tcp'', multiply them by 500 to preserve TCP's behavior. 19990828: RCS Id tags changed to FreeBSD. This will cause huge cvsup updates. 19990821: On 28-May-1999 libreadline was upgraded from readline-2.2 to readline-4.0. At that time the shared library major version number was bumped from "3" to "4". It has been deemed that the interface change between readline-2.2 and readline-4.0 was not sufficient to warrant the version number bump. Thus I have reverted it back to "3". You will need to perform the below immediately before your next ``make world'': cd /usr/lib ls -l libreadline.so.4 (if you have /usr/lib/libreadline.so.4) mv libreadline.so.4 libreadline.so.3 rm -f libreadline.so ln -s libreadline.so.3 libreadline.so 19990801: Changes to the pccardd kernel interface require that you recompile pccardd for new kernel. 19980725: The ipfw interface to the kernel has changed. You will need to recompile ipfw programs for the new kernel. 19990715: The bpfilter device has been renamed to bpf. You will need to change your config files in order to enable this in newer kernels. 19990704: src/contrib/sys/softupdates is moving to src/sys/contrib/softupdates. Update your symbolic links/etc. 19990702: Major changes have been made to vinum and its interface. See the man page (vinum(8)) for details. Look at the concat, mirror and stripe commands, as well as the SIMPLIFIED CONFIGURATION section. 19990628: Newsyslog.conf has had a minor, but potentially dangerous, change to its username/group syntax. The old syntax was user.group, while the new syntax is user:group. 19990627: Inetd wrapping default has changed. Please see the updated man page for details. 19990623: Compaq Smart Raid driver committed as ida. 19990622: The second phase of syscons cleanup has happened. Some functionality has been made optional. For details, see http://www.freebsd.org/~yokota/sc_update-June.txt Everyone will need to re-config(8) their kernels, but old binaries will work with the new kernel. 19990620: IPFW uid/gid-based filtering support has been committed. This breaks binary compatibility with previous copies of ipfw(8). Any utilities using the ioctl()s of ipfw (especially ipfw(8)) need to be recompiled with the newest headers installed. 19990618: Inetd now wraps all stream-based services, including internals. Syslog "severity" options are honoured. Installed syslog.conf and hosts.allow should be checked. 19990509: Most of the problems with newbus have been corrected, but it is still current and evolving. libcam's ABI has changed. You must recompile the world and any ports that use it. 19990427: Massive changes to SMP went into the tree that should speed things up. However, if you experience problems with SMP machines, you can back off to the PRE_SMP_VMSHARE tag in the CVS repository (or run an MP kernel). 19990420: Pccardd and the pccard bus in general seem to be broken or most people. Soren has patches to make it better for some, but not all people. Work is underway to make it better for all people. 19990416: new bus changes integrated into -current. Many problems were initially reported, but most have been fixed. You'll need a new config and to tweak your kernel config file the way that GENERIC was tweaked. Keep a copy of your old kernel when upgrading in case your new kernel doesn't work (and report the breakage to current@freebsd.org). As of 19990421 the remaining problems/quirks are o sio no longer supports pnp nor pccard. This will be corrected, but the new pccard code needs to be completed. o Some of the sound drivers broke for some people. It seems inconsistent as to who/what/when/where things broke. o Duplicate device entries in your config do not work. Previously they were silently ignored. psm0 seems to be the most common duplicate choice, although some reports have come in from people that wired their scsi disk entries. o You must move the keyboard and mouse attachments from the isa bus to the atkbdc bus. See GENERIC for details. o Machines with multiple host-pci bridges (Intel 450NX) will not probe the second pci bus. o Some probe ordering may have changed, so device naming may change with the new kernel. If you have multiple devices, please double check to make sure they didn't move. This is especially true for cards on different buses. o The bus attachment for vga0 is always isa0 and never pci0 when it is in fact a pci card. It is safe to ignore this. o The format of the boot messages has changed (and is not guaranteed to be constant for a while) so you may see this in some shell scripts that diff dmesg from day to day as well as scripts that parse dmesg output. 19990414: cc -aout sometimes has problems compiling with -g, remove -g from those compilation units affected until this is corrected. cc -aout has problems with producing some threaded libraries, so make world -DWANT_AOUT is not functional at this time. Since make world for a.out isn't functional, you cannot do make aout-to-elf from a pre-egcs a.out system. To work around this problem, make aout-to-elf using 3.1-stable first (or a pre egcs -current) and then a simple make world will take you the rest of the way with a -current source base. 19990413: Make -j works again for make world. As always, use it with care, and be sure to try a make world w/o -j before reporting problems (that is, know if the problem exists w/o -j before reporting the problem with -j). 19990413: Note cc -aout, which had been broken since the conversion to egcs, now supposedly works. If you have rebuilt things like XFree86 a.out libraries, you should rebuild them again or progams that use them, including netscape, will fail to work. 19990409: NOTE: New c++ compiler cannot be used with c++ binaries from the old compiler and vice versa. 19990408: In recent days egcs has been imported into the tree. A number of problems have been discussed in -current. Here is a highlight of a few of the more common ones. With the exception of make -j n, they have been claimed to have been fixed. c++ is broken after make world: This is correct. Because we changed compilers two make worlds are necessary to get C++ working again. The code generated by the old compiler and new compiler are not compatible, so things wind up being undefined. cpp is broken in make world: There was a window where cpp would be built incorrectly. The fix for this is cd src/gnu/usr.bin/cc make clean make all make install and this should correct your problems. See the -current archives for a version of this that does moer cleaning. Make -j n doesn't work. Work contiunes to make this work, I've seen no reports of success as of April 7th. 19990329: Previously, one would define "NOAOUT" to keep from building the legacy a.out bits. Now one would define "WANT_AOUT" to build them. 19990316: The name of the old wd.c and atapi.c based CDROM driver has been changed back to wcd. So update your config file to use "device wcd" instead of "device acd". 19990314: For those of you using the VN device as a loadable module, please be aware that the new VN device has been committed to -4.x and cannot yet be used as a loadable module. This will be fixed in the future. 19990309: New loader.rc mechanism. Please see src/sys/boot/README for details. 19990225: struct proc size changed. Recompile kernel and the usual suspects. Make world if in doubt. 19990214: The nlpt driver has changed names back to be the lpt driver. See ppbus(4) or http://www.freebsd.org/~nsouch/ppbus.html for proper configuration details. 19990210: The 'lpt' driver is now obsolete. Replace it with the 'nlpt' driver and 'ppbus' controller combination. 19990209: New devstat API requires recompilation of libdevstat, systat, iostat, vmstat and rpc.rstatd. A new kernel is also required. make world + building a kernel should do all of this. Any ports that use devstat need to be recompiled as well. 19990125: Linux threads options has gone away (they are now standard in the FreeBSD kernel). A recompile of all libkvm using programs is in order (or better yet a make world). 19990122: On or about this date there was a small window when the boot blocks had some minor problems which seemed to force one to edit /etc/fstab. This has been corrected, if you are seeing this problem, please rebuild and reinstall your boot blocks. 19990121: Vinum has changed. The "vinum read" command has changed. For updates, please see http://www.freebsd.org/cgi/getmsg.cgi?fetch=800363+0+current/freebsd-current for details. Matt Dillon committed a boatload of VM changes, for information please see http://www.freebsd.org/cgi/getmsg.cgi?fetch=886676+0+current/freebsd-current or http://www.freebsd.org/cgi/getmsg.cgi?fetch=827400+0+current/freebsd-current for details. These changes will likely not impact anybody, but large chagnes to the VM need at least a heads up. 19990120: Stable branch created. You might want to consider using this branch. It is tagged with RELENG_3. 19990119: More work on the syscons driver has been committed. Since files moved around, you will need to reconfigure your kernel, and make clean; make depend before rebuilding the kernel. No config file changes are needed. 19990111: New keyboard and video card drivers are introduced as the first stage of console driver reorganization. You are required to update the kernel configuration file and rebuild the kernel. kbdcontrol, vidcontrol, and screen savers also need recompilation. The instruction can be found in http://www.freebsd.org/~yokota/sc_update.txt It has notes on splash screen too. 19990106: Robert Nordier was kind enough to make this page to enable people to install the new bootblocks: http://www.freebsd.org/~rnordier/boot.txt When updating to ELF, make sure that you have updated your /etc/rc files which have different ldconfig invocations for elf and aout. Otherwise things like X will stop working with messages about being unable to find library files. The mergemaster utility in ports/sysutils/mergemaster helps to keep critical files like this in sync, and its use is recommended. 19990104: Information about ELF day (see 19981230) can be found in http://www.freebsd.org/~peter/elfday.html about the upcoming change, its motivations and instructions for doing the upgrade. 19981230: You should install new bootblocks now. The ELF kernel will become default soon. In addition, you'll need to upgrade your userland programs to ELF before then as well. Use make aout-to-elf to upgrade your userland programs (old a.out programs in, for example, /usr/local/bin will continue to work, even after the upgrade). See src/Makefile for more details. 19981224: The old wcd driver has been deleted from the kernel. The driver that replaces it is named acd. You'll need to change this in your configuration files. Failure to do this will result in "ATAPI CD-ROMs not configured" at boot time. The floppy tape driver (ft) has been removed from the kernel, with no replacement driver. 19981202: New groups from 19981201 commented out of mtree, so they aren't strictly needed, but still a good idea to have. 19981201: New user/group added: bind. From src/etc/master.passwd and src/etc/group: % grep /usr/src/etc/group bind:*:53: % grep /usr/src/etc/master.passwd tty:*:4:65533::0:0:Tty Sandbox:/:/sbin/nologin kmem:*:5:65533::0:0:KMem Sandbox:/:/sbin/nologin bind:*:53:53::0:0:Bind Sandbox:/:/sbin/nologin 19981118: PAM integrated into the tree. Requires new /etc/pam.conf file to silence warnings from authentication programs (login, etc). See src/etc/pam.conf for a sample. FORMAT: This file contains a list, in reverse chronologocal order, of major breakages in tracking -stable. Not all things will be listed here, and it only starts on November 18, 1998. If you have an earlier version of FreeBSD, you are on your own to get to November 18, 1998. Please filter your entries through Warner Losh (imp@village.org) so that the style, formatting, etc of this file can be maintained. Copyright information: Copyright 1998-2002 M. Warner Losh. All Rights Reserved. Redistribution, translation and use, with or without modification, in full or in part, are permitted provided that the above copyright notice is retained. THIS DOCUMENT IS PROVIDED BY WARNER LOSH ``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 WARNER LOSH 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. If you find this document useful, and you want to, you may buy the author a beer. $FreeBSD$ Index: releng/4.9/crypto/openssl/crypto/opensslv.h =================================================================== --- releng/4.9/crypto/openssl/crypto/opensslv.h (revision 127116) +++ releng/4.9/crypto/openssl/crypto/opensslv.h (revision 127117) @@ -1,85 +1,85 @@ #ifndef HEADER_OPENSSLV_H #define HEADER_OPENSSLV_H /* Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ #define OPENSSL_VERSION_NUMBER 0x0090703fL -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7c 30 Sep 2003" +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7c-p1 30 Sep 2003" #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT /* The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major verson number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ #define SHLIB_VERSION_HISTORY "" #define SHLIB_VERSION_NUMBER "0.9.7" #endif /* HEADER_OPENSSLV_H */ Index: releng/4.9/crypto/openssl/ssl/s3_pkt.c =================================================================== --- releng/4.9/crypto/openssl/ssl/s3_pkt.c (revision 127116) +++ releng/4.9/crypto/openssl/ssl/s3_pkt.c (revision 127117) @@ -1,1302 +1,1310 @@ /* ssl/s3_pkt.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * 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@cryptsoft.com). * * 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 attribution * 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. * * 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@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * 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 PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * 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. * * 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@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 product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include #define USE_SOCKETS #include "ssl_locl.h" #include #include static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment); static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len); static int ssl3_get_record(SSL *s); static int do_compress(SSL *ssl); static int do_uncompress(SSL *ssl); static int do_change_cipher_spec(SSL *ssl); /* used only by ssl3_get_record */ static int ssl3_read_n(SSL *s, int n, int max, int extend) { /* If extend == 0, obtain new n-byte packet; if extend == 1, increase * packet by another n bytes. * The packet will be in the sub-array of s->s3->rbuf.buf specified * by s->packet and s->packet_length. * (If s->read_ahead is set, 'max' bytes may be stored in rbuf * [plus s->packet_length bytes if extend == 1].) */ int i,off,newb; if (!extend) { /* start with empty packet ... */ if (s->s3->rbuf.left == 0) s->s3->rbuf.offset = 0; s->packet = s->s3->rbuf.buf + s->s3->rbuf.offset; s->packet_length = 0; /* ... now we can act as if 'extend' was set */ } /* if there is enough in the buffer from a previous read, take some */ if (s->s3->rbuf.left >= (int)n) { s->packet_length+=n; s->s3->rbuf.left-=n; s->s3->rbuf.offset+=n; return(n); } /* else we need to read more data */ if (!s->read_ahead) max=n; { /* avoid buffer overflow */ int max_max = s->s3->rbuf.len - s->packet_length; if (max > max_max) max = max_max; } if (n > max) /* does not happen */ { SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR); return -1; } off = s->packet_length; newb = 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 != s->s3->rbuf.buf) { /* off > 0 */ memmove(s->s3->rbuf.buf, s->packet, off+newb); s->packet = s->s3->rbuf.buf; } while (newb < 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) */ clear_sys_error(); if (s->rbio != NULL) { s->rwstate=SSL_READING; i=BIO_read(s->rbio, &(s->s3->rbuf.buf[off+newb]), max-newb); } else { SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET); i = -1; } if (i <= 0) { s->s3->rbuf.left = newb; return(i); } newb+=i; } /* done reading, now the book-keeping */ s->s3->rbuf.offset = off + n; s->s3->rbuf.left = newb - n; s->packet_length += n; s->rwstate=SSL_NOTHING; return(n); } /* Call this to get a new input record. * It will return <= 0 if more data is needed, normally due to an error * or non-blocking IO. * When it finishes, one packet has been decoded and can be found in * ssl->s3->rrec.type - is the type of record * ssl->s3->rrec.data, - data * ssl->s3->rrec.length, - number of bytes */ /* used only by ssl3_read_bytes */ static int ssl3_get_record(SSL *s) { int ssl_major,ssl_minor,al; int enc_err,n,i,ret= -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned int mac_size; int clear=0; size_t extra; int decryption_failed_or_bad_record_mac = 0; unsigned char *mac = NULL; rr= &(s->s3->rrec); sess=s->session; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) extra=SSL3_RT_MAX_EXTRA; else extra=0; if (extra != s->s3->rbuf.len - SSL3_RT_MAX_PACKET_SIZE) { /* actually likely 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; } again: /* check if we have the header */ if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); if (n <= 0) return(n); /* error or non-blocking */ s->rstate=SSL_ST_READ_BODY; p=s->packet; /* Pull apart the header into the SSL3_RECORD */ rr->type= *(p++); ssl_major= *(p++); ssl_minor= *(p++); version=(ssl_major<<8)|ssl_minor; n2s(p,rr->length); /* Lets check version */ if (s->first_packet) { s->first_packet=0; } else { if (version != s->version) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); /* Send back error using their * version number :-) */ s->version=version; al=SSL_AD_PROTOCOL_VERSION; goto f_err; } } if ((version>>8) != SSL3_VERSION_MAJOR) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); goto err; } if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG); goto f_err; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length-SSL3_RT_HEADER_LENGTH) { /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ i=rr->length; n=ssl3_read_n(s,i,i,1); if (n <= 0) return(n); /* error or non-blocking io */ /* now n == rr->length, * and s->packet_length == SSL3_RT_HEADER_LENGTH + rr->length */ } s->rstate=SSL_ST_READ_HEADER; /* set state for later operations */ /* At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, * and we have that many bytes in s->packet */ rr->input= &(s->packet[SSL3_RT_HEADER_LENGTH]); /* ok, we can now read from 's->packet' data into 'rr' * rr->input points at rr->length bytes, which * need to be copied into rr->data by either * the decryption or by the decompression * When the data is 'copied' into the rr->data buffer, * rr->input will be pointed at the new buffer */ /* We now have - encrypted [ MAC [ compressed [ plain ] ] ] * rr->length bytes of encrypted compressed stuff. */ /* check is not needed I believe */ if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_ENCRYPTED_LENGTH_TOO_LONG); goto f_err; } /* decrypt in place in 'rr->input' */ rr->data=rr->input; enc_err = s->method->ssl3_enc->enc(s,0); if (enc_err <= 0) { if (enc_err == 0) /* SSLerr() and ssl3_send_alert() have been called */ goto err; /* Otherwise enc_err == -1, which indicates bad padding * (rec->length has not been changed in this case). * To minimize information leaked via timing, we will perform * the MAC computation anyway. */ decryption_failed_or_bad_record_mac = 1; } #ifdef TLS_DEBUG printf("dec %d\n",rr->length); { unsigned int z; for (z=0; zlength; z++) printf("%02X%c",rr->data[z],((z+1)%16)?' ':'\n'); } printf("\n"); #endif /* r->length is now the compressed data plus mac */ if ( (sess == NULL) || (s->enc_read_ctx == NULL) || (s->read_hash == NULL)) clear=1; if (!clear) { mac_size=EVP_MD_size(s->read_hash); if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) { #if 0 /* OK only for stream ciphers (then rr->length is visible from ciphertext anyway) */ al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PRE_MAC_LENGTH_TOO_LONG); goto f_err; #else decryption_failed_or_bad_record_mac = 1; #endif } /* check the MAC for rr->input (it's in mac_size bytes at the tail) */ if (rr->length >= mac_size) { rr->length -= mac_size; mac = &rr->data[rr->length]; } else { /* record (minus padding) is too short to contain a MAC */ #if 0 /* OK only for stream ciphers */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); goto f_err; #else decryption_failed_or_bad_record_mac = 1; rr->length = 0; #endif } i=s->method->ssl3_enc->mac(s,md,0); if (mac == NULL || memcmp(md, mac, mac_size) != 0) { decryption_failed_or_bad_record_mac = 1; } } if (decryption_failed_or_bad_record_mac) { /* A separate 'decryption_failed' alert was introduced with TLS 1.0, * SSL 3.0 only has 'bad_record_mac'. But unless a decryption * failure is directly visible from the ciphertext anyway, * we should not reveal which kind of error occured -- this * might become visible to an attacker (e.g. via a logfile) */ al=SSL_AD_BAD_RECORD_MAC; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); goto f_err; } /* r->length is now just compressed */ if (s->expand != NULL) { if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_COMPRESSED_LENGTH_TOO_LONG); goto f_err; } if (!do_uncompress(s)) { al=SSL_AD_DECOMPRESSION_FAILURE; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BAD_DECOMPRESSION); goto f_err; } } if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } rr->off=0; /* So at this point the following is true * ssl->s3->rrec.type is the type of record * ssl->s3->rrec.length == number of bytes in record * ssl->s3->rrec.off == offset to first valid byte * ssl->s3->rrec.data == where to take bytes from, increment * after use :-). */ /* we have pulled in a full packet so zero things */ s->packet_length=0; /* just read a 0 length packet */ if (rr->length == 0) goto again; return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(ret); } static int do_uncompress(SSL *ssl) { int i; SSL3_RECORD *rr; rr= &(ssl->s3->rrec); i=COMP_expand_block(ssl->expand,rr->comp, SSL3_RT_MAX_PLAIN_LENGTH,rr->data,(int)rr->length); if (i < 0) return(0); else rr->length=i; rr->data=rr->comp; return(1); } static int do_compress(SSL *ssl) { int i; SSL3_RECORD *wr; wr= &(ssl->s3->wrec); i=COMP_compress_block(ssl->compress,wr->data, SSL3_RT_MAX_COMPRESSED_LENGTH, wr->input,(int)wr->length); if (i < 0) return(0); else wr->length=i; wr->input=wr->data; return(1); } /* Call this to write data in records of type 'type' * It will return <= 0 if not all data has been sent or non-blocking IO. */ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) { const unsigned char *buf=buf_; unsigned int tot,n,nw; int i; s->rwstate=SSL_NOTHING; tot=s->s3->wnum; s->s3->wnum=0; if (SSL_in_init(s) && !s->in_handshake) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return -1; } } n=(len-tot); for (;;) { if (n > SSL3_RT_MAX_PLAIN_LENGTH) nw=SSL3_RT_MAX_PLAIN_LENGTH; else nw=n; i=do_ssl3_write(s, type, &(buf[tot]), nw, 0); if (i <= 0) { s->s3->wnum=tot; return i; } if ((i == (int)n) || (type == SSL3_RT_APPLICATION_DATA && (s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE))) { /* next chunk of data should get another prepended empty fragment * in ciphersuites with known-IV weakness: */ s->s3->empty_fragment_done = 0; return tot+i; } n-=i; tot+=i; } } static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) { unsigned char *p,*plen; int i,mac_size,clear=0; int prefix_len = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb; SSL_SESSION *sess; /* first check if there is a SSL3_BUFFER still being written * out. This will happen with non blocking IO */ if (s->s3->wbuf.left != 0) return(ssl3_write_pending(s,type,buf,len)); /* If we have an alert to send, lets send it */ if (s->s3->alert_dispatch) { i=ssl3_dispatch_alert(s); if (i <= 0) return(i); /* if it went, fall through and send more stuff */ } if (len == 0 && !create_empty_fragment) return 0; wr= &(s->s3->wrec); wb= &(s->s3->wbuf); sess=s->session; if ( (sess == NULL) || (s->enc_write_ctx == NULL) || (s->write_hash == NULL)) clear=1; if (clear) mac_size=0; else mac_size=EVP_MD_size(s->write_hash); /* 'create_empty_fragment' is true only when this function calls itself */ if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done) { /* countermeasure against known-IV weakness in CBC ciphersuites * (see http://www.openssl.org/~bodo/tls-cbc.txt) */ if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA) { /* recursive function call with 'create_empty_fragment' set; * this prepares and buffers the data for an empty fragment * (these 'prefix_len' bytes are sent out later * together with the actual payload) */ prefix_len = do_ssl3_write(s, type, buf, 0, 1); if (prefix_len <= 0) goto err; if (s->s3->wbuf.len < (size_t)prefix_len + SSL3_RT_MAX_PACKET_SIZE) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR); goto err; } } s->s3->empty_fragment_done = 1; } p = wb->buf + prefix_len; /* write the header */ *(p++)=type&0xff; wr->type=type; *(p++)=(s->version>>8); *(p++)=s->version&0xff; /* field where we are to write out packet length */ plen=p; p+=2; /* lets setup the record stuff. */ wr->data=p; wr->length=(int)len; wr->input=(unsigned char *)buf; /* we now 'read' from wr->input, wr->length bytes into * wr->data */ /* first we compress */ if (s->compress != NULL) { if (!do_compress(s)) { SSLerr(SSL_F_DO_SSL3_WRITE,SSL_R_COMPRESSION_FAILURE); goto err; } } else { memcpy(wr->data,wr->input,wr->length); wr->input=wr->data; } /* we should still have the output to wr->data and the input * from wr->input. Length should be wr->length. * wr->data still points in the wb->buf */ if (mac_size != 0) { s->method->ssl3_enc->mac(s,&(p[wr->length]),1); wr->length+=mac_size; wr->input=p; wr->data=p; } /* ssl3_enc can only have an error on read */ s->method->ssl3_enc->enc(s,1); /* record length after mac and block padding */ s2n(wr->length,plen); /* we should now have * wr->data pointing to the encrypted data, which is * wr->length long */ wr->type=type; /* not needed but helps for debugging */ wr->length+=SSL3_RT_HEADER_LENGTH; if (create_empty_fragment) { /* we are in a recursive call; * just return the length, don't write out anything here */ return wr->length; } /* now let's set up wb */ wb->left = prefix_len + wr->length; wb->offset = 0; /* memorize arguments so that ssl3_write_pending can detect bad write retries later */ s->s3->wpend_tot=len; s->s3->wpend_buf=buf; s->s3->wpend_type=type; s->s3->wpend_ret=len; /* we now just need to write the buffer */ return ssl3_write_pending(s,type,buf,len); err: return -1; } /* if s->s3->wbuf.left != 0, we need to call this */ static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; /* XXXX */ if ((s->s3->wpend_tot > (int)len) || ((s->s3->wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->s3->wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BAD_WRITE_RETRY); return(-1); } for (;;) { clear_sys_error(); if (s->wbio != NULL) { s->rwstate=SSL_WRITING; i=BIO_write(s->wbio, (char *)&(s->s3->wbuf.buf[s->s3->wbuf.offset]), (unsigned int)s->s3->wbuf.left); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BIO_NOT_SET); i= -1; } if (i == s->s3->wbuf.left) { s->s3->wbuf.left=0; s->rwstate=SSL_NOTHING; return(s->s3->wpend_ret); } else if (i <= 0) return(i); s->s3->wbuf.offset+=i; s->s3->wbuf.left-=i; } } /* Return up to 'len' payload bytes received in 'type' records. * 'type' is one of the following: * * - SSL3_RT_HANDSHAKE (when ssl3_get_message calls us) * - SSL3_RT_APPLICATION_DATA (when ssl3_read calls us) * - 0 (during a shutdown, no data has to be returned) * * If we don't have stored data to work from, read a SSL/TLS record first * (possibly multiple records if we still don't have anything to return). * * This function must handle any surprises the peer may have for us, such as * Alert records (e.g. close_notify), ChangeCipherSpec records (not really * a surprise, but handled as if it were), or renegotiation requests. * Also if record payloads contain fragments too small to process, we store * them until there is enough for the respective protocol (the record protocol * may use arbitrary fragmentation and even interleaving): * Change cipher spec protocol * just 1 byte needed, no need for keeping anything stored * Alert protocol * 2 bytes needed (AlertLevel, AlertDescription) * Handshake protocol * 4 bytes needed (HandshakeType, uint24 length) -- we just have * to detect unexpected Client Hello and Hello Request messages * here, anything else is handled by higher layers * Application data protocol * none of our business */ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) { int al,i,j,ret; unsigned int n; SSL3_RECORD *rr; void (*cb)(const SSL *ssl,int type2,int val)=NULL; if (s->s3->rbuf.buf == NULL) /* Not initialized yet */ if (!ssl3_setup_buffers(s)) return(-1); if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->s3->handshake_fragment_len; k++) s->s3->handshake_fragment[k] = *src++; return n; } /* Now s->s3->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!s->in_handshake && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } start: s->rwstate=SSL_NOTHING; /* s->s3->rrec.type - is the type of record * s->s3->rrec.data, - data * s->s3->rrec.off, - offset into 'data' for next read * s->s3->rrec.length, - number of bytes. */ rr = &(s->s3->rrec); /* get new packet if necessary */ if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret=ssl3_get_record(s); if (ret <= 0) return(ret); } /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (rr->type != SSL3_RT_HANDSHAKE)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto err; } /* If the other end has shut down, throw anything we read away * (even in 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length=0; s->rwstate=SSL_NOTHING; return(0); } if (type == rr->type) /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ { /* make sure that we are not getting application data when we * are doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return(len); if ((unsigned int)len > rr->length) n = rr->length; else n = (unsigned int)len; memcpy(buf,&(rr->data[rr->off]),n); if (!peek) { rr->length-=n; rr->off+=n; if (rr->length == 0) { s->rstate=SSL_ST_READ_HEADER; rr->off=0; } } return(n); } /* If we get here, then type != rr->type; if we have a handshake * message, then it was unexpected (Hello Request or Client Hello). */ /* In case of record types for which we have 'fragment' storage, * fill that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (rr->length < n) n = rr->length; /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; /* fragment was too small */ } } /* s->s3->handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->s3->alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); goto err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } } } /* we either finished a handshake or ignored the request, * now try again to obtain the (application) data we were asked for */ goto start; } if (s->s3->alert_fragment_len >= 2) { int alert_level = s->s3->alert_fragment[0]; int alert_descr = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->s3->alert_fragment, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == 1) /* warning */ { s->s3->warn_alert = alert_descr; if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return(0); } } else if (alert_level == 2) /* fatal */ { char tmp[16]; s->rwstate=SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp,sizeof tmp,"%d",alert_descr); ERR_add_error_data(2,"SSL alert number ",tmp); s->shutdown|=SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx,s->session); return(0); } else { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) /* but we have not received a shutdown */ { s->rwstate=SSL_NOTHING; rr->length=0; return(0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { /* 'Change Cipher Spec' is just a single byte, so we know * exactly what the record payload has to look like */ if ( (rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { i=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); goto err; } + /* Check we have a cipher to change to */ + if (s->s3->tmp.new_cipher == NULL) + { + i=SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); + goto err; + } + rr->length=0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, s->msg_callback_arg); s->s3->change_cipher_spec=1; if (!do_change_cipher_spec(s)) goto err; else goto start; } /* Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { #if 0 /* worked only because C operator preferences are not as expected (and * because this is not really needed for clients except for detecting * protocol violations): */ s->state=SSL_ST_BEFORE|(s->server) ?SSL_ST_ACCEPT :SSL_ST_CONNECT; #else s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #endif s->new_session=1; } i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } goto start; } switch (rr->type) { default: #ifndef OPENSSL_NO_TLS /* TLS just ignores unknown message types */ if (s->version == TLS1_VERSION) { rr->length = 0; goto start; } #endif al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* we already handled all of these, with the possible exception * of SSL3_RT_HANDSHAKE when s->in_handshake is set, but that * should not happen when type != rr->type */ al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* At this point, we were expecting handshake data, * but have application data. If the library was * running inside ssl3_read() (i.e. in_read_app_data * is set) and it makes sense to read application data * at this point (session renegotiation not yet started), * we will indulge it. */ if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (( (s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ( (s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data=2; return(-1); } else { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(-1); } static int do_change_cipher_spec(SSL *s) { int i; const char *sender; int slen; if (s->state & SSL_ST_ACCEPT) i=SSL3_CHANGE_CIPHER_SERVER_READ; else i=SSL3_CHANGE_CIPHER_CLIENT_READ; if (s->s3->tmp.key_block == NULL) { s->session->cipher=s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) return(0); } if (!s->method->ssl3_enc->change_cipher_state(s,i)) return(0); /* we have to record the message digest at * this point so we can get it before we read * the finished message */ if (s->state & SSL_ST_CONNECT) { sender=s->method->ssl3_enc->server_finished_label; slen=s->method->ssl3_enc->server_finished_label_len; } else { sender=s->method->ssl3_enc->client_finished_label; slen=s->method->ssl3_enc->client_finished_label_len; } s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, &(s->s3->finish_dgst1), &(s->s3->finish_dgst2), sender,slen,s->s3->tmp.peer_finish_md); return(1); } void ssl3_send_alert(SSL *s, int level, int desc) { /* Map tls/ssl alert value to correct one */ desc=s->method->ssl3_enc->alert_value(desc); if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION) desc = SSL_AD_HANDSHAKE_FAILURE; /* SSL 3.0 does not have protocol_version alerts */ if (desc < 0) return; /* If a fatal one, remove from cache */ if ((level == 2) && (s->session != NULL)) SSL_CTX_remove_session(s->ctx,s->session); s->s3->alert_dispatch=1; s->s3->send_alert[0]=level; s->s3->send_alert[1]=desc; if (s->s3->wbuf.left == 0) /* data still being written out? */ ssl3_dispatch_alert(s); /* else data is still being written out, we will get written * some time in the future */ } int ssl3_dispatch_alert(SSL *s) { int i,j; void (*cb)(const SSL *ssl,int type,int val)=NULL; s->s3->alert_dispatch=0; i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], 2, 0); if (i <= 0) { s->s3->alert_dispatch=1; } else { /* Alert sent to BIO. If it is important, flush it now. * If the message does not get sent due to non-blocking IO, * we will not worry too much. */ if (s->s3->send_alert[0] == SSL3_AL_FATAL) (void)BIO_flush(s->wbio); if (s->msg_callback) s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j=(s->s3->send_alert[0]<<8)|s->s3->send_alert[1]; cb(s,SSL_CB_WRITE_ALERT,j); } } return(i); } Index: releng/4.9/sys/conf/newvers.sh =================================================================== --- releng/4.9/sys/conf/newvers.sh (revision 127116) +++ releng/4.9/sys/conf/newvers.sh (revision 127117) @@ -1,99 +1,99 @@ #!/bin/sh - # # Copyright (c) 1984, 1986, 1990, 1993 # The Regents of the University of California. 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 acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # 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 PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. # # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # $FreeBSD$ TYPE="FreeBSD" REVISION="4.9" -BRANCH="RELEASE-p3" +BRANCH="RELEASE-p4" RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) else RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ $(dirname $0)/../sys/param.h) fi b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b do if [ -r "$bsd_copyright" ]; then COPYRIGHT=`sed \ -e "s/\[year\]/$year/" \ -e 's/\[your name here\]\.* /FreeBSD Inc./' \ -e 's/\[your name\]\.*/FreeBSD Inc./' \ -e '/\[id for your version control system, if any\]/d' \ $bsd_copyright` break fi done # no copyright found, use a dummy if [ X"$COPYRIGHT" = X ]; then COPYRIGHT="/* * Copyright (c) $year * FreeBSD Inc. All rights reserved. * */" fi # add newline COPYRIGHT="$COPYRIGHT " LC_ALL=C; export LC_ALL if [ ! -r version ] then echo 0 > version fi touch version v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` cat << EOF > vers.c $COPYRIGHT char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; char sccs[4] = { '@', '(', '#', ')' }; char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}"; int osreldate = ${RELDATE}; EOF echo `expr ${v} + 1` > version Index: releng/5.1/UPDATING =================================================================== --- releng/5.1/UPDATING (revision 127116) +++ releng/5.1/UPDATING (revision 127117) @@ -1,1328 +1,1331 @@ Updating Information for FreeBSD 5.1 users This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the COMMON ITEMS: section later in the file. This is for the 5.1 release branch. All entries since 5.0 are an itemized list of commits to this branch, numbered from the beginning. The security advisories related to various patches contain information on how to build/install a minimal set of binaries and start/stop a minimal number of processes, if possible, for that patch. For those updates that don't have an advisory, or to be safe, you can do a full build and install as described in the COMMON ITEMS section. +20040317: p16 FreeBSD-SA-04:05.openssl + Correct a denial-of-service vulnerability in OpenSSL. + 20040315: p15 FreeBSD-SA-04:04.tcp Limit TCP segment reassembly queue size. 20040225: p14 FreeBSD-SA-04:03.jail Correct a bug in jail_attach(2) which could allow jailed `superusers' to access files in another jail. 20040205: p13 FreeBSD-SA-04:02.shmat Correct a reference counting bug in shmat(2). 20040127: p12 FreeBSD-SA-04:01.mksnap_ffs Fixed mksnap_ffs to preserve existing file system flags. 20031126: p11 FreeBSD-SA-03:19.bind Corrected remote denial-of-service vulnerability in named(8). 20031003: p10 FreeBSD-SA-03:18.openssl Corrected vulnerabilities in OpenSSL ASN.1 parsing. 20031003: p9 FreeBSD-SA-03:17.procfs Correct integer underflows/overflows in procfs(5) and linprocfs(5). 20030924: p8 FreeBSD-SA-03:14.arp Updated fix for arplookup bug. 20030924: p7 FreeBSD-SA-03:15.openssh Fix PAM-related bugs in OpenSSH's challenge/response code. 20030923: p6 FreeBSD-SA-03:14.arp Fix a bug in arplookup(), whereby a hostile party on a locally attached network could exhaust kernel memory, and cause a system panic, by sending a flood of spoofed ARP requests. 20030917: p5 FreeBSD-SA-03:13.sendmail Fix another address parsing buffer overflow. 20030916: p4 FreeBSD-SA-03:12.openssh Follow-up fixes for OpenSSH oversized packet buffer handling. 20030916: p3 FreeBSD-SA-03:12.openssh OpenSSH oversized packet buffer handling corrected. 20030810: p2 FreeBSD-SA-03:10.iBCS2 iBCS2 system call translator for statfs leaked information. 20030810: p1 FreeBSD-SA-03:09.signal Repair range-checking errors in signal handling. 20030603: FreeBSD 5.1 20030505: Kerberos 5 (Heimdal) is now built by default. Setting MAKE_KERBEROS5 no longer has any effect. If you do NOT want the "base" Kerberos 5, you need to set NO_KERBEROS. 20030502: groff has been updated. If you try to do a buildworld and get an infinite loop in troff, update to May 4th or newer. If you have a newer kernel than userland, you may need to set the OSRELDATE to 500110 in your environment before starting a buildworld. 20030501: The old rc system has been removed. Please report any problems to freebsd-rc@yahoogroups.com, and/or freebsd-current@freebsd.org. Your personal versions of these files will not be removed, so you can continue to use them. However, you should take great care when updating, especially when using mergemaster, since the compatibility code that utilizes these old scripts has also been removed. 20030423: A bug has been fixed in /dev/devctl which would cause devd to hang on boot, were it not for a workaround in devd. The work around in devd will be removed around 20030507. You have until then to upgrade your kernel before updating userland. In general, you should have a userland and kernel that's in sync with each other. However, given the effects of this bug (hang on boot when starting devd), some allowances are made. 20030329: Alphas with libc from between 20030312 and 20030329 exhibit floating point exceptions (FPEs), most notably in awk(1) while upgrading the system through a buildworld. So, to successfully upgrade your Alpha, you must either downgrade your libc.so to a pre-20030312 version, or update /usr/share/mk/bsd.cpu.mk to revision 1.26 which adds -mieee to CFLAGS, then forcibly rebuild and install libc: cd /usr/src/lib/libc && \ make cleandir && make obj && \ make -DNOMAN -DNOPROFILE all && \ make -DNOMAN -DNOPROFILE install 20030208: sendmail 8.12.7 has been imported. It has one important change for IPv6 users. The default submit.mc now uses '[127.0.0.1]' instead of 'localhost' meaning only IPv4 is used to connect to the MTA. Users on IPv6-only machines will need to edit /etc/mail/submit.mc appropriately. 20030128: NODEVFS option has been removed and DEVFS thereby made standard. This makes all references to MAKEDEV obsolete, and they should be removed when convenient. 20030126: The name of the device for the ofw console has changed, sparc64 users must run mergemaster to update their installed /etc/ttys. 20030125: The scheduler framework has grown a second scheduler and consequently you must specify one and only one scheduler in your kernel config. The cvs config files have been updated to use the old scheduler which may be selected via 'options SCHED_4BSD'. If you would like to try the new, much more experimental, scheduler please try 'options SCHED_ULE' and contribute to the arch@ discussion. 20030115: A new version of the wi driver has been imported into the tree. One now must have device wlan in the config file for it to operate properly. In addition, there have been some changes to how wi devices are configured for point to point links to bring it more in line with the former way of doing things, as well as compatibility with NetBSD. 20021222: For a period after the GCC 3.2.1 import (from 12/04 to 12/22), GCC used an incompatible form of ABI for returning structures and unions which FreeBSD's GCC maintainers were not aware of relative to previous versions of FreeBSD. We have gone back to the ABI for now, and any code compiled which is required to interoperate with other code (not built at the same time) returning structs or unions should be rebuilt. 20021216: A name change in /etc/netconfig has been reverted to stay compatible with suns TIRPC and also with NetBSD. You need to run mergemaster after make world. A new libc does still work with an outdated /etc/netconfig for some time, but you'll get a warning. This warning will be removed in 20030301. 20021202: The recent binutils upgrade marks a kernel flag day on sparc64: modules built with the old binutils will not work with new kernels and vice versa. Mismatches will result in panics. Make sure your kernel and modules are in sync. 20021029: The value of IPPROTO_DIVERT has changed. Make sure to keep your kernel, netstat, natd and any third-party DIVERT consumers in sync. 20021024: Old, compatibility slices have been removed in GEOM kernels. This means that you will have to update your /etc/fstab to not use disk devices of the form /dev/ad0a. Instead, you now must specify /dev/ad0s1a, or whatever slice your FreeBSD partition really is on. The old device names have gone away, so if you use them anywhere else, you must also adjust those uses. (This doesn't affect the disks formatted in the ``dangerously-dedicated'' mode.) 20021023: Alphas with kernels from between 20020830 and 20021023 and/or rtld (ld-elf.so.1) older than 20021023 may experience problems with groff while doing a buildworld (kernel: "out of memory", fixed in rev 1.129 of kern/imgact_elf.c; rtld: "too few PT_LOAD segments", fixed in rev 1.8 of libexec/rtld-elf/map_object.c). So, to successfully upgrade your Alpha, you must either upgrade your kernel and rtld first (which might be a bit tricky), or avoid running the bootstrapped groff during the "transitional" buildworld. To avoid running groff during the transitional upgrade run make buildworld with -DNOMAN, -DNO_SHAREDOCS, and -DNO_LPR. 20020831: gcc has been upgraded to 3.2. It is not all binary compatible with earlier versions of gcc for c++ programs. All c++ programs and libraries need to be recompiled. Also, if you encounter g++ issues, rm /usr/include/g++/* before doing an installworld to make sure that stale files are removed. 20020827: Our /etc/termcap now has all the entries from the XFree86 xterm almost unchanged. This means xterm now supports color by default. If you used TERM=xterm-color in the past you now should use TERM=xterm. (xterm-color will lead to benign warnings). 20020815: A "bug" in gcc(1) that was hiding warning in system headers was fixed. It's probably time to add -DNO_WERROR to your make line again. 20020729: COPY is being deprecated. The 20010530 change was reverted, as it causes far more pain than was expected, and to always compare before installing, please use INSTALL="install -C" again. The -C option is now silently ignored when used with the -d option. 20020702: Problems with libc_r clients like KDE and GNOME have been resolved. There are still some minor problems with some signals but the system is stable enough for general use again. SMP is less so than UP but each can successfully complete multiple buildworlds. Libkvm needs to be recompiled due to KSE. 20020701: Now would be a bad time to upgrade. Something in or near the KSE commit totally broke programs using libc_r like KDE and GNOME. 20020511: The k5su utility installed as part of Kerberos 5 is no longer installed with the set-user-ID bit set by default. Add ENABLE_SUID_K5SU=yes to /etc/make.conf to have it installed with the set-user-ID bit set. 20020510: Gcc 3.1 debugging format (cc -g) has changed from STABS to DWARF2. Unfortunately our native GDB (at version 4.18) does not understand the DWARF2 debugging format. Thus you must use `gcc -gstabs+' to generated debugging information for our native GDB. 20020510: Due to the way CVS works, it may not properly update src/contrib/gcc to the 3.1 sources. The easiest fix is to `rm -rf' src/contrib/gcc and then do a cvs update. 20020421: When exec'ing set[ug]id executables, the kernel now ensures that the stdio file descriptors (0..2) are open. See FreeBSD-SA-02:23.stdio. 20020404: New sendmail startup scripts have been installed to make it easier to use alternative MTAs with FreeBSD. Setting the rc.conf variable sendmail_enable to "NO" no longer prevents any sendmail daemons from starting. Instead, either set sendmail_enable to "NONE" or change mta_start_script to a script for starting an alternative MTA. Setting mta_start_script to "" will also prevent any MTA from being started at boot. 20020403: UCONSOLE is no longer a valid kernel option. 20020315: FreeBSD 5.0 DP-1 was basically branched today. 20020225: Warnings are now errors in the kernel. Unless you are a developer, you should add -DNO_WERROR to your make line. 20020217: sendmail 8.12.2 has been imported. The sendmail binary is no longer a set-user-ID root binary and the infrastructure to support command line mail submission has changed. Be sure to run mergemaster (especially for updating /etc/rc, /etc/defaults/rc.conf, and /etc/mail) and read /etc/mail/README for more details. Due to the import of sendmail 8.12.2, a new user and group are required in order for sendmail to run as a set-group-ID binary. A 'make installworld' will use the new user and group to set the owner and group of /var/spool/clientmqueue and will fail if the new user and group do not exist. The 'smmsp' user and group must be merged from src/etc/group and src/etc/master.passwd before using 'make installworld'. 'mergemaster -p' will do this. You may need to install mergemaster before this will work if you are updating from a very old version of current. The updating recipe has changed as of this date. 20020112: The preferred configuration method for PAM is now /etc/pam.d/ rather than /etc/pam.conf. If you have an unmodified pam.conf, just delete it after your next mergemaster run. If you have local modifications, you can use /usr/src/etc/pam.d/convert.pl to incorporate them into your /etc/pam.d. Please see the following url for more details: http://www.freebsd.org/cgi/mid.cgi?db=mid&id= 20011229: If anyone here is already using the new rc.conf(5) variable networkfs_types, please note that it has changed http://www.freebsd.org/cgi/mid.cgi?db=mid&id=<9744.1009655556@axl.seasidesoftware.co.za> 20011220: sys/i4b/driver/i4b_ispppsubr.c has been retired. This file started out its life in the ISDN4BSD project as an offspring from sys/net/if_spppsubr.c, which eventually got a life of its own. All the accumulated features and bugfixes of the i4b version have now been merged back into the base system's version now. The only user-visible change resulting from this is that i4b's sppp(4) interfaces are to be managed with spppcontrol(8) again, since ispppcontrol(8) has been retired as well. (There has never been rc file support for ispppcontrol in -current, but only in -stable. That will be reverted by the time the changes are MFCed.) 20011215: The fdc(4) driver has been updated and now automatically recognizes media in `standard' formats (like 1440 KB and 720 KB for a 3.5" high-density drive) when accessing the default device node (e. g. /dev/fd0). The old variety of floppy device nodes /dev/fd*.* is no longer present by default, devices can be created (in DEVFS) on demand. They will need to be customized then for `odd' densities using fdcontrol(8). 20011209: The bugs in procfs' debugging support code have been fixed, and truss(1) now works again. 20011207: Daily security checks have been split out to use the periodic(8) scripts. Some change in configuration may be necessary. Please see http://www.freebsd.org/cgi/mid.cgi?db=mid&id=<20011207155805.R8975@blossom.cjclark.org> for details. 20011204: sos added VCD/SVCD support to ata driver and that needs the kernel and burncd to be in sync. 20011203: The procfs pseudo-filesystem has now been converted to use the pseudofs framework. If you have 'options PROCFS' in your kernel config, you'll need to add 'options PSEUDOFS' if it's not there already. This change temporarily breaks truss(1); use ktrace(1) instead until the issue has been resolved. 20011202: A security hole in OpenSSH involving `UseLogin yes' has been patched. 20011126: You need to remove /usr/obj/.../usr.bin/tip before rebuilding after this date. You need to do this only once. 20011103: Most of the awk issues have been resolved. Some rough edges may be left, but for the most part things should be back to "normal." For CURRENT's usual definition of "normal." 20011030: Awk has been upgraded to the one true awk from bell labs. Expect choppy waves in the upgrade process. 20011030: The asr driver problem has been resolved. 20011027: Due to changes in other parts of the system, the asr driver now causes the system to panic on boot. Do not use it pending correction. Comment it out of any kernel config file that you try to use from this date forward. 20011025: When crossbuilding, use TARGET=xxx where you used to use MACHINE=xxx. You don't need to set TARGET_ARCH and TARGET, unless you are changing both of them. To cross build pc98 on an alpha, for example, you need to set TARGET=pc98 and TARGET_ARCH=i386. 20011001: The kernel interface that burncd depends on has changed. You must recompile both the kernel and userland applications at the same time. 20010929: When crossbuilding, please set TARGET_ARCH rather than MACHINE_ARCH to indicate the target. In the future, one will set TARGET_MACHINE where you set MACHINE now. At the moment, setting MACHINE alone for same MACHINE_ARCH machines works (eg, you can build pc98 on an i386 machine and vice versa). 20010927: Some weird problems result from using ACPI on some machines. To disable ACPI you can add hint.acpi.0.disabled="1" to /boot/loader.conf (or by putting set X=Y at the boot loader "ok" prompt). Alternatively, you can remove it from /boot/kernel/acpi.ko or use the MODULES_OVERRIDE function in your kernel config file and not list acpi in that list. 20010924: The buildworld has been fixed. You may need to install the 4.x compatibility libraries for some old binaries to work. Add COMPAT4X=true to your /etc/make.conf to get them installed on every installworld, or execute the following to get them installed only once: cd src/lib/compat/compat4x. make all install You will see ``__stdoutp undefined'' until you do this. 20010919: There's a bug in the world build process. The cross-tools are build with the NEW headers, but the OLD libc.a. This leads to all kinds of problems with the new libc. A temporary workaround is to add CFLAGS="-O -pipe -D_OLD_STDIO" before building world when upgrading from 4.x to current. This can be removed afterwards. A proper fix to the buildworld target is needed. 20010918: Peter has committed his new kthread nfs client/server code. NFS may be unstable after this date. 20010912: KSE has hit the tree. Lots of things are now different in the kernel. While a few problems were introduced in the initial commit, most of the major ones have been found and corrected. 20010901: In OLDCARD, CardBus bridges appear to be stable. The work arounds described in the 20010604 entry are now no longer necessary and will be ignored. Most insert/remove problems have been rectified around this date. 20010823: named now runs as user bind and group bind rather than as root. If named_enable is set to YES in /etc/rc.conf, ensure that user bind is available in /etc/passwd (using vipw(8)) and that group bind is available in /etc/group. Also make sure that user or group bind has read (and not write) permission for your name server configuration and that it has read and write permission for your slave zone files and directory. If you wish to continue to run named as root (a less secure alternative), add a line to /etc/rc.conf saying named_flags= 20010709: The PAM libraries have had an API upgrade that is beyond the ability of the shared library major number to handle. It is manifested by PAM-using ports dumping core. The solution is to rebuild those ports. 20010628: The kernel compile module has moved from src/sys/compile/FOO to src/sys/${MACHINE}/compile/FOO. 20010625: The pccard modem issue from 20010613 has been corrected. OLDCARD support is still a little weak in -current. slot 1 is known not to work on some TI based cardbus bridges. Some cardbus bridges do not properly detect insert/removal events. IRQ configuration needs more safety belts. 20010617: Softupdates problems have been corrected. 20010614: Peter ripped out the linkerset support. You must, as always, rerun config after you cvsup if you are using the traditional kernel building methods. 20010613: pccard modems may not work with current after 20010604 date. Some do, others result in panics. *MAKE*SURE* that you update your config and /etc/rc.conf ala the 20010604 entry, or you will have problems (this issue will be fixed, it just hasn't been yet). 20010613: SOFTUPDATES seem to be broken since the middle of May or so. Do not use them in current. You can disable softupdates on all mounted partitions, or remove SOFTUPDATES the kernel config file. 20010612: After Peter's commits to the hints code, people have been noticing that certain devices are attached (or try to) twice. This is due to having both static hints as well as a /boot/device.hints. To work around this issue, please use only one or the other mechanism until this bug is fixed. Please note that a feature of config is that if you have config file FOO and FOO.hints, it automatically adds FOO.hints to the hints.c file, whether you want it to or not. 20010610: Locale names have changed to match other systems better. 20010604: pccard support for pci cards has been committed. You must change your /etc/pccard.conf irq lines. It must match the irq used by pcic device. Interrupt storms may result if you fail to do this. Interrupt storms look a lot like a hang. You must also install a new pccardd, otherwise you will get an interrupt storm at card reset time (just after it tells you what it is). pccardd_flags="-I" is necessary for the time being. It tells pccardd not to ask the kernel if the interrupt is really free or not before using it. You can either change the /etc/pccard.conf irq lines to match pcic, or add "-i X" to the pccardd_flags. 20010530: INSTALL=install -C is being deprecated. If you want to do this, use COPY=-C instead. The former method will be supported for only a limited time. If you see install: warning: the -d and -C options may not be specified together in your makeworld, then you need to migrate towards using COPY=-C. 20010525: It appears that vm is now stable enough to use again. However, there may be other problems, so caution is still urged. alpha definitely is in bad shape. 20010521: Minor repo damage has happened. This may cause problems with cvsup of ports. If you get errors, please see http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27495 at the bottom for details on a workaround. The error message is Updater failed: Cannot delete "/usr/ports/www/jakarta-tomcat/files": Directory not empty 20010520: Vm and/or swapping are busted on -current. Please be patient. 20010519: pccard has had much reorganizational work done to it over the past few days. Everything should still work, but if not, please contact imp@freebsd.org. 20010517: ata ioctl changed. Make sure to recompile both kernel and userland at the same time. 20010517: New ncurses imported. 20010512: DEVFS is now opt out, not opt in. Barring major problems, this will be the only way to go starting July 1. 20010504: OpenSSH has been updated to 2.9. Some defaults are different, including RhostsRSAAuthentication, which changes from yes to no. 20010502: Perl breakage in 20010501 was corrected at 14:18:33 PDT. 20010501: Building perl was broken at 02:25:25 PDT. 20010430: The bug in 20010429 was corrected at 07:35:37 PDT. It is safe to go back in the water. 20010429: A bad bug was committed at 04:48:42 PDT. Don't use kernels after this date, but before the correction date. 20010423: old fsck and new kernel interactions appear to have been fixed. 20010411: fsck and the kernel were changed to handle some optimizations to directory layout. This breaks backward compatibility. Update only if you understand that you must not use the old fsck with the new kernel ever. 20010330: fsck has changed the meaning of the pass column in /etc/fstab. Please see the cvs commit to fsck.8 or the fsck.8 man page for details. It is unclear if changes to /etc/fstab are necessary. 20010319: portmap had changed name to rpcbind for maximum POLA in your current world. /etc/hosts.{allow,deny} needs changes. nfs and other rpc based programs that rely on portmapper will not work without updates to /etc/hosts.{allow,deny} and /etc/netconfig. 20010315: ata subsystem changes. ATA_ENABLE_ATAPI_DMA, ATA_ENABLE_WC and ATA_ENABLE_TAGS are no longer kernel options. They have been replaced by tunables. See ata.4 for details. 20010312: The fxp driver was converted to use miibus. If you compile fxp into your kernel statically, you will need to add miibus. 20010312: The wi device now defaults to BSS (infrastructure) mode instead of ad-hoc. 20010310: /dev/urandom should be a symbolic link to /dev/random now. Users of current not using DEVFS need to run MAKEDEV std. ssh might not work if you don't. 20010303: The ed driver has been updated. It now allows mii attachments, which means that you must include the miibus in your kernel if you use the ed driver. 20010220: The problems with libc have been corrected. It is now mostly safe to go back into the water. 20010211: The size of FILE was changed. This breaks upgrading. If you must upgrade, be prepared for pain. It also breaks almost all binaries that you've compiled on -current. You are warned that before upgrading would be a good time to do a level 0 dump of your system. No, really, I mean it this time. To get to the new system, you'll need to use the following workaround. Hopefully this can be sorted out so that we don't have to move this to the updating section. To get around the installworld problem, do: # cd /usr/src/usr.bin/sed # make install # cd /usr/src # make installworld If that doesn't work, then try: # make -k installworld # make installworld 20010207: DEVFS is now the default. If you use vinum, make sure that you do not include devfs in your kernel as problems result. 20010205: FFS_ROOT and CD9660_ROOT have been removed or deprecated. Remove them from your config. 20010122: ****************************** WARNING ****************************** buildkernel has been changed slightly ****************************** WARNING ****************************** KERNCONF replaces the variable KERNEL for buildkernel. You should update your scripts and make.conf accordingly. 20010119: config has changed to allow DEV_FOO as a replacement for NFOO. This requires a new config to build correctly. 20010116: The kernel option I386_CPU is now mutually exclusive with the other cpu types. If you have an i386 system, be sure that it only had this line. Remove it for all other configurations. 20010110: Changes to the kernel require it and burncd be in sync. 20010102: Everyone who has hw.sndunit set to something in /etc/sysctl.conf, it is now hw.snd.unit. 20010101: ex and vi were broken by some changes to sys/queue.h. If you have a bad vi, you will see make buildworld fail with a core dump while building termcap. You can work around this problem by adding -k to your make buildworld. This will cause the build to complete and install a new vi. Once that's done, you can rebuild again without the -k to pick up anything that might have been ignored by the -k option. Others have suggested that you can just rebuild libc if your vi/ex is dynamically linked, but I've not received any reports of this working. 20001228: There have been some changes to libcrypt in -current. The libscrypt/libdescrypt symlink silliness is gone and the installed libcrypt is fully functional. Be aware of this. 20001218: Linksys Fast Ethernet PCCARD cards supported by the ed driver now require the addition of flag 0x80000 to their config line in pccard.conf(5). This flag is not optional. These Linksys cards will not be recognized without it. 20001205: Important new FreeBSD-version stuff: PAM support has been worked in, partially from the "Unix" OpenSSH version. This requires adding the following in pam.conf: sshd auth sufficient pam_skey.so sshd auth required pam_unix.so try_first_pass sshd session required pam_permit.so 20001031: cvs updated to 1.11. 20001020: The random device needs more entropy, so you need to make sure that you've run mergemaster to get a /etc/rc which will seed /dev/random. If you don't and the system hangs after ldconfig, then banging on the keyboard randomly until it unhangs is one workaround. 20001010: ****************************** WARNING ****************************** Sendmail has been updated. ****************************** WARNING ****************************** o mail.local(8) is no longer installed as a set-user-id binary. o sendmail(8) is now built with STARTTLS support unless NO_OPENSSL is set. o The default /etc/mail/sendmail.cf disables the SMTP EXPN and VRFY commands. o Now using sendmail's version of vacation(1). o The sendmail cf building tools (contrib/sendmail/cf) are installed in /usr/share/sendmail/cf. o sendmail.cw changed to local-host-names More details can be found at http://people.freebsd.org/~imp/UPDATING/sendmail-20001010 20001009: The ports tree's new layout is in place. Be sure to update your entire ports tree, or you will have problems. 20001006: The perl build procedure no longer installs miniperl, nor uses the installed miniperl. It is recommended that you delete /usr/bin/miniperl. 20001005: This weekend the ports tree will be updated to a new layout. It will be in an inconsistent state until noted in the UPDATING file, or with asami-san's message to the relevant mailing lists. With this new layout, you'll need to update the whole tree for anything to work. 20000928: There was a change in the passwd format. Need more information. 20000916: /boot/kernel/kernel.ko -> /boot/kernel/kernel change has taken place. Please update boot loader (not the boot blocks) at the same time as your kernel. 20000914: The new pmtimer device is necessary for laptops. Failure to include the device will cause suspended laptops losing time when they resume. Include device pmtimer in your config file and hint.pmtimer.0.at="isa" to your /boot/device.hints file. 20000911: The random device has been turned into a (pseudo-)device, rather than an option. The supplied kernel config files have been updated. You will need to do something similar in your own kernel config file. Remove: options RANDOMDEV Add: device random If you prefer to load the loadable module, you need to do nothing. 20000909: The random device module has been renamed from randomdev.ko to random.ko. You will need to edit your /boot/loader.conf to reflect this if you load this module at boot time. The line should read: random_load="YES" 20000907: The SMPNG commit has happened. It should work, but if it doesn't, fallback to the PRE_SMPNG CVS tag. There are likely to be a variety of minor issues. Please see 20000905 to make sure you don't have model loading problems which might at first blush appear related to SMP. 20000906: nsswitch has been imported from NetBSD. Among other things, this means that /etc/host.conf is no longer used. See nsswitch.conf(5) instead. Note that at boot time rc.network will attempt to produce a new nsswitch.conf file for you if you don't have one, and you have host.conf. 20000905: The ucred structure changed size. This breaks the interface that mountd uses. Trying to use an older mountd with a newer kernel guarantees a panic. This means that you need to use kernels newer than today only with matching mountd, but you needed to do that anyway with the boot loader changes. 20000905: The boot loader has been updated. The new default kernel is now /boot/kernel/kernel.ko. The new default module location is /boot/kernel. You *MUST* upgrade your boot loader and kernel at the same time. The easiest way to do this is to do the buildworld/buildkernel/ installkernel/installworld dance. Furthermore, you are urged to delete your old /modules directory before booting the new kernel, since kldload will find stale modules in that directory instead of finding them in the correct path, /boot/kernel. The most common complaint that this cures is that the linux module crashes your machine after the update. if [ ! -d /boot/kernel.old ]; then mv /modules.old /boot/kernel.old chflags noschg /kernel.old mv /kernel.old /boot/kernel.old/kernel.ko chflags schg /boot/kernel.old/kernel.ko fi 20000904: A new issue with the sendmail upgrade has come to light. /etc/aliases has moved to /etc/mail/aliases. Mergemaster will incorrectly install the default aliases in /etc/mail rather than move the old one from /etc. So you'll need to manually move the file, create a symbolic link, remove the old /etc/aliases.db and run newaliases. For safety sake, you should stop sendmail while doing this and run the upgrade when locally sourced email is not likely to be generated. 20000825: /boot/device.hints is now required for installkernel to succeed. You should copy GENERIC.hints for your architecture into /boot/device.hints. If and only if you compile hints into your kernel, then this file may be empty. Please note, if you have an empty or missing /boot/device.hints file and you neglected to compile hints into your kernel, no boot messages will appear after the boot loader tries to start the kernel. 20000821: If you do NOT have ``options RANDOMDEV'' in your kernel and you DO want the random device then add randomdev_load="YES" to /boot/loader.conf. 20000812: suidperl is now always built and installed on the system, but with permissions of 511. If you have applications that use this program, you are now required to add ENABLE_SUIDPERL=true to /etc/make.conf. If you forget to do this, chmod 4511 /usr/bin/suidperl will fix this until the next build. 20000812: sendmail has been updated from 8.9.3 to 8.11.0. Some of the more visible changes that may immediately affect your configuration include: - New default file locations from src/contrib/sendmail/cf/README - newaliases limited to root and trusted users - MSA port (587) turned on by default - New queue file naming system so can't go from 8.11 -> 8.9 - FEATURE(`rbl') renamed to FEATURE(`dnsbl') - FEATURE(`nullclient') is more full featured - FEATURE(`nouucp') requires an argument: `reject' or `nospecial' - mail.local FreeBSD-only -b option changed to -B - See src/contrib/sendmail/RELEASE_NOTES for more info 20000810: suidperl (aka sperl) is no longer build by default. You must specifically define BUILD_SUIDPERL to "true" for it to be build. Furthermore, we recommend that you remove /usr/bin/sperl* and /usr/bin/suidperl files from your system unless you have a specific use for it. 20000729: Networking defaults have been tightened. Anybody upgrading /etc/defaults/rc.conf needs to add the following lines to /etc/rc.conf if they want to have the same setup afterwards (unless the variables already are set, of course): # Enable network daemons for user convenience. inetd_enable="YES" portmap_enable="YES" sendmail_enable="YES" 20000728: If you have null_load="YES" in your /boot/loader.conf, you will need to change that to nullfs_load="YES". 20000728: The "installkernel" target has changed slightly. Now even if you override KERNEL e.g. 'make installkernel KERNEL=MYKERNEL' it will install the MYKERNEL file (built with the buildkernel target) as /kernel rather than /MYKERNEL. Those who have updated their /boot/loader.conf files to point to /MYKERNEL should remove that entry or perform manual rename of /kernel to /MYKERNEL. 20000711: If you use CVSUP or CTM to get CVS trees, AND you used to get the old crypto files from internat.freebsd.org AND you check out files from the CVS tree with the cvs command, please read http://people.freebsd.org/~imp/internat.txt for details on potential problems that you might have and how to get around them. If you are merely a mirror, or don't answer yes to each of the clauses above, you needn't worry. 20000711: /etc/security has been updated to print the inode number of setuid programs that have changed. You will see a large spike in the number of changed programs the first time when you run mergemaster to get a new /etc/security. 20000710: /dev/random now has good entropy collection (from the keyboard and sysmouse drivers). Please ensure that either `options RANDOMDEV' is present in your kernel config file or that `randomdev_load="YES"' is in your /boot/loader.conf. If you do not have the /dev/random driver, OpenSSL (and consequently lots of crypto tools (like SSH)) will fail with strange errors. (see below, 20000624). FreeBSD-current is safe again to run Crypto. 20000709: phk made the malloc default options AJ. This may slow things down and uncover other latent bugs in the code. If you need to run at full speed, you can disable this by doing the following: ln -s aj /etc/malloc.conf 20000706: libftpio's version was accidentally bumped a few days ago. This has been corrected. You may need to remove /usr/lib/libftpio.so.6 before doing your next buildworld/installworld pair. It certainly won't hurt to remove it before the update procedure. It will break fetch until a new one is built, but ftp can be used in the interim if needed. 20000705: The crypto packages have changed for the cvsup. This has been done in a backward compatible way, but the old packages will go away at some point in the future. Look at /usr/share/examples/cvsup for details. 20000704: With the new sys/modules/sound/drivers/*, you will need to set SYSDIR until you do an installworld after July 7th. 20000704: rc.shutdown and rc will now call the rc.d scripts with start or stop. This may cause some harmless warnings from older rc.d scripts that haven't been updated. 20000630: The libfetch based version of fetch has gone into the tree. Minor problems may result on some of the less popular sites, which should be reported to des@freebsd.org. 20000625: From approximately this date forward, one must have the crypto system installed in order to build the system and kernel. While not technically strictly true, one should treat it as required and grab the crypto bits. If you are grabbing CVS trees, src-all and cvs-crypto should be treated as if they were required. You should check with the latest collections to make sure that these haven't changed. 20000624: Mark Murray just committed the first parts of a cleanup of /dev/zero, et al. This is also cleaning up /dev/random. The entropy is disconnected, so DO NOT USE VERSIONS OF FREEBSD -CURRENT FROM THIS POINT to 2000710 for cryptographic services until Mark can merge in the fixes to this work in progress. openssh and openssl should not be used to generate keys from this date to the completion of the work. If you must operate at this reduced level of security, add ' options RANDOMDEV' to your kernel or modload the randomdev module. You may also need to copy a new MAKEDEV to /dev and recreate the random and urandom devices. 20000622: The license on the softupdates is now a standard 2 clause BSD license. You may need to remove your symbolic links that used to be required when updating. 20000621: Scott Flatman sent in a decent write-up on the config file update procedure. http://people.freebsd.org/~imp/config-upd.html NOTE: LINT is gone. It has been replaced with NOTES. NOTES isn't buildable. However, you can generate a LINT file: cd /sys//conf && make LINT 20000620: Binutils 2.10 have hit the tree, or will shortly. As soon as they do, the problem noted in 20000522 will be resolved and that workaround will no longer be required. 20000615: phk removed the compatibility creation of wd devices in the ad driver. If you haven't done so already, you must update your fstab, etc to use the ad devices instead of the wd devices. In addition, you'll need to update your boot blocks to a more modern version, if you haven't already done so. Modern here means 4.0 release or newer (although older releases may work). 20000612: Peter took an axe to config(8). Be sure that you read his mail on the topic before even thinking about updating. You will need to create a /boot/device.hints or add a hints directive to your config file to compile them in statically. The format of the config file has changed as well. Please see GENERIC or NEWCARD for examples of the new format. Indirectly, this also breaks USERCONFIG. Unless a newer entry says that it has been fixed, assume that must use the hints mechanism in the loader if you need to use a machine with very old ISA cards in it. 20000522: A new set of binutils went into the tree today. Anybody building a kernel after this point is advised that they need to rebuild their binutils (or better yet do a buildworld/installworld) before building a new kernel. Due to bugs in binutils, using malloc options (eg /etc/malloc.conf or MALLOC_OPTIONS env var) J will cause ld to dump core. It is recommended that you don't set this option until the problem is resolved. 20000513: The ethernet drivers were all updated to clean up the BPF handling. 20000510: The problems with boot blocks on the alphas have been corrected. This will require some care in updating alphas. A new libstand is requires for the boot blocks to build properly. 20000503: Recompile all kld modules. Proper version dependency info is now available. 20000502: Modules have been disconnected from the buildworld tree and connected to the kernel building instead. 20000427: You may need to build gperf cd /usr/src/gnu/usr.bin/gperf && make depend all install when upgrading from 4.0 -> current. The build system now uses an option only in -current. 20000417: The method that we brand ELF binaries has changed to be more acceptable to the binutils maintainers. You will need to rebrand your ELF binaries that aren't native. One problem binary is the Linux ldconfig. After your make world, but before you reboot, you'll need to issue: brandelf -t Linux /compat/linux/sbin/ldconfig if you have Linux compatibility enabled on your machine. 20000320: If you have really bad/marginal IDE drives, you may find they don't work well. Use pio mode instead. The easiest way to cope if you have a problem combination is to add: /sbin/sysctl hw.ata.ata_dma=0 to the start of /etc/rc.conf. 20000319: The ISA and PCI compatibility shims have been connected to the options COMPAT_OLDISA and COMPAT_OLDPCI. If you are using old style PCI or ISA drivers (i.e. tx, voxware, etc.) you must include the appropriate option in your kernel config. Drivers using the shims should be updated or they won't ship with 5.0-RELEASE, targeted for 2001. 20000318: We've entered the traditional post release dumping party. Large kernel changes are being committed and are in the works. It is important to keep the systems' klds and kernel in sync as kernel interfaces and structures are changing. Before reporting kernel panics, make sure that all modules that you are loading are up to date. 20000315: If you are upgrading from an older version of FreeBSD, you need to update your boot blocks as well. 'disklabel -B ad0' will do the trick. This isn't critical until you remove your wd device entries in /dev, at which point your system will not boot. 20000315: 4.0 RELEASE shipped. Please see the 4.0 UPDATING file for how to upgrade to 4.0 from 3.x. COMMON ITEMS: General Notes ------------- Avoid using make -j when upgrading. From time to time in the past there have been problems using -j with buildworld and/or installworld. This is especially true when upgrading between "distant" versions (eg one that cross a major release boundary or several minor releases, or when several months have passed on the -current branch). Sometimes, obscure build problems are the result of environment poisoning. This can happen because the make utility reads its environment when searching for values for global variables. To run your build attempts in an "environmental clean room", prefix all make commands with 'env -i '. See the env(1) manual page for more details. To build a kernel ----------------- If you are updating from a prior version of FreeBSD (even one just a few days old), you should follow this procedure. With a /usr/obj tree with a fresh buildworld, make buildkernel KERNCONF=YOUR_KERNEL_HERE make installkernel KERNCONF=YOUR_KERNEL_HERE To just build a kernel when you know that it won't mess you up -------------------------------------------------------------- cd src/sys/{i386,alpha}/conf config KERNEL_NAME_HERE cd ../../compile/KERNEL_NAME_HERE make depend make make install If this fails, go to the "To build a kernel" section. To rebuild everything and install it on the current system. ----------------------------------------------------------- # Note: sometimes if you are running current you gotta do more than # is listed here if you are upgrading from a really old current. [7] make buildworld make buildkernel KERNCONF=YOUR_KERNEL_HERE make installkernel KERNCONF=YOUR_KERNEL_HERE [1] [3] mergemaster -p [5] make installworld mergemaster [4] To cross-install current onto a separate partition -------------------------------------------------- # In this approach we use a separate partition to hold # current's root, 'usr', and 'var' directories. A partition # holding "/", "/usr" and "/var" should be about 2GB in # size. make buildworld make installworld DESTDIR=${CURRENT_ROOT} make buildkernel KERNCONF=YOUR_KERNEL_HERE cp /usr/src/sys/${ARCH}/conf/GENERIC.hints \ ${CURRENT_ROOT}/boot/device.hints # as needed make installkernel KERNCONF=YOUR_KERNEL_HERE DESTDIR=${CURRENT_ROOT} cd /usr/src/etc; make distribution DESTDIR=${CURRENT_ROOT} # if newfs'd cp /etc/fstab ${CURRENT_ROOT}/etc/fstab # if newfs'd To upgrade in-place from 4.x-stable to current ---------------------------------------------- # 5.x uses more space than 4.x. Also, the location of kernel # modules has changed. If you are installing 5.0 onto a 4.x # system, you'll need about 30MB of free disk space on your / # partition. If you have less than this, you may encounter difficult # to back out of problems with this procedure. If /tmp is on # the / partition, you may want to completely remove all its content # before upgrading, as this can be a common source of shortage of # space on /. [7] make buildworld [9] make buildkernel KERNCONF=YOUR_KERNEL_HERE [8] cp src/sys/${MACHINE}/conf/GENERIC.hints /boot/device.hints [2] make installkernel KERNCONF=YOUR_KERNEL_HERE cd src/sys/boot ; make install [6] [1] [3] mergemaster -p [5] rm -rf /usr/include/g++ make installworld mergemaster [4] Make sure that you've read the UPDATING file to understand the tweaks to various things you need. At this point in the life cycle of current, things change often and you are on your own to cope. The defaults can also change, so please read ALL of the UPDATING entries. Also, if you are tracking -current, you must be subscribed to freebsd-current@freebsd.org. Make sure that before you update your sources that you have read and understood all the recent messages there. If in doubt, please track -stable which has much fewer pitfalls. [1] If you have third party modules, such as vmware, you should disable them at this point so they don't crash your system on reboot. [2] If you have legacy ISA devices, you may need to create your own device.hints to reflect your unique hardware configuration. [3] From the bootblocks, boot -s, and then do fsck -p mount -u / mount -a cd /usr/src adjkerntz -i # if CMOS is wall time Also, when doing a major release upgrade, it is required that you boot into single user mode to do the installworld. For the 4.x -> 5.0 upgrade, you will also see many messages about needing to recompile your userland. These are harmless and can be ignored while you proceed to the next step. [4] Note: This step is non-optional. Failure to do this step can result in a significant reduction in the functionality of the system. Attempting to do it by hand is not recommended and those that pursue this avenue should read this file carefully, as well as the archives of freebsd-current and freebsd-hackers mailing lists for potential gotchas. [5] Usually this step is a noop. However, from time to time you may need to do this if you get unknown user in the following step. It never hurts to do it all the time. You may need to install a new mergemaster (cd src/usr.sbin/mergemaster && make install) after the buildworld before this step if you last updated from current before 20020224 or from -stable before 20020408. [6] 4.x boot loader can be used to boot a 5.x system, however it is difficult to do that at best. If you wish to try, then you should interrupt the boot and at the ok prompt type: ok unload ok boot /boot/kernel/kernel If this fails to work, you must install a new boot loader as described here. [7] Before you upgrade, please make sure that you are not using compatibility slices. These are device names of the form, on i386 and other architectures that use MBR slicing, /dev/ad0a without the actual slice name. Chances are excellent that these will break. You generally must update these entries to use the post FreeBSD 2.x form of /dev/ad0s1a. [8] In order to have a kernel that can run the 4.x binaries needed to do an installworld, you must include the COMPAT_FREEBSD4 option in your kernel. Failure to do so may leave you with a system that is hard to boot to recover. [9] When checking out sources, you must include the -P flag to have cvs prune empty directories. FORMAT: This file contains a list, in reverse chronological order, of major breakages in tracking -current. Not all things will be listed here, and it only starts on March 15, 2000. Updating files can found in previous releases if your system is older than this. Copyright information: Copyright 1998, 2002 M. Warner Losh. All Rights Reserved. Redistribution, publication, translation and use, with or without modification, in full or in part, in any form or format of this document are permitted without further permission from the author. THIS DOCUMENT IS PROVIDED BY WARNER LOSH ``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 WARNER LOSH 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. If you find this document useful, and you want to, you may buy the author a beer. Contact Warner Losh if you have any questions about your use of this document. $FreeBSD$ Index: releng/5.1/crypto/openssl/crypto/opensslv.h =================================================================== --- releng/5.1/crypto/openssl/crypto/opensslv.h (revision 127116) +++ releng/5.1/crypto/openssl/crypto/opensslv.h (revision 127117) @@ -1,85 +1,85 @@ #ifndef HEADER_OPENSSLV_H #define HEADER_OPENSSLV_H /* Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ #define OPENSSL_VERSION_NUMBER 0x0090701fL -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7a Feb 19 2003" +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7a-p1 Feb 19 2003" #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT /* The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major verson number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ #define SHLIB_VERSION_HISTORY "" #define SHLIB_VERSION_NUMBER "0.9.7" #endif /* HEADER_OPENSSLV_H */ Index: releng/5.1/crypto/openssl/ssl/s3_pkt.c =================================================================== --- releng/5.1/crypto/openssl/ssl/s3_pkt.c (revision 127116) +++ releng/5.1/crypto/openssl/ssl/s3_pkt.c (revision 127117) @@ -1,1302 +1,1310 @@ /* ssl/s3_pkt.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * 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@cryptsoft.com). * * 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 attribution * 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. * * 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@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * 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 PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * 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. * * 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@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 product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include #define USE_SOCKETS #include "ssl_locl.h" #include #include static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment); static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len); static int ssl3_get_record(SSL *s); static int do_compress(SSL *ssl); static int do_uncompress(SSL *ssl); static int do_change_cipher_spec(SSL *ssl); /* used only by ssl3_get_record */ static int ssl3_read_n(SSL *s, int n, int max, int extend) { /* If extend == 0, obtain new n-byte packet; if extend == 1, increase * packet by another n bytes. * The packet will be in the sub-array of s->s3->rbuf.buf specified * by s->packet and s->packet_length. * (If s->read_ahead is set, 'max' bytes may be stored in rbuf * [plus s->packet_length bytes if extend == 1].) */ int i,off,newb; if (!extend) { /* start with empty packet ... */ if (s->s3->rbuf.left == 0) s->s3->rbuf.offset = 0; s->packet = s->s3->rbuf.buf + s->s3->rbuf.offset; s->packet_length = 0; /* ... now we can act as if 'extend' was set */ } /* if there is enough in the buffer from a previous read, take some */ if (s->s3->rbuf.left >= (int)n) { s->packet_length+=n; s->s3->rbuf.left-=n; s->s3->rbuf.offset+=n; return(n); } /* else we need to read more data */ if (!s->read_ahead) max=n; { /* avoid buffer overflow */ int max_max = s->s3->rbuf.len - s->packet_length; if (max > max_max) max = max_max; } if (n > max) /* does not happen */ { SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR); return -1; } off = s->packet_length; newb = 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 != s->s3->rbuf.buf) { /* off > 0 */ memmove(s->s3->rbuf.buf, s->packet, off+newb); s->packet = s->s3->rbuf.buf; } while (newb < 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) */ clear_sys_error(); if (s->rbio != NULL) { s->rwstate=SSL_READING; i=BIO_read(s->rbio, &(s->s3->rbuf.buf[off+newb]), max-newb); } else { SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET); i = -1; } if (i <= 0) { s->s3->rbuf.left = newb; return(i); } newb+=i; } /* done reading, now the book-keeping */ s->s3->rbuf.offset = off + n; s->s3->rbuf.left = newb - n; s->packet_length += n; s->rwstate=SSL_NOTHING; return(n); } /* Call this to get a new input record. * It will return <= 0 if more data is needed, normally due to an error * or non-blocking IO. * When it finishes, one packet has been decoded and can be found in * ssl->s3->rrec.type - is the type of record * ssl->s3->rrec.data, - data * ssl->s3->rrec.length, - number of bytes */ /* used only by ssl3_read_bytes */ static int ssl3_get_record(SSL *s) { int ssl_major,ssl_minor,al; int enc_err,n,i,ret= -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned int mac_size; int clear=0; size_t extra; int decryption_failed_or_bad_record_mac = 0; unsigned char *mac = NULL; rr= &(s->s3->rrec); sess=s->session; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) extra=SSL3_RT_MAX_EXTRA; else extra=0; if (extra != s->s3->rbuf.len - SSL3_RT_MAX_PACKET_SIZE) { /* actually likely 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; } again: /* check if we have the header */ if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); if (n <= 0) return(n); /* error or non-blocking */ s->rstate=SSL_ST_READ_BODY; p=s->packet; /* Pull apart the header into the SSL3_RECORD */ rr->type= *(p++); ssl_major= *(p++); ssl_minor= *(p++); version=(ssl_major<<8)|ssl_minor; n2s(p,rr->length); /* Lets check version */ if (s->first_packet) { s->first_packet=0; } else { if (version != s->version) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); /* Send back error using their * version number :-) */ s->version=version; al=SSL_AD_PROTOCOL_VERSION; goto f_err; } } if ((version>>8) != SSL3_VERSION_MAJOR) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); goto err; } if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG); goto f_err; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length-SSL3_RT_HEADER_LENGTH) { /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ i=rr->length; n=ssl3_read_n(s,i,i,1); if (n <= 0) return(n); /* error or non-blocking io */ /* now n == rr->length, * and s->packet_length == SSL3_RT_HEADER_LENGTH + rr->length */ } s->rstate=SSL_ST_READ_HEADER; /* set state for later operations */ /* At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, * and we have that many bytes in s->packet */ rr->input= &(s->packet[SSL3_RT_HEADER_LENGTH]); /* ok, we can now read from 's->packet' data into 'rr' * rr->input points at rr->length bytes, which * need to be copied into rr->data by either * the decryption or by the decompression * When the data is 'copied' into the rr->data buffer, * rr->input will be pointed at the new buffer */ /* We now have - encrypted [ MAC [ compressed [ plain ] ] ] * rr->length bytes of encrypted compressed stuff. */ /* check is not needed I believe */ if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_ENCRYPTED_LENGTH_TOO_LONG); goto f_err; } /* decrypt in place in 'rr->input' */ rr->data=rr->input; enc_err = s->method->ssl3_enc->enc(s,0); if (enc_err <= 0) { if (enc_err == 0) /* SSLerr() and ssl3_send_alert() have been called */ goto err; /* Otherwise enc_err == -1, which indicates bad padding * (rec->length has not been changed in this case). * To minimize information leaked via timing, we will perform * the MAC computation anyway. */ decryption_failed_or_bad_record_mac = 1; } #ifdef TLS_DEBUG printf("dec %d\n",rr->length); { unsigned int z; for (z=0; zlength; z++) printf("%02X%c",rr->data[z],((z+1)%16)?' ':'\n'); } printf("\n"); #endif /* r->length is now the compressed data plus mac */ if ( (sess == NULL) || (s->enc_read_ctx == NULL) || (s->read_hash == NULL)) clear=1; if (!clear) { mac_size=EVP_MD_size(s->read_hash); if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) { #if 0 /* OK only for stream ciphers (then rr->length is visible from ciphertext anyway) */ al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PRE_MAC_LENGTH_TOO_LONG); goto f_err; #else decryption_failed_or_bad_record_mac = 1; #endif } /* check the MAC for rr->input (it's in mac_size bytes at the tail) */ if (rr->length >= mac_size) { rr->length -= mac_size; mac = &rr->data[rr->length]; } else { /* record (minus padding) is too short to contain a MAC */ #if 0 /* OK only for stream ciphers */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); goto f_err; #else decryption_failed_or_bad_record_mac = 1; rr->length = 0; #endif } i=s->method->ssl3_enc->mac(s,md,0); if (mac == NULL || memcmp(md, mac, mac_size) != 0) { decryption_failed_or_bad_record_mac = 1; } } if (decryption_failed_or_bad_record_mac) { /* A separate 'decryption_failed' alert was introduced with TLS 1.0, * SSL 3.0 only has 'bad_record_mac'. But unless a decryption * failure is directly visible from the ciphertext anyway, * we should not reveal which kind of error occured -- this * might become visible to an attacker (e.g. via a logfile) */ al=SSL_AD_BAD_RECORD_MAC; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); goto f_err; } /* r->length is now just compressed */ if (s->expand != NULL) { if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_COMPRESSED_LENGTH_TOO_LONG); goto f_err; } if (!do_uncompress(s)) { al=SSL_AD_DECOMPRESSION_FAILURE; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BAD_DECOMPRESSION); goto f_err; } } if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } rr->off=0; /* So at this point the following is true * ssl->s3->rrec.type is the type of record * ssl->s3->rrec.length == number of bytes in record * ssl->s3->rrec.off == offset to first valid byte * ssl->s3->rrec.data == where to take bytes from, increment * after use :-). */ /* we have pulled in a full packet so zero things */ s->packet_length=0; /* just read a 0 length packet */ if (rr->length == 0) goto again; return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(ret); } static int do_uncompress(SSL *ssl) { int i; SSL3_RECORD *rr; rr= &(ssl->s3->rrec); i=COMP_expand_block(ssl->expand,rr->comp, SSL3_RT_MAX_PLAIN_LENGTH,rr->data,(int)rr->length); if (i < 0) return(0); else rr->length=i; rr->data=rr->comp; return(1); } static int do_compress(SSL *ssl) { int i; SSL3_RECORD *wr; wr= &(ssl->s3->wrec); i=COMP_compress_block(ssl->compress,wr->data, SSL3_RT_MAX_COMPRESSED_LENGTH, wr->input,(int)wr->length); if (i < 0) return(0); else wr->length=i; wr->input=wr->data; return(1); } /* Call this to write data in records of type 'type' * It will return <= 0 if not all data has been sent or non-blocking IO. */ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) { const unsigned char *buf=buf_; unsigned int tot,n,nw; int i; s->rwstate=SSL_NOTHING; tot=s->s3->wnum; s->s3->wnum=0; if (SSL_in_init(s) && !s->in_handshake) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return -1; } } n=(len-tot); for (;;) { if (n > SSL3_RT_MAX_PLAIN_LENGTH) nw=SSL3_RT_MAX_PLAIN_LENGTH; else nw=n; i=do_ssl3_write(s, type, &(buf[tot]), nw, 0); if (i <= 0) { s->s3->wnum=tot; return i; } if ((i == (int)n) || (type == SSL3_RT_APPLICATION_DATA && (s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE))) { /* next chunk of data should get another prepended empty fragment * in ciphersuites with known-IV weakness: */ s->s3->empty_fragment_done = 0; return tot+i; } n-=i; tot+=i; } } static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) { unsigned char *p,*plen; int i,mac_size,clear=0; int prefix_len = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb; SSL_SESSION *sess; /* first check if there is a SSL3_BUFFER still being written * out. This will happen with non blocking IO */ if (s->s3->wbuf.left != 0) return(ssl3_write_pending(s,type,buf,len)); /* If we have an alert to send, lets send it */ if (s->s3->alert_dispatch) { i=ssl3_dispatch_alert(s); if (i <= 0) return(i); /* if it went, fall through and send more stuff */ } if (len == 0 && !create_empty_fragment) return 0; wr= &(s->s3->wrec); wb= &(s->s3->wbuf); sess=s->session; if ( (sess == NULL) || (s->enc_write_ctx == NULL) || (s->write_hash == NULL)) clear=1; if (clear) mac_size=0; else mac_size=EVP_MD_size(s->write_hash); /* 'create_empty_fragment' is true only when this function calls itself */ if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done) { /* countermeasure against known-IV weakness in CBC ciphersuites * (see http://www.openssl.org/~bodo/tls-cbc.txt) */ if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA) { /* recursive function call with 'create_empty_fragment' set; * this prepares and buffers the data for an empty fragment * (these 'prefix_len' bytes are sent out later * together with the actual payload) */ prefix_len = do_ssl3_write(s, type, buf, 0, 1); if (prefix_len <= 0) goto err; if (s->s3->wbuf.len < (size_t)prefix_len + SSL3_RT_MAX_PACKET_SIZE) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR); goto err; } } s->s3->empty_fragment_done = 1; } p = wb->buf + prefix_len; /* write the header */ *(p++)=type&0xff; wr->type=type; *(p++)=(s->version>>8); *(p++)=s->version&0xff; /* field where we are to write out packet length */ plen=p; p+=2; /* lets setup the record stuff. */ wr->data=p; wr->length=(int)len; wr->input=(unsigned char *)buf; /* we now 'read' from wr->input, wr->length bytes into * wr->data */ /* first we compress */ if (s->compress != NULL) { if (!do_compress(s)) { SSLerr(SSL_F_DO_SSL3_WRITE,SSL_R_COMPRESSION_FAILURE); goto err; } } else { memcpy(wr->data,wr->input,wr->length); wr->input=wr->data; } /* we should still have the output to wr->data and the input * from wr->input. Length should be wr->length. * wr->data still points in the wb->buf */ if (mac_size != 0) { s->method->ssl3_enc->mac(s,&(p[wr->length]),1); wr->length+=mac_size; wr->input=p; wr->data=p; } /* ssl3_enc can only have an error on read */ s->method->ssl3_enc->enc(s,1); /* record length after mac and block padding */ s2n(wr->length,plen); /* we should now have * wr->data pointing to the encrypted data, which is * wr->length long */ wr->type=type; /* not needed but helps for debugging */ wr->length+=SSL3_RT_HEADER_LENGTH; if (create_empty_fragment) { /* we are in a recursive call; * just return the length, don't write out anything here */ return wr->length; } /* now let's set up wb */ wb->left = prefix_len + wr->length; wb->offset = 0; /* memorize arguments so that ssl3_write_pending can detect bad write retries later */ s->s3->wpend_tot=len; s->s3->wpend_buf=buf; s->s3->wpend_type=type; s->s3->wpend_ret=len; /* we now just need to write the buffer */ return ssl3_write_pending(s,type,buf,len); err: return -1; } /* if s->s3->wbuf.left != 0, we need to call this */ static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; /* XXXX */ if ((s->s3->wpend_tot > (int)len) || ((s->s3->wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->s3->wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BAD_WRITE_RETRY); return(-1); } for (;;) { clear_sys_error(); if (s->wbio != NULL) { s->rwstate=SSL_WRITING; i=BIO_write(s->wbio, (char *)&(s->s3->wbuf.buf[s->s3->wbuf.offset]), (unsigned int)s->s3->wbuf.left); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BIO_NOT_SET); i= -1; } if (i == s->s3->wbuf.left) { s->s3->wbuf.left=0; s->rwstate=SSL_NOTHING; return(s->s3->wpend_ret); } else if (i <= 0) return(i); s->s3->wbuf.offset+=i; s->s3->wbuf.left-=i; } } /* Return up to 'len' payload bytes received in 'type' records. * 'type' is one of the following: * * - SSL3_RT_HANDSHAKE (when ssl3_get_message calls us) * - SSL3_RT_APPLICATION_DATA (when ssl3_read calls us) * - 0 (during a shutdown, no data has to be returned) * * If we don't have stored data to work from, read a SSL/TLS record first * (possibly multiple records if we still don't have anything to return). * * This function must handle any surprises the peer may have for us, such as * Alert records (e.g. close_notify), ChangeCipherSpec records (not really * a surprise, but handled as if it were), or renegotiation requests. * Also if record payloads contain fragments too small to process, we store * them until there is enough for the respective protocol (the record protocol * may use arbitrary fragmentation and even interleaving): * Change cipher spec protocol * just 1 byte needed, no need for keeping anything stored * Alert protocol * 2 bytes needed (AlertLevel, AlertDescription) * Handshake protocol * 4 bytes needed (HandshakeType, uint24 length) -- we just have * to detect unexpected Client Hello and Hello Request messages * here, anything else is handled by higher layers * Application data protocol * none of our business */ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) { int al,i,j,ret; unsigned int n; SSL3_RECORD *rr; void (*cb)(const SSL *ssl,int type2,int val)=NULL; if (s->s3->rbuf.buf == NULL) /* Not initialized yet */ if (!ssl3_setup_buffers(s)) return(-1); if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->s3->handshake_fragment_len; k++) s->s3->handshake_fragment[k] = *src++; return n; } /* Now s->s3->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!s->in_handshake && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } start: s->rwstate=SSL_NOTHING; /* s->s3->rrec.type - is the type of record * s->s3->rrec.data, - data * s->s3->rrec.off, - offset into 'data' for next read * s->s3->rrec.length, - number of bytes. */ rr = &(s->s3->rrec); /* get new packet if necessary */ if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret=ssl3_get_record(s); if (ret <= 0) return(ret); } /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (rr->type != SSL3_RT_HANDSHAKE)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto err; } /* If the other end has shut down, throw anything we read away * (even in 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length=0; s->rwstate=SSL_NOTHING; return(0); } if (type == rr->type) /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ { /* make sure that we are not getting application data when we * are doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return(len); if ((unsigned int)len > rr->length) n = rr->length; else n = (unsigned int)len; memcpy(buf,&(rr->data[rr->off]),n); if (!peek) { rr->length-=n; rr->off+=n; if (rr->length == 0) { s->rstate=SSL_ST_READ_HEADER; rr->off=0; } } return(n); } /* If we get here, then type != rr->type; if we have a handshake * message, then it was unexpected (Hello Request or Client Hello). */ /* In case of record types for which we have 'fragment' storage, * fill that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (rr->length < n) n = rr->length; /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; /* fragment was too small */ } } /* s->s3->handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->s3->alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); goto err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } } } /* we either finished a handshake or ignored the request, * now try again to obtain the (application) data we were asked for */ goto start; } if (s->s3->alert_fragment_len >= 2) { int alert_level = s->s3->alert_fragment[0]; int alert_descr = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->s3->alert_fragment, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == 1) /* warning */ { s->s3->warn_alert = alert_descr; if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return(0); } } else if (alert_level == 2) /* fatal */ { char tmp[16]; s->rwstate=SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp,sizeof tmp,"%d",alert_descr); ERR_add_error_data(2,"SSL alert number ",tmp); s->shutdown|=SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx,s->session); return(0); } else { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) /* but we have not received a shutdown */ { s->rwstate=SSL_NOTHING; rr->length=0; return(0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { /* 'Change Cipher Spec' is just a single byte, so we know * exactly what the record payload has to look like */ if ( (rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { i=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); goto err; } + /* Check we have a cipher to change to */ + if (s->s3->tmp.new_cipher == NULL) + { + i=SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); + goto err; + } + rr->length=0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, s->msg_callback_arg); s->s3->change_cipher_spec=1; if (!do_change_cipher_spec(s)) goto err; else goto start; } /* Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { #if 0 /* worked only because C operator preferences are not as expected (and * because this is not really needed for clients except for detecting * protocol violations): */ s->state=SSL_ST_BEFORE|(s->server) ?SSL_ST_ACCEPT :SSL_ST_CONNECT; #else s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #endif s->new_session=1; } i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } goto start; } switch (rr->type) { default: #ifndef OPENSSL_NO_TLS /* TLS just ignores unknown message types */ if (s->version == TLS1_VERSION) { rr->length = 0; goto start; } #endif al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* we already handled all of these, with the possible exception * of SSL3_RT_HANDSHAKE when s->in_handshake is set, but that * should not happen when type != rr->type */ al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* At this point, we were expecting handshake data, * but have application data. If the library was * running inside ssl3_read() (i.e. in_read_app_data * is set) and it makes sense to read application data * at this point (session renegotiation not yet started), * we will indulge it. */ if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (( (s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ( (s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data=2; return(-1); } else { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(-1); } static int do_change_cipher_spec(SSL *s) { int i; const char *sender; int slen; if (s->state & SSL_ST_ACCEPT) i=SSL3_CHANGE_CIPHER_SERVER_READ; else i=SSL3_CHANGE_CIPHER_CLIENT_READ; if (s->s3->tmp.key_block == NULL) { s->session->cipher=s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) return(0); } if (!s->method->ssl3_enc->change_cipher_state(s,i)) return(0); /* we have to record the message digest at * this point so we can get it before we read * the finished message */ if (s->state & SSL_ST_CONNECT) { sender=s->method->ssl3_enc->server_finished_label; slen=s->method->ssl3_enc->server_finished_label_len; } else { sender=s->method->ssl3_enc->client_finished_label; slen=s->method->ssl3_enc->client_finished_label_len; } s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, &(s->s3->finish_dgst1), &(s->s3->finish_dgst2), sender,slen,s->s3->tmp.peer_finish_md); return(1); } void ssl3_send_alert(SSL *s, int level, int desc) { /* Map tls/ssl alert value to correct one */ desc=s->method->ssl3_enc->alert_value(desc); if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION) desc = SSL_AD_HANDSHAKE_FAILURE; /* SSL 3.0 does not have protocol_version alerts */ if (desc < 0) return; /* If a fatal one, remove from cache */ if ((level == 2) && (s->session != NULL)) SSL_CTX_remove_session(s->ctx,s->session); s->s3->alert_dispatch=1; s->s3->send_alert[0]=level; s->s3->send_alert[1]=desc; if (s->s3->wbuf.left == 0) /* data still being written out? */ ssl3_dispatch_alert(s); /* else data is still being written out, we will get written * some time in the future */ } int ssl3_dispatch_alert(SSL *s) { int i,j; void (*cb)(const SSL *ssl,int type,int val)=NULL; s->s3->alert_dispatch=0; i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], 2, 0); if (i <= 0) { s->s3->alert_dispatch=1; } else { /* Alert sent to BIO. If it is important, flush it now. * If the message does not get sent due to non-blocking IO, * we will not worry too much. */ if (s->s3->send_alert[0] == SSL3_AL_FATAL) (void)BIO_flush(s->wbio); if (s->msg_callback) s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j=(s->s3->send_alert[0]<<8)|s->s3->send_alert[1]; cb(s,SSL_CB_WRITE_ALERT,j); } } return(i); } Index: releng/5.1/sys/conf/newvers.sh =================================================================== --- releng/5.1/sys/conf/newvers.sh (revision 127116) +++ releng/5.1/sys/conf/newvers.sh (revision 127117) @@ -1,99 +1,99 @@ #!/bin/sh - # # Copyright (c) 1984, 1986, 1990, 1993 # The Regents of the University of California. 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 acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # 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 PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. # # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # $FreeBSD$ TYPE="FreeBSD" REVISION="5.1" -BRANCH="RELEASE-p15" +BRANCH="RELEASE-p16" RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) else RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ $(dirname $0)/../sys/param.h) fi b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b do if [ -r "$bsd_copyright" ]; then COPYRIGHT=`sed \ -e "s/\[year\]/$year/" \ -e 's/\[your name here\]\.* /FreeBSD Inc./' \ -e 's/\[your name\]\.*/FreeBSD Inc./' \ -e '/\[id for your version control system, if any\]/d' \ $bsd_copyright` break fi done # no copyright found, use a dummy if [ X"$COPYRIGHT" = X ]; then COPYRIGHT="/* * Copyright (c) $year * FreeBSD Inc. All rights reserved. * */" fi # add newline COPYRIGHT="$COPYRIGHT " LC_ALL=C; export LC_ALL if [ ! -r version ] then echo 0 > version fi touch version v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` cat << EOF > vers.c $COPYRIGHT char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; char sccs[4] = { '@', '(', '#', ')' }; char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}"; int osreldate = ${RELDATE}; EOF echo `expr ${v} + 1` > version Index: releng/5.2/UPDATING =================================================================== --- releng/5.2/UPDATING (revision 127116) +++ releng/5.2/UPDATING (revision 127117) @@ -1,1520 +1,1523 @@ Updating Information for FreeBSD 5.2.1 users This file is maintained and copyrighted by M. Warner Losh . See end of file for further details. For commonly done items, please see the COMMON ITEMS: section later in the file. This is for the 5.2 release branch. FreeBSD 5.2.1 is part of the 5.2 release branch and has no branch of its own. All entries since 5.0 are an itemized list of commits to this branch, numbered from the beginning. The security advisories related to various patches contain information on how to build/install a minimal set of binaries and start/stop a minimal number of processes, if possible, for that patch. For those updates that don't have an advisory, or to be safe, you can do a full build and install as described in the COMMON ITEMS section. +20040317: p3 FreeBSD-SA-04:05.openssl + Correct a denial-of-service vulnerability in OpenSSL. + 20040316: p2 Improvement of FreeBSD-SA-04:04.tcp fix. 20040302: p1 FreeBSD-SA-04:04.tcp Limit TCP segment reassembly queue size. 20040222: FreeBSD 5.2.1 RELEASE 20040210: Fixed bugs in vfs_mount(9) that could allow jailed processes to mount or unmount file systems outside of the jail and in some cases allow a normal user to unmount a file system when usermounts have been changed from enabled to disabled. Fix a panic in pseudofs(9). 20040205: p2 FreeBSD-SA-04:02.shmat Correct a reference counting bug in shmat(2). 20040127: p1 FreeBSD-SA-04:01.mksnap_ffs Fixed mksnap_ffs to preserve existing file system flags. NOTE WELL: Due to release engineering in progress, 5.2-RELEASE-p1 also includes numerous other critical bug fixes, most of which are not security related. - (i386) `cdboot' now works around a BIOS problem observed on some systems when booting from USB CDROM drives. - (sparc64) The dc(4) driver now supports sparc64 Davicom cards that store their MAC address in OpenFirmware. - Several bugs related to multicast and promiscuous mode handling in the sk(4) driver have been fixed. - A bug in GEOM(4) that could result in I/O hangs in some rare cases has been fixed. - A panic in the NFSv4 client has been fixed; this occurred when attempting operations against an NFSv3/NFSv2-only server. - A bugfix has been applied to NSS support, which fixes problems when using third-party NSS modules (such as `net/nss_ldap') and groups with large membership lists. - Security improvements from CVS 1.11.10 and 1.11.11 have been backported. Specifically, certain malformed module requests are now rejected, and when using `cvs pserver' mode, attempts to authenticate as `root' are rejected and recorded via syslog(3). - The `PFIL_HOOKS' option is now enabled by default in the GENERIC kernel. The most notable effect of this change is to make IPFilter work correctly when loaded as a kernel module. - Some bugs in the IPsec implementation from the KAME Project have been fixed. These bugs were related to freeing memory objects before all references to them were removed, and could cause erratic behavior or kernel panics after flushing the Security Policy Database (SPD). - A number of bugs in the ata(4) driver have been fixed. Most notably, master/slave device detection should work better, and some problems with timeouts should be resolved. - (pc98) The partition type used for new partitions on the pc98 platform was corrected. - Allow devfs path rules to work on directories. 20031206: FreeBSD 5.2 branched 20031112: The statfs structure has been updated with 64-bit fields to allow accurate reporting of multi-terabyte filesystem sizes. You should build world, then build and boot the new kernel BEFORE doing a `installworld' as the new kernel will know about binaries using the old statfs structure, but an old kernel will not know about the new system calls that support the new statfs structure. Note that the backwards compatibility is only present when the kernel is configured with the COMPAT_FREEBSD4 option. Since even /bin/sh will not run with a new kernel without said option you're pretty much dead in the water without it. Make sure you have COMPAT_FREEBSD4! Running an old kernel after a `make world' will cause programs such as `df' that do a statfs system call to fail with a bad system call. Marco Wertejuk also reports that cfsd (ports/security/cfs) needs to be recompiled after these changes are installed. ****************************DANGER******************************* DO NOT make installworld after the buildworld w/o building and installing a new kernel FIRST. You will be unable to build a new kernel otherwise on a system with new binaries and an old kernel. 20031203: The ACPI module has been reactivated. It is no longer required to compile ACPI support into kernels statically. 20031112: Some netgraph string length constants have been changed. This change requires the netgraph kernel modules and all netgraph userland components to be in sync. Especially users who require netgraph to boot need to make sure to have world and kernel in sync before rebooting. 20031111: Hyperthreading logical CPU's are no longer probed by default when using the MP Table. If ACPI is being used, then logical CPUs will be probed if hyperthreading is enabled in the BIOS. If ACPI is not being used and hyperthreading is enabled in the BIOS, logical CPUs can be enabled by building a custom kernel with the option MPTABLE_FORCE_HTT enabled. 20031103: The i386 APIC_IO kernel option has been replaced by 'device apic'. The ACPI module has also been temporarily disabled, so ACPI must be statically compiled into your kernel using 'device acpi' if you wish to use the ACPI driver. 20031031: The API and ABI of struct ifnet have been changed by removing the if_name and if_unit members and replacing them with if_xname, if_dname, and if_dunit. All network drivers and most userland programs which include net/if_var.h must be updated and recompiled. __FreeBSD_version has been bumped to 501113 to reflect this change. 20030928: Changes to the cdevsw default functions have been made to remove the need to specify nullopen() and nullclose() explicitly. __FreeBSD_version bumpted to 501110. 20030926: kiconv(3) has been added. mount_msdosfs(8), mount_ntfs(8) and mount_cd9660(8) need to be in sync with kernel. 20030925: Configuring a system to use IPFILTER now requires that PFIL_HOOKS also be explicitly configured. Previously this dependency was magically handled through some cruft in net/pfil.h; but that has been removed. Building a kernel with IPFILTER but not PFIL_HOOKS will fail with obtuse errors in ip_fil.c. 20030923: Fix a bug in arplookup(), whereby a hostile party on a locally attached network could exhaust kernel memory, and cause a system panic, by sending a flood of spoofed ARP requests. See FreeBSD-SA-03:14.arp. 20030915: A change to /etc/defaults/rc.conf now causes inetd to be started with `-C 60' if it is not overridden in /etc/rc.conf. This causes inetd to stop accepting connections from an IP address that exceeds the rate of 60 connections per minute. 20030829: The following rc.d scripts have been removed and should be deleted from your installation: atm2.sh atm3.sh devdb localdaemons network1 network2 network3. Depending on when you last updated world and used mergemaster(8) you may or may not have problems during the rc boot sequence. The simplest solution is an 'rm -rf /etc/rc.d/*' and then 'mergemaster -i'. The atm2.sh atm3.sh and devdb scripts were removed some time ago, so depending on when you installed -CURRENT these scripts may or may not exist on your system. 20030824: ATAng has been committed. You need to build world as sys/ata.h has changed, and userland atacontrol depends on it. If you use ATA SW raids you need "device ataraid" in your kernel config file, as it is no longer pulled in automatically. 20030819: The OFW_NEWPCI option has been turned on in the Sparc64 GENERIC kernel. Among other things, this changes the device enumeration to be closer to Solaris. Be aware that, this can even cause the machine to not boot without manual intervention before the fstab is adjusted. 20030728: All current USB and Firewire quirks in da(4) have been deprecated and will be removed for 5.2. If this causes failure for your umass(4) devices, enable "options DA_OLD_QUIRKS" in your kernel and send the output of "camcontrol inquiry da0" to scsi@freebsd.org so the quirk can be re-enabled. 20030722: FPU-less support has been removed from FreeBSD. Chances are you won't notice. 386+387 support should still work after this change, but it is now a minimum requirement for the i386 port that you have real FPU hardware. 20030714: Some people are having problems with changes related to /rescue. If you are building -j N, you will need to define NO_RESCUE. Others will need to define it if /rescue has issues with their environment. People should report those issues to current@. 20030711: gcc was upgraded to 3.3. You are advised to not build -DNOCLEAN across this point. Further, it might be a good idea to remove /usr/obj. 20030613: [retrospective] There was a small window in which sed(1) was broken. If you happen to have sed(1) installed during that window, which is evidenced by an inability to build world with the failure given below, you need to manually build and install sed(1) (and only sed(1)) before doing anything else. This is a one- time snafu. Typical failure mode: In file included from /usr/src/contrib/binutils/bfd/targets.c:1092: targmatch.h:7:1: null character(s) ignored targmatch.h:12:1: null character(s) ignored targmatch.h:16:1: null character(s) ignored : The window of "sed(1)-uction" is from Wed Jun 4 15:31:55 2003 UTC to Thu Jun 5 12:10:19 2003 UTC (from rev 1.30 to rev 1.31 of usr.bin/sed/process.c). 20030610: Remove deprecated locale names and transition period code for them, finishing switching to the new scheme. Check your LANG environment variable. 20030609: CCD has been changed to be a fully GEOMified class. Kernel and ccdconfig(8) needs to be in sync, this is particularly important to remember beforehand if your source tree is on a ccd device. Consider making a copy of the old ccdconfig into /boot/kernel.good or wherever you keep your backup kernel. 20030505: Kerberos 5 (Heimdal) is now built by default. Setting MAKE_KERBEROS5 no longer has any effect. If you do NOT want the "base" Kerberos 5, you need to set NO_KERBEROS. 20030502: groff has been updated. If you try to do a buildworld and get an infinite loop in troff, update to May 4th or newer. If you have a newer kernel than userland, you may need to set the OSRELDATE to 500110 in your environment before starting a buildworld. 20030501: The old rc system has been removed. Please report any problems to freebsd-rc@yahoogroups.com, and/or freebsd-current@freebsd.org. Your personal versions of these files will not be removed, so you can continue to use them. However, you should take great care when updating, especially when using mergemaster, since the compatibility code that utilizes these old scripts has also been removed. 20030423: A bug has been fixed in /dev/devctl which would cause devd to hang on boot, were it not for a workaround in devd. The work around in devd will be removed around 20030507. You have until then to upgrade your kernel before updating userland. In general, you should have a userland and kernel that's in sync with each other. However, given the effects of this bug (hang on boot when starting devd), some allowances are made. 20030329: Alphas with libc from between 20030312 and 20030329 exhibit floating point exceptions (FPEs), most notably in awk(1) while upgrading the system through a buildworld. So, to successfully upgrade your Alpha, you must either downgrade your libc.so to a pre-20030312 version, or update /usr/share/mk/bsd.cpu.mk to revision 1.26 which adds -mieee to CFLAGS, then forcibly rebuild and install libc: cd /usr/src/lib/libc && \ make cleandir && make obj && \ make -DNOMAN -DNOPROFILE all && \ make -DNOMAN -DNOPROFILE install 20030208: sendmail 8.12.7 has been imported. It has one important change for IPv6 users. The default submit.mc now uses '[127.0.0.1]' instead of 'localhost' meaning only IPv4 is used to connect to the MTA. Users on IPv6-only machines will need to edit /etc/mail/submit.mc appropriately. 20030128: NODEVFS option has been removed and DEVFS thereby made standard. This makes all references to MAKEDEV obsolete, and they should be removed when convenient. 20030126: The name of the device for the ofw console has changed, sparc64 users must run mergemaster to update their installed /etc/ttys. 20030125: The scheduler framework has grown a second scheduler and consequently you must specify one and only one scheduler in your kernel config. The cvs config files have been updated to use the old scheduler which may be selected via 'options SCHED_4BSD'. If you would like to try the new, much more experimental, scheduler please try 'options SCHED_ULE' and contribute to the arch@ discussion. 20030115: A new version of the wi driver has been imported into the tree. One now must have device wlan in the config file for it to operate properly. In addition, there have been some changes to how wi devices are configured for point to point links to bring it more in line with the former way of doing things, as well as compatibility with NetBSD. 20021222: For a period after the GCC 3.2.1 import (from 12/04 to 12/22), GCC used an incompatible form of ABI for returning structures and unions which FreeBSD's GCC maintainers were not aware of relative to previous versions of FreeBSD. We have gone back to the ABI for now, and any code compiled which is required to interoperate with other code (not built at the same time) returning structs or unions should be rebuilt. 20021216: A name change in /etc/netconfig has been reverted to stay compatible with suns TIRPC and also with NetBSD. You need to run mergemaster after make world. A new libc does still work with an outdated /etc/netconfig for some time, but you'll get a warning. This warning will be removed in 20030301. 20021202: The recent binutils upgrade marks a kernel flag day on sparc64: modules built with the old binutils will not work with new kernels and vice versa. Mismatches will result in panics. Make sure your kernel and modules are in sync. 20021029: The value of IPPROTO_DIVERT has changed. Make sure to keep your kernel, netstat, natd and any third-party DIVERT consumers in sync. 20021024: Old, compatibility slices have been removed in GEOM kernels. This means that you will have to update your /etc/fstab to not use disk devices of the form /dev/ad0a. Instead, you now must specify /dev/ad0s1a, or whatever slice your FreeBSD partition really is on. The old device names have gone away, so if you use them anywhere else, you must also adjust those uses. (This doesn't affect the disks formatted in the ``dangerously-dedicated'' mode.) 20021023: Alphas with kernels from between 20020830 and 20021023 and/or rtld (ld-elf.so.1) older than 20021023 may experience problems with groff while doing a buildworld (kernel: "out of memory", fixed in rev 1.129 of kern/imgact_elf.c; rtld: "too few PT_LOAD segments", fixed in rev 1.8 of libexec/rtld-elf/map_object.c). So, to successfully upgrade your Alpha, you must either upgrade your kernel and rtld first (which might be a bit tricky), or avoid running the bootstrapped groff during the "transitional" buildworld. To avoid running groff during the transitional upgrade run make buildworld with -DNOMAN, -DNO_SHAREDOCS, and -DNO_LPR. 20020831: gcc has been upgraded to 3.2. It is not all binary compatible with earlier versions of gcc for c++ programs. All c++ programs and libraries need to be recompiled. Also, if you encounter g++ issues, rm /usr/include/g++/* before doing an installworld to make sure that stale files are removed. 20020827: Our /etc/termcap now has all the entries from the XFree86 xterm almost unchanged. This means xterm now supports color by default. If you used TERM=xterm-color in the past you now should use TERM=xterm. (xterm-color will lead to benign warnings). 20020815: A "bug" in gcc(1) that was hiding warning in system headers was fixed. It's probably time to add -DNO_WERROR to your make line again. 20020729: COPY is being deprecated. The 20010530 change was reverted, as it causes far more pain than was expected, and to always compare before installing, please use INSTALL="install -C" again. The -C option is now silently ignored when used with the -d option. 20020702: Problems with libc_r clients like KDE and GNOME have been resolved. There are still some minor problems with some signals but the system is stable enough for general use again. SMP is less so than UP but each can successfully complete multiple buildworlds. Libkvm needs to be recompiled due to KSE. 20020701: Now would be a bad time to upgrade. Something in or near the KSE commit totally broke programs using libc_r like KDE and GNOME. 20020511: The k5su utility installed as part of Kerberos 5 is no longer installed with the set-user-ID bit set by default. Add ENABLE_SUID_K5SU=yes to /etc/make.conf to have it installed with the set-user-ID bit set. 20020510: Gcc 3.1 debugging format (cc -g) has changed from STABS to DWARF2. Unfortunately our native GDB (at version 4.18) does not understand the DWARF2 debugging format. Thus you must use `gcc -gstabs+' to generated debugging information for our native GDB. 20020510: Due to the way CVS works, it may not properly update src/contrib/gcc to the 3.1 sources. The easiest fix is to `rm -rf' src/contrib/gcc and then do a cvs update. 20020421: When exec'ing set[ug]id executables, the kernel now ensures that the stdio file descriptors (0..2) are open. See FreeBSD-SA-02:23.stdio. 20020404: New sendmail startup scripts have been installed to make it easier to use alternative MTAs with FreeBSD. Setting the rc.conf variable sendmail_enable to "NO" no longer prevents any sendmail daemons from starting. Instead, either set sendmail_enable to "NONE" or change mta_start_script to a script for starting an alternative MTA. Setting mta_start_script to "" will also prevent any MTA from being started at boot. 20020403: UCONSOLE is no longer a valid kernel option. 20020315: FreeBSD 5.0 DP-1 was basically branched today. 20020225: Warnings are now errors in the kernel. Unless you are a developer, you should add -DNO_WERROR to your make line. 20020217: sendmail 8.12.2 has been imported. The sendmail binary is no longer a set-user-ID root binary and the infrastructure to support command line mail submission has changed. Be sure to run mergemaster (especially for updating /etc/rc, /etc/defaults/rc.conf, and /etc/mail) and read /etc/mail/README for more details. Due to the import of sendmail 8.12.2, a new user and group are required in order for sendmail to run as a set-group-ID binary. A 'make installworld' will use the new user and group to set the owner and group of /var/spool/clientmqueue and will fail if the new user and group do not exist. The 'smmsp' user and group must be merged from src/etc/group and src/etc/master.passwd before using 'make installworld'. 'mergemaster -p' will do this. You may need to install mergemaster before this will work if you are updating from a very old version of current. The updating recipe has changed as of this date. 20020112: The preferred configuration method for PAM is now /etc/pam.d/ rather than /etc/pam.conf. If you have an unmodified pam.conf, just delete it after your next mergemaster run. If you have local modifications, you can use /usr/src/etc/pam.d/convert.pl to incorporate them into your /etc/pam.d. Please see the following url for more details: http://www.freebsd.org/cgi/mid.cgi?db=mid&id= 20011229: If anyone here is already using the new rc.conf(5) variable networkfs_types, please note that it has changed http://www.freebsd.org/cgi/mid.cgi?db=mid&id=<9744.1009655556@axl.seasidesoftware.co.za> 20011220: sys/i4b/driver/i4b_ispppsubr.c has been retired. This file started out its life in the ISDN4BSD project as an offspring from sys/net/if_spppsubr.c, which eventually got a life of its own. All the accumulated features and bugfixes of the i4b version have now been merged back into the base system's version now. The only user-visible change resulting from this is that i4b's sppp(4) interfaces are to be managed with spppcontrol(8) again, since ispppcontrol(8) has been retired as well. (There has never been rc file support for ispppcontrol in -current, but only in -stable. That will be reverted by the time the changes are MFCed.) 20011215: The fdc(4) driver has been updated and now automatically recognizes media in `standard' formats (like 1440 KB and 720 KB for a 3.5" high-density drive) when accessing the default device node (e. g. /dev/fd0). The old variety of floppy device nodes /dev/fd*.* is no longer present by default, devices can be created (in DEVFS) on demand. They will need to be customized then for `odd' densities using fdcontrol(8). 20011209: The bugs in procfs' debugging support code have been fixed, and truss(1) now works again. 20011207: Daily security checks have been split out to use the periodic(8) scripts. Some change in configuration may be necessary. Please see http://www.freebsd.org/cgi/mid.cgi?db=mid&id=<20011207155805.R8975@blossom.cjclark.org> for details. 20011204: sos added VCD/SVCD support to ata driver and that needs the kernel and burncd to be in sync. 20011203: The procfs pseudo-filesystem has now been converted to use the pseudofs framework. If you have 'options PROCFS' in your kernel config, you'll need to add 'options PSEUDOFS' if it's not there already. This change temporarily breaks truss(1); use ktrace(1) instead until the issue has been resolved. 20011202: A security hole in OpenSSH involving `UseLogin yes' has been patched. 20011126: You need to remove /usr/obj/.../usr.bin/tip before rebuilding after this date. You need to do this only once. 20011103: Most of the awk issues have been resolved. Some rough edges may be left, but for the most part things should be back to "normal." For CURRENT's usual definition of "normal." 20011030: Awk has been upgraded to the one true awk from bell labs. Expect choppy waves in the upgrade process. 20011030: The asr driver problem has been resolved. 20011027: Due to changes in other parts of the system, the asr driver now causes the system to panic on boot. Do not use it pending correction. Comment it out of any kernel config file that you try to use from this date forward. 20011025: When crossbuilding, use TARGET=xxx where you used to use MACHINE=xxx. You don't need to set TARGET_ARCH and TARGET, unless you are changing both of them. To cross build pc98 on an alpha, for example, you need to set TARGET=pc98 and TARGET_ARCH=i386. 20011001: The kernel interface that burncd depends on has changed. You must recompile both the kernel and userland applications at the same time. 20010929: When crossbuilding, please set TARGET_ARCH rather than MACHINE_ARCH to indicate the target. In the future, one will set TARGET_MACHINE where you set MACHINE now. At the moment, setting MACHINE alone for same MACHINE_ARCH machines works (eg, you can build pc98 on an i386 machine and vice versa). 20010927: Some weird problems result from using ACPI on some machines. To disable ACPI you can add hint.acpi.0.disabled="1" to /boot/loader.conf (or by putting set X=Y at the boot loader "ok" prompt). Alternatively, you can remove it from /boot/kernel/acpi.ko or use the MODULES_OVERRIDE function in your kernel config file and not list acpi in that list. 20010924: The buildworld has been fixed. You may need to install the 4.x compatibility libraries for some old binaries to work. Add COMPAT4X=true to your /etc/make.conf to get them installed on every installworld, or execute the following to get them installed only once: cd src/lib/compat/compat4x. make all install You will see ``__stdoutp undefined'' until you do this. 20010919: There's a bug in the world build process. The cross-tools are build with the NEW headers, but the OLD libc.a. This leads to all kinds of problems with the new libc. A temporary workaround is to add CFLAGS="-O -pipe -D_OLD_STDIO" before building world when upgrading from 4.x to current. This can be removed afterwards. A proper fix to the buildworld target is needed. 20010918: Peter has committed his new kthread nfs client/server code. NFS may be unstable after this date. 20010912: KSE has hit the tree. Lots of things are now different in the kernel. While a few problems were introduced in the initial commit, most of the major ones have been found and corrected. 20010901: In OLDCARD, CardBus bridges appear to be stable. The work arounds described in the 20010604 entry are now no longer necessary and will be ignored. Most insert/remove problems have been rectified around this date. 20010823: named now runs as user bind and group bind rather than as root. If named_enable is set to YES in /etc/rc.conf, ensure that user bind is available in /etc/passwd (using vipw(8)) and that group bind is available in /etc/group. Also make sure that user or group bind has read (and not write) permission for your name server configuration and that it has read and write permission for your slave zone files and directory. If you wish to continue to run named as root (a less secure alternative), add a line to /etc/rc.conf saying named_flags= 20010709: The PAM libraries have had an API upgrade that is beyond the ability of the shared library major number to handle. It is manifested by PAM-using ports dumping core. The solution is to rebuild those ports. 20010628: The kernel compile module has moved from src/sys/compile/FOO to src/sys/${MACHINE}/compile/FOO. 20010625: The pccard modem issue from 20010613 has been corrected. OLDCARD support is still a little weak in -current. slot 1 is known not to work on some TI based cardbus bridges. Some cardbus bridges do not properly detect insert/removal events. IRQ configuration needs more safety belts. 20010617: Softupdates problems have been corrected. 20010614: Peter ripped out the linkerset support. You must, as always, rerun config after you cvsup if you are using the traditional kernel building methods. 20010613: pccard modems may not work with current after 20010604 date. Some do, others result in panics. *MAKE*SURE* that you update your config and /etc/rc.conf ala the 20010604 entry, or you will have problems (this issue will be fixed, it just hasn't been yet). 20010613: SOFTUPDATES seem to be broken since the middle of May or so. Do not use them in current. You can disable softupdates on all mounted partitions, or remove SOFTUPDATES the kernel config file. 20010612: After Peter's commits to the hints code, people have been noticing that certain devices are attached (or try to) twice. This is due to having both static hints as well as a /boot/device.hints. To work around this issue, please use only one or the other mechanism until this bug is fixed. Please note that a feature of config is that if you have config file FOO and FOO.hints, it automatically adds FOO.hints to the hints.c file, whether you want it to or not. 20010610: Locale names have changed to match other systems better. 20010604: pccard support for pci cards has been committed. You must change your /etc/pccard.conf irq lines. It must match the irq used by pcic device. Interrupt storms may result if you fail to do this. Interrupt storms look a lot like a hang. You must also install a new pccardd, otherwise you will get an interrupt storm at card reset time (just after it tells you what it is). pccardd_flags="-I" is necessary for the time being. It tells pccardd not to ask the kernel if the interrupt is really free or not before using it. You can either change the /etc/pccard.conf irq lines to match pcic, or add "-i X" to the pccardd_flags. 20010530: INSTALL=install -C is being deprecated. If you want to do this, use COPY=-C instead. The former method will be supported for only a limited time. If you see install: warning: the -d and -C options may not be specified together in your makeworld, then you need to migrate towards using COPY=-C. 20010525: It appears that vm is now stable enough to use again. However, there may be other problems, so caution is still urged. alpha definitely is in bad shape. 20010521: Minor repo damage has happened. This may cause problems with cvsup of ports. If you get errors, please see http://www.FreeBSD.org/cgi/query-pr.cgi?pr=27495 at the bottom for details on a workaround. The error message is Updater failed: Cannot delete "/usr/ports/www/jakarta-tomcat/files": Directory not empty 20010520: Vm and/or swapping are busted on -current. Please be patient. 20010519: pccard has had much reorganizational work done to it over the past few days. Everything should still work, but if not, please contact imp@freebsd.org. 20010517: ata ioctl changed. Make sure to recompile both kernel and userland at the same time. 20010517: New ncurses imported. 20010512: DEVFS is now opt out, not opt in. Barring major problems, this will be the only way to go starting July 1. 20010504: OpenSSH has been updated to 2.9. Some defaults are different, including RhostsRSAAuthentication, which changes from yes to no. 20010502: Perl breakage in 20010501 was corrected at 14:18:33 PDT. 20010501: Building perl was broken at 02:25:25 PDT. 20010430: The bug in 20010429 was corrected at 07:35:37 PDT. It is safe to go back in the water. 20010429: A bad bug was committed at 04:48:42 PDT. Don't use kernels after this date, but before the correction date. 20010423: old fsck and new kernel interactions appear to have been fixed. 20010411: fsck and the kernel were changed to handle some optimizations to directory layout. This breaks backward compatibility. Update only if you understand that you must not use the old fsck with the new kernel ever. 20010330: fsck has changed the meaning of the pass column in /etc/fstab. Please see the cvs commit to fsck.8 or the fsck.8 man page for details. It is unclear if changes to /etc/fstab are necessary. 20010319: portmap had changed name to rpcbind for maximum POLA in your current world. /etc/hosts.{allow,deny} needs changes. nfs and other rpc based programs that rely on portmapper will not work without updates to /etc/hosts.{allow,deny} and /etc/netconfig. 20010315: ata subsystem changes. ATA_ENABLE_ATAPI_DMA, ATA_ENABLE_WC and ATA_ENABLE_TAGS are no longer kernel options. They have been replaced by tunables. See ata.4 for details. 20010312: The fxp driver was converted to use miibus. If you compile fxp into your kernel statically, you will need to add miibus. 20010312: The wi device now defaults to BSS (infrastructure) mode instead of ad-hoc. 20010310: /dev/urandom should be a symbolic link to /dev/random now. Users of current not using DEVFS need to run MAKEDEV std. ssh might not work if you don't. 20010303: The ed driver has been updated. It now allows mii attachments, which means that you must include the miibus in your kernel if you use the ed driver. 20010220: The problems with libc have been corrected. It is now mostly safe to go back into the water. 20010211: The size of FILE was changed. This breaks upgrading. If you must upgrade, be prepared for pain. It also breaks almost all binaries that you've compiled on -current. You are warned that before upgrading would be a good time to do a level 0 dump of your system. No, really, I mean it this time. To get to the new system, you'll need to use the following workaround. Hopefully this can be sorted out so that we don't have to move this to the updating section. To get around the installworld problem, do: # cd /usr/src/usr.bin/sed # make install # cd /usr/src # make installworld If that doesn't work, then try: # make -k installworld # make installworld 20010207: DEVFS is now the default. If you use vinum, make sure that you do not include devfs in your kernel as problems result. 20010205: FFS_ROOT and CD9660_ROOT have been removed or deprecated. Remove them from your config. 20010122: ****************************** WARNING ****************************** buildkernel has been changed slightly ****************************** WARNING ****************************** KERNCONF replaces the variable KERNEL for buildkernel. You should update your scripts and make.conf accordingly. 20010119: config has changed to allow DEV_FOO as a replacement for NFOO. This requires a new config to build correctly. 20010116: The kernel option I386_CPU is now mutually exclusive with the other cpu types. If you have an i386 system, be sure that it only had this line. Remove it for all other configurations. 20010110: Changes to the kernel require it and burncd be in sync. 20010102: Everyone who has hw.sndunit set to something in /etc/sysctl.conf, it is now hw.snd.unit. 20010101: ex and vi were broken by some changes to sys/queue.h. If you have a bad vi, you will see make buildworld fail with a core dump while building termcap. You can work around this problem by adding -k to your make buildworld. This will cause the build to complete and install a new vi. Once that's done, you can rebuild again without the -k to pick up anything that might have been ignored by the -k option. Others have suggested that you can just rebuild libc if your vi/ex is dynamically linked, but I've not received any reports of this working. 20001228: There have been some changes to libcrypt in -current. The libscrypt/libdescrypt symlink silliness is gone and the installed libcrypt is fully functional. Be aware of this. 20001218: Linksys Fast Ethernet PCCARD cards supported by the ed driver now require the addition of flag 0x80000 to their config line in pccard.conf(5). This flag is not optional. These Linksys cards will not be recognized without it. 20001205: Important new FreeBSD-version stuff: PAM support has been worked in, partially from the "Unix" OpenSSH version. This requires adding the following in pam.conf: sshd auth sufficient pam_skey.so sshd auth required pam_unix.so try_first_pass sshd session required pam_permit.so 20001031: cvs updated to 1.11. 20001020: The random device needs more entropy, so you need to make sure that you've run mergemaster to get a /etc/rc which will seed /dev/random. If you don't and the system hangs after ldconfig, then banging on the keyboard randomly until it unhangs is one workaround. 20001010: ****************************** WARNING ****************************** Sendmail has been updated. ****************************** WARNING ****************************** o mail.local(8) is no longer installed as a set-user-id binary. o sendmail(8) is now built with STARTTLS support unless NO_OPENSSL is set. o The default /etc/mail/sendmail.cf disables the SMTP EXPN and VRFY commands. o Now using sendmail's version of vacation(1). o The sendmail cf building tools (contrib/sendmail/cf) are installed in /usr/share/sendmail/cf. o sendmail.cw changed to local-host-names More details can be found at http://people.freebsd.org/~imp/UPDATING/sendmail-20001010 20001009: The ports tree's new layout is in place. Be sure to update your entire ports tree, or you will have problems. 20001006: The perl build procedure no longer installs miniperl, nor uses the installed miniperl. It is recommended that you delete /usr/bin/miniperl. 20001005: This weekend the ports tree will be updated to a new layout. It will be in an inconsistent state until noted in the UPDATING file, or with asami-san's message to the relevant mailing lists. With this new layout, you'll need to update the whole tree for anything to work. 20000928: There was a change in the passwd format. Need more information. 20000916: /boot/kernel/kernel.ko -> /boot/kernel/kernel change has taken place. Please update boot loader (not the boot blocks) at the same time as your kernel. 20000914: The new pmtimer device is necessary for laptops. Failure to include the device will cause suspended laptops losing time when they resume. Include device pmtimer in your config file and hint.pmtimer.0.at="isa" to your /boot/device.hints file. 20000911: The random device has been turned into a (pseudo-)device, rather than an option. The supplied kernel config files have been updated. You will need to do something similar in your own kernel config file. Remove: options RANDOMDEV Add: device random If you prefer to load the loadable module, you need to do nothing. 20000909: The random device module has been renamed from randomdev.ko to random.ko. You will need to edit your /boot/loader.conf to reflect this if you load this module at boot time. The line should read: random_load="YES" 20000907: The SMPNG commit has happened. It should work, but if it doesn't, fallback to the PRE_SMPNG CVS tag. There are likely to be a variety of minor issues. Please see 20000905 to make sure you don't have model loading problems which might at first blush appear related to SMP. 20000906: nsswitch has been imported from NetBSD. Among other things, this means that /etc/host.conf is no longer used. See nsswitch.conf(5) instead. Note that at boot time rc.network will attempt to produce a new nsswitch.conf file for you if you don't have one, and you have host.conf. 20000905: The ucred structure changed size. This breaks the interface that mountd uses. Trying to use an older mountd with a newer kernel guarantees a panic. This means that you need to use kernels newer than today only with matching mountd, but you needed to do that anyway with the boot loader changes. 20000905: The boot loader has been updated. The new default kernel is now /boot/kernel/kernel.ko. The new default module location is /boot/kernel. You *MUST* upgrade your boot loader and kernel at the same time. The easiest way to do this is to do the buildworld/buildkernel/ installkernel/installworld dance. Furthermore, you are urged to delete your old /modules directory before booting the new kernel, since kldload will find stale modules in that directory instead of finding them in the correct path, /boot/kernel. The most common complaint that this cures is that the linux module crashes your machine after the update. if [ ! -d /boot/kernel.old ]; then mv /modules.old /boot/kernel.old chflags noschg /kernel.old mv /kernel.old /boot/kernel.old/kernel.ko chflags schg /boot/kernel.old/kernel.ko fi 20000904: A new issue with the sendmail upgrade has come to light. /etc/aliases has moved to /etc/mail/aliases. Mergemaster will incorrectly install the default aliases in /etc/mail rather than move the old one from /etc. So you'll need to manually move the file, create a symbolic link, remove the old /etc/aliases.db and run newaliases. For safety sake, you should stop sendmail while doing this and run the upgrade when locally sourced email is not likely to be generated. 20000825: /boot/device.hints is now required for installkernel to succeed. You should copy GENERIC.hints for your architecture into /boot/device.hints. If and only if you compile hints into your kernel, then this file may be empty. Please note, if you have an empty or missing /boot/device.hints file and you neglected to compile hints into your kernel, no boot messages will appear after the boot loader tries to start the kernel. 20000821: If you do NOT have ``options RANDOMDEV'' in your kernel and you DO want the random device then add randomdev_load="YES" to /boot/loader.conf. 20000812: suidperl is now always built and installed on the system, but with permissions of 511. If you have applications that use this program, you are now required to add ENABLE_SUIDPERL=true to /etc/make.conf. If you forget to do this, chmod 4511 /usr/bin/suidperl will fix this until the next build. 20000812: sendmail has been updated from 8.9.3 to 8.11.0. Some of the more visible changes that may immediately affect your configuration include: - New default file locations from src/contrib/sendmail/cf/README - newaliases limited to root and trusted users - MSA port (587) turned on by default - New queue file naming system so can't go from 8.11 -> 8.9 - FEATURE(`rbl') renamed to FEATURE(`dnsbl') - FEATURE(`nullclient') is more full featured - FEATURE(`nouucp') requires an argument: `reject' or `nospecial' - mail.local FreeBSD-only -b option changed to -B - See src/contrib/sendmail/RELEASE_NOTES for more info 20000810: suidperl (aka sperl) is no longer build by default. You must specifically define BUILD_SUIDPERL to "true" for it to be build. Furthermore, we recommend that you remove /usr/bin/sperl* and /usr/bin/suidperl files from your system unless you have a specific use for it. 20000729: Networking defaults have been tightened. Anybody upgrading /etc/defaults/rc.conf needs to add the following lines to /etc/rc.conf if they want to have the same setup afterwards (unless the variables already are set, of course): # Enable network daemons for user convenience. inetd_enable="YES" portmap_enable="YES" sendmail_enable="YES" 20000728: If you have null_load="YES" in your /boot/loader.conf, you will need to change that to nullfs_load="YES". 20000728: The "installkernel" target has changed slightly. Now even if you override KERNEL e.g. 'make installkernel KERNEL=MYKERNEL' it will install the MYKERNEL file (built with the buildkernel target) as /kernel rather than /MYKERNEL. Those who have updated their /boot/loader.conf files to point to /MYKERNEL should remove that entry or perform manual rename of /kernel to /MYKERNEL. 20000711: If you use CVSUP or CTM to get CVS trees, AND you used to get the old crypto files from internat.freebsd.org AND you check out files from the CVS tree with the cvs command, please read http://people.freebsd.org/~imp/internat.txt for details on potential problems that you might have and how to get around them. If you are merely a mirror, or don't answer yes to each of the clauses above, you needn't worry. 20000711: /etc/security has been updated to print the inode number of setuid programs that have changed. You will see a large spike in the number of changed programs the first time when you run mergemaster to get a new /etc/security. 20000710: /dev/random now has good entropy collection (from the keyboard and sysmouse drivers). Please ensure that either `options RANDOMDEV' is present in your kernel config file or that `randomdev_load="YES"' is in your /boot/loader.conf. If you do not have the /dev/random driver, OpenSSL (and consequently lots of crypto tools (like SSH)) will fail with strange errors. (see below, 20000624). FreeBSD-current is safe again to run Crypto. 20000709: phk made the malloc default options AJ. This may slow things down and uncover other latent bugs in the code. If you need to run at full speed, you can disable this by doing the following: ln -s aj /etc/malloc.conf 20000706: libftpio's version was accidentally bumped a few days ago. This has been corrected. You may need to remove /usr/lib/libftpio.so.6 before doing your next buildworld/installworld pair. It certainly won't hurt to remove it before the update procedure. It will break fetch until a new one is built, but ftp can be used in the interim if needed. 20000705: The crypto packages have changed for the cvsup. This has been done in a backward compatible way, but the old packages will go away at some point in the future. Look at /usr/share/examples/cvsup for details. 20000704: With the new sys/modules/sound/drivers/*, you will need to set SYSDIR until you do an installworld after July 7th. 20000704: rc.shutdown and rc will now call the rc.d scripts with start or stop. This may cause some harmless warnings from older rc.d scripts that haven't been updated. 20000630: The libfetch based version of fetch has gone into the tree. Minor problems may result on some of the less popular sites, which should be reported to des@freebsd.org. 20000625: From approximately this date forward, one must have the crypto system installed in order to build the system and kernel. While not technically strictly true, one should treat it as required and grab the crypto bits. If you are grabbing CVS trees, src-all and cvs-crypto should be treated as if they were required. You should check with the latest collections to make sure that these haven't changed. 20000624: Mark Murray just committed the first parts of a cleanup of /dev/zero, et al. This is also cleaning up /dev/random. The entropy is disconnected, so DO NOT USE VERSIONS OF FREEBSD -CURRENT FROM THIS POINT to 2000710 for cryptographic services until Mark can merge in the fixes to this work in progress. openssh and openssl should not be used to generate keys from this date to the completion of the work. If you must operate at this reduced level of security, add ' options RANDOMDEV' to your kernel or modload the randomdev module. You may also need to copy a new MAKEDEV to /dev and recreate the random and urandom devices. 20000622: The license on the softupdates is now a standard 2 clause BSD license. You may need to remove your symbolic links that used to be required when updating. 20000621: Scott Flatman sent in a decent write-up on the config file update procedure. http://people.freebsd.org/~imp/config-upd.html NOTE: LINT is gone. It has been replaced with NOTES. NOTES isn't buildable. However, you can generate a LINT file: cd /sys//conf && make LINT 20000620: Binutils 2.10 have hit the tree, or will shortly. As soon as they do, the problem noted in 20000522 will be resolved and that workaround will no longer be required. 20000615: phk removed the compatibility creation of wd devices in the ad driver. If you haven't done so already, you must update your fstab, etc to use the ad devices instead of the wd devices. In addition, you'll need to update your boot blocks to a more modern version, if you haven't already done so. Modern here means 4.0 release or newer (although older releases may work). 20000612: Peter took an axe to config(8). Be sure that you read his mail on the topic before even thinking about updating. You will need to create a /boot/device.hints or add a hints directive to your config file to compile them in statically. The format of the config file has changed as well. Please see GENERIC or NEWCARD for examples of the new format. Indirectly, this also breaks USERCONFIG. Unless a newer entry says that it has been fixed, assume that must use the hints mechanism in the loader if you need to use a machine with very old ISA cards in it. 20000522: A new set of binutils went into the tree today. Anybody building a kernel after this point is advised that they need to rebuild their binutils (or better yet do a buildworld/installworld) before building a new kernel. Due to bugs in binutils, using malloc options (eg /etc/malloc.conf or MALLOC_OPTIONS env var) J will cause ld to dump core. It is recommended that you don't set this option until the problem is resolved. 20000513: The ethernet drivers were all updated to clean up the BPF handling. 20000510: The problems with boot blocks on the alphas have been corrected. This will require some care in updating alphas. A new libstand is requires for the boot blocks to build properly. 20000503: Recompile all kld modules. Proper version dependency info is now available. 20000502: Modules have been disconnected from the buildworld tree and connected to the kernel building instead. 20000427: You may need to build gperf cd /usr/src/gnu/usr.bin/gperf && make depend all install when upgrading from 4.0 -> current. The build system now uses an option only in -current. 20000417: The method that we brand ELF binaries has changed to be more acceptable to the binutils maintainers. You will need to rebrand your ELF binaries that aren't native. One problem binary is the Linux ldconfig. After your make world, but before you reboot, you'll need to issue: brandelf -t Linux /compat/linux/sbin/ldconfig if you have Linux compatibility enabled on your machine. 20000320: If you have really bad/marginal IDE drives, you may find they don't work well. Use pio mode instead. The easiest way to cope if you have a problem combination is to add: /sbin/sysctl hw.ata.ata_dma=0 to the start of /etc/rc.conf. 20000319: The ISA and PCI compatibility shims have been connected to the options COMPAT_OLDISA and COMPAT_OLDPCI. If you are using old style PCI or ISA drivers (i.e. tx, voxware, etc.) you must include the appropriate option in your kernel config. Drivers using the shims should be updated or they won't ship with 5.0-RELEASE, targeted for 2001. 20000318: We've entered the traditional post release dumping party. Large kernel changes are being committed and are in the works. It is important to keep the systems' klds and kernel in sync as kernel interfaces and structures are changing. Before reporting kernel panics, make sure that all modules that you are loading are up to date. 20000315: If you are upgrading from an older version of FreeBSD, you need to update your boot blocks as well. 'disklabel -B ad0' will do the trick. This isn't critical until you remove your wd device entries in /dev, at which point your system will not boot. 20000315: 4.0 RELEASE shipped. Please see the 4.0 UPDATING file for how to upgrade to 4.0 from 3.x. COMMON ITEMS: General Notes ------------- Avoid using make -j when upgrading. From time to time in the past there have been problems using -j with buildworld and/or installworld. This is especially true when upgrading between "distant" versions (eg one that cross a major release boundary or several minor releases, or when several months have passed on the -current branch). Sometimes, obscure build problems are the result of environment poisoning. This can happen because the make utility reads its environment when searching for values for global variables. To run your build attempts in an "environmental clean room", prefix all make commands with 'env -i '. See the env(1) manual page for more details. To build a kernel ----------------- If you are updating from a prior version of FreeBSD (even one just a few days old), you should follow this procedure. With a /usr/obj tree with a fresh buildworld, make -DALWAYS_CHECK_MAKE buildkernel KERNCONF=YOUR_KERNEL_HERE make -DALWAYS_CHECK_MAKE installkernel KERNCONF=YOUR_KERNEL_HERE To just build a kernel when you know that it won't mess you up -------------------------------------------------------------- cd src/sys/{i386,alpha}/conf config KERNEL_NAME_HERE cd ../../compile/KERNEL_NAME_HERE make depend make make install If this fails, go to the "To build a kernel" section. To rebuild everything and install it on the current system. ----------------------------------------------------------- # Note: sometimes if you are running current you gotta do more than # is listed here if you are upgrading from a really old current. [7] make buildworld make buildkernel KERNCONF=YOUR_KERNEL_HERE make installkernel KERNCONF=YOUR_KERNEL_HERE [1] [3] mergemaster -p [5] make installworld mergemaster [4] To cross-install current onto a separate partition -------------------------------------------------- # In this approach we use a separate partition to hold # current's root, 'usr', and 'var' directories. A partition # holding "/", "/usr" and "/var" should be about 2GB in # size. make buildworld make installworld DESTDIR=${CURRENT_ROOT} make buildkernel KERNCONF=YOUR_KERNEL_HERE cp /usr/src/sys/${ARCH}/conf/GENERIC.hints \ ${CURRENT_ROOT}/boot/device.hints # as needed make installkernel KERNCONF=YOUR_KERNEL_HERE DESTDIR=${CURRENT_ROOT} cd /usr/src/etc; make distribution DESTDIR=${CURRENT_ROOT} # if newfs'd cp /etc/fstab ${CURRENT_ROOT}/etc/fstab # if newfs'd To upgrade in-place from 4.x-stable to current ---------------------------------------------- # 5.x uses more space than 4.x. Also, the location of kernel # modules has changed. If you are installing 5.0 onto a 4.x # system, you'll need about 30MB of free disk space on your / # partition. If you have less than this, you may encounter difficult # to back out of problems with this procedure. If /tmp is on # the / partition, you may want to completely remove all its content # before upgrading, as this can be a common source of shortage of # space on /. [7] make buildworld [9] make buildkernel KERNCONF=YOUR_KERNEL_HERE [8] cp src/sys/${MACHINE}/conf/GENERIC.hints /boot/device.hints [2] make installkernel KERNCONF=YOUR_KERNEL_HERE cd src/sys/boot ; make install [6] [1] [3] mergemaster -p [5] rm -rf /usr/include/g++ make installworld mergemaster [4] Make sure that you've read the UPDATING file to understand the tweaks to various things you need. At this point in the life cycle of current, things change often and you are on your own to cope. The defaults can also change, so please read ALL of the UPDATING entries. Also, if you are tracking -current, you must be subscribed to freebsd-current@freebsd.org. Make sure that before you update your sources that you have read and understood all the recent messages there. If in doubt, please track -stable which has much fewer pitfalls. [1] If you have third party modules, such as vmware, you should disable them at this point so they don't crash your system on reboot. [2] If you have legacy ISA devices, you may need to create your own device.hints to reflect your unique hardware configuration. [3] From the bootblocks, boot -s, and then do fsck -p mount -u / mount -a cd /usr/src adjkerntz -i # if CMOS is wall time Also, when doing a major release upgrade, it is required that you boot into single user mode to do the installworld. For the 4.x -> 5.0 upgrade, you will also see many messages about needing to recompile your userland. These are harmless and can be ignored while you proceed to the next step. [4] Note: This step is non-optional. Failure to do this step can result in a significant reduction in the functionality of the system. Attempting to do it by hand is not recommended and those that pursue this avenue should read this file carefully, as well as the archives of freebsd-current and freebsd-hackers mailing lists for potential gotchas. [5] Usually this step is a noop. However, from time to time you may need to do this if you get unknown user in the following step. It never hurts to do it all the time. You may need to install a new mergemaster (cd src/usr.sbin/mergemaster && make install) after the buildworld before this step if you last updated from current before 20020224 or from -stable before 20020408. [6] 4.x boot loader can be used to boot a 5.x system, however it is difficult to do that at best. If you wish to try, then you should interrupt the boot and at the ok prompt type: ok unload ok boot /boot/kernel/kernel If this fails to work, you must install a new boot loader as described here. [7] Before you upgrade, please make sure that you are not using compatibility slices. These are device names of the form, on i386 and other architectures that use MBR slicing, /dev/ad0a without the actual slice name. Chances are excellent that these will break. You generally must update these entries to use the post FreeBSD 2.x form of /dev/ad0s1a. [8] In order to have a kernel that can run the 4.x binaries needed to do an installworld, you must include the COMPAT_FREEBSD4 option in your kernel. Failure to do so may leave you with a system that is hard to boot to recover. [9] When checking out sources, you must include the -P flag to have cvs prune empty directories. FORMAT: This file contains a list, in reverse chronological order, of major breakages in tracking -current. Not all things will be listed here, and it only starts on March 15, 2000. Updating files can found in previous releases if your system is older than this. Copyright information: Copyright 1998, 2002 M. Warner Losh. All Rights Reserved. Redistribution, publication, translation and use, with or without modification, in full or in part, in any form or format of this document are permitted without further permission from the author. THIS DOCUMENT IS PROVIDED BY WARNER LOSH ``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 WARNER LOSH 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. If you find this document useful, and you want to, you may buy the author a beer. Contact Warner Losh if you have any questions about your use of this document. $FreeBSD$ Index: releng/5.2/crypto/openssl/crypto/opensslv.h =================================================================== --- releng/5.2/crypto/openssl/crypto/opensslv.h (revision 127116) +++ releng/5.2/crypto/openssl/crypto/opensslv.h (revision 127117) @@ -1,85 +1,85 @@ #ifndef HEADER_OPENSSLV_H #define HEADER_OPENSSLV_H /* Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas * 1 to 14, and f for release. The patch level is exactly that. * For example: * 0.9.3-dev 0x00903000 * 0.9.3-beta1 0x00903001 * 0.9.3-beta2-dev 0x00903002 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) * 0.9.3 0x0090300f * 0.9.3a 0x0090301f * 0.9.4 0x0090400f * 1.2.3z 0x102031af * * For continuity reasons (because 0.9.5 is already out, and is coded * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level * part is slightly different, by setting the highest bit. This means * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start * with 0x0090600S... * * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for * major minor fix final patch/beta) */ #define OPENSSL_VERSION_NUMBER 0x0090703fL -#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7c 30 Sep 2003" +#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.7c-p1 30 Sep 2003" #define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT /* The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor * number, and have the runtime loader check that the major number is equal * to what it was at application link time, while the minor number has to * be greater or equal to what it was at application link time. With this * scheme, the version number is usually part of the file name, like this: * * libcrypto.so.0.9 * * Some unixen also make a softlink with the major verson number only: * * libcrypto.so.0 * * On Tru64 and IRIX 6.x it works a little bit differently. There, the * shared library version is stored in the file, and is actually a series * of versions, separated by colons. The rightmost version present in the * library when linking an application is stored in the application to be * matched at run time. When the application is run, a check is done to * see if the library version stored in the application matches any of the * versions in the version string of the library itself. * This version string can be constructed in any way, depending on what * kind of matching is desired. However, to implement the same scheme as * the one used in the other unixen, all compatible versions, from lowest * to highest, should be part of the string. Consecutive builds would * give the following versions strings: * * 3.0 * 3.0:3.1 * 3.0:3.1:3.2 * 4.0 * 4.0:4.1 * * Notice how version 4 is completely incompatible with version, and * therefore give the breach you can see. * * There may be other schemes as well that I haven't yet discovered. * * So, here's the way it works here: first of all, the library version * number doesn't need at all to match the overall OpenSSL version. * However, it's nice and more understandable if it actually does. * The current library version is stored in the macro SHLIB_VERSION_NUMBER, * which is just a piece of text in the format "M.m.e" (Major, minor, edit). * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, * we need to keep a history of version numbers, which is done in the * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and * should only keep the versions that are binary compatible with the current. */ #define SHLIB_VERSION_HISTORY "" #define SHLIB_VERSION_NUMBER "0.9.7" #endif /* HEADER_OPENSSLV_H */ Index: releng/5.2/crypto/openssl/ssl/s3_pkt.c =================================================================== --- releng/5.2/crypto/openssl/ssl/s3_pkt.c (revision 127116) +++ releng/5.2/crypto/openssl/ssl/s3_pkt.c (revision 127117) @@ -1,1302 +1,1310 @@ /* ssl/s3_pkt.c */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * 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@cryptsoft.com). * * 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 attribution * 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. * * 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@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * 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 PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* ==================================================================== * 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. * * 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@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 product includes cryptographic software written by Eric Young * (eay@cryptsoft.com). This product includes software written by Tim * Hudson (tjh@cryptsoft.com). * */ #include #include #define USE_SOCKETS #include "ssl_locl.h" #include #include static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment); static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len); static int ssl3_get_record(SSL *s); static int do_compress(SSL *ssl); static int do_uncompress(SSL *ssl); static int do_change_cipher_spec(SSL *ssl); /* used only by ssl3_get_record */ static int ssl3_read_n(SSL *s, int n, int max, int extend) { /* If extend == 0, obtain new n-byte packet; if extend == 1, increase * packet by another n bytes. * The packet will be in the sub-array of s->s3->rbuf.buf specified * by s->packet and s->packet_length. * (If s->read_ahead is set, 'max' bytes may be stored in rbuf * [plus s->packet_length bytes if extend == 1].) */ int i,off,newb; if (!extend) { /* start with empty packet ... */ if (s->s3->rbuf.left == 0) s->s3->rbuf.offset = 0; s->packet = s->s3->rbuf.buf + s->s3->rbuf.offset; s->packet_length = 0; /* ... now we can act as if 'extend' was set */ } /* if there is enough in the buffer from a previous read, take some */ if (s->s3->rbuf.left >= (int)n) { s->packet_length+=n; s->s3->rbuf.left-=n; s->s3->rbuf.offset+=n; return(n); } /* else we need to read more data */ if (!s->read_ahead) max=n; { /* avoid buffer overflow */ int max_max = s->s3->rbuf.len - s->packet_length; if (max > max_max) max = max_max; } if (n > max) /* does not happen */ { SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR); return -1; } off = s->packet_length; newb = 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 != s->s3->rbuf.buf) { /* off > 0 */ memmove(s->s3->rbuf.buf, s->packet, off+newb); s->packet = s->s3->rbuf.buf; } while (newb < 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) */ clear_sys_error(); if (s->rbio != NULL) { s->rwstate=SSL_READING; i=BIO_read(s->rbio, &(s->s3->rbuf.buf[off+newb]), max-newb); } else { SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET); i = -1; } if (i <= 0) { s->s3->rbuf.left = newb; return(i); } newb+=i; } /* done reading, now the book-keeping */ s->s3->rbuf.offset = off + n; s->s3->rbuf.left = newb - n; s->packet_length += n; s->rwstate=SSL_NOTHING; return(n); } /* Call this to get a new input record. * It will return <= 0 if more data is needed, normally due to an error * or non-blocking IO. * When it finishes, one packet has been decoded and can be found in * ssl->s3->rrec.type - is the type of record * ssl->s3->rrec.data, - data * ssl->s3->rrec.length, - number of bytes */ /* used only by ssl3_read_bytes */ static int ssl3_get_record(SSL *s) { int ssl_major,ssl_minor,al; int enc_err,n,i,ret= -1; SSL3_RECORD *rr; SSL_SESSION *sess; unsigned char *p; unsigned char md[EVP_MAX_MD_SIZE]; short version; unsigned int mac_size; int clear=0; size_t extra; int decryption_failed_or_bad_record_mac = 0; unsigned char *mac = NULL; rr= &(s->s3->rrec); sess=s->session; if (s->options & SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER) extra=SSL3_RT_MAX_EXTRA; else extra=0; if (extra != s->s3->rbuf.len - SSL3_RT_MAX_PACKET_SIZE) { /* actually likely 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; } again: /* check if we have the header */ if ( (s->rstate != SSL_ST_READ_BODY) || (s->packet_length < SSL3_RT_HEADER_LENGTH)) { n=ssl3_read_n(s, SSL3_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); if (n <= 0) return(n); /* error or non-blocking */ s->rstate=SSL_ST_READ_BODY; p=s->packet; /* Pull apart the header into the SSL3_RECORD */ rr->type= *(p++); ssl_major= *(p++); ssl_minor= *(p++); version=(ssl_major<<8)|ssl_minor; n2s(p,rr->length); /* Lets check version */ if (s->first_packet) { s->first_packet=0; } else { if (version != s->version) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); /* Send back error using their * version number :-) */ s->version=version; al=SSL_AD_PROTOCOL_VERSION; goto f_err; } } if ((version>>8) != SSL3_VERSION_MAJOR) { SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_WRONG_VERSION_NUMBER); goto err; } if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PACKET_LENGTH_TOO_LONG); goto f_err; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length-SSL3_RT_HEADER_LENGTH) { /* now s->packet_length == SSL3_RT_HEADER_LENGTH */ i=rr->length; n=ssl3_read_n(s,i,i,1); if (n <= 0) return(n); /* error or non-blocking io */ /* now n == rr->length, * and s->packet_length == SSL3_RT_HEADER_LENGTH + rr->length */ } s->rstate=SSL_ST_READ_HEADER; /* set state for later operations */ /* At this point, s->packet_length == SSL3_RT_HEADER_LNGTH + rr->length, * and we have that many bytes in s->packet */ rr->input= &(s->packet[SSL3_RT_HEADER_LENGTH]); /* ok, we can now read from 's->packet' data into 'rr' * rr->input points at rr->length bytes, which * need to be copied into rr->data by either * the decryption or by the decompression * When the data is 'copied' into the rr->data buffer, * rr->input will be pointed at the new buffer */ /* We now have - encrypted [ MAC [ compressed [ plain ] ] ] * rr->length bytes of encrypted compressed stuff. */ /* check is not needed I believe */ if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_ENCRYPTED_LENGTH_TOO_LONG); goto f_err; } /* decrypt in place in 'rr->input' */ rr->data=rr->input; enc_err = s->method->ssl3_enc->enc(s,0); if (enc_err <= 0) { if (enc_err == 0) /* SSLerr() and ssl3_send_alert() have been called */ goto err; /* Otherwise enc_err == -1, which indicates bad padding * (rec->length has not been changed in this case). * To minimize information leaked via timing, we will perform * the MAC computation anyway. */ decryption_failed_or_bad_record_mac = 1; } #ifdef TLS_DEBUG printf("dec %d\n",rr->length); { unsigned int z; for (z=0; zlength; z++) printf("%02X%c",rr->data[z],((z+1)%16)?' ':'\n'); } printf("\n"); #endif /* r->length is now the compressed data plus mac */ if ( (sess == NULL) || (s->enc_read_ctx == NULL) || (s->read_hash == NULL)) clear=1; if (!clear) { mac_size=EVP_MD_size(s->read_hash); if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra+mac_size) { #if 0 /* OK only for stream ciphers (then rr->length is visible from ciphertext anyway) */ al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_PRE_MAC_LENGTH_TOO_LONG); goto f_err; #else decryption_failed_or_bad_record_mac = 1; #endif } /* check the MAC for rr->input (it's in mac_size bytes at the tail) */ if (rr->length >= mac_size) { rr->length -= mac_size; mac = &rr->data[rr->length]; } else { /* record (minus padding) is too short to contain a MAC */ #if 0 /* OK only for stream ciphers */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_LENGTH_TOO_SHORT); goto f_err; #else decryption_failed_or_bad_record_mac = 1; rr->length = 0; #endif } i=s->method->ssl3_enc->mac(s,md,0); if (mac == NULL || memcmp(md, mac, mac_size) != 0) { decryption_failed_or_bad_record_mac = 1; } } if (decryption_failed_or_bad_record_mac) { /* A separate 'decryption_failed' alert was introduced with TLS 1.0, * SSL 3.0 only has 'bad_record_mac'. But unless a decryption * failure is directly visible from the ciphertext anyway, * we should not reveal which kind of error occured -- this * might become visible to an attacker (e.g. via a logfile) */ al=SSL_AD_BAD_RECORD_MAC; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); goto f_err; } /* r->length is now just compressed */ if (s->expand != NULL) { if (rr->length > SSL3_RT_MAX_COMPRESSED_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_COMPRESSED_LENGTH_TOO_LONG); goto f_err; } if (!do_uncompress(s)) { al=SSL_AD_DECOMPRESSION_FAILURE; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_BAD_DECOMPRESSION); goto f_err; } } if (rr->length > SSL3_RT_MAX_PLAIN_LENGTH+extra) { al=SSL_AD_RECORD_OVERFLOW; SSLerr(SSL_F_SSL3_GET_RECORD,SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } rr->off=0; /* So at this point the following is true * ssl->s3->rrec.type is the type of record * ssl->s3->rrec.length == number of bytes in record * ssl->s3->rrec.off == offset to first valid byte * ssl->s3->rrec.data == where to take bytes from, increment * after use :-). */ /* we have pulled in a full packet so zero things */ s->packet_length=0; /* just read a 0 length packet */ if (rr->length == 0) goto again; return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(ret); } static int do_uncompress(SSL *ssl) { int i; SSL3_RECORD *rr; rr= &(ssl->s3->rrec); i=COMP_expand_block(ssl->expand,rr->comp, SSL3_RT_MAX_PLAIN_LENGTH,rr->data,(int)rr->length); if (i < 0) return(0); else rr->length=i; rr->data=rr->comp; return(1); } static int do_compress(SSL *ssl) { int i; SSL3_RECORD *wr; wr= &(ssl->s3->wrec); i=COMP_compress_block(ssl->compress,wr->data, SSL3_RT_MAX_COMPRESSED_LENGTH, wr->input,(int)wr->length); if (i < 0) return(0); else wr->length=i; wr->input=wr->data; return(1); } /* Call this to write data in records of type 'type' * It will return <= 0 if not all data has been sent or non-blocking IO. */ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len) { const unsigned char *buf=buf_; unsigned int tot,n,nw; int i; s->rwstate=SSL_NOTHING; tot=s->s3->wnum; s->s3->wnum=0; if (SSL_in_init(s) && !s->in_handshake) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return -1; } } n=(len-tot); for (;;) { if (n > SSL3_RT_MAX_PLAIN_LENGTH) nw=SSL3_RT_MAX_PLAIN_LENGTH; else nw=n; i=do_ssl3_write(s, type, &(buf[tot]), nw, 0); if (i <= 0) { s->s3->wnum=tot; return i; } if ((i == (int)n) || (type == SSL3_RT_APPLICATION_DATA && (s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE))) { /* next chunk of data should get another prepended empty fragment * in ciphersuites with known-IV weakness: */ s->s3->empty_fragment_done = 0; return tot+i; } n-=i; tot+=i; } } static int do_ssl3_write(SSL *s, int type, const unsigned char *buf, unsigned int len, int create_empty_fragment) { unsigned char *p,*plen; int i,mac_size,clear=0; int prefix_len = 0; SSL3_RECORD *wr; SSL3_BUFFER *wb; SSL_SESSION *sess; /* first check if there is a SSL3_BUFFER still being written * out. This will happen with non blocking IO */ if (s->s3->wbuf.left != 0) return(ssl3_write_pending(s,type,buf,len)); /* If we have an alert to send, lets send it */ if (s->s3->alert_dispatch) { i=ssl3_dispatch_alert(s); if (i <= 0) return(i); /* if it went, fall through and send more stuff */ } if (len == 0 && !create_empty_fragment) return 0; wr= &(s->s3->wrec); wb= &(s->s3->wbuf); sess=s->session; if ( (sess == NULL) || (s->enc_write_ctx == NULL) || (s->write_hash == NULL)) clear=1; if (clear) mac_size=0; else mac_size=EVP_MD_size(s->write_hash); /* 'create_empty_fragment' is true only when this function calls itself */ if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done) { /* countermeasure against known-IV weakness in CBC ciphersuites * (see http://www.openssl.org/~bodo/tls-cbc.txt) */ if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA) { /* recursive function call with 'create_empty_fragment' set; * this prepares and buffers the data for an empty fragment * (these 'prefix_len' bytes are sent out later * together with the actual payload) */ prefix_len = do_ssl3_write(s, type, buf, 0, 1); if (prefix_len <= 0) goto err; if (s->s3->wbuf.len < (size_t)prefix_len + SSL3_RT_MAX_PACKET_SIZE) { /* insufficient space */ SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR); goto err; } } s->s3->empty_fragment_done = 1; } p = wb->buf + prefix_len; /* write the header */ *(p++)=type&0xff; wr->type=type; *(p++)=(s->version>>8); *(p++)=s->version&0xff; /* field where we are to write out packet length */ plen=p; p+=2; /* lets setup the record stuff. */ wr->data=p; wr->length=(int)len; wr->input=(unsigned char *)buf; /* we now 'read' from wr->input, wr->length bytes into * wr->data */ /* first we compress */ if (s->compress != NULL) { if (!do_compress(s)) { SSLerr(SSL_F_DO_SSL3_WRITE,SSL_R_COMPRESSION_FAILURE); goto err; } } else { memcpy(wr->data,wr->input,wr->length); wr->input=wr->data; } /* we should still have the output to wr->data and the input * from wr->input. Length should be wr->length. * wr->data still points in the wb->buf */ if (mac_size != 0) { s->method->ssl3_enc->mac(s,&(p[wr->length]),1); wr->length+=mac_size; wr->input=p; wr->data=p; } /* ssl3_enc can only have an error on read */ s->method->ssl3_enc->enc(s,1); /* record length after mac and block padding */ s2n(wr->length,plen); /* we should now have * wr->data pointing to the encrypted data, which is * wr->length long */ wr->type=type; /* not needed but helps for debugging */ wr->length+=SSL3_RT_HEADER_LENGTH; if (create_empty_fragment) { /* we are in a recursive call; * just return the length, don't write out anything here */ return wr->length; } /* now let's set up wb */ wb->left = prefix_len + wr->length; wb->offset = 0; /* memorize arguments so that ssl3_write_pending can detect bad write retries later */ s->s3->wpend_tot=len; s->s3->wpend_buf=buf; s->s3->wpend_type=type; s->s3->wpend_ret=len; /* we now just need to write the buffer */ return ssl3_write_pending(s,type,buf,len); err: return -1; } /* if s->s3->wbuf.left != 0, we need to call this */ static int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, unsigned int len) { int i; /* XXXX */ if ((s->s3->wpend_tot > (int)len) || ((s->s3->wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->s3->wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BAD_WRITE_RETRY); return(-1); } for (;;) { clear_sys_error(); if (s->wbio != NULL) { s->rwstate=SSL_WRITING; i=BIO_write(s->wbio, (char *)&(s->s3->wbuf.buf[s->s3->wbuf.offset]), (unsigned int)s->s3->wbuf.left); } else { SSLerr(SSL_F_SSL3_WRITE_PENDING,SSL_R_BIO_NOT_SET); i= -1; } if (i == s->s3->wbuf.left) { s->s3->wbuf.left=0; s->rwstate=SSL_NOTHING; return(s->s3->wpend_ret); } else if (i <= 0) return(i); s->s3->wbuf.offset+=i; s->s3->wbuf.left-=i; } } /* Return up to 'len' payload bytes received in 'type' records. * 'type' is one of the following: * * - SSL3_RT_HANDSHAKE (when ssl3_get_message calls us) * - SSL3_RT_APPLICATION_DATA (when ssl3_read calls us) * - 0 (during a shutdown, no data has to be returned) * * If we don't have stored data to work from, read a SSL/TLS record first * (possibly multiple records if we still don't have anything to return). * * This function must handle any surprises the peer may have for us, such as * Alert records (e.g. close_notify), ChangeCipherSpec records (not really * a surprise, but handled as if it were), or renegotiation requests. * Also if record payloads contain fragments too small to process, we store * them until there is enough for the respective protocol (the record protocol * may use arbitrary fragmentation and even interleaving): * Change cipher spec protocol * just 1 byte needed, no need for keeping anything stored * Alert protocol * 2 bytes needed (AlertLevel, AlertDescription) * Handshake protocol * 4 bytes needed (HandshakeType, uint24 length) -- we just have * to detect unexpected Client Hello and Hello Request messages * here, anything else is handled by higher layers * Application data protocol * none of our business */ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) { int al,i,j,ret; unsigned int n; SSL3_RECORD *rr; void (*cb)(const SSL *ssl,int type2,int val)=NULL; if (s->s3->rbuf.buf == NULL) /* Not initialized yet */ if (!ssl3_setup_buffers(s)) return(-1); if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->s3->handshake_fragment_len; k++) s->s3->handshake_fragment[k] = *src++; return n; } /* Now s->s3->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!s->in_handshake && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } start: s->rwstate=SSL_NOTHING; /* s->s3->rrec.type - is the type of record * s->s3->rrec.data, - data * s->s3->rrec.off, - offset into 'data' for next read * s->s3->rrec.length, - number of bytes. */ rr = &(s->s3->rrec); /* get new packet if necessary */ if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret=ssl3_get_record(s); if (ret <= 0) return(ret); } /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (rr->type != SSL3_RT_HANDSHAKE)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto err; } /* If the other end has shut down, throw anything we read away * (even in 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length=0; s->rwstate=SSL_NOTHING; return(0); } if (type == rr->type) /* SSL3_RT_APPLICATION_DATA or SSL3_RT_HANDSHAKE */ { /* make sure that we are not getting application data when we * are doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return(len); if ((unsigned int)len > rr->length) n = rr->length; else n = (unsigned int)len; memcpy(buf,&(rr->data[rr->off]),n); if (!peek) { rr->length-=n; rr->off+=n; if (rr->length == 0) { s->rstate=SSL_ST_READ_HEADER; rr->off=0; } } return(n); } /* If we get here, then type != rr->type; if we have a handshake * message, then it was unexpected (Hello Request or Client Hello). */ /* In case of record types for which we have 'fragment' storage, * fill that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (rr->length < n) n = rr->length; /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; /* fragment was too small */ } } /* s->s3->handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->s3->alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); goto err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } } } /* we either finished a handshake or ignored the request, * now try again to obtain the (application) data we were asked for */ goto start; } if (s->s3->alert_fragment_len >= 2) { int alert_level = s->s3->alert_fragment[0]; int alert_descr = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->s3->alert_fragment, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == 1) /* warning */ { s->s3->warn_alert = alert_descr; if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return(0); } } else if (alert_level == 2) /* fatal */ { char tmp[16]; s->rwstate=SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp,sizeof tmp,"%d",alert_descr); ERR_add_error_data(2,"SSL alert number ",tmp); s->shutdown|=SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx,s->session); return(0); } else { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) /* but we have not received a shutdown */ { s->rwstate=SSL_NOTHING; rr->length=0; return(0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { /* 'Change Cipher Spec' is just a single byte, so we know * exactly what the record payload has to look like */ if ( (rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { i=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); goto err; } + /* Check we have a cipher to change to */ + if (s->s3->tmp.new_cipher == NULL) + { + i=SSL_AD_UNEXPECTED_MESSAGE; + SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); + goto err; + } + rr->length=0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, s->msg_callback_arg); s->s3->change_cipher_spec=1; if (!do_change_cipher_spec(s)) goto err; else goto start; } /* Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { #if 0 /* worked only because C operator preferences are not as expected (and * because this is not really needed for clients except for detecting * protocol violations): */ s->state=SSL_ST_BEFORE|(s->server) ?SSL_ST_ACCEPT :SSL_ST_CONNECT; #else s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #endif s->new_session=1; } i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) /* no read-ahead left? */ { BIO *bio; /* In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } } goto start; } switch (rr->type) { default: #ifndef OPENSSL_NO_TLS /* TLS just ignores unknown message types */ if (s->version == TLS1_VERSION) { rr->length = 0; goto start; } #endif al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* we already handled all of these, with the possible exception * of SSL3_RT_HANDSHAKE when s->in_handshake is set, but that * should not happen when type != rr->type */ al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* At this point, we were expecting handshake data, * but have application data. If the library was * running inside ssl3_read() (i.e. in_read_app_data * is set) and it makes sense to read application data * at this point (session renegotiation not yet started), * we will indulge it. */ if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (( (s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ( (s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data=2; return(-1); } else { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(-1); } static int do_change_cipher_spec(SSL *s) { int i; const char *sender; int slen; if (s->state & SSL_ST_ACCEPT) i=SSL3_CHANGE_CIPHER_SERVER_READ; else i=SSL3_CHANGE_CIPHER_CLIENT_READ; if (s->s3->tmp.key_block == NULL) { s->session->cipher=s->s3->tmp.new_cipher; if (!s->method->ssl3_enc->setup_key_block(s)) return(0); } if (!s->method->ssl3_enc->change_cipher_state(s,i)) return(0); /* we have to record the message digest at * this point so we can get it before we read * the finished message */ if (s->state & SSL_ST_CONNECT) { sender=s->method->ssl3_enc->server_finished_label; slen=s->method->ssl3_enc->server_finished_label_len; } else { sender=s->method->ssl3_enc->client_finished_label; slen=s->method->ssl3_enc->client_finished_label_len; } s->s3->tmp.peer_finish_md_len = s->method->ssl3_enc->final_finish_mac(s, &(s->s3->finish_dgst1), &(s->s3->finish_dgst2), sender,slen,s->s3->tmp.peer_finish_md); return(1); } void ssl3_send_alert(SSL *s, int level, int desc) { /* Map tls/ssl alert value to correct one */ desc=s->method->ssl3_enc->alert_value(desc); if (s->version == SSL3_VERSION && desc == SSL_AD_PROTOCOL_VERSION) desc = SSL_AD_HANDSHAKE_FAILURE; /* SSL 3.0 does not have protocol_version alerts */ if (desc < 0) return; /* If a fatal one, remove from cache */ if ((level == 2) && (s->session != NULL)) SSL_CTX_remove_session(s->ctx,s->session); s->s3->alert_dispatch=1; s->s3->send_alert[0]=level; s->s3->send_alert[1]=desc; if (s->s3->wbuf.left == 0) /* data still being written out? */ ssl3_dispatch_alert(s); /* else data is still being written out, we will get written * some time in the future */ } int ssl3_dispatch_alert(SSL *s) { int i,j; void (*cb)(const SSL *ssl,int type,int val)=NULL; s->s3->alert_dispatch=0; i = do_ssl3_write(s, SSL3_RT_ALERT, &s->s3->send_alert[0], 2, 0); if (i <= 0) { s->s3->alert_dispatch=1; } else { /* Alert sent to BIO. If it is important, flush it now. * If the message does not get sent due to non-blocking IO, * we will not worry too much. */ if (s->s3->send_alert[0] == SSL3_AL_FATAL) (void)BIO_flush(s->wbio); if (s->msg_callback) s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j=(s->s3->send_alert[0]<<8)|s->s3->send_alert[1]; cb(s,SSL_CB_WRITE_ALERT,j); } } return(i); } Index: releng/5.2/sys/conf/newvers.sh =================================================================== --- releng/5.2/sys/conf/newvers.sh (revision 127116) +++ releng/5.2/sys/conf/newvers.sh (revision 127117) @@ -1,101 +1,101 @@ #!/bin/sh - # # Copyright (c) 1984, 1986, 1990, 1993 # The Regents of the University of California. 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 acknowledgement: # This product includes software developed by the University of # California, Berkeley and its contributors. # 4. Neither the name of the University nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # 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 PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. # # @(#)newvers.sh 8.1 (Berkeley) 4/20/94 # $FreeBSD$ TYPE="FreeBSD" REVISION="5.2.1" -BRANCH="RELEASE-p2" +BRANCH="RELEASE-p3" RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) else RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ $(dirname $0)/../sys/param.h) fi b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template for bsd_copyright in ../$b ../../$b ../../../$b /usr/src/$b /usr/$b do if [ -r "$bsd_copyright" ]; then COPYRIGHT=`sed \ -e "s/\[year\]/$year/" \ -e 's/\[your name here\]\.* /FreeBSD Inc./' \ -e 's/\[your name\]\.*/FreeBSD Inc./' \ -e '/\[id for your version control system, if any\]/d' \ $bsd_copyright` break fi done # no copyright found, use a dummy if [ X"$COPYRIGHT" = X ]; then COPYRIGHT="/* * Copyright (c) $year * FreeBSD Inc. All rights reserved. * */" fi # add newline COPYRIGHT="$COPYRIGHT " LC_ALL=C; export LC_ALL if [ ! -r version ] then echo 0 > version fi touch version v=`cat version` u=${USER-root} d=`pwd` h=`hostname` t=`date` i=`make -V KERN_IDENT` cat << EOF > vers.c $COPYRIGHT char sccspad[32 - 4 /* sizeof(sccs) */] = { '\\0' }; char sccs[4] = { '@', '(', '#', ')' }; char version[] = "${VERSION} #${v}: ${t}\\n ${u}@${h}:${d}\\n"; char ostype[] = "${TYPE}"; char osrelease[] = "${RELEASE}"; int osreldate = ${RELDATE}; char kern_ident[] = "${i}"; EOF echo `expr ${v} + 1` > version