Compare commits

...
154 Commits
Author SHA1 Message Date
Glen Barber 4ba619efbd - Switch releng/12.0 from RC3 to RELEASE.
- Add the anticipated 12.0-RELEASE date to UPDATING.
- Set a static __FreeBSD_version.
- This one goes to 12.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-12-07 00:00:12 +00:00
Glen Barber 958cc17b94 MFS12 r341490, r341493:
r341490 (markj):
  MFC r341442, r341443:
  Plug memory disclosures via ptrace(2).

 r341493 (garga):
  MFC r341464:
  Restore /var/crash permissions to 0750, as declared in mtree file.
  After r337337 it changed to 0755.

As this would have otherwise been resolved as a post-release EN/SA
from so@, this does not warrant adding RC4 to the 12.0 schedule.

Approved by:	re (implicit), so
Sponsored by:	The FreeBSD Foundation
2018-12-05 19:16:12 +00:00
Gordon Tetlow 7120cc96ee Fix insufficient bounds checking in bhyve(8) device model. [SA-18:14.bhyve]
Submitted by:	jhb
Reported by:	Reno Robert
Approved by:	so
Approved by:	re (implicit)
Security:	FreeBSD-SA-18:14.bhyve
Security:	CVE-2018-17160
2018-12-04 18:38:03 +00:00
Glen Barber 47ca0d7d12 Update releng/12.0 from RC2 to RC3 as part of the 12.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-11-30 00:00:51 +00:00
Marius Strobl 132a9c6842 MFV: r341039, MFC: r341041, MF12: r341264
Import CK as of 21d3e319407d19dece16ee317c757ffc54a452bc, which makes its
sparcv9 atomics compatible with the FreeBSD kernel by using instructions
which access the appropriate address space.
Atomic operations within the kernel must access the nucleus address space
instead of the default primary one. Without this change but the increased
use of CK in the kernel, machines started to panic after some minutes of
uptime due to an unresolvable fault in ck_pr_cas_64_value().

Approved by:	re (gjb)
2018-11-29 22:00:20 +00:00
Marius Strobl 8935371200 MFC: r341016, MF12: r341261
- Add a belated UPDATING entry for the ixlv(4) -> iavf(4) rename in r339338.
- Likewise, add ixlv.4.gz to OLD_FILES,
- and link if_ixlv.ko to if_iavf.ko in order to aid a bit in the transition.

Approved by:	re (gjb)
2018-11-29 21:59:09 +00:00
Mark Johnston 952168d0cb MFstable/12 r341259:
Add some additional length checks to the IPv4 fragmentation code.

Approved by:	re (gjb)
2018-11-29 20:59:18 +00:00
Mark Johnston f2ade22c6c MFstable/12 r341250:
Fix age_old_log() after r337468.

PR:		233633
Approved by:	re (gjb)
2018-11-29 18:02:35 +00:00
Mark Johnston f140b6f6b2 MFstable/12 r341249:
Update the free page count when blacklisting pages.

Approved by:	re (gjb)
2018-11-29 17:54:03 +00:00
Mark Johnston f2464ec60c MFstable/12 r341238:
Plug routing sysctl leaks.

Approved by:	re (gjb)
2018-11-29 15:58:14 +00:00
Oleg Bulyzhin b7ff6145a6 MFS r341139:
MFC r340724:

Unbreak kernel build with VLAN_ARRAY defined.

Approved by:	re (gjb)
2018-11-29 15:26:07 +00:00
Yuri Pankov 1564e78e66 MFS12 r341168:
MFC r340974:
bectl: sync usage with man page, removing stray multibyte characters
in the process.

PR:             233526
Submitted by:   [email protected] (original version)
Reviewed by:    kevans
Approved by:	re (gjb)
Differential revision:  https://reviews.freebsd.org/D18335
2018-11-29 01:31:12 +00:00
Glen Barber d2400028d1 MFS12 r341167:
MFC r340983:
 Fix NTP query on GCE due to unresolved hostname.

PR:		232456
Submitted by:	Lucas Kanashiro
Approved by:	re (delphij)
Sponsored by:	The FreeBSD Foundation
2018-11-29 01:02:52 +00:00
Mark Johnston 3a2ceb530c MFstable/12 r341082:
Ensure that knotes do not get registered when KQ_CLOSING is set.

PR:		228858
Approved by:	re (gjb)
2018-11-28 18:06:16 +00:00
Mark Johnston c8a5b4f24b MFstable/12 r341077:
Lock the knlist before releasing the in-flux state in knote_fork().

PR:		228858
Approved by:	re (gjb)
2018-11-28 17:40:08 +00:00
Mark Johnston 80dcfd1eb4 MFstable/12 r341075:
Plug some kernel memory disclosures via kevent(2).

Approved by:	re (gjb)
2018-11-28 17:31:34 +00:00
Eric van Gyzen db07df555d MFS r341147
MFC r340995

Prevent kernel stack disclosure in signal delivery

On arm64 and riscv platforms, sendsig() failed to zero the signal
frame before copying it out to userspace.  Zero it.

On arm, I believe all the contents of the frame were initialized,
so there was no disclosure.  However, explicitly zero the whole frame
because that fact could inadvertently change in the future,
it's more clear to the reader, and I could be wrong in the first place.

Approved by:	re (gjb)
Security:	similar to FreeBSD-EN-18:12.mem and CVE-2018-17155
Sponsored by:	Dell EMC Isilon
2018-11-28 16:58:35 +00:00
Eric van Gyzen de76300dcd MFS r341146
MFC r340994

Prevent kernel stack disclosure in getcontext/swapcontext

Expand r338982 to cover freebsd32 interfaces on amd64, mips, and powerpc.

Approved by:	re (gjb)
Security:	FreeBSD-EN-18:12.mem
Security:	CVE-2018-17155
Sponsored by:	Dell EMC Isilon
2018-11-28 16:20:04 +00:00
Mark Johnston e9ed7ded6f MFstable/12 r340970:
Ensure that directory entry padding bytes are zeroed.

Approved by:	re (gjb)
2018-11-27 17:58:25 +00:00
Mark Johnston 60d38f079b MFstable/12 r340921:
Plug some networking sysctl leaks.

Approved by:	re (gjb)
2018-11-26 16:36:38 +00:00
Mark Johnston 50d8a8c2b6 MFstable/12 r340903:
Avoid unsynchronized updates to kn_status.

Approved by:	re (gjb)
2018-11-26 15:46:46 +00:00
Ed Maste 798fd2a5fc MFS12 r340849, r340850, r340851:
MFC r340661 (rmacklem):

r304026 added code that started statistics gathering for an operation
before the operation number (the variable called "op") was sanity checked.
This patch moves the code down to below the range sanity check for "op".

MFC r340662 (rmacklem):

nfsm_advance() would panic() when the offs argument was negative.
The code assumed that this would indicate a corrupted mbuf chain, but
it could simply be caused by bogus RPC message data.
This patch replaces the panic() with a printf() plus error return.

MFC r340663 (rmacklem):

Improve sanity checking for the dircount hint argument to
NFSv3's ReaddirPlus and NFSv4's Readdir operations. The code
checked for a zero argument, but did not check for a very large value.
This patch clips dircount at the server's maximum data size.

Approved by:	re (kib)
2018-11-23 21:08:11 +00:00
Glen Barber 2d134a34df - Update releng/12.0 from RC1 to RC2 as part of the 12.0-RELEASE
cycle.
- Update the dvd1.iso pkg(8) configuration to use the release_0
  package set to populate the dvd.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-11-23 16:32:27 +00:00
Mark Johnston 50f530b444 MFstable/12 r340788:
Clear pad bytes in the struct exported by kern.ntp_pll.gettime.

Approved by:	re (gjb)
2018-11-23 01:07:12 +00:00
Ed Maste 29acfe3f53 MF12 r340697: Introduce src.conf knob to build userland with retpoline
MFC r339511: Introduce src.conf knob to build userland with retpoline

WITH_RETPOLINE enables -mretpoline vulnerability mitigation in userland
for CVE-2017-5715.

MFC r340099: libcompat: disable retpoline when building build tools

These are built with the host toolchain which may not support retpoline.
While here, move the MK_ overrides to a separate line and sort them
alphabetically to support future changes.

MFC r340650: Avoid retpolineplt with static linking

Statically linked binaries linked with -zretpolineplt crash at startup
as lld produces a broken PLT.

MFC r340652: rescue: set NO_SHARED in Makefile

The rescue binary is built statically via the Makefile generated by
crunchgen, but that does not trigger other shared/static logic in
bsd.prog.mk - in particular

PR:		233336
Reported by:	Peter Malcom (r339511), Charlie Li (r340652)
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2018-11-22 18:59:05 +00:00
Marius Strobl bf45cbe065 MFC: r340656, MF12: r340759
Given that the idea of D15374 was to "make memmove a first class citizen",
provide a _MEMMOVE extension of _MEMCPY that deals with overlap based on
the previous bcopy(9) implementation and use the former for bcopy(9) and
memmove(9). This addresses my D15374 review comment, avoiding extra MOVs
in case of memmove(9) and trashing the stack pointer.

Approved by:	re (kib)
2018-11-22 16:27:30 +00:00
Tijl Coosemans 3d0ff7a6fa MFS r340757:
Fix another user address dereference in linux_sendmsg syscall.

This was hidden behind the LINUX_CMSG_NXTHDR macro which dereferences its
second argument.  Stop using the macro as well as LINUX_CMSG_FIRSTHDR.  Use
the size field of the kernel copy of the control message header to obtain
the next control message.

PR:		217901
Approved by:	re (marius)
2018-11-22 13:12:17 +00:00
Tijl Coosemans 9321d6f091 MFS r340755:
Do proper copyin of control message data in the Linux sendmsg syscall.

Instead of calling m_append with a user address, allocate an mbuf cluster
and copy data into it using copyin.  For the SCM_CREDS case, instead of
zeroing a stack variable and appending that to the mbuf, zero part of the
mbuf cluster directly.  One mbuf cluster is also the size limit used by
the FreeBSD sendmsg syscall (uipc_syscalls.c:sockargs()).

PR:		217901
Reviewed by:	kib
Approved by:	re (marius)
2018-11-22 13:09:42 +00:00
Kyle Evans 803e875cdc MFC r340507-r340508, r340592-r340594, r340635-r340636: bectl(8) fixes
r340507:
libbe(3): rewrite init to support chroot usage

libbe(3) currently uses zfs_be_root and locates which of its children is
currently mounted at "/". This is reasonable, but not correct in the case of
a chroot, for two reasons:

- chroot root may be of a different zpool than zfs_be_root
- chroot root will not show up as mounted at "/"

Fix both of these by rewriting libbe_init to work from the rootfs down.
zfs_path_to_zhandle on / will resolve to the dataset mounted at the new
root, rather than the real root. From there, we can derive the BE root/pool
and grab the bootfs off of the new pool. This does no harm in the average
case, and opens up bectl to operating on different pools for scenarios where
one may be, for instance, updating a pool that generally gets re-rooted into
from a separate UFS root or zfs bootpool.

While here, I've also:
- Eliminated the check for /boot and / to be on the same partition. This
  leaves one open to a setup where /boot (and consequently, kernel/modules)
  are not included in the boot environment. This may very well be an
  intentional setup done by someone that knows what they're doing, we should
  not kill BE usage because of it.

- Eliminated the validation bits of BEs and snapshots that enforced
  'mountpoint' to be "/" -- this broke when trying to operate on an imported
  pool with an altroot, but we need not be this picky.

Reported by:	philip
Reviewed by:	philip, allanjude (previous version)
Tested by:	philip
Differential Revision:	https://reviews.freebsd.org/D18012

r340508:
libbe(3): Rewrite be_unmount to stop mucking with getmntinfo(2)

Go through the ZFS layer instead; given a BE, we can derive the dataset,
zfs_open it, then zfs_unmount. ZFS takes care of the dirty details and
likely gets it more correct than we did for more interesting setups.

r340592:
bectl(3)/libbe(3): Allow BE root to be specified

Add an undocumented -r option preceding the bectl subcommand to specify a BE
root to operate out of. This will remain undocumented for now, as some
caveats apply:

- BEs cannot be activated in the pool that doesn't contain the rootfs
- bectl create cannot work out of the box without the -e option right now,
  since it defaults to the rootfs and cross-pool cloning doesn't work like
  that (IIRC)

Plumb the BE root through to libbe(3) so that some things -can- be done to
it, e.g.

bectl -r tank/ROOT create -e default upgrade
bectl -r tank/ROOT mount upgrade /mnt

this aides in some upgrade setups where rootfs is not necessarily ZFS, and
also makes it easier/possible to regression-test bectl when combined with a
file-backed zpool.

Differential Revision:	https://reviews.freebsd.org/D18029

r340593:
libbe(3): Properly account for altroot when creating new BEs

Previously we would blindly copy the 'mountpoint' property, which includes
the altroot. The altroot needs to be snipped off prior to setting it on the
new BE, though, or you'll end up with a new BE and a mountpoint of /mnt with
altroot=/mnt

r340594:
bectl(8): Add some regression tests

These tests operate on a file-backed zpool that gets created in the kyua
temp dir. root and ZFS support are both required for these tests. Current
tests cover create, destroy, export/import, jail, list (kind of), mount,
rename, and jail.

List tests should later be extended to cover formatting and the different
list flags, but for now only covers basic "are create/destroy actually
reflected properly"

r340635:
libbe(3): Handle non-ZFS rootfs better

If rootfs isn't ZFS, current version will emit an error claiming so and fail
to initialize libbe. As a consumer, bectl -r (undocumented) can be specified
to operate on a BE independently of whether on a UFS or ZFS root.

Unbreak this for the UFS case by only erroring out the init if we can't
determine a ZFS dataset for rootfs and no BE root was specified. Consumers
of libbe should take care to ensure that rootfs is non-empty if they're
trying to use it, because this could certainly be the case.

Some check is needed before zfs_path_to_zhandle because it will
unconditionally emit to stderr if the path isn't a ZFS filesystem, which is
unhelpful for our purposes.

This should also unbreak the bectl(8) tests on a UFS root, as is the case in
Jenkins' -test runs.

r340636:
bectl(8) tests: attempt to load the ZFS module

Observed in a CI test image, bectl_create test will run and be marked as
skipped because the module is not loaded. The first zpool invocation will
automagically load the module, but bectl_create is still skipped. Subsequent
tests all pass as expected because the module is now loaded and everything
is OK.

Approved by:	re (gjb)
2018-11-22 04:39:06 +00:00
Marius Strobl e2e9732579 MFC: r340495, MF12: r340739
- Restore setting the clock for devices which support the default/legacy
  transfer mode only (lost with r321385). [1]
- Similarly, don't try to set the power class on MMC devices that comply
  to version 4.0 of the system specification but are operated in default/
  legacy transfer or 1-bit bus mode as no power class is specified for
  these cases. Trying to set a power class nevertheless resulted in an -
  albeit harmless - error message.

PR:		231713 [1]
Approved by:	re (gjb)
2018-11-21 19:49:21 +00:00
Mark Johnston 82bdcab53f MFstable/12 r340728:
Change dumpon(8)'s handling of -g.

Approved by:	re (gjb)
2018-11-21 17:47:40 +00:00
Stephen Hurd b5d49a47b1 MFS r340729:
Prevent POLA violation with TSO/CSUM offload

Ensure that any time CSUM_IP_TSO or CSUM_IP6_TSO is set that the corresponding
CSUM_IP6?_TCP / CSUM_IP flags are also set.

Approved by:	re (gjb)
Sponsored by:	Limelight Networks
2018-11-21 17:33:19 +00:00
Mark Johnston d9875e8a58 MFstable/12 r340727:
dumpon.8: Significantly revamp page

Approved by:	re (gjb)
2018-11-21 17:22:31 +00:00
Mateusz Guzik dbea3640aa MFC r340108 and r340149
hwpmc: limit wait for user callchain collection to 1 tick
Add aditional counter descriptions to AMD 0x17

Approved by:	re (rgrimes)
2018-11-21 03:22:37 +00:00
Jung-uk Kim 2d81533e22 MFC: r340714
Revert r340708.  Some files became symlinks and vice versa.

Approved by:	re (gjb)
2018-11-21 00:16:43 +00:00
Jung-uk Kim 129701749c MFC: r340705, r340708
Merge OpenSSL 1.1.1a.

Approved by:	re (gjb)
2018-11-20 23:07:45 +00:00
Renato Botelho 4ce81672e2 MFC r340439,r340440
Fix /etc/ntp permissions. According to mtree it must be 0700

Approved by:	re (gjb)
Sponsored by:	Rubicon Communications, LLC (Netgate)
2018-11-20 20:31:23 +00:00
Mateusz Guzik e6d818ee28 MFC r339531,r339579,r340252,r340463,r340464,340472,r340587
amd64: tidy up memset to have rax set earlier for small sizes
amd64: finish the tail in memset with an overlapping store
amd64: align memset buffers to 16 bytes before using rep stos
amd64: convert libc bzero to a C func to avoid future bloat
amd64: sync up libc memset with the kernel version
amd64: handle small memset buffers with overlapping stores
Fix -DNO_CLEAN amd64 build after r340463

Approved by:	re (gjb)
2018-11-20 18:14:30 +00:00
Mark Johnston 53eccb9321 MFstable/12 r340680:
Handle kernel superpage mappings in pmap_remove_l2().

PR:		233088
Approved by:	re (gjb)
2018-11-20 17:43:24 +00:00
Brooks Davis af9e43fb5f MFS r340643:
MFC r340489-r340490

r340489:
Fix freebsd32 support for PCIOCGETCONF.

This fixes regresssions in pciconf -l and some ports as reported on
freebsd-current:

https://lists.freebsd.org/pipermail/freebsd-current/2018-November/072144.html

Reported by:	jbeich
Reviewed by:	kib (also proposed an idential patch)
Tested by:	jbeich
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18011

r340490:
Fix stray tab.

Reported by:	jbeich
MFC with:	r340489
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18011

Approved by:	re (gjb)
2018-11-20 00:43:14 +00:00
Stephen Hurd 5c8d70a512 MFS r340629
r340434:
Fix leaks caused by ifc_nhwtxqs never being initialized (broken by r333502)
and clear the last ring in the case where isc_nfl != isc_nrxqs

r340445:
Clear RX completion queue state variables in iflib_stop()

Approved by:	re (gjb)
Sponsored by:	Limelight Networks
2018-11-19 16:40:19 +00:00
Glen Barber 0fae320feb MFS12 r340630:
Remove debugging options from amd64 MINIMAL [1] and riscv GENERIC
 kernel configuration files.  This should have been turned off when
 stable/12 branched.

Submitted by:   Harry Schmalzbauer [1]
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2018-11-19 15:49:39 +00:00
Konstantin Belousov 9ad3bf320c MFS r340603:
Allow set ether/vlan PCP operation from the VNET jails.

Approved by:	re (gjb)
2018-11-19 14:19:27 +00:00
Konstantin Belousov 56a1e41cc1 MFS r340605:
Align IA32_ARCH_CAP MSR definitions and use with SDM rev. 068.

Approved by:	re (gjb)
2018-11-19 13:59:11 +00:00
Mark Johnston d4919c7dba MFstable/12 r340498:
Hook mac_ntpd.4 up to the build.

PR:		232757
Approved by:	re (gjb)
2018-11-17 20:47:41 +00:00
Glen Barber f2a71a6821 MFS12 r340503:
Remove debugging options from arm, armv6, armv7 files included by
 GENERIC.  This should have been turned off when stable/12 branched.

Submitted by:   thompsa
Approved by:	re (rgrimes)
Sponsored by:	The FreeBSD Foundation
2018-11-17 20:11:20 +00:00
Glen Barber b9ffe52b79 - Copy stable/12@r340462 to releng/12.0 as part of the 12.0-RELEASE
cycle.
- Prune svn:mergeinfo from the new branch.
- Update from BETA4 to RC1.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-11-16 00:00:59 +00:00
Alan Somers 5c1fe75840 MFC r340314:
libjail: fix handling of allow.mount.fusefs in jailparam_init

fusefs is inconsistently named. The kernel module is named "fuse", but the
mount helper is named "mount_fusefs" and the jail(8) parameter is named
"allow.mount.fusefs". Special case it in libjail.

Reviewed by:	jamie
Approved by:	re (gjb)
Differential Revision:	https://reviews.freebsd.org/D17929
2018-11-15 19:06:07 +00:00
Vincenzo Maffione 03bc8eede4 MFC :r340436
vtnet: fix netmap support

netmap(4) support for vtnet(4) was incomplete and had multiple bugs.
This commit fixes those bugs to bring netmap on vtnet in a functional state.

Changelist:
  - handle errors returned by virtqueue_enqueue() properly (they were
    previously ignored)
  - make sure netmap XOR rest of the kernel access each virtqueue.
  - compute the number of netmap slots for TX and RX separately, according to
    whether indirect descriptors are used or not for a given virtqueue.
  - make sure sglist are freed according to their type (mbufs or netmap
    buffers)
  - add support for mulitiqueue and netmap host (aka sw) rings.
  - intercept VQ interrupts directly instead of intercepting them in txq_eof
    and rxq_eof. This simplifies the code and makes it easier to make sure
    taskqueues are not running for a VQ while it is in netmap mode.
  - implement vntet_netmap_config() to cope with changes in the number of queues.

Sponsored by:	Sunny Valley Networks
Differential Revision:	https://reviews.freebsd.org/D17916
Approved by: re (gjb)
2018-11-15 18:51:37 +00:00
Michael Tuexen 45e9405ea4 MFC r340361:
Fix printing of 64-bit counters on 32-bit ppc platforms.

Several statistic counters are uint64_t values and are printed by systat
using %lu. This results in displaying wrong numbers. Use PRIu64 instead.
While there, print variables of size_t using %zd.

Approved by:		re (gjb@)
Differential Revision:	https://reviews.freebsd.org/D17838
2018-11-15 17:25:32 +00:00
Glen Barber 21f383924e MFC r340406:
The roff ascii.gz documentation installed to /usr/share/doc
 was removed in r318881 when roff was removed from the base
 system.

 This results in the doc.txz distribution set containing a
 single directory (./) which is empty.

 Remove the "Additional documentation" option from the menu
 selection of bsdinstall(8), as the plain-text documentation
 installed in /usr/share/doc is installed as part of the
 packageworld target.

 The doc entry has not been removed from EXTRA_DISTRIBUTIONS
 in Makefile.inc1, in case its removal triggers an issue with
 freebsd-update(8), which is currently aware of the world/doc
 component, so the empty doc.txz continues to be created as
 a precaution.

Approved by:	re (rgrimes)
Sponsored by:	The FreeBSD Foundation
2018-11-15 16:42:59 +00:00
Kyle Evans 2210ae4965 MFC r340334: libbe(3): Set canmount properly when activating a new BE
The previously activated BE should have canmount=noauto set on it upon
activation of the new BE, but we previously did not touch canmount on either
old or new BE.

PR:		233113
Approved by:	re (gjb)
2018-11-15 16:03:52 +00:00
Eric van Gyzen cff60c178f MFC r340426 (by cem)
amdtemp(4): Fix temperature reporting on AMD 2990WX

Update the AMD family 17h temperature reporting based on AMD Tech Doc 56255
OSRR, section 4.2.1.

For CPUS w/CUR_TEMP_RANGE_SEL set, scale the reported temperature into the
range -49..206; i.e., subtract 49°C.

Submitted by:	gallatin@
Reported by:	bcran@
Reviewed by:	cem (long ago)
Approved by:	re (kib)
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D16855
2018-11-14 22:05:20 +00:00
Eric van Gyzen 0d094645f7 MFC r340425 (by cem)
amdsmn(4)/amdtemp(4): Attach to Ryzen 2 hostbridges

As reported, tested, and patch supplied by Johannes.

There may be future work to do to support multiple sensors, but for now, any
sensor at all is a strict improvement for Ryzen 2 systems.

PR:		228480
Submitted by:	Johannes Lundberg <johalun0 AT gmail.com> (earlier version)
Reported by:	deischen@, Johannes, and numerous others
Early MFC approved by:  cem
Approved by:    re (kib)
Relnotes:       yes
2018-11-14 21:31:26 +00:00
Stefan Eßer 8e85462800 MFC S340428: Prepare move of ctm from base to a port (misc/ctm) by:
- Adding a note to UPDATING
- Adding a note to the history section of the manpage ctm.1
- Adding a message printed to STDERR to the ctm program

This version is meant for release in FreeBSD-12.0 and should remain in
FreeBSD-12 over its life-time.

A follow-up commit will remove ctm from -CURRENT after the MFC to 12
has happened.

Approved by:    re
Relnotes:       yes
Differential Revision:  https://reviews.freebsd.org/D17969
2018-11-14 20:35:04 +00:00
Mark Johnston d18a8aa15d MFC r339927:
Add malloc_domainset(9) and _domainset variants to other allocator KPIs.

Approved by:	re (gjb)
2018-11-13 18:21:47 +00:00
Mark Johnston 24d81f89d0 MFC r340331:
Re-apply r336984, reverting r339934.

Approved by:	re (gjb)
2018-11-13 17:43:16 +00:00
Mark Johnston 5323d309df MFC r340313:
Ensure that IP fragments do not extend beyond IP_MAXPACKET.

Approved by:	re (gjb)
2018-11-13 17:25:34 +00:00
Mark Johnston 8d33352d0a MFC r339925:
Fix some problems that manifest when NUMA domain 0 is empty.

Approved by:	re (gjb)
2018-11-13 16:51:30 +00:00
Brooks Davis c2d6ce7fd2 Regen after r340388: MFC r340302: Fix freebsd32 mknod(at).
Approved by:	re (gjb, implicit)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17928
2018-11-12 21:53:47 +00:00
Brooks Davis 0f41ded533 MFC r340302:
Fix freebsd32 mknod(at).

As dev_t is now a 64-bit integer, it requires special handling as a
system call argument.  64-bit arguments are split between two 64-bit
integers due to the way arguments are promoted to allow reuse of most
system call implementations.  They must be reassembled before use.
Further, 64-bit arguments at an odd offset (counting from zero) are
padded and slid to the next slot on powerpc and mips.  Fix the
non-COMPAT11 system call by adding a freebsd32_mknodat() and
appropriately padded declerations.

The COMPAT11 system calls are fully compatible with the 64-bit
implementations so remove the freebsd32_ versions.

Use uint32_t consistently as the type of the old dev_t.  This matches
the old definition.

Reviewed by:	kib
Approved by:	re (gjb)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17928
2018-11-12 21:51:36 +00:00
Brooks Davis 47e7df3fe2 Regen after r340377: MFC r340272, r340274, r340294
r340272: Make __sysctl follow the freebsd32_foo convention.
r340274: Make freebsd32_umtx_op follow the freebsd32_foo convention.
r340294: Fix a number of bugs in freebsd32's capabilities.conf.

Approved by:	re (gjb, implicit)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17925
2018-11-12 18:23:51 +00:00
Brooks Davis 1c172d408a MFC r340272, r340274, r340294
r340272:
Make __sysctl follow the freebsd32_foo convention.

Sponsored by:	DARPA, AFRL

r340274:
Make freebsd32_umtx_op follow the freebsd32_foo convention.

Sponsored by:	DARPA, AFRL

r340294:
Fix a number of bugs in freebsd32's capabilities.conf.

Bugs range from failure to update after changing syscall implementaion
names to using the wrong name.  Somewhat confusingly, the name in
capabilities.conf is exactly the string that appears in syscalls.master,
not the name with a COMPAT* prefix which is the actual function name.

Found while making a change to use the default capabilities.conf.

Fixes:	r335177, r336980, r340272, r340274, others
Reviewed by:	kib, emaste
Approved by:	re (gjb)
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D17925
2018-11-12 18:21:17 +00:00
Bjoern A. Zeeb 4ea900c024 MFC r340251:
Update rum(4) and run(4) man pages to reflect that newer versions
  of TP-LINK TL-WN321G are run(4) and not rum(4) anymore.

  Reported by:	J (tech-lists zyxst.net)
Approved by:	re (kib)
2018-11-12 16:37:23 +00:00
Stephen Hurd d1db2aa912 MFC r340310:
Fix first-packet completion

The first packet after the ring is initialized was never
completed as isc_txd_credits_update() would not include it in the
count of completed packets. This caused netmap to never complete
a batch. See PR 233022 for more details.

PR:		233022
Reported by:	lev
Reviewed by:	lev
Approved by:	re (kib)
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D17931
2018-11-12 16:28:07 +00:00
Stephen Hurd 8d219159c7 MFC r340236:
Fix rxcsum issue introduced in r338838

r338838 attempted to fix issues with rxcsum and rxcsum6.
However, the rxcsum bits were set as though if_setcapenablebit() was
being called, not if_togglecapenable() which is in use. As a result,
it was not possible to disable rxcsum when rxcsum6 was supported.

PR:		233004
Reported by:	lev
Reviewed by:	lev
Approved by:	re (kib)
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D17881
2018-11-12 16:08:14 +00:00
Kyle Evans 5ccca965c2 MFC r340297: Use ${ECHO} in dtb/dtbo build, pass in from dtb.mk for -s
Approved by:	re (kib)
2018-11-12 15:18:09 +00:00
Hans Petter Selasky d4d9b85cce MFC r340248:
Don't read the USB audio sync endpoint when we don't use it to save
isochronous bandwidth.

Approved by:		re (kib)
Sponsored by:		Mellanox Technologies
2018-11-11 12:31:27 +00:00
Devin Teske af22b383fc MFC r339971: Add new rc keywords: enable, disable, delete
This adds new keywords to rc/service to enable/disable a service's
rc.conf(5) variable and "delete" to remove the variable.

When the "service_delete_empty" variable in rc.conf(5) is set to "YES"
(default is "NO") an rc.conf.d file (in /etc/ or /usr/local/etc) is
deleted if empty after modification using "service $foo delete".

Submitted by:	lme (modified)
Reviewed by:	0mp (previous version), lme, bcr
Approved by:	re (rgrimes)
Relnotes:	yes
Sponsored by:	Smule, Inc.
Differential Revision:	https://reviews.freebsd.org/D17113
2018-11-11 06:05:28 +00:00
Mark Johnston b42e561d6a MFC r340241:
Fix a use-after-free in swp_pager_meta_free().

Approved by:	re (gjb)
2018-11-10 20:36:48 +00:00
Mark Johnston 5027105905 MFC r339793:
Don't set NFSv4 ACL inheritance flags on non-directories.

PR:		155163
Approved by:	re (gjb)
2018-11-10 20:34:59 +00:00
Hans Petter Selasky 53bcdaef90 MFC r340212:
Sometimes the complete split packet may be queued too early and the
transaction translator will return a NAK. Ignore this message and
retry the complete split instead.

Approved by:		re (kib)
Sponsored by:		Mellanox Technologies
2018-11-10 10:30:01 +00:00
Hans Petter Selasky 977368147d MFC r340089:
Use correct type for IOCTL request argument.
This fixes signed IOCTL value warnings in uhsoctl().

Approved by:		re (kib)
Submitted by:		Marcin Cieslak <[email protected]>
Sponsored by:		Mellanox Technologies
2018-11-09 09:26:10 +00:00
Andrey V. Elsukov 19da555275 MFC r340100:
Do not use bzero() for the O_ICMP6TYPE opcode.

  The buffer is already zeroed in compile_rule() function, and also it
  may contain configured F_NOT flag in o.len field. This fixes the
  filling for "not icmp6types" opcode.

MFC r340175:
  Do not print "ip6" keyword in print_icmp6types() for O_ICMP6TYPE opcode.

  It produces incompatibility when rules listing is used again to
  restore saved ruleset, because "ip6" keyword produces separate opcode.
  The kernel already has the check and only IPv6 packets will be checked
  for matching.

PR:		232939
Approved by:	re (kib)
2018-11-09 08:14:47 +00:00
Glen Barber a04e071689 Update stable/12 from BETA3 to BETA4 as part of the 12.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-11-09 00:01:53 +00:00
John Baldwin 8406429759 MFC 340164,340168,340170: Add custom cpu_lock_delay() for x86.
340164:
Add a KPI for the delay while spinning on a spin lock.

Replace a call to DELAY(1) with a new cpu_lock_delay() KPI.  Currently
cpu_lock_delay() is defined to DELAY(1) on all platforms.  However,
platforms with a DELAY() implementation that uses spin locks should
implement a custom cpu_lock_delay() doesn't use locks.

340168:
Add a delay_tsc() static function for when DELAY() uses the TSC.

This uses slightly simpler logic than the existing code by using the
full 64-bit counter and thus not having to worry about counter
overflow.

340170:
Add a custom implementation of cpu_lock_delay() for x86.

Avoid using DELAY() since it can try to use spin locks on CPUs without
a P-state invariant TSC.  For cpu_lock_delay(), always use the TSC if
it exists (even if it is not P-state invariant) to delay for a
microsecond.  If the TSC does not exist, read from I/O port 0x84 to
delay instead.

PR:		228768
Approved by:	re (gjb)
2018-11-08 22:39:38 +00:00
Glen Barber 47a256af7a MFC r340260 (emaste):
Avoid buffer underwrite in icmp_error

 icmp_error allocates either an mbuf (with pkthdr) or a cluster depending
 on the size of data to be quoted in the ICMP reply, but the calculation
 failed to account for the additional padding that m_align may apply.

 Include the ip header in the size passed to m_align.  On 64-bit archs
 this will have the net effect of moving everything 4 bytes later in the
 mbuf or cluster.  This will result in slightly pessimal alignment for
 the ICMP data copy.

 Also add an assertion that we do not move m_data before the beginning of
 the mbuf or cluster.

Approved by:	re (kib)
Security:	CVE-2018-17156
Sponsored by:	The FreeBSD Foundation
2018-11-08 21:58:23 +00:00
Eric Joyner 84b28a1f9b MFC r340256: ixl/iavf(4): Fix TSO offloads when TXCSUM is disabled
Approved by: re (gjb@)
2018-11-08 21:36:45 +00:00
Tijl Coosemans a14a7bbbc3 MFC r340181, r340185:
On amd64 both Linux compat modules, linux.ko and linux64.ko, provide
linux_ioctl_(un)register_handler that allows other driver modules to
register ioctl handlers.  The ioctl syscall implementation in each Linux
compat module iterates over the list of handlers and forwards the call to
the appropriate driver.  Because the registration functions have the same
name in each module it is not possible for a driver to support both 32 and
64 bit linux compatibility.

Move the list of ioctl handlers to linux_common.ko so it is shared by
both Linux modules and all drivers receive both 32 and 64 bit ioctl calls
with one registration.  These ioctl handlers normally forward the call
to the FreeBSD ioctl handler which can handle both 32 and 64 bit.

Keep the special COMPAT_LINUX32 ioctl handlers in linux.ko in a separate
list for now and let the ioctl syscall iterate over that list first.
Later, COMPAT_LINUX32 support can be added to the 64 bit ioctl handlers
via a runtime check for ILP32 like is done for COMPAT_FREEBSD32 and then
this separate list would disappear again.  That is a much bigger effort
however and this commit is meant to be MFCable.

This enables linux64 support in x11/nvidia-driver*.

PR:		206711
Reviewed by:	kib
Approved by:	re (gjb)
2018-11-08 19:56:29 +00:00
Warner Losh 0dc238a663 MFC r340155: Assert locks held for async events.
Approved by:	re@ (gjb)
2018-11-08 14:21:25 +00:00
Kyle Evans 4532ac986d MFC r340040, r340152: lualoader boot-conf and chainload
r340040:
lualoader: Implement boot-conf

r340152:
lualoader: Add chainload menu entry

Approved by:	re (rgrimes)
2018-11-08 03:25:18 +00:00
Kyle Evans 12da6be5ad MFC r340146: Move pmc* bits behind MK_PMC to fix WITHOUT_PMC build
Approved by:	re (rgrimes)
2018-11-08 03:24:24 +00:00
Konstantin Belousov 934ea6ccb0 MFC r339892:
Clarify explanation of VFCF_SBDRY.

Approved by:	re (gjb)
2018-11-07 18:29:54 +00:00
Konstantin Belousov 6b05d8eac6 MFC r339896:
Initialize ifunc calling machinery earlier.

Approved by:	re (gjb)
2018-11-07 18:07:29 +00:00
Ed Maste 6b7a2785e2 MFC r340137: rtld: move relro enforcement after ifunc processing
Previously the combination of relro (implicit), -z now and ifunc use
resulted in a segfault when applying ifuncs after relro (test binary
here just calls amd64_get_fsbase()):

| % env LD_DEBUG=1 libexec/rtld-elf/obj/ld-elf.so.1 a.out
| ...
| enforcing main obj relro
| ...
| resolving ifuncs
| reloc_jmpslot: *0x203198 = 0x189368ea4570
| zsh: bus error (core dumped)  LD_DEBUG=1 obj/ld-elf.so.1 ~/a.out

Approved by:	re (gjb)
2018-11-07 18:04:19 +00:00
Konstantin Belousov 3abc4ff44e MFC r339979:
Add pci_early function to detect Intel stolen memory.

Approved by:	re (rgrimes)
2018-11-07 17:44:27 +00:00
Dag-Erling Smørgrav 03eb6a5667 MFH (r339812): add default value for local_unbound_tls
MFH (r339995): run unbound-anchor if root.key is empty (PR 232555)
MFH (r340037): turn off so-reuseport by default

Approved by:	re (gjb)
2018-11-07 16:22:18 +00:00
Stephen Hurd 81afa92400 MFC r339861:
Drain grouptaskqueue of the gtask before detaching it.

taskqgroup_detach() would remove the task even if it was running or
enqueued, which could lead to panics (see D17404). With this change,
taskqgroup_detach() drains the task and sets a new flag which prevents the
task from being scheduled again.

I've added grouptask_block() and grouptask_unblock() to allow control
over the flag from other locations as well.

Reviewed by:	Jeffrey Pieper <[email protected]>
Approved by:	re (kib)
Sponsored by:	Limelight Networks
Differential Revision:	https://reviews.freebsd.org/D17674
2018-11-06 20:46:00 +00:00
Andriy Gapon 87711319c5 MFC r339591: ichwd: add support for TCO watchdog timer in Lewisburg PCH (C620)
PR:		222079
Approved by:	re (rgrimes)
Relnotes:	maybe
Sponsored by:	Panzura
2018-11-06 17:31:09 +00:00
Glen Barber 607156d373 Switch the dvd1.iso pkg(8) configuration to use the quarterly
branch, now that the package sets are now available.  This
normally would have been after BETA1, however there were issues
preventing package builds to succeed.

Switch the default pkg(8) repository to the quarterly branch
as well, to prevent 'pkg upgrade' from downgrading packages
as the 12.0-RELEASE cycle progresses.

These changes will be reverted after releng/12.0 is branched.

This is a direct commit to stable/12.

MFC after:	2 weeks
MFC note:	fake MFC timeframe as a reminder to revert
Approved by:	re (delphij)
Sponsored by:	The FreeBSD Foundation
2018-11-05 21:28:32 +00:00
Kyle Evans 1ef5e7d56c MFC r339994: libbe(3): Don't promote non-cloned BEs
Most easily reproducible by attempting to activate the currently activated
BE, one would get a "not a cloned filesystem" error instead of success or a
sane message.

PR:		232488
Approved by:	re (gjb)
2018-11-05 18:12:41 +00:00
Kyle Evans ef5d846a47 MFC r339972: rescue: Add bectl(8)
Approved by:	re (gjb)
2018-11-05 18:11:38 +00:00
Bjoern A. Zeeb ae78f8f429 MFC r340009:
carpstats are the last virtualised variable in the file and end up at the
  end of the vnet_set.  The generated code uses an absolute relocation at
  one byte beyond the end of the carpstats array.  This means the relocation
  for the vnet does not happen for carpstats initialisation and as a result
  the kernel panics on module load.

  This problem has only been observed with carp and only on i386.
  We considered various possible solutions including using linker scripts
  to add padding to all kernel modules for pcpu and vnet sections.

  While the symbols (by chance) stay in the order of appearance in the file
  adding an unused non-file-local variable at the end of the file will extend
  the size of set_vnet and hence make the absolute relocation for carpstats
  work (think of this as a single-module set_vnet padding).

  This is a (tmporary) hack.  It is the least intrusive one as we need a
  timely solution for the upcoming release.  We will revisit the problem in
  HEAD.  For a lot more information and the possible alternate solutions
  please see the PR and the references therein.

PR:		230857
Approved by:	re (kib)
2018-11-04 06:25:07 +00:00
Michael Tuexen f18168af70 MFC r339914:
Bump the number of fans supported from 8 to 12.
The number of fans on a PowerMac7,3 with liquid cooling is 9.

Approved by:		re (kib@)
Reviewed by:		andreast@
Differential Revision:	https://reviews.freebsd.org/D17754
2018-11-03 20:35:39 +00:00
Glen Barber 9fd7c97b87 Update stable/12 from BETA2 to BETA3 as part of the 12.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-11-01 23:56:10 +00:00
Warner Losh c147f2f0a2 MFC: r339800 and r339802:
Fixes to ignore partial DEVICE_PATH items in  BOOT_PARAM objects that are
too short.

Approved by:	re@ (glen)
2018-11-01 21:28:22 +00:00
Kyle Evans 4c6e112e9f MFC r339849: lualoader: Fix try_include error handling
The previous iteration of try_include attempted to be 'friendly' and error()
out if we hit an error that wasn't ENOENT. This was semi-OK, but fragile as
it relied on pattern matching the error message.

Move the responsibility for handling failure to the caller. Following
a common lua pattern, we'll return the return value of the underlying
require() on success, or false and an error message.

Approved by:	re (gjb)
2018-11-01 17:37:20 +00:00
Mark Johnston 69d2f812fd MFC r339688:
Add an #include required after r339686.

Reported by:	lwhsu
Approved by:	re (gjb)
2018-11-01 17:36:42 +00:00
Mark Johnston 97fba7509b MFC r339616:
Make it possible to disable NUMA support with a tunable.

PR:		231460
Approved by:	re (gjb)
2018-11-01 16:50:19 +00:00
Mark Johnston 0401b2fb08 MFC r339686:
Use a vm_domainset iterator in keg_fetch_slab().

Approved by:	re (kib)
2018-11-01 16:00:00 +00:00
Hans Petter Selasky 711db39fec MFC r339924:
Implement the dump_stack() function in the LinuxKPI.

Approved by:		re (gjb)
Submitted by:		Johannes Lundberg <[email protected]>
Sponsored by:		Mellanox Technologies
2018-11-01 15:47:07 +00:00
Mark Johnston c643cd842c MFC r339661, r339669:
Refactor domainset iterators for use by malloc(9) and UMA.

Approved by:	re (gjb)
2018-11-01 15:19:36 +00:00
Hans Petter Selasky 48e4bb4379 MFC r339923:
Implement __KERNEL_DIV_ROUND_UP() function macro in the LinuxKPI.

Approved by:		re (kib)
Submitted by:		Johannes Lundberg <[email protected]>
Sponsored by:		Mellanox Technologies
2018-11-01 14:42:14 +00:00
Hans Petter Selasky bcd172012b MFC r339868:
Implement dma_pool_zalloc() in the LinuxKPI.

Approved by:		re (rgrimes)
Submitted by:		Johannes Lundberg <[email protected]>
Sponsored by:		Mellanox Technologies
2018-11-01 08:59:18 +00:00
Wei Hu 352fc1abf9 MFC r339585:
Do not drop UDP traffic when TXCSUM_IPV6 flag is on.

PR:		231797
Submitted by:	whu
Reviewed by:	dexuan
Obtained from:	Kevin Morse
Approved by:	re (rgrimes)
Sponsored by:	Microsoft
2018-11-01 08:08:08 +00:00
Glen Barber b6eaf36aa3 MFC r339873:
Set OPTIONS_UNSET in the argument list to env(1), and add
 AVAHI to the list.  This fixes the textproc/docproj build
 seemingly following FLAVORS being added.

 Specifically, the problem with the dependency chain here is:
 - textproc/docproj depends on print/cups, which sets AVAHI=on
   by default;
 - net/avahi-app depends on devel/gobject-introspection, which
   requires python3+;
 - graphics/netpbm depends on graphics/mesa-libs, which can
   only be built with python2.7;
 - textproc/docproj depends on a number of graphics ports for
   font rendering, etc.

MFC r339875:
 Pass _BRANCH in the reldoc target to ensure the correct
 src branch is used when generating the hardware.html page.

Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2018-10-31 23:54:36 +00:00
Kyle Evans fdc0a80de8 MFC r339677-r339678, r339702, r339805: Lualoader Bugfixes
r339677:
lualoader: unload upon kernel change if a kernel was previously loaded

In the majority of cases, a kernel is not loaded before we hit the menu.
However, if a password is set, we'll trigger autoboot and have loadelf'd
beforehand. We also need to take into account one dropping to the loader
prompt and twiddling with things manually; if they try to toggle through
kernels, we'll assume they mean it.

r339678:
menu.lua: Abort autoboot sequence on failed command

Currently, a timeout in the menu autoboot sequence would effectively do
nothing. We would return from the autoboot handling, then begin processing
the menu without redrawing it.

This change makes the behavior a little more friendly. Returning the user to
the menu can't have any good effects, so abort the autoboot sequence and
drop to the loader prompt.

r339702:
lualoader: Improve module loading diagnostics

Some fixes:

- Maintain historical behavior more accurately w.r.t verbose_loading;
  verbose_loading strictly prints "${module_name...}" and later "failed!"
  or "ok" based on load success
- With or without verbose_loading, dump command_errbuf on load failure.
  This usually happens prior to ok/failed if we're verbose_loading

r339805:
lualoader: Always return a proper dictionary for blacklist

If module_blacklist isn't specified, we have an empty blacklist; effectively
the same as if module_blacklist="" were specified in loader.conf(5).

This was reported when switching to a BE that predated the module_blacklist
introduction, but the problem is valid all the same and likely to be tripped
over in other scenarios.

Approved by:	re (kib)
2018-10-31 23:08:49 +00:00
Devin Teske f137a85e48 MFC r339843: Fix jail examples in jib, jng, README
Submitted by:	Ryan Moeller <[email protected]>
Reported by:	Ryan Moeller <[email protected]>
Approved by:	re (gjb)
Sponsored by:	Smule, Inc.
Differential Revision:	https://reviews.freebsd.org/D17697
2018-10-31 23:07:47 +00:00
Gleb Smirnoff c3102c342a MFhead r339643:
Fix ipw_start(), where logic was reverted in r287197.

PR		232554
Approved by:	re (kib)
2018-10-31 23:02:59 +00:00
Mark Johnston 702b7be467 MFC r339601, r339603:
Swap in processes unless there's a global memory shortage.

Approved by:	re (gjb)
2018-10-31 19:28:05 +00:00
Gleb Smirnoff c884ba7756 MFhead r339596:
If we lost race or were migrated during bucket allocation for the per-CPU
  cache, then we put new bucket on generic bucket cache. However, code didn't
  honor UMA_ZONE_NOBUCKETCACHE flag, so potentially we could start a cache
  on a zone that clearly forbids that. Fix this.

Approved by:	re (gjb)
2018-10-31 18:01:02 +00:00
Bjoern A. Zeeb 1259c0994a MFC r339931,r339933:
As a follow-up to r339930 (r339951 in stable/12) and various reports
   implement logging in case we fail during module load because the pcpu
   or vnet module sections are full.
   We did return a proper error but not leaving any indication to the
   user as to what the actual problem was.

   Even worse, on 12/13 currently we are seeing an unrelated error (ENOSYS
   instead of ENOSPC, which gets skipped over in kern_linker.c) to be
   printed which made problem diagnostics even harder.

PR:		228854

Approved by:	re (kib)
2018-10-31 14:03:48 +00:00
Bjoern A. Zeeb 4ba00f725a MFC r339930:
With more excessive use of modules, more kernel parts working with
   VIMAGE, and feature richness and global state increasing the 8k of
   vnet module space are no longer sufficient for people and loading
   multiple modules, e.g., pf(4) and ipl(4) or ipsec(4) will fail on
   the second module.

   Increase the module space to 8 * PAGE_SIZE which should be enough
   to hold multiple firewalls, ipsec, multicast (as in the old days was
   a problem), epair, carp, and any kind of other vnet enabled modules.

   Sadly this is a global byte array part of the vnet_set, so we cannot
   dynamically change its size;  otherwise a TUNABLE would have been
   a better solution.

PR:			228854
   Reported by:	Ernie Luzar, Marek Zarychta

Approved by:	re (kib)
2018-10-31 12:50:39 +00:00
Bjoern A. Zeeb 10b26c77fe MFC r339682:
rip6_input() inp validation after epoch(9)

  After r335924 rip6_input() needs inp validation to avoid
  working on FREED inps.

  Apply the relevant bits from r335497,r335501 (rip_input() change)
  to the IPv6 counterpart.

PR:			232194
  Reviewed by:	rgrimes, ae (,hps)

Approved by:	re (kib)
2018-10-31 12:49:18 +00:00
Bjoern A. Zeeb f0eb1c5531 MFC r339586:
In bhyve's fbuf emulation improve the overall "usage" message and
  for the vga option, rather than printing the entire option string,
  only print vga (as we do for everything else).

MFC r339681:

  Allow the bhyve VNC server to listen on IPv6 for incoming connections.

  Alternatively to IPv4 address:port this will allow to listen on IPv6
  link-local (incl. scope), a specific address, or ::.  Addresses have
  to be given in RFC2732 format so that [::]:port parsing will work.

  This patch also starts to introduce WITH_INET/INET6_SUPPORT to bhyve.

PR:			232018
  Submitted by:	Dave Rush (northwoodlogic.free gmail.com) (original)
  Reviewed by:	Dave Rush (updated verison)

Approved by:	re (kib)
2018-10-31 12:05:45 +00:00
Mark Johnston e9131f34b8 MFC r339452, r339664:
Create some global domainsets and refactor NUMA registration.

Approved by:	re (kib)
2018-10-31 02:02:12 +00:00
Philip Paeps 4209a7bf2a MFC r339848: mport tzdata 2018g
Approved by:	re (kib)
2018-10-31 01:57:51 +00:00
Mark Johnston 0f4e2de7c6 MFC r339934:
Revert r336984.

Approved by:	re (kib)
2018-10-30 23:09:04 +00:00
Xin LI 52584919e7 Restore backward compatibility for "attach" verb.
In r332361 and r333439, two new parameters were added to geli attach
verb using gctl_get_paraml, which requires the value to be present.
This would prevent old geli(8) binary from attaching geli(4) device
as they have no knowledge about the new parameters.

Restore backward compatibility by treating the absense of these two
values as seeing the default value supplied by userland.

PR:		232595
Reviewed by:	oshogbo
Approved by:	re (rgrimes)
2018-10-30 15:11:34 +00:00
Vincenzo Maffione f97f4e0b8f MFC r339685
netmap: add man page for the vale-ctl program

Added man page for vale-ctl program.
Small fixes to vale-ctl, including the support for -m option
(to specify the netmap memory allocator id).

Approved by:	re (rgrimes)
2018-10-30 14:25:16 +00:00
Vincenzo Maffione 95ff7e4bb5 MFC r339659:
netmap: add man page for the bridge program

Added bridge(8).
Also, minor fixes to the netmap "bridge" application:
 - indentation fixes and code cleanup
 - better usage description
 - better processing of netmap flags

Approved by:	re (rgrimes)
2018-10-30 10:01:15 +00:00
Vincenzo Maffione d740f83794 MFC r339639:
netmap: align codebase to the current upstream (sha 8374e1a7e6941)

Changelist:
    - Move large parts of VALE code to a new file and header netmap_bdg.[ch].
      This is useful to reuse the code within upcoming projects.
    - Improvements and bug fixes to pipes and monitors.
    - Introduce nm_os_onattach(), nm_os_onenter() and nm_os_onexit() to
      handle differences between FreeBSD and Linux.
    - Introduce some new helper functions to handle more host rings and fake
      rings (netmap_all_rings(), netmap_real_rings(), ...)
    - Added new sysctl to enable/disable hw checksum in emulated netmap mode.
    - nm_inject: add support for NS_MOREFRAG

Approved by: re (gjb)
2018-10-30 08:36:36 +00:00
Navdeep Parhar fbf40542f8 MFC r339626:
cxgbe(4): Use automatic cidx updates with ofld and ctrl queues.

The bits that explicitly request cidx updates do not work reliably with
all possible WRs that can be sent over the queue.  The F_FW_WR_EQUIQ
requests that still remain may also have to be replaced with explicit
credit flush WRs in the future.

Approved by:	re@ (rgrimes@)
Sponsored by:	Chelsio Communications
2018-10-30 05:04:18 +00:00
Michael Tuexen 5bb244b0a0 MFC r339869,r339870:
Remove empty line.

Reported by:	gjb@
Approved by:	re (gjb@)
2018-10-29 20:08:19 +00:00
Michael Tuexen 985f3e4c66 MFC r339791:
Add initial descriptions for SCTP related MIB variable.
This work was mostly done by Marie-Helene Kvello-Aune.

Approved by:		re (gjb)
Differential Revision:	https://reviews.freebsd.org/D3583
2018-10-29 19:01:47 +00:00
Hans Petter Selasky 44291434af MFC r339600:
Make sure returned value is checked and assert a valid refcount.
While at it fix a print: Unsigned types cannot be negative.

Reviewed by:		kib, mjg
Approved by:		re (gjb)
Differential revision:	https://reviews.freebsd.org/D17616
Sponsored by:		Mellanox Technologies
2018-10-29 14:06:20 +00:00
Hans Petter Selasky 860538b4fb MFC r339588:
Resolve deadlock between epoch(9) and various network interface
SX-locks, during if_purgeaddrs(), by not allowing to hold the epoch
read lock over typical network IOCTL code paths. This is a regression
issue after r334305.

Reviewed by:		ae (network)
Approved by:		re (kib)
Differential revision:	https://reviews.freebsd.org/D17647
Sponsored by:		Mellanox Technologies
2018-10-29 13:17:41 +00:00
Hans Petter Selasky a352cef971 MFC r339587:
Added support for formula-based arbitrary baud rates, in contrast to
the current fixed values, which enables use of rates above 1 Mbps.
Improved the detection of HXD chips, and the status flag handling as
well.

Submitted by:		Gabor Simon <[email protected]>
PR:			225932
Approved by:		re (kib)
Differential revision:	https://reviews.freebsd.org/D16639
Sponsored by:		Mellanox Technologies
2018-10-29 12:08:15 +00:00
Andrey V. Elsukov 5a4deb4db9 MFC r339740:
Use correct format specificator to print setdscp action.

  PR:		232642
Approved by:	re (rgrimes)
2018-10-28 18:21:14 +00:00
Vincenzo Maffione 91463af35f MFC r339548:
man: fix vale(4) port naming

The current documentation describing the syntax of a VALE port is wrong.
This patch fixes it to make it consistent.

Approved by:	re (gjb)
2018-10-28 07:50:15 +00:00
Cy Schubert daccc520c1 Follow up on r331936. gets_s(3) will also fail in the same way that
gets(3) does. This was missed in r331936.

Reported by:	emaste@
Approved by:	re (kib@)
2018-10-28 00:57:39 +00:00
Yuri Pankov 0a8c491e71 MFC r339489:
Add -b/-l options to localedef(1) to specify output endianness and use
it appropriately when building share/ctypedef and share/colldef.

This makes the resulting locale data in EL->EB (amd64->powerpc64) cross
build and in the native EB build match.  Revert the changes done to libc
in r308170 as they are no longer needed.

PR:             231965
Reviewed by:    bapt, emaste, sbruno, 0mp
Approved by:    re (gjb), kib (mentor)
Differential Revision:  https://reviews.freebsd.org/D17603
2018-10-27 21:17:01 +00:00
Justin Hibbits d5958b4d6d MFC r339514:
powerpcspe: Implement SPE exception handling

The Signal Processing Engine (SPE) found in Freescale e500 cores (and
others) offloads IEEE-754 compliance (NaN, Inf handling, overflow,
underflow) to software, most likely as a means of simplifying the APU
silicon.  Some software, like AbiWord, needs full IEEE-754 compliance,
including NaN handling.  Implement the necessary bits to enable it.

Approved by:	re(kib)
2018-10-27 03:16:32 +00:00
Andrey V. Elsukov 4982480b2e MFC r339532 (by glebius):
Fix exiting an epoch(9) we never entered. May happen only with MAC.

Approved by:	re (kib)
2018-10-26 10:20:03 +00:00
Glen Barber 5bd5b97bc2 Update stable/12 from BETA1 to BETA2 as part of the 12.0-RELEASE
cycle.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-10-26 00:00:13 +00:00
Glen Barber 347338d6cc MFC r339741:
Update SHLIB_VERSION_NUMBER following the OpenSSL shared library
 number bump.

Approved by:	re (bdrewery)
Sponsored by:	The FreeBSD Foundation
2018-10-25 19:57:42 +00:00
Brooks Davis 68742e0d2e MFC r339703:
Deprecate a number of less used 10 and 10/100 Ethernet devices.

The current deprecated list is: ae, bm, cs, de, dme, ed, ep, ex, fe,
pcn, sf, sn, tl, tx, txp, vx, wb, xe

The list was defined as part of FCP-0101. Per the FCP, devices may be
removed from the deprecation list if enough users are found or they are
converted to iflib.

FCP:		https://github.com/freebsd/fcp/blob/master/fcp-0101.md
Approved by:	re (gjb)
Reviewed by:	rgrimes
Differential Revision:	https://reviews.freebsd.org/D17654
2018-10-25 17:00:39 +00:00
Tijl Coosemans 6cbca952c3 MFC r339618:
Define linuxkpi readq for 64-bit architectures.  It is used by drm-kmod.
Currently the compiler picks up the definition in machine/cpufunc.h.

Add compiler memory barriers to read* and write*.  The Linux x86
implementation of these functions uses inline asm with "memory" clobber.
The Linux x86 implementation of read_relaxed* and write_relaxed* uses the
same inline asm without "memory" clobber.

Implement ioread* and iowrite* in terms of read* and write* so they also
have memory barriers.

Qualify the addr parameter in write* as volatile.

Like Linux, define macros with the same name as the inline functions.

Only define 64-bit versions on 64-bit architectures because generally
32-bit architectures can't do atomic 64-bit loads and stores.

Regroup the functions a bit and add brief comments explaining what they do:
- __raw_read*, __raw_write*: atomic, no barriers, no byte swapping
- read_relaxed*, write_relaxed*: atomic, no barriers, little-endian
- read*, write*: atomic, with barriers, little-endian

Add a comment that says our implementation of ioread* and iowrite*
only handles MMIO and does not support port IO.

Reviewed by:	hselasky
Approved by:	re (gjb)
2018-10-25 16:01:10 +00:00
Konstantin Belousov d33226f4dc MFC r339709:
Bump base OpenSSL libraries versions to avoid conflict with port's libraries.

Approved by:	re (gjb)
2018-10-25 15:49:59 +00:00
Warner Losh 271d3b9a5b MFC r339493: add wdc as an alias for wds
wdc is the preferred name for Western Digital. wds should never
have been committed in the first place. Add wdc as an alias for 12
and in 13 we'll retire the undocumented wds.

Approved by:	re@ (kib)
2018-10-25 15:35:12 +00:00
Ed Maste 868f48f109 MFC r339451: objcopy: restore behaviour required by GCC's build
In r339350 filter_reloc() was removed, to fix the case of stripping
statically linked binaries with relocations (which may come from ifunc
use, for example).  As a side effect this changed the behaviour when
stripping object files - the output was broken both before and after
r339350, in different ways.  Unfortunately GCC's build process relies
on the previous behaviour, so:

- Revert r339350, restoring filter_reloc().
- Fix an unitialized variable use (commited as r3638 in ELF Tool Chain).
- Change filter_reloc() to omit relocations referencing removed
  symbols, while retaining relocations with no symbol reference.
- Retain the entire relocation section if it references the dynamic
  symbol table (fix from kaiw in D17596).

PR:		232176
Approved by:	re (gjb, kib)
Sponsored by:	The FreeBSD Foundation
2018-10-25 15:18:54 +00:00
Glen Barber f757fe4a18 MFC r339684:
Reduce the GCE image size to 27G to be lower than the free
 quota limit.

PR:		232313
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2018-10-25 15:11:18 +00:00
Hans Petter Selasky 20991c24d0 MFC r339582:
Drop sequencer mutex around uiomove() and make sure we don't move more bytes
than is available, else a panic might happen.

Found by:		Peter Holm <[email protected]>
Approved by:		re (rgrimes)
Sponsored by:		Mellanox Technologies
2018-10-25 14:53:24 +00:00
Slava Shwartsman 5956f49d94 MFC r339584:
mlx5: Notify user that the ConnectX-6 shutdown its port due to power limitation

If power exceed the slot limit, or slot limit is unknown the ConnectX-6
firmware will shutdown its port.
Inform the user via debug message.

Approved by:    re(rgrimes), hselasky (mentor), kib (mentor)
Sponsored by:   Mellanox Technologies
2018-10-25 14:07:28 +00:00
Hans Petter Selasky 3865992e19 MFC r339581:
Fix off-by-one which can lead to panics.

Found by:		Peter Holm <[email protected]>
Approved by:		re (kib)
Sponsored by:		Mellanox Technologies
2018-10-25 12:27:16 +00:00
Warner Losh c905270a53 MFC: r339562 (remove obsolete drivers from GENERIC)
Remove the drivers we'd planned on removing from 12.x from GENERIC.

Approved by:	re@ (rgrimes@)
2018-10-25 05:18:25 +00:00
Devin Teske dedcd347d6 MFC r339509: Fix loader.conf(5) "password" feature
Restore the ability to prevent the user from interrupting the boot process
without first entering the password stored in loader.conf(5).

PR:		kern/207069
Reported by:	[email protected]
Approved by:	re (rgrimes)
Sponsored by:	Smule, Inc.
2018-10-24 23:13:53 +00:00
Kristof Provost 81c4c199a5 MFC r339547:
vlan: Fix panic with lagg and vlan

vlan_lladdr_fn() is called from taskqueue, which means there's no vnet context
set. We can end up trying to send ARP messages (through the iflladdr_event
event), which requires a vnet context.

PR:		227654
Approved by:	re (kib)
2018-10-24 17:32:31 +00:00
Glen Barber 6763b01834 Remove debug.witness.trace=0 from the installer sysctl.conf(5),
which should have been removed from stable/12 post-branch.

This is a direct commit to stable/12.

Reported by:	bdrewery
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2018-10-23 16:24:26 +00:00
Warner Losh e68496f578 MFC 339475: improve drm messaging in driver and UPDATING
Approved by:	re@ (rgrimes)
2018-10-23 03:30:14 +00:00
Philip Paeps 4b34e3e645 MFC r339503: Import tzdata 2018f
Approved by:	re (kib)
2018-10-23 01:39:26 +00:00
Eugene Grosbein 1bf567ff00 MFC r339462: make upgrade from previous FreeBSD versions less painful
and make previously working configuration like this work again:

gif_interfaces="gif0"
gifconfig_gif0="1.1.1.1 2.2.2.2"
ifconfig_gif0="inet 192.168.1.1 192.168.1.2 netmask 255.255.255.252"

PR:		204700
Approved by:	re (gjb)
2018-10-22 17:27:36 +00:00
Glen Barber bf347bfd58 Uncomment -DNDEBUG in stable/12 after branching stable/12.
This edit was a mistake in head, and should have been applied
to stable/12 upon branching, not head.

This is a direct commit to stable/12.

Reported by:	jbeich, dim
Approved by:	re (kib)
Sponsored by:	The FreeBSD Foundation
2018-10-21 17:38:52 +00:00
Glen Barber f34e7e0e50 - Prune svn:mergeinfo from the new branch, as nothing has been merged
here.
- Remove debugging from GENERIC* kernel configurations
- Enable MALLOC_PRODUCTION
- Default dumpdev=NO
- Remove UPDATING entry regarding debugging features
- Switch 12.0 from -ALPHA10 to -BETA1 to prepare for builds.

Approved by:	re (implicit)
Sponsored by:	The FreeBSD Foundation
2018-10-19 00:24:23 +00:00
1067 changed files with 22281 additions and 7703 deletions

No files matched your search

+11 -3
View File
@@ -659,7 +659,7 @@ BSARGS= DESTDIR= \
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
MK_LLDB=no MK_TESTS=no \
MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no \
MK_INCLUDES=yes
BMAKE= \
@@ -680,7 +680,7 @@ TMAKE= \
-DNO_LINT \
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
MK_CLANG_EXTRAS=no MK_CLANG_FULL=no \
MK_LLDB=no MK_TESTS=no
MK_LLDB=no MK_RETPOLINE=no MK_TESTS=no
# cross-tools stage
# TOOLS_PREFIX set in BMAKE
@@ -703,7 +703,7 @@ KTMAKE= \
SSP_CFLAGS= \
MK_HTML=no -DNO_LINT MK_MAN=no \
-DNO_PIC MK_PROFILE=no -DNO_SHARED \
-DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no
-DNO_CPU_CFLAGS MK_RETPOLINE=no MK_WARNS=no MK_CTF=no
# world stage
WMAKEENV= ${CROSSENV} \
@@ -948,6 +948,13 @@ _cleanobj_fast_depend_hack: .PHONY
${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.${f}.*}; \
fi
.endfor
# 20181115 r340463 bzero reimplemented as .c
@if [ -e "${OBJTOP}/lib/libc/.depend.bzero.o" ] && \
egrep -qw 'bzero\.[sS]' ${OBJTOP}/lib/libc/.depend.bzero.o; then \
echo "Removing stale dependencies for bzero"; \
rm -f ${OBJTOP}/lib/libc/.depend.bzero.* \
${LIBCOMPAT:D${LIBCOMPAT_OBJTOP}/lib/libc/.depend.bzero.*}; \
fi
# 20181009 track migration from ntp's embedded libevent to updated one
@if [ -e "${OBJTOP}/usr.sbin/ntp/libntpevent/.depend.bufferevent_openssl.o" ] && \
egrep -q 'contrib/ntp/sntp/libevent/bufferevent_openssl.c' \
@@ -2383,6 +2390,7 @@ NXBMAKEARGS+= \
MK_OFED=no \
MK_OPENSSH=no \
MK_PROFILE=no \
MK_RETPOLINE=no \
MK_SENDMAIL=no \
MK_SVNLITE=no \
MK_TESTS=no \
+2 -1
View File
@@ -200,7 +200,8 @@ build${libcompat}: .PHONY
OBJTOP=${LIBCOMPAT_OBJTOP} \
OBJROOT='$${OBJTOP}/' \
MAKEOBJDIRPREFIX= \
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS MK_WARNS=no MK_CTF=no \
DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \
MK_CTF=no MK_RETPOLINE=no MK_WARNS=no \
${_t}
.endfor
.endfor
+9
View File
@@ -38,6 +38,13 @@
# xargs -n1 | sort | uniq -d;
# done
# 20181030: malloc_domain(9) KPI change
OLD_FILES+=share/man/man9/malloc_domain.9.gz
# 20181025: OpenSSL libraries version bump to avoid conflict with ports
OLD_LIBS+=lib/libcrypto.so.9
OLD_LIBS+=usr/lib/libssl.so.9
OLD_LIBS+=usr/lib32/libcrypto.so.9
OLD_LIBS+=usr/lib32/libssl.so.9
# 20181015: Stale libcasper(3) files following r329452
OLD_LIBS+=lib/casper/libcap_sysctl.so.0
OLD_LIBS+=lib/casper/libcap_grp.so.0
@@ -51,6 +58,8 @@ OLD_LIBS+=usr/lib32/libcap_pwd.so.0
OLD_LIBS+=usr/lib32/libcap_random.so.0
OLD_LIBS+=usr/lib32/libcap_dns.so.0
OLD_LIBS+=usr/lib32/libcap_syslog.so.0
# 20181012: rename of ixlv(4) to iavf(4)
OLD_FILES+=usr/share/man/man4/ixlv.4.gz
# 20181009: OpenSSL 1.1.1
OLD_FILES+=usr/include/openssl/des_old.h
OLD_FILES+=usr/include/openssl/dso.h
+45 -14
View File
@@ -16,20 +16,51 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to
the tip of head, and then rebuild without this option. The bootstrap process
from older version of current across the gcc/clang cutover is a bit fragile.
NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW:
FreeBSD 12.x has many debugging features turned on, in both the kernel
and userland. These features attempt to detect incorrect use of
system primitives, and encourage loud failure through extra sanity
checking and fail stop semantics. They also substantially impact
system performance. If you want to do performance measurement,
benchmarking, and optimization, you'll want to turn them off. This
includes various WITNESS- related kernel options, INVARIANTS, malloc
debugging flags in userland, and various verbose features in the
kernel. Many developers choose to disable these features on build
machines to maximize performance. (To completely disable malloc
debugging, define MALLOC_PRODUCTION in /etc/make.conf, or to merely
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20181211:
12.0-RELEASE.
20181115:
The set of CTM commands (ctm, ctm_smail, ctm_rmail, ctm_dequeue)
has been converted to a port (misc/ctm) and will be removed from
FreeBSD-13. A depreciation warning will be printed to stderr by
the ctm command, but the functionality will remain in base for all
FreeBSD-12 releases.
20181019:
The stable/12 branch has been created in subversion from head
revision r339432.
20181015:
Ports for the DRM modules have been simplified. Now, amd64 users should
just install the drm-kmod port. All others should install
drm-legacy-kmod.
Graphics hardware that's newer than about 2010 usually works with
drm-kmod. For hardware older than 2013, however, some users will need
to use drm-legacy-kmod if drm-kmod doesn't work for them. Hardware older
than 2008 usually only works in drm-legacy-kmod. The graphics team can
only commit to hardware made since 2013 due to the complexity of the
market and difficulty to test all the older cards effectively. If you
have hardware supported by drm-kmod, you are strongly encouraged to use
that as you will get better support.
Other than KPI chasing, drm-legacy-kmod will not be updated. As outlined
elsewhere, the drm and drm2 modules will be eliminated from the src base
soon (with a limited exception for arm). Please update to the package asap
and report any issues to [email protected].
Generally, anybody using the drm*-kmod packages should add
WITHOUT_DRM_MODULE=t and WITHOUT_DRM2_MODULE=t to avoid nasty
cross-threading surprises, especially with automatic driver
loading from X11 startup. These will become the defaults in 13-current
shortly.
20181012:
The ixlv(4) driver has been renamed to iavf(4). As a consequence,
custom kernel and module loading configuration files must be updated
accordingly. Moreover, interfaces previous presented as ixlvN to the
system are now exposed as iavfN and network configuration files must
be adjusted as necessary.
20181009:
OpenSSL has been updated to version 1.1.1. This update included
+3 -1
View File
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd April 10, 2018
.Dd October 26, 2018
.Dt SETFACL 1
.Os
.Sh NAME
@@ -136,6 +136,8 @@ option is specified, no symbolic links are followed.
This is the default.
.It Fl R
Perform the action recursively on any specified directories.
When modifying or adding NFSv4 ACL entries, inheritance flags
are applied only to directories.
.It Fl x Ar entries | position
If
.Ar entries
+68 -13
View File
@@ -27,9 +27,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/acl.h>
#include <sys/queue.h>
@@ -73,6 +71,7 @@ static bool need_mask;
static acl_type_t acl_type = ACL_TYPE_ACCESS;
static int handle_file(FTS *ftsp, FTSENT *file);
static acl_t clear_inheritance_flags(acl_t acl);
static char **stdin_files(void);
static void usage(void);
@@ -124,10 +123,57 @@ stdin_files(void)
return (files_list);
}
/*
* Remove any inheritance flags from NFSv4 ACLs when running in recursive
* mode. This is to avoid files being assigned identical ACLs to their
* parent directory while also being set to inherit them.
*
* The acl argument is assumed to be valid.
*/
static acl_t
clear_inheritance_flags(acl_t acl)
{
acl_t nacl;
acl_entry_t acl_entry;
acl_flagset_t acl_flagset;
int acl_brand, entry_id;
(void)acl_get_brand_np(acl, &acl_brand);
if (acl_brand != ACL_BRAND_NFS4)
return (acl);
nacl = acl_dup(acl);
if (nacl == NULL) {
warn("acl_dup() failed");
return (acl);
}
entry_id = ACL_FIRST_ENTRY;
while (acl_get_entry(nacl, entry_id, &acl_entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (acl_get_flagset_np(acl_entry, &acl_flagset) != 0) {
warn("acl_get_flagset_np() failed");
continue;
}
if (acl_get_flag_np(acl_flagset, ACL_ENTRY_INHERIT_ONLY) == 1) {
if (acl_delete_entry(nacl, acl_entry) != 0)
warn("acl_delete_entry() failed");
continue;
}
if (acl_delete_flag_np(acl_flagset,
ACL_ENTRY_FILE_INHERIT |
ACL_ENTRY_DIRECTORY_INHERIT |
ACL_ENTRY_NO_PROPAGATE_INHERIT) != 0)
warn("acl_delete_flag_np() failed");
}
return (nacl);
}
static int
handle_file(FTS *ftsp, FTSENT *file)
{
acl_t acl;
acl_t acl, nacl;
acl_entry_t unused_entry;
int local_error, ret;
struct sf_entry *entry;
@@ -193,17 +239,20 @@ handle_file(FTS *ftsp, FTSENT *file)
/* Cycle through each option. */
TAILQ_FOREACH(entry, &entrylist, next) {
if (local_error)
continue;
switch(entry->op) {
nacl = entry->acl;
switch (entry->op) {
case OP_ADD_ACL:
local_error += add_acl(entry->acl, entry->entry_number,
&acl, file->fts_path);
if (R_flag && file->fts_info != FTS_D &&
acl_type == ACL_TYPE_NFS4)
nacl = clear_inheritance_flags(nacl);
local_error += add_acl(nacl, entry->entry_number, &acl,
file->fts_path);
break;
case OP_MERGE_ACL:
local_error += merge_acl(entry->acl, &acl,
file->fts_path);
if (R_flag && file->fts_info != FTS_D &&
acl_type == ACL_TYPE_NFS4)
nacl = clear_inheritance_flags(nacl);
local_error += merge_acl(nacl, &acl, file->fts_path);
need_mask = true;
break;
case OP_REMOVE_EXT:
@@ -240,8 +289,7 @@ handle_file(FTS *ftsp, FTSENT *file)
need_mask = false;
break;
case OP_REMOVE_ACL:
local_error += remove_acl(entry->acl, &acl,
file->fts_path);
local_error += remove_acl(nacl, &acl, file->fts_path);
need_mask = true;
break;
case OP_REMOVE_BY_NUMBER:
@@ -250,6 +298,13 @@ handle_file(FTS *ftsp, FTSENT *file)
need_mask = true;
break;
}
if (nacl != entry->acl) {
acl_free(nacl);
nacl = NULL;
}
if (local_error)
break;
}
/*
+143
View File
@@ -39,6 +39,7 @@ ELFTC_VCSID("$Id: sections.c 3443 2016-04-15 18:57:54Z kaiwang27 $");
static void add_gnu_debuglink(struct elfcopy *ecp);
static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc);
static void check_section_rename(struct elfcopy *ecp, struct section *s);
static void filter_reloc(struct elfcopy *ecp, struct section *s);
static int get_section_flags(struct elfcopy *ecp, const char *name);
static void insert_sections(struct elfcopy *ecp);
static void insert_to_strtab(struct section *t, const char *s);
@@ -572,6 +573,14 @@ copy_content(struct elfcopy *ecp)
strcmp(s->name, ".shstrtab") == 0)
continue;
/*
* If strip action is STRIP_ALL, relocation info need
* to be stripped. Skip filtering otherwisw.
*/
if (ecp->strip == STRIP_ALL &&
(s->type == SHT_REL || s->type == SHT_RELA))
filter_reloc(ecp, s);
/*
* The section indices in the SHT_GROUP section needs
* to be updated since we might have stripped some
@@ -664,6 +673,140 @@ update_section_group(struct elfcopy *ecp, struct section *s)
s->nocopy = 1;
}
/*
* Filter relocation entries, only keep those entries whose
* symbol is in the keep list.
*/
static void
filter_reloc(struct elfcopy *ecp, struct section *s)
{
const char *name;
GElf_Shdr ish;
GElf_Rel rel;
GElf_Rela rela;
Elf32_Rel *rel32;
Elf64_Rel *rel64;
Elf32_Rela *rela32;
Elf64_Rela *rela64;
Elf_Data *id;
uint64_t cap, n, nrels, sym;
int elferr, i;
if (gelf_getshdr(s->is, &ish) == NULL)
errx(EXIT_FAILURE, "gelf_getehdr() failed: %s",
elf_errmsg(-1));
/* We don't want to touch relocation info for dynamic symbols. */
if ((ecp->flags & SYMTAB_EXIST) == 0) {
/*
* No symbol table in output. If sh_link points to a section
* that exists in the output object, this relocation section
* is for dynamic symbols. Don't touch it.
*/
if (ish.sh_link != 0 && ecp->secndx[ish.sh_link] != 0)
return;
} else {
/* Symbol table exist, check if index equals. */
if (ish.sh_link != elf_ndxscn(ecp->symtab->is))
return;
}
#define COPYREL(REL, SZ) do { \
if (nrels == 0) { \
if ((REL##SZ = malloc(cap * \
sizeof(*REL##SZ))) == NULL) \
err(EXIT_FAILURE, "malloc failed"); \
} \
if (nrels >= cap) { \
cap *= 2; \
if ((REL##SZ = realloc(REL##SZ, cap * \
sizeof(*REL##SZ))) == NULL) \
err(EXIT_FAILURE, "realloc failed"); \
} \
REL##SZ[nrels].r_offset = REL.r_offset; \
REL##SZ[nrels].r_info = REL.r_info; \
if (s->type == SHT_RELA) \
rela##SZ[nrels].r_addend = rela.r_addend; \
nrels++; \
} while (0)
nrels = 0;
cap = 4; /* keep list is usually small. */
rel32 = NULL;
rel64 = NULL;
rela32 = NULL;
rela64 = NULL;
if ((id = elf_getdata(s->is, NULL)) == NULL)
errx(EXIT_FAILURE, "elf_getdata() failed: %s",
elf_errmsg(-1));
n = ish.sh_size / ish.sh_entsize;
for(i = 0; (uint64_t)i < n; i++) {
if (s->type == SHT_REL) {
if (gelf_getrel(id, i, &rel) != &rel)
errx(EXIT_FAILURE, "gelf_getrel failed: %s",
elf_errmsg(-1));
sym = GELF_R_SYM(rel.r_info);
} else {
if (gelf_getrela(id, i, &rela) != &rela)
errx(EXIT_FAILURE, "gelf_getrel failed: %s",
elf_errmsg(-1));
sym = GELF_R_SYM(rela.r_info);
}
/*
* If a relocation references a symbol and we are omitting
* either that symbol or the entire symbol table we cannot
* produce valid output, and so just omit the relocation.
* Broken output like this is generally not useful, but some
* uses of elfcopy/strip rely on it - for example, GCC's build
* process uses it to check for build reproducibility by
* stripping objects and comparing them.
*
* Relocations that do not reference a symbol are retained.
*/
if (sym != 0) {
if (ish.sh_link == 0 || ecp->secndx[ish.sh_link] == 0)
continue;
name = elf_strptr(ecp->ein, elf_ndxscn(ecp->strtab->is),
sym);
if (name == NULL)
errx(EXIT_FAILURE, "elf_strptr failed: %s",
elf_errmsg(-1));
if (lookup_symop_list(ecp, name, SYMOP_KEEP) == NULL)
continue;
}
if (ecp->oec == ELFCLASS32) {
if (s->type == SHT_REL)
COPYREL(rel, 32);
else
COPYREL(rela, 32);
} else {
if (s->type == SHT_REL)
COPYREL(rel, 64);
else
COPYREL(rela, 64);
}
}
elferr = elf_errno();
if (elferr != 0)
errx(EXIT_FAILURE, "elf_getdata() failed: %s",
elf_errmsg(elferr));
if (ecp->oec == ELFCLASS32) {
if (s->type == SHT_REL)
s->buf = rel32;
else
s->buf = rela32;
} else {
if (s->type == SHT_REL)
s->buf = rel64;
else
s->buf = rela64;
}
s->sz = gelf_fsize(ecp->eout, (s->type == SHT_REL ? ELF_T_REL :
ELF_T_RELA), nrels, EV_CURRENT);
s->nocopy = 1;
}
static void
update_reloc(struct elfcopy *ecp, struct section *s)
{
@@ -5,7 +5,7 @@
#undef JEMALLOC_OVERRIDE_VALLOC
#ifndef MALLOC_PRODUCTION
#define JEMALLOC_DEBUG
#define MALLOC_PRODUCTION
#endif
#undef JEMALLOC_DSS
+8 -5
View File
@@ -17,11 +17,14 @@ To email small changes, please run a POSIX shell command like
'diff -u old/europe new/europe >myfix.patch', and attach
myfix.patch to the email.
For more-elaborate changes, please read the theory.html file and browse
the mailing list archives <https://mm.icann.org/pipermail/tz/> for
examples of patches that tend to work well. Additions to
data should contain commentary citing reliable sources as
justification. Citations should use https: URLs if available.
For more-elaborate or possibly-controversial changes,
such as renaming, adding or removing zones, please read
<https://www.iana.org/time-zones/repository/theory.html> or the file
theory.html. It is also good to browse the mailing list archives
<https://mm.icann.org/pipermail/tz/> for examples of patches that tend
to work well. Additions to data should contain commentary citing
reliable sources as justification. Citations should use https: URLs
if available.
Please submit changes against either the latest release in
<https://www.iana.org/time-zones> or the master branch of the development
+199 -129
View File
@@ -1,3 +1,5 @@
# Make and install tzdb code and data.
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -19,9 +21,9 @@ BUGEMAIL= [email protected]
# DATAFORM= rearguard
DATAFORM= main
# Change the line below for your time zone (after finding the zone you want in
# the time zone files, or adding it to a time zone file).
# Alternatively, if you discover you've got the wrong time zone, you can just
# Change the line below for your timezone (after finding the one you want in
# one of the $(TDATA) source files, or adding it to a source file).
# Alternatively, if you discover you've got the wrong timezone, you can just
# zic -l rightzone
# to correct things.
# Use the command
@@ -31,14 +33,14 @@ DATAFORM= main
LOCALTIME= GMT
# If you want something other than Eastern United States time as a template
# for handling POSIX-style time zone environment variables,
# change the line below (after finding the zone you want in the
# time zone files, or adding it to a time zone file).
# for handling POSIX-style timezone environment variables,
# change the line below (after finding the timezone you want in the
# one of the $(TDATA) source files, or adding it to a source file).
# When a POSIX-style environment variable is handled, the rules in the
# template file are used to determine "spring forward" and "fall back" days and
# times; the environment variable itself specifies UT offsets of standard and
# daylight saving time.
# Alternatively, if you discover you've got the wrong time zone, you can just
# Alternatively, if you discover you've got the wrong timezone, you can just
# zic -p rightzone
# to correct things.
# Use the command
@@ -75,7 +77,7 @@ DESTDIR =
# TOPDIR should be empty or an absolute name unless you're just testing.
TOPDIR =
# The default local time zone is taken from the file TZDEFAULT.
# The default local timezone is taken from the file TZDEFAULT.
TZDEFAULT = $(TOPDIR)/etc/localtime
# The subdirectory containing installed program and data files, and
@@ -84,7 +86,7 @@ TZDEFAULT = $(TOPDIR)/etc/localtime
USRDIR = usr
USRSHAREDIR = $(USRDIR)/share
# "Compiled" time zone information is placed in the "TZDIR" directory
# "Compiled" timezone information is placed in the "TZDIR" directory
# (and subdirectories).
# TZDIR_BASENAME should not contain "/" and should not be ".", ".." or empty.
TZDIR_BASENAME= zoneinfo
@@ -106,9 +108,13 @@ MANDIR = $(TOPDIR)/$(USRSHAREDIR)/man
LIBDIR = $(TOPDIR)/$(USRDIR)/lib
# Types to try, as an alternative to time_t. int64_t should be first.
TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
# Types to try, as an alternative to time_t.
TIME_T_ALTERNATIVES = $(TIME_T_ALTERNATIVES_HEAD) $(TIME_T_ALTERNATIVES_TAIL)
TIME_T_ALTERNATIVES_HEAD = int64_t
TIME_T_ALTERNATIVES_TAIL = int32_t uint32_t uint64_t
# What kind of TZif data files to generate.
# (TZif is the binary time zone data format that zic generates.)
# If you want only POSIX time, with time values interpreted as
# seconds since the epoch (not counting leap seconds), use
# REDO= posix_only
@@ -129,7 +135,7 @@ TIME_T_ALTERNATIVES = int64_t int32_t uint32_t uint64_t
REDO= posix_right
# To install data in text form that has all the information of the binary data,
# To install data in text form that has all the information of the TZif data,
# (optionally incorporating leap second information), use
# TZDATA_TEXT= tzdata.zi leapseconds
# To install text data without leap second information (e.g., because
@@ -171,7 +177,6 @@ LDLIBS=
# Add the following to the end of the "CFLAGS=" line as needed to override
# defaults specified in the source code. "-DFOO" is equivalent to "-DFOO=1".
# -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c)
# -DDEPRECATE_TWO_DIGIT_YEARS for optional runtime warnings about strftime
# formats that generate only the last two digits of year numbers
# -DEPOCH_LOCAL if the 'time' function returns local time not UT
@@ -295,7 +300,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff",
# "posix2time", and "time2posix" to be added to the time conversion library.
# "tzsetwall" is like "tzset" except that it arranges for local wall clock
# time (rather than the time specified in the TZ environment variable)
# time (rather than the timezone specified in the TZ environment variable)
# to be used.
# "offtime" is like "gmtime" except that it accepts a second (long) argument
# that gives an offset to add to the time_t when converting it.
@@ -318,7 +323,7 @@ GCC_DEBUG_FLAGS = -DGCC_LINT -g3 -O3 -fno-common \
# "posix2time_z" and "time2posix_z" are added as well.
# The functions ending in "_z" (or "_rz") are like their unsuffixed
# (or suffixed-by-"_r") counterparts, except with an extra first
# argument of opaque type timezone_t that specifies the time zone.
# argument of opaque type timezone_t that specifies the timezone.
# "tzalloc" allocates a timezone_t value, and "tzfree" frees it.
#
# If you want to allocate state structures in localtime, add
@@ -357,11 +362,14 @@ ZIC= $(zic) $(ZFLAGS)
ZFLAGS=
# How to use zic to install tz binary files.
# How to use zic to install TZif files.
ZIC_INSTALL= $(ZIC) -d '$(DESTDIR)$(TZDIR)' $(LEAPSECONDS)
# The name of a Posix-compliant 'awk' on your system.
# Older 'mawk' versions, such as the 'mawk' in Ubuntu 16.04, might dump core;
# on Ubuntu you can work around this with
# AWK= gawk
AWK= awk
# The full path name of a Posix-compliant shell, preferably one that supports
@@ -410,10 +418,16 @@ SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~'
SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3)
SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]'
# These characters are Latin-1, and so are likely to be displayable
# even in editors with limited character sets.
UNUSUAL_OK_LATIN_1 = «°±»½¾×
# This IPA symbol is represented in Unicode as the composition of
# U+0075 and U+032F, and U+032F is not considered alphabetic by some
# grep implementations that do not grok composition.
UNUSUAL_OK_IPA = u̯
# Non-ASCII non-letters that OK_CHAR allows, as these characters are
# useful in commentary. XEmacs 21.5.34 displays them correctly,
# presumably because they are Latin-1.
UNUSUAL_OK_CHARSET= °±½¾×
# useful in commentary.
UNUSUAL_OK_CHARSET= $(UNUSUAL_OK_LATIN_1)$(UNUSUAL_OK_IPA)
# OK_CHAR matches any character allowed in the distributed files.
# This is the same as SAFE_CHAR, except that UNUSUAL_OK_CHARSET and
@@ -492,11 +506,14 @@ AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk \
ziguard.awk zishrink.awk
MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl
TZS_YEAR= 2050
TZS_CUTOFF_FLAG= -c $(TZS_YEAR)
TZS= to$(TZS_YEAR).tzs
TZS_NEW= to$(TZS_YEAR)new.tzs
TZS_DEPS= $(PRIMARY_YDATA) asctime.c localtime.c \
private.h tzfile.h zdump.c zic.c
ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) $(TZS) tzdata.zi
# EIGHT_YARDS is just a yard short of the whole ENCHILADA.
EIGHT_YARDS = $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) tzdata.zi
ENCHILADA = $(EIGHT_YARDS) $(TZS)
# Consult these files when deciding whether to rebuild the 'version' file.
# This list is not the same as the output of 'git ls-files', since
@@ -560,14 +577,21 @@ version: $(VERSION_DEPS)
printf '%s\n' "$$V" >$@.out
mv $@.out $@
# These files can be tailored by setting BACKWARD, PACKRATDATA, etc.
# These files can be tailored by setting BACKWARD and PACKRATDATA.
vanguard.zi main.zi rearguard.zi: $(DSTDATA_ZI_DEPS)
$(AWK) -v DATAFORM=`expr $@ : '\(.*\).zi'` -f ziguard.awk \
$(TDATA) $(PACKRATDATA) >$@.out
mv $@.out $@
tzdata.zi: $(DATAFORM).zi version
# This file has a version comment that attempts to capture any tailoring
# via BACKWARD, DATAFORM, PACKRATDATA, and REDO.
tzdata.zi: $(DATAFORM).zi version zishrink.awk
version=`sed 1q version` && \
LC_ALL=C $(AWK) -v version="$$version" -f zishrink.awk \
LC_ALL=C $(AWK) \
-v dataform='$(DATAFORM)' \
-v deps='$(DSTDATA_ZI_DEPS) zishrink.awk' \
-v redo='$(REDO)' \
-v version="$$version" \
-f zishrink.awk \
$(DATAFORM).zi >$@.out
mv $@.out $@
@@ -605,14 +629,16 @@ INSTALLARGS = \
YEARISTYPE='$(YEARISTYPE)' \
ZIC='$(ZIC)'
# 'make install_data' installs one set of tz binary files.
install_data: zic leapseconds yearistype tzdata.zi
INSTALL_DATA_DEPS = zic leapseconds yearistype tzdata.zi
# 'make install_data' installs one set of TZif files.
install_data: $(INSTALL_DATA_DEPS)
$(ZIC_INSTALL) tzdata.zi
posix_only:
posix_only: $(INSTALL_DATA_DEPS)
$(MAKE) $(INSTALLARGS) LEAPSECONDS= install_data
right_only:
right_only: $(INSTALL_DATA_DEPS)
$(MAKE) $(INSTALLARGS) LEAPSECONDS='-L leapseconds' \
install_data
@@ -639,7 +665,7 @@ posix_right: posix_only
# This obsolescent rule is present for backwards compatibility with
# tz releases 2014g through 2015g. It should go away eventually.
posix_packrat:
posix_packrat: $(INSTALL_DATA_DEPS)
$(MAKE) $(INSTALLARGS) PACKRATDATA=backzone posix_only
zones: $(REDO)
@@ -650,29 +676,33 @@ ZDS = dummy.zd
# Rule used only by submakes invoked by the $(TZS_NEW) rule.
# It is separate so that GNU 'make -j' can run instances in parallel.
$(ZDS): zdump
./zdump -i -c $(TZS_YEAR) '$(wd)/'$$(expr $@ : '\(.*\).zd') >$@
./zdump -i $(TZS_CUTOFF_FLAG) '$(wd)/'$$(expr $@ : '\(.*\).zd') \
>$@
$(TZS_NEW): tzdata.zi zdump zic
rm -fr tzs.dir
mkdir tzs.dir
$(zic) -d tzs.dir tzdata.zi
TZS_NEW_DEPS = tzdata.zi zdump zic
$(TZS_NEW): $(TZS_NEW_DEPS)
rm -fr tzs$(TZS_YEAR).dir
mkdir tzs$(TZS_YEAR).dir
$(zic) -d tzs$(TZS_YEAR).dir tzdata.zi
$(AWK) '/^L/{print "Link\t" $$2 "\t" $$3}' \
tzdata.zi | LC_ALL=C sort >$@.out
wd=`pwd` && \
set x `$(AWK) '/^Z/{print "tzs.dir/" $$2 ".zd"}' tzdata.zi \
x=`$(AWK) '/^Z/{print "tzs$(TZS_YEAR).dir/" $$2 ".zd"}' \
tzdata.zi \
| LC_ALL=C sort -t . -k 2,2` && \
set x $$x && \
shift && \
ZDS=$$* && \
$(MAKE) wd="$$wd" TZS_YEAR=$(TZS_YEAR) ZDS="$$ZDS" $$ZDS && \
sed 's,^TZ=".*tzs\.dir/,TZ=",' $$ZDS >>$@.out
rm -fr tzs.dir
$(MAKE) wd="$$wd" TZS_CUTOFF_FLAG="$(TZS_CUTOFF_FLAG)" \
ZDS="$$ZDS" $$ZDS && \
sed 's,^TZ=".*\.dir/,TZ=",' $$ZDS >>$@.out
rm -fr tzs$(TZS_YEAR).dir
mv $@.out $@
# If $(TZS) does not already exist (e.g., old-format tarballs), create it.
# If it exists but 'make check_tzs' fails, a maintainer should inspect the
# If $(TZS) exists but 'make check_tzs' fails, a maintainer should inspect the
# failed output and fix the inconsistency, perhaps by running 'make force_tzs'.
$(TZS):
$(MAKE) force_tzs
touch $@
force_tzs: $(TZS_NEW)
cp $(TZS_NEW) $(TZS)
@@ -711,18 +741,21 @@ check_character_set: $(ENCHILADA)
$(MISC) $(SOURCES) $(WEB_PAGES) \
CONTRIBUTING LICENSE README \
version tzdata.zi && \
! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_CHARSET='$(OK_CHAR)'*$$' \
! grep -Env $(SAFE_LINE)'|^UNUSUAL_OK_'$(OK_CHAR)'*$$' \
Makefile && \
! grep -Env $(SAFE_SHARP_LINE) $(TDATA_TO_CHECK) backzone \
leapseconds yearistype.sh zone.tab && \
! grep -Env $(OK_LINE) $(ENCHILADA); \
}
touch $@
check_white_space: $(ENCHILADA)
patfmt=' \t|[\f\r\v]' && pat=`printf "$$patfmt\\n"` && \
! grep -En "$$pat" $(ENCHILADA)
! grep -En "$$pat" \
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
! grep -n '[[:space:]]$$' \
$$(ls $(ENCHILADA) | grep -Fvx leap-seconds.list)
touch $@
PRECEDES_FILE_NAME = ^(Zone|Link[[:space:]]+[^[:space:]]+)[[:space:]]+
FILE_NAME_COMPONENT_TOO_LONG = \
@@ -731,6 +764,7 @@ FILE_NAME_COMPONENT_TOO_LONG = \
check_name_lengths: $(TDATA_TO_CHECK) backzone
! grep -En '$(FILE_NAME_COMPONENT_TOO_LONG)' \
$(TDATA_TO_CHECK) backzone
touch $@
CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; }
@@ -743,52 +777,61 @@ check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab
LC_ALL=C sort -c
$(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \
LC_ALL=C sort -cu
touch $@
check_links: checklinks.awk $(TDATA_TO_CHECK) tzdata.zi
$(AWK) -f checklinks.awk $(TDATA_TO_CHECK)
$(AWK) -f checklinks.awk tzdata.zi
touch $@
check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES)
for tab in $(ZONETABLES); do \
$(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \
|| exit; \
done
touch $@
check_tzs: $(TZS) $(TZS_NEW)
diff -u $(TZS) $(TZS_NEW)
if test -s $(TZS); then \
diff -u $(TZS) $(TZS_NEW); \
else \
cp $(TZS_NEW) $(TZS); \
fi
touch $@
# This checks only the HTML 4.01 strict page.
# To check the the other pages, use <https://validator.w3.org/>.
check_web: tz-how-to.html
$(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) tz-how-to.html
touch $@
# Check that zishrink.awk does not alter the data, and that ziguard.awk
# preserves main-format data.
check_zishrink: zic leapseconds $(PACKRATDATA) $(TDATA) \
$(DATAFORM).zi tzdata.zi
for type in posix right; do \
mkdir -p time_t.dir/$$type time_t.dir/$$type-t \
time_t.dir/$$type-shrunk && \
case $$type in \
right) leap='-L leapseconds';; \
*) leap=;; \
esac && \
$(ZIC) $$leap -d time_t.dir/$$type $(DATAFORM).zi && \
check_zishrink: check_zishrink_posix check_zishrink_right
check_zishrink_posix check_zishrink_right: \
zic leapseconds $(PACKRATDATA) $(TDATA) $(DATAFORM).zi tzdata.zi
rm -fr $@.dir $@-t.dir $@-shrunk.dir
mkdir $@.dir $@-t.dir $@-shrunk.dir
case $@ in \
*_right) leap='-L leapseconds';; \
*) leap=;; \
esac && \
$(ZIC) $$leap -d $@.dir $(DATAFORM).zi && \
$(ZIC) $$leap -d $@-shrunk.dir tzdata.zi && \
case $(DATAFORM) in \
main) \
$(ZIC) $$leap -d time_t.dir/$$type-t $(TDATA) && \
$(ZIC) $$leap -d $@-t.dir $(TDATA) && \
$(AWK) '/^Rule/' $(TDATA) | \
$(ZIC) $$leap -d time_t.dir/$$type-t - \
$(PACKRATDATA) && \
diff -r time_t.dir/$$type time_t.dir/$$type-t;; \
esac && \
$(ZIC) $$leap -d time_t.dir/$$type-shrunk tzdata.zi && \
diff -r time_t.dir/$$type time_t.dir/$$type-shrunk || exit; \
done
rm -fr time_t.dir
$(ZIC) $$leap -d $@-t.dir - $(PACKRATDATA) && \
diff -r $@.dir $@-t.dir;; \
esac
diff -r $@.dir $@-shrunk.dir
rm -fr $@.dir $@-t.dir $@-shrunk.dir
touch $@
clean_misc:
rm -f core *.o *.out \
rm -f *.o *.out $(TIME_T_ALTERNATIVES) \
check_* core typecheck_* \
date tzselect version.h zdump zic yearistype libtz.a
clean: clean_misc
rm -fr *.dir *.zi tzdb-*/ $(TZS_NEW)
@@ -818,17 +861,17 @@ $(MANTXTS): workman.sh
LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@.out
mv $@.out $@
# Set the time stamps to those of the git repository, if available,
# Set the timestamps to those of the git repository, if available,
# and if the files have not changed since then.
# This uses GNU 'touch' syntax 'touch -d@N FILE',
# where N is the number of seconds since 1970.
# If git or GNU 'touch' is absent, don't bother to sync with git timestamps.
# Also, set the timestamp of each prebuilt file like 'leapseconds'
# to be the maximum of the files it depends on.
set-timestamps.out: $(ENCHILADA)
set-timestamps.out: $(EIGHT_YARDS)
rm -f $@
if (type git) >/dev/null 2>&1 && \
files=`git ls-files $(ENCHILADA)` && \
files=`git ls-files $(EIGHT_YARDS)` && \
touch -md @1 test.out; then \
rm -f test.out && \
for file in $$files; do \
@@ -846,83 +889,100 @@ set-timestamps.out: $(ENCHILADA)
exit; \
done
touch -cmr `ls -t $(TZDATA_ZI_DEPS) | sed 1q` tzdata.zi
touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
touch -cmr `ls -t $(VERSION_DEPS) | sed 1q` version
touch $@
set-tzs-timestamp.out: $(TZS)
touch -cmr `ls -t $(TZS_DEPS) | sed 1q` $(TZS)
touch $@
# The zics below ensure that each data file can stand on its own.
# We also do an all-files run to catch links to links.
check_public:
$(MAKE) maintainer-clean
$(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
mkdir -p public.dir
for i in $(TDATA_TO_CHECK) tzdata.zi; do \
$(zic) -v -d public.dir $$i 2>&1 || exit; \
done
$(zic) -v -d public.dir $(TDATA_TO_CHECK)
check_public: $(VERSION_DEPS)
rm -fr public.dir
mkdir public.dir
ln $(VERSION_DEPS) public.dir
cd public.dir && $(MAKE) CFLAGS='$(GCC_DEBUG_FLAGS)' ALL
for i in $(TDATA_TO_CHECK) public.dir/tzdata.zi; do \
public.dir/zic -v -d public.dir/zoneinfo $$i 2>&1 || exit; \
done
public.dir/zic -v -d public.dir/zoneinfo-all $(TDATA_TO_CHECK)
rm -fr public.dir
touch $@
# Check that the code works under various alternative
# implementations of time_t.
check_time_t_alternatives:
if diff -q Makefile Makefile 2>/dev/null; then \
quiet_option='-q'; \
else \
quiet_option=''; \
fi && \
check_time_t_alternatives: $(TIME_T_ALTERNATIVES)
$(TIME_T_ALTERNATIVES_TAIL): $(TIME_T_ALTERNATIVES_HEAD)
$(TIME_T_ALTERNATIVES): $(VERSION_DEPS)
rm -fr $@.dir
mkdir $@.dir
ln $(VERSION_DEPS) $@.dir
case $@ in \
int32_t) range=-2147483648,2147483648;; \
u*) range=0,4294967296;; \
*) range=-4294967296,4294967296;; \
esac && \
wd=`pwd` && \
zones=`$(AWK) '/^[^#]/ { print $$3 }' <zone1970.tab` && \
for type in $(TIME_T_ALTERNATIVES); do \
mkdir -p time_t.dir/$$type && \
$(MAKE) clean_misc && \
$(MAKE) TOPDIR="$$wd/time_t.dir/$$type" \
CFLAGS='$(CFLAGS) -Dtime_tz='"'$$type'" \
if test $@ = $(TIME_T_ALTERNATIVES_HEAD); then \
range_target=; \
else \
range_target=to$$range.tzs; \
fi && \
(cd $@.dir && \
$(MAKE) TOPDIR="$$wd/$@.dir" \
CFLAGS='$(CFLAGS) -Dtime_tz='"'$@'" \
REDO='$(REDO)' \
install && \
diff $$quiet_option -r \
time_t.dir/int64_t/etc \
time_t.dir/$$type/etc && \
diff $$quiet_option -r \
time_t.dir/int64_t/usr/share \
time_t.dir/$$type/usr/share && \
case $$type in \
int32_t) range=-2147483648,2147483647;; \
uint32_t) range=0,4294967296;; \
int64_t) continue;; \
*u*) range=0,10000000000;; \
*) range=-10000000000,10000000000;; \
esac && \
echo checking $$type zones ... && \
time_t.dir/int64_t/usr/bin/zdump -V -t $$range $$zones \
>time_t.dir/int64_t.out && \
time_t.dir/$$type/usr/bin/zdump -V -t $$range $$zones \
>time_t.dir/$$type.out && \
diff -u time_t.dir/int64_t.out time_t.dir/$$type.out \
|| exit; \
done
rm -fr time_t.dir
D=$$wd/$@.dir \
TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
install $$range_target) && \
test $@ = $(TIME_T_ALTERNATIVES_HEAD) || { \
(cd $(TIME_T_ALTERNATIVES_HEAD).dir && \
$(MAKE) TOPDIR="$$wd/$@.dir" \
TZS_YEAR="$$range" TZS_CUTOFF_FLAG="-t $$range" \
D=$$wd/$@.dir \
to$$range.tzs) && \
diff -u $(TIME_T_ALTERNATIVES_HEAD).dir/to$$range.tzs \
$@.dir/to$$range.tzs && \
if diff -q Makefile Makefile 2>/dev/null; then \
quiet_option='-q'; \
else \
quiet_option=''; \
fi && \
diff $$quiet_option -r $(TIME_T_ALTERNATIVES_HEAD).dir/etc \
$@.dir/etc && \
diff $$quiet_option -r \
$(TIME_T_ALTERNATIVES_HEAD).dir/usr/share \
$@.dir/usr/share; \
}
touch $@
TRADITIONAL_ASC = \
tzcode$(VERSION).tar.gz.asc \
tzdata$(VERSION).tar.gz.asc
ALL_ASC = $(TRADITIONAL_ASC) \
tzdata$(VERSION)-rearguard.tar.gz.asc \
REARGUARD_ASC = \
tzdata$(VERSION)-rearguard.tar.gz.asc
ALL_ASC = $(TRADITIONAL_ASC) $(REARGUARD_ASC) \
tzdb-$(VERSION).tar.lz.asc
tarballs traditional_tarballs signatures traditional_signatures: version
tarballs rearguard_tarballs traditional_tarballs \
signatures rearguard_signatures traditional_signatures: \
version set-timestamps.out rearguard.zi
VERSION=`cat version` && \
$(MAKE) VERSION="$$VERSION" $@_version
# These *_version rules are intended for use if VERSION is set by some
# other means. Ordinarily these rules are used only by the above
# non-_version rules, which set VERSION on the 'make' command line.
tarballs_version: traditional_tarballs_version \
tzdata$(VERSION)-rearguard.tar.gz \
tarballs_version: traditional_tarballs_version rearguard_tarballs_version \
tzdb-$(VERSION).tar.lz
rearguard_tarballs_version: \
tzdata$(VERSION)-rearguard.tar.gz
traditional_tarballs_version: \
tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz
signatures_version: $(ALL_ASC)
rearguard_signatures_version: $(REARGUARD_ASC)
traditional_signatures_version: $(TRADITIONAL_ASC)
tzcode$(VERSION).tar.gz: set-timestamps.out
@@ -958,7 +1018,7 @@ tzdata$(VERSION)-rearguard.tar.gz: rearguard.zi set-timestamps.out
gzip $(GZIPFLAGS)) >$@.out
mv $@.out $@
tzdb-$(VERSION).tar.lz: set-timestamps.out
tzdb-$(VERSION).tar.lz: set-timestamps.out set-tzs-timestamp.out
rm -fr tzdb-$(VERSION)
mkdir tzdb-$(VERSION)
ln $(ENCHILADA) tzdb-$(VERSION)
@@ -972,16 +1032,26 @@ tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz
tzdata$(VERSION)-rearguard.tar.gz.asc: tzdata$(VERSION)-rearguard.tar.gz
tzdb-$(VERSION).tar.lz.asc: tzdb-$(VERSION).tar.lz
$(ALL_ASC):
gpg --armor --detach-sign $?
gpg2 --armor --detach-sign $?
typecheck:
$(MAKE) clean
for i in "long long" unsigned; \
do \
$(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \
./zdump -v Europe/Rome ; \
$(MAKE) clean ; \
done
TYPECHECK_CFLAGS = $(CFLAGS) -DTYPECHECK -D__time_t_defined -D_TIME_T
typecheck: typecheck_long_long typecheck_unsigned
typecheck_long_long typecheck_unsigned: $(VERSION_DEPS)
rm -fr $@.dir
mkdir $@.dir
ln $(VERSION_DEPS) $@.dir
cd $@.dir && \
case $@ in \
*_long_long) i="long long";; \
*_unsigned ) i="unsigned" ;; \
esac && \
typecheck_cflags='' && \
$(MAKE) \
CFLAGS="$(TYPECHECK_CFLAGS) \"-Dtime_t=$$i\"" \
TOPDIR="`pwd`" \
install
$@.dir/zdump -i -c 1970,1971 Europe/Rome
touch $@
zonenames: tzdata.zi
@$(AWK) '/^Z/ { print $$2 } /^L/ { print $$3 }' tzdata.zi
@@ -997,14 +1067,14 @@ zic.o: private.h tzfile.h version.h
.KEEP_STATE:
.PHONY: ALL INSTALL all
.PHONY: check check_character_set check_links check_name_lengths
.PHONY: check_public check_sorted check_tables
.PHONY: check_time_t_alternatives check_tzs check_web check_white_space
.PHONY: check check_time_t_alternatives
.PHONY: check_zishrink
.PHONY: clean clean_misc dummy.zd force_tzs
.PHONY: install install_data maintainer-clean names
.PHONY: posix_only posix_packrat posix_right
.PHONY: public right_only right_posix signatures signatures_version
.PHONY: posix_only posix_packrat posix_right public
.PHONY: rearguard_signatures rearguard_signatures_version
.PHONY: rearguard_tarballs rearguard_tarballs_version
.PHONY: right_only right_posix signatures signatures_version
.PHONY: tarballs tarballs_version
.PHONY: traditional_signatures traditional_signatures_version
.PHONY: traditional_tarballs traditional_tarballs_version
+256 -90
View File
@@ -1,5 +1,171 @@
News for the tz database
Release 2018g - 2018-10-26 22:22:45 -0700
Briefly:
Morocco switches to permanent +01 on 2018-10-27.
Changes to future timestamps
Morocco switches from +00/+01 to permanent +01 effective 2018-10-27,
so its clocks will not fall back on 2018-10-28 as previously scheduled.
(Thanks to Mohamed Essedik Najd and Brian Inglis.)
Changes to code
When generating TZif files with leap seconds, zic no longer uses a
format that trips up older 32-bit clients, fixing a bug introduced
in 2018f. (Reported by Daniel Fischer.) Also, the zic workaround
for QTBUG-53071 now also works for TZif files with leap seconds.
The translator to rearguard format now rewrites the line
"Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S" to
"Rule Japan 1948 1951 - Sep Sun>=9 1:00 0 S".
This caters to zic before 2007 and to Oracle TZUpdater 2.2.0
and earlier. (Reported by Christos Zoulas.)
Changes to past time zone abbreviations
Change HDT to HWT/HPT for WWII-era abbreviations in Hawaii.
This reverts to 2011h, as the abbreviation change in 2011i was
likely inadvertent.
Changes to documentation
tzfile.5 has new sections on interoperability issues.
Release 2018f - 2018-10-18 00:14:18 -0700
Briefly:
Volgograd moves from +03 to +04 on 2018-10-28.
Fiji ends DST 2019-01-13, not 2019-01-20.
Most of Chile changes DST dates, effective 2019-04-06.
Changes to future timestamps
Volgograd moves from +03 to +04 on 2018-10-28 at 02:00.
(Thanks to Alexander Fetisov and Stepan Golosunov.)
Fiji ends DST 2019-01-13 instead of the 2019-01-20 previously
predicted. (Thanks to Raymond Kumar.) Adjust future predictions
accordingly.
Most of Chile will end DST on the first Saturday in April at 24:00 mainland
time, and resume DST on the first Saturday in September at 24:00 mainland
time. The changes are effective from 2019-04-06, and do not affect the
Magallanes region modeled by America/Punta_Arenas. (Thanks to Juan Correa
and Tim Parenti.) Adjust future predictions accordingly.
Changes to past timestamps
The 2018-05-05 North Korea 30-minute time zone change took place
at 23:30 the previous day, not at 00:00 that day.
China's 1988 spring-forward transition was on April 17, not
April 10. Its DST transitions in 1986/91 were at 02:00, not 00:00.
(Thanks to P Chan.)
Fix several issues for Macau before 1992. Macau's pre-1904 LMT
was off by 10 s. Macau switched to +08 in 1904 not 1912, and
temporarily switched to +09/+10 during World War II. Macau
observed DST in 1942/79, not 1961/80, and there were several
errors for transition times and dates. (Thanks to P Chan.)
The 1948-1951 fallback transitions in Japan were at 25:00 on
September's second Saturday, not at 24:00. (Thanks to Phake Nick.)
zic turns this into 01:00 on the day after September's second
Saturday, which is the best that POSIX or C platforms can do.
Incorporate 1940-1949 Asia/Shanghai DST transitions from a 2014
paper by Li Yu, replacing more-questionable data from Shanks.
Changes to time zone abbreviations
Use "PST" and "PDT" for Philippine time. (Thanks to Paul Goyette.)
Changes to code
zic now always generates TZif files where time type 0 is used for
timestamps before the first transition. This simplifies the
reading of TZif files and should not affect behavior of existing
TZif readers because the same set of time types is used; only
their internal indexes may have changed. This affects only the
legacy zones EST5EDT, CST6CDT, MST7MDT, PST8PDT, CET, MET, and
EET, which previously used nonzero types for these timestamps.
Because of the type 0 change, zic no longer outputs a dummy
transition at time -2**59 (before the Big Bang), as clients should
no longer need this to handle historical timestamps correctly.
This reverts a change introduced in 2013d and shrinks most TZif
files by a few bytes.
zic now supports negative time-of-day in Rule and Leap lines, e.g.,
"Rule X min max - Apr lastSun -6:00 1:00 -" means the transition
occurs at 18:00 on the Saturday before the last Sunday in April.
This behavior was documented in 2018a but the code did not
entirely match the documentation.
localtime.c no longer requires at least one time type in TZif
files that lack transitions or have a POSIX-style TZ string. This
future-proofs the code against possible future extensions to the
format that would allow TZif files with POSIX-style TZ strings and
without transitions or time types.
A read-access subscript error in localtime.c has been fixed.
It could occur only in TZif files with timecnt == 0, something that
does not happen in practice now but could happen in future versions.
localtime.c no longer ignores TZif POSIX-style TZ strings that
specify only standard time. Instead, these TZ strings now
override the default time type for timestamps after the last
transition (or for all time stamps if there are no transitions),
just as DST strings specifying DST have always done.
leapseconds.awk now outputs "#updated" and "#expires" comments,
and supports leap seconds at the ends of months other than June
and December. (Inspired by suggestions from Chris Woodbury.)
Changes to documentation
New restrictions: A Rule name must start with a character that
is neither an ASCII digit nor "-" nor "+", and an unquoted name
should not use characters in the set "!$%&'()*,/:;<=>?@[\]^`{|}~".
The latter restriction makes room for future extensions (a
possibility noted by Tom Lane).
tzfile.5 now documents what time types apply before the first and
after the last transition, if any.
Documentation now uses the spelling "timezone" for a TZ setting
that determines timestamp history, and "time zone" for a
geographic region currently sharing the same standard time.
The name "TZif" is now used for the tz binary data format.
tz-link.htm now mentions the A0 TimeZone Migration utilities.
(Thanks to Aldrin Martoq for the link.)
Changes to build procedure
New 'make' target 'rearguard_tarballs' to build the rearguard
tarball only. This is a convenience on platforms that lack lzip
if you want to build the rearguard tarball. (Problem reported by
Deborah Goldsmith.)
tzdata.zi is now more stable from release to release. (Problem
noted by Tom Lane.) It is also a bit shorter.
tzdata.zi now can contain comment lines documenting configuration
information, such as which data format was selected, which input
files were used, and how leap seconds are treated. (Problems
noted by Lester Caine and Brian Inglis.) If the Makefile defaults
are used these comment lines are absent, for backward
compatibility. A redistributor intending to alter its copy of the
files should also append "-LABEL" to the 'version' file's first
line, where "LABEL" identifies the redistributor's change.
Release 2018e - 2018-05-01 23:42:51 -0700
Briefly:
@@ -9,7 +175,7 @@ Release 2018e - 2018-05-01 23:42:51 -0700
'make tarballs' now also builds a rearguard tarball.
New 's' and 'd' suffixes in SAVE columns of Rule and Zone lines.
Changes to past and future time stamps
Changes to past and future timestamps
North Korea switches back from +0830 to +09 on 2018-05-05.
(Thanks to Kang Seonghoon, Arthur David Olson, Seo Sanghyeon,
@@ -17,9 +183,9 @@ Release 2018e - 2018-05-01 23:42:51 -0700
Bring back the negative-DST changes of 2018a, except be more
compatible with data parsers that do not support negative DST.
Also, this now affects historical time stamps in Namibia and the
Also, this now affects historical timestamps in Namibia and the
former Czechoslovakia, not just Ireland. The main format now uses
negative DST to model time stamps in Europe/Dublin (from 1971 on),
negative DST to model timestamps in Europe/Dublin (from 1971 on),
Europe/Prague (1946/7), and Africa/Windhoek (1994/2017). This
does not affect UT offsets, only time zone abbreviations and the
tm_isdst flag. Also, this does not affect rearguard or vanguard
@@ -44,7 +210,7 @@ Release 2018e - 2018-05-01 23:42:51 -0700
in tzdata, it could be used to specify the legal time in Namibia
1994-2017, as opposed to the popular time (see below).
Changes to past time stamps
Changes to past timestamps
From 1994 through 2017 Namibia observed DST in winter, not summer.
That is, it used negative DST, as Ireland still does. This change
@@ -54,12 +220,12 @@ Release 2018e - 2018-05-01 23:42:51 -0700
both simply called "standard time" in Namibian law, in common
practice winter time was considered to be DST (as noted by Stephen
Colebourne). The full effect of this change is only in vanguard
format; in rearguard and main format, the tm_isdst flag is still
and main format; in rearguard format, the tm_isdst flag is still
zero in winter and nonzero in summer.
In 1946/7 Czechoslovakia also observed negative DST in winter.
The full effect of this change is only in vanguard format; in
rearguard and main formats, it is modeled as plain GMT without
The full effect of this change is only in vanguard and main
formats; in rearguard format, it is modeled as plain GMT without
daylight saving. Also, the dates of some 1944/5 DST transitions
in Czechoslovakia have been changed.
@@ -72,17 +238,17 @@ Release 2018d - 2018-03-22 07:05:46 -0700
Add support for vanguard and rearguard data consumers.
Add subsecond precision to source data format, though not to data.
Changes to future time stamps
Changes to future timestamps
In 2018, Palestine starts DST on March 24, not March 31.
Adjust future predictions accordingly. (Thanks to Sharef Mustafa.)
Changes to past and future time stamps
Changes to past and future timestamps
Casey Station in Antarctica changed from +11 to +08 on 2018-03-11
at 04:00. (Thanks to Steffen Thorsen.)
Changes to past time stamps
Changes to past timestamps
Historical transitions for Uruguay, represented by
America/Montevideo, have been updated per official legal documents,
@@ -224,7 +390,7 @@ Release 2018c - 2018-01-22 23:00:44 -0800
change is reapplied. (Problems reported by Deborah Goldsmith and
Stephen Colebourne.)
Changes to past time stamps
Changes to past timestamps
Japanese DST transitions (1948-1951) were Sundays at 00:00, not
Saturdays or Sundays at 02:00. (Thanks to Takayuki Nikai.)
@@ -256,18 +422,18 @@ Release 2018a - 2018-01-12 22:29:21 -0800
Use Debian-style installation locations, instead of 4.3BSD-style.
New zic option -t.
Changes to past and future time stamps
Changes to past and future timestamps
São Tomé and Príncipe switched from +00 to +01 on 2018-01-01 at
01:00. (Thanks to Steffen Thorsen and Michael Deckers.)
Changes to future time stamps
Changes to future timestamps
Starting in 2018 southern Brazil will begin DST on November's
first Sunday instead of October's third Sunday. (Thanks to
Steffen Thorsen.)
Changes to past time stamps
Changes to past timestamps
A discrepancy of 4 s in timestamps before 1931 in South Sudan has
been corrected. The 'backzone' and 'zone.tab' files did not agree
@@ -355,7 +521,7 @@ Release 2017c - 2017-10-20 14:49:34 -0700
A new file tzdata.zi now holds a small text copy of all data.
The zic input format has been regularized slightly.
Changes to future time stamps
Changes to future timestamps
Northern Cyprus has decided to resume EU rules starting
2017-10-29, thus reinstituting winter time.
@@ -381,7 +547,7 @@ Release 2017c - 2017-10-20 14:49:34 -0700
2018-03-11 at 03:00. This affects UT offsets starting 2018-11-04
at 02:00. (Thanks to Steffen Thorsen.)
Changes to past time stamps
Changes to past timestamps
Namibia switched from +02 to +01 on 1994-03-21, not 1994-04-03.
(Thanks to Arthur David Olson.)
@@ -511,11 +677,11 @@ Release 2017b - 2017-03-17 07:30:38 -0700
Briefly: Haiti has resumed DST.
Changes to past and future time stamps
Changes to past and future timestamps
Haiti resumed observance of DST in 2017. (Thanks to Steffen Thorsen.)
Changes to past time stamps
Changes to past timestamps
Liberia changed from -004430 to +00 on 1972-01-07, not 1972-05-01.
@@ -527,7 +693,7 @@ Release 2017b - 2017-03-17 07:30:38 -0700
The reference localtime implementation now falls back on the
current US daylight-saving transition rules rather than the
1987-2006 rules. This fallback occurs only when (1) the TZ
environment variable's value has a name like "AST4ADT" that asks
environment variable has a value like "AST4ADT" that asks
for daylight saving time but does not specify the rules, (2) there
is no file by that name, and (3) the TZDEFRULES file cannot be
loaded. (Thanks to Tom Lane.)
@@ -538,7 +704,7 @@ Release 2017a - 2017-02-28 00:05:36 -0800
Briefly: Southern Chile moves from -04/-03 to -03, and Mongolia
discontinues DST.
Changes to future time stamps
Changes to future timestamps
Mongolia no longer observes DST. (Thanks to Ganbold Tsagaankhuu.)
@@ -549,12 +715,12 @@ Release 2017a - 2017-02-28 00:05:36 -0800
assume it's permanent. (Thanks to Juan Correa and Deborah
Goldsmith.) This also affects Antarctica/Palmer.
Changes to past time stamps
Changes to past timestamps
Fix many entries for historical time stamps for Europe/Madrid
Fix many entries for historical timestamps for Europe/Madrid
before 1979, to agree with tables compiled by Pere Planesas of the
National Astronomical Observatory of Spain. As a side effect,
this changes some time stamps for Africa/Ceuta before 1929, which
this changes some timestamps for Africa/Ceuta before 1929, which
are probably guesswork anyway. (Thanks to Steve Allen and
Pierpaolo Bernardi for the heads-ups, and to Michael Deckers for
correcting the 1901 transition.)
@@ -645,13 +811,13 @@ Release 2016j - 2016-11-22 23:17:13 -0800
Briefly: Saratov, Russia moves from +03 to +04 on 2016-12-04.
Changes to future time stamps
Changes to future timestamps
Saratov, Russia switches from +03 to +04 on 2016-12-04 at 02:00.
This hives off a new zone Europe/Saratov from Europe/Volgograd.
(Thanks to Yuri Konotopov and Stepan Golosunov.)
Changes to past time stamps
Changes to past timestamps
The new zone Asia/Atyrau for Atyraū Region, Kazakhstan, is like
Asia/Aqtau except it switched from +05/+06 to +04/+05 in spring
@@ -687,7 +853,7 @@ Release 2016i - 2016-11-01 23:19:52 -0700
Briefly: Cyprus split into two time zones on 2016-10-30, and Tonga
reintroduces DST on 2016-11-06.
Changes to future time stamps
Changes to future timestamps
Pacific/Tongatapu begins DST on 2016-11-06 at 02:00, ending on
2017-01-15 at 03:00. Assume future observances in Tonga will be
@@ -695,7 +861,7 @@ Release 2016i - 2016-11-01 23:19:52 -0700
January, like Fiji. (Thanks to Pulu ʻAnau.) Switch to numeric
time zone abbreviations for this zone.
Changes to past and future time stamps
Changes to past and future timestamps
Northern Cyprus is now +03 year round, causing a split in Cyprus
time zones starting 2016-10-30 at 04:00. This creates a zone
@@ -704,9 +870,9 @@ Release 2016i - 2016-11-01 23:19:52 -0700
Antarctica/Casey switched from +08 to +11 on 2016-10-22.
(Thanks to Steffen Thorsen.)
Changes to past time stamps
Changes to past timestamps
Several corrections were made for pre-1975 time stamps in Italy.
Several corrections were made for pre-1975 timestamps in Italy.
These affect Europe/Malta, Europe/Rome, Europe/San_Marino, and
Europe/Vatican.
@@ -744,7 +910,7 @@ Release 2016i - 2016-11-01 23:19:52 -0700
Release 2016h - 2016-10-19 23:17:57 -0700
Changes to future time stamps
Changes to future timestamps
Asia/Gaza and Asia/Hebron end DST on 2016-10-29 at 01:00, not
2016-10-21 at 00:00. (Thanks to Sharef Mustafa.) Predict that
@@ -752,7 +918,7 @@ Release 2016h - 2016-10-19 23:17:57 -0700
at 01:00, which is consistent with predicted spring transitions
on the last Saturday of March. (Thanks to Tim Parenti.)
Changes to past time stamps
Changes to past timestamps
In Turkey, transitions in 1986-1990 were at 01:00 standard time
not at 02:00, and the spring 1994 transition was on March 20, not
@@ -801,7 +967,7 @@ Release 2016h - 2016-10-19 23:17:57 -0700
Release 2016g - 2016-09-13 08:56:38 -0700
Changes to future time stamps
Changes to future timestamps
Turkey switched from EET/EEST (+02/+03) to permanent +03,
effective 2016-09-07. (Thanks to Burak AYDIN.) Use "+03" rather
@@ -810,7 +976,7 @@ Release 2016g - 2016-09-13 08:56:38 -0700
New leap second 2016-12-31 23:59:60 UTC as per IERS Bulletin C 52.
(Thanks to Tim Parenti.)
Changes to past time stamps
Changes to past timestamps
For America/Los_Angeles, spring-forward transition times have been
corrected from 02:00 to 02:01 in 1948, and from 02:00 to 01:00 in
@@ -859,9 +1025,9 @@ Release 2016g - 2016-09-13 08:56:38 -0700
zic no longer generates binary files containing POSIX TZ-like
strings that disagree with the local time type after the last
explicit transition in the data. This fixes a bug with
Africa/Casablanca and Africa/El_Aaiun in some year-2037 time
stamps on the reference platform. (Thanks to Alexander Belopolsky
for reporting the bug and suggesting a way forward.)
Africa/Casablanca and Africa/El_Aaiun in some year-2037 timestamps
on the reference platform. (Thanks to Alexander Belopolsky for
reporting the bug and suggesting a way forward.)
If the installed localtime and/or posixrules files are symbolic
links, zic now keeps them symbolic links when updating them, for
@@ -924,7 +1090,7 @@ Release 2016g - 2016-09-13 08:56:38 -0700
Release 2016f - 2016-07-05 16:26:51 +0200
Changes affecting future time stamps
Changes affecting future timestamps
The Egyptian government changed its mind on short notice, and
Africa/Cairo will not introduce DST starting 2016-07-07 after all.
@@ -933,12 +1099,12 @@ Release 2016f - 2016-07-05 16:26:51 +0200
Asia/Novosibirsk switches from +06 to +07 on 2016-07-24 at 02:00.
(Thanks to Stepan Golosunov.)
Changes to past and future time stamps
Changes to past and future timestamps
Asia/Novokuznetsk and Asia/Novosibirsk now use numeric time zone
abbreviations instead of invented ones.
Changes affecting past time stamps
Changes affecting past timestamps
Europe/Minsk's 1992-03-29 spring-forward transition was at 02:00 not 00:00.
(Thanks to Stepan Golosunov.)
@@ -946,14 +1112,14 @@ Release 2016f - 2016-07-05 16:26:51 +0200
Release 2016e - 2016-06-14 08:46:16 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Africa/Cairo observes DST in 2016 from July 7 to the end of October.
Guess October 27 and 24:00 transitions. (Thanks to Steffen Thorsen.)
For future years, guess April's last Thursday to October's last
Thursday except for Ramadan.
Changes affecting past time stamps
Changes affecting past timestamps
Locations while uninhabited now use '-00', not 'zzz', as a
placeholder time zone abbreviation. This is inspired by Internet
@@ -982,7 +1148,7 @@ Release 2016e - 2016-06-14 08:46:16 -0700
Release 2016d - 2016-04-17 22:50:29 -0700
Changes affecting future time stamps
Changes affecting future timestamps
America/Caracas switches from -0430 to -04 on 2016-05-01 at 02:30.
(Thanks to Alexander Krivenyshev for the heads-up.)
@@ -994,7 +1160,7 @@ Release 2016d - 2016-04-17 22:50:29 -0700
Tomsk Oblast, Russia, which switches from +06 to +07 on 2016-05-29
at 02:00. (Thanks to Stepan Golosunov.)
Changes affecting past time stamps
Changes affecting past timestamps
New zone Europe/Kirov, split off from Europe/Volgograd. It covers
Kirov Oblast, Russia, which switched from +04/+05 to +03/+04 on
@@ -1017,7 +1183,7 @@ Release 2016d - 2016-04-17 22:50:29 -0700
Release 2016c - 2016-03-23 00:51:27 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Azerbaijan no longer observes DST. (Thanks to Steffen Thorsen.)
@@ -1028,7 +1194,7 @@ Release 2016c - 2016-03-23 00:51:27 -0700
2014-09-07 through 2016-05-14 daylight saving time instead of
standard time, as that seems more appropriate now.
Changes affecting past time stamps
Changes affecting past timestamps
Europe/Kaliningrad and Europe/Vilnius changed from +03/+04 to
+02/+03 on 1989-03-26, not 1991-03-31. Europe/Volgograd changed
@@ -1053,7 +1219,7 @@ Release 2016b - 2016-03-12 17:30:14 -0800
POSIX.1-1988 that was removed in POSIX.1-2001. One way to suppress the
warnings is to upgrade to zic derived from tz releases 2015f and later.
Changes affecting future time stamps
Changes affecting future timestamps
New zones Europe/Astrakhan and Europe/Ulyanovsk for Astrakhan and
Ulyanovsk Oblasts, Russia, both of which will switch from +03 to +04 on
@@ -1077,7 +1243,7 @@ Release 2016b - 2016-03-12 17:30:14 -0800
(Thanks to Hannah Kreitem.) Guess future transitions will be March's last
Saturday at 01:00, not March's last Friday at 24:00.
Changes affecting past time stamps
Changes affecting past timestamps
Europe/Chisinau observed DST during 1990, and switched from +04 to
+03 at 1990-05-06 02:00, instead of switching from +03 to +02.
@@ -1112,7 +1278,7 @@ Release 2016b - 2016-03-12 17:30:14 -0800
Release 2016a - 2016-01-26 23:28:02 -0800
Changes affecting future time stamps
Changes affecting future timestamps
America/Cayman will not observe daylight saving this year after all.
Revert our guess that it would. (Thanks to Matt Johnson.)
@@ -1124,7 +1290,7 @@ Release 2016a - 2016-01-26 23:28:02 -0800
to be March 21 00:00 to September 21 00:00. This is likely better
than predicting no DST, albeit off by a day every now and then.
Changes affecting past and future time stamps
Changes affecting past and future timestamps
America/Metlakatla switched from PST all year to AKST/AKDT on
2015-11-01 at 02:00. (Thanks to Steffen Thorsen.)
@@ -1133,7 +1299,7 @@ Release 2016a - 2016-01-26 23:28:02 -0800
backward compatibility link to America/Tijuana. Its contents were
apparently based on a misreading of Mexican legislation.
Changes affecting past time stamps
Changes affecting past timestamps
Asia/Karachi's two transition times in 2002 were off by a minute.
(Thanks to Matt Johnson.)
@@ -1167,7 +1333,7 @@ Release 2016a - 2016-01-26 23:28:02 -0800
Release 2015g - 2015-10-01 00:39:51 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Turkey's 2015 fall-back transition is scheduled for Nov. 8, not Oct. 25.
(Thanks to Fatih.)
@@ -1182,7 +1348,7 @@ Release 2015g - 2015-10-01 00:39:51 -0700
effectively been on MST (-0700) since it advanced its clocks on 2015-03-08.
New zone America/Fort_Nelson. (Thanks to Matt Johnson.)
Changes affecting past time stamps
Changes affecting past timestamps
Norfolk observed DST from 1974-10-27 02:00 to 1975-03-02 02:00.
@@ -1212,7 +1378,7 @@ Release 2015g - 2015-10-01 00:39:51 -0700
Release 2015f - 2015-08-10 18:06:56 -0700
Changes affecting future time stamps
Changes affecting future timestamps
North Korea switches to +0830 on 2015-08-15. (Thanks to Steffen Thorsen.)
The abbreviation remains "KST". (Thanks to Robert Elz.)
@@ -1220,7 +1386,7 @@ Release 2015f - 2015-08-10 18:06:56 -0700
Uruguay no longer observes DST. (Thanks to Steffen Thorsen
and Pablo Camargo.)
Changes affecting past and future time stamps
Changes affecting past and future timestamps
Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC.
(Thanks to Roman Tudos.)
@@ -1279,7 +1445,7 @@ Release 2015f - 2015-08-10 18:06:56 -0700
Release 2015e - 2015-06-13 10:56:02 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Morocco will suspend DST from 2015-06-14 03:00 through 2015-07-19 02:00,
not 06-13 and 07-18 as we had guessed. (Thanks to Milamber.)
@@ -1307,13 +1473,13 @@ Release 2015e - 2015-06-13 10:56:02 -0700
Release 2015d - 2015-04-24 08:09:46 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Egypt will not observe DST in 2015 and will consider canceling it
permanently. For now, assume no DST indefinitely.
(Thanks to Ahmed Nazmy and Tim Parenti.)
Changes affecting past time stamps
Changes affecting past timestamps
America/Whitehorse switched from UT -09 to -08 on 1967-05-28, not
1966-07-01. Also, Yukon's time zone history is documented better.
@@ -1333,16 +1499,16 @@ Release 2015d - 2015-04-24 08:09:46 -0700
Release 2015c - 2015-04-11 08:55:55 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Egypt's spring-forward transition is at 24:00 on April's last Thursday,
not 00:00 on April's last Friday. 2015's transition will therefore be on
Thursday, April 30 at 24:00, not Friday, April 24 at 00:00. Similar fixes
apply to 2026, 2037, 2043, etc. (Thanks to Steffen Thorsen.)
Changes affecting past time stamps
Changes affecting past timestamps
The following changes affect some pre-1991 Chile-related time stamps
The following changes affect some pre-1991 Chile-related timestamps
in America/Santiago, Antarctica/Palmer, and Pacific/Easter.
The 1910 transition was January 10, not January 1.
@@ -1367,8 +1533,8 @@ Release 2015c - 2015-04-11 08:55:55 -0700
since we have no data suggesting that they existed.
One more zone has been turned into a link, as it differed
from an existing zone only for older time stamps. As usual,
this change affects UT offsets in pre-1970 time stamps only.
from an existing zone only for older timestamps. As usual,
this change affects UT offsets in pre-1970 timestamps only.
The zone's old contents have been moved to the 'backzone' file.
The affected zone is America/Montreal.
@@ -1381,7 +1547,7 @@ Release 2015c - 2015-04-11 08:55:55 -0700
Release 2015b - 2015-03-19 23:28:11 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Mongolia will start observing DST again this year, from the last
Saturday in March at 02:00 to the last Saturday in September at 00:00.
@@ -1391,14 +1557,14 @@ Release 2015b - 2015-03-19 23:28:11 -0700
correct the fall 2014 transition from September 26 to October 24.
Adjust future predictions accordingly. (Thanks to Steffen Thorsen.)
Changes affecting past time stamps
Changes affecting past timestamps
The 1982 zone shift in Pacific/Easter has been corrected, fixing a 2015a
regression. (Thanks to Stuart Bishop for reporting the problem.)
Some more zones have been turned into links, when they differed
from existing zones only for older time stamps. As usual,
these changes affect UT offsets in pre-1970 time stamps only.
from existing zones only for older timestamps. As usual,
these changes affect UT offsets in pre-1970 timestamps only.
Their old contents have been moved to the 'backzone' file.
The affected zones are: America/Antigua, America/Cayman,
Pacific/Midway, and Pacific/Saipan.
@@ -1429,7 +1595,7 @@ Release 2015b - 2015-03-19 23:28:11 -0700
Release 2015a - 2015-01-29 22:35:20 -0800
Changes affecting future time stamps
Changes affecting future timestamps
The Mexican state of Quintana Roo, represented by America/Cancun,
will shift from Central Time with DST to Eastern Time without DST
@@ -1442,15 +1608,15 @@ Release 2015a - 2015-01-29 22:35:20 -0800
New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49.
(Thanks to Tim Parenti.)
Changes affecting past time stamps
Changes affecting past timestamps
Iceland observed DST in 1919 and 1921, and its 1939 fallback
transition was Oct. 29, not Nov. 29. Remove incorrect data from
Shanks about time in Iceland between 1837 and 1908.
Some more zones have been turned into links, when they differed
from existing zones only for older time stamps. As usual,
these changes affect UT offsets in pre-1970 time stamps only.
from existing zones only for older timestamps. As usual,
these changes affect UT offsets in pre-1970 timestamps only.
Their old contents have been moved to the 'backzone' file.
The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait,
and Asia/Muscat.
@@ -1481,23 +1647,23 @@ Release 2015a - 2015-01-29 22:35:20 -0800
Release 2014j - 2014-11-10 17:37:11 -0800
Changes affecting current and future time stamps
Changes affecting current and future timestamps
Turks & Caicos' switch from US eastern time to UT -04 year-round
did not occur on 2014-11-02 at 02:00. It's currently scheduled
for 2015-11-01 at 02:00. (Thanks to Chris Walton.)
Changes affecting past time stamps
Changes affecting past timestamps
Many pre-1989 time stamps have been corrected for Asia/Seoul and
Many pre-1989 timestamps have been corrected for Asia/Seoul and
Asia/Pyongyang, based on sources for the Korean-language Wikipedia
entry for time in Korea. (Thanks to Sanghyuk Jung.) Also, no
longer guess that Pyongyang mimicked Seoul time after World War II,
as this is politically implausible.
Some more zones have been turned into links, when they differed
from existing zones only for older time stamps. As usual,
these changes affect UT offsets in pre-1970 time stamps only.
from existing zones only for older timestamps. As usual,
these changes affect UT offsets in pre-1970 timestamps only.
Their old contents have been moved to the 'backzone' file.
The affected zones are: Africa/Addis_Ababa, Africa/Asmara,
Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala,
@@ -1512,7 +1678,7 @@ Release 2014j - 2014-11-10 17:37:11 -0800
Release 2014i - 2014-10-21 22:04:57 -0700
Changes affecting future time stamps
Changes affecting future timestamps
Pacific/Fiji will observe DST from 2014-11-02 02:00 to 2015-01-18 03:00.
(Thanks to Ken Rylander for the heads-up.) Guess that future
@@ -1532,17 +1698,17 @@ Release 2014i - 2014-10-21 22:04:57 -0700
The new abbreviation IDT stands for the pre-1976 use of UT +08 in
Indochina, to distinguish it better from ICT (+07).
Changes affecting past time stamps
Changes affecting past timestamps
Many time stamps have been corrected for Asia/Ho_Chi_Minh before 1976
Many timestamps have been corrected for Asia/Ho_Chi_Minh before 1976
(thanks to Trần Ngọc Quân for an indirect pointer to Trần Tiến Bình's
authoritative book). Asia/Ho_Chi_Minh has been added to
zone1970.tab, to give tzselect users in Vietnam two choices,
since north and south Vietnam disagreed after our 1970 cutoff.
Asia/Phnom_Penh and Asia/Vientiane have been turned into links, as
they differed from existing zones only for older time stamps. As
usual, these changes affect pre-1970 time stamps only. Their old
they differed from existing zones only for older timestamps. As
usual, these changes affect pre-1970 timestamps only. Their old
contents have been moved to the 'backzone' file.
Changes affecting code
@@ -1682,7 +1848,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700
Unless NETBSD_INSPIRED is defined to 0, the tz library now
supplies functions for creating and using objects that represent
time zones. The new functions are tzalloc, tzfree, localtime_rz,
timezones. The new functions are tzalloc, tzfree, localtime_rz,
mktime_z, and (if STD_INSPIRED is also defined) posix2time_z and
time2posix_z. They are intended for performance: for example,
localtime_rz (unlike localtime_r) is trivially thread-safe without
@@ -1696,7 +1862,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700
TZDOBJS=zdump.o CHECK_TIME_T_ALTERNATIVES='.
zdump now uses localtime_rz if available, as it's significantly faster,
and it can help zdump better diagnose invalid time zone names.
and it can help zdump better diagnose invalid timezone names.
Define HAVE_LOCALTIME_RZ to 0 to suppress this. HAVE_LOCALTIME_RZ
defaults to 1 if NETBSD_INSPIRED && USE_LTZ. When localtime_rz is
not available, zdump now uses localtime_r and tzset if available,
@@ -1712,7 +1878,7 @@ Release 2014g - 2014-08-28 12:31:23 -0700
invalid or outlandish input.
The tz library no longer mishandles leap seconds on platforms with
unsigned time_t in time zones that lack ordinary transitions after 1970.
unsigned time_t in timezones that lack ordinary transitions after 1970.
The tz code now attempts to infer TM_GMTOFF and TM_ZONE if not
already defined, to make it easier to configure on common platforms.
@@ -2036,8 +2202,8 @@ Release 2014d - 2014-05-27 21:34:40 -0700
Changes affecting code
zic no longer generates files containing timestamps before the Big Bang.
This works around GNOME bug 730332
<https://bugzilla.gnome.org/show_bug.cgi?id=730332>.
This works around GNOME glib bug 878
<https://gitlab.gnome.org/GNOME/glib/issues/878>
(Thanks to Leonardo Chiquitto for reporting the bug, and to
Arthur David Olson and James Cloos for suggesting improvements to the fix.)
@@ -3490,7 +3656,7 @@ Release 2005j - 2005-06-13 14:34:13 -0400
These reflect changes to limit the length of time zone abbreviations
and the characters used in those abbreviations.
There are also changes to handle POSIX-style "quoted" time zone
There are also changes to handle POSIX-style "quoted" timezone
environment variables.
The changes were circulated on the time zone mailing list; the only
@@ -3816,7 +3982,7 @@ Release 1999f - 1999-09-23 09:48:14 -0400
Release 1999e - 1999-08-17 15:20:54 -0400
changes circulated by Paul Eggert, although the change to handling
of DST-specifying time zone names has been commented out for now
of DST-specifying timezone names has been commented out for now
(search for "XXX" in "localtime.c" for details). These files also
do not make any changes to the start of DST in Brazil.
@@ -3941,7 +4107,7 @@ Release code1997i-data1997k - 1997-12-29 09:53:41 -0500
Release code1997h-data1997j - 1997-12-18 17:47:35 -0500
minor changes to put "TZif" at the start of each time zone information file
minor changes to put "TZif" at the start of each timezone information file
a rule has also been added to the Makefile so you can
make zones
@@ -4451,8 +4617,8 @@ consisting of a single tarball tzdb-R.tar.lz with extra data.
Release timestamps are taken from the release's commit (for newer,
Git-based releases), from the newest file in the tarball (for older
releases, where this info is available) or from the email announcing
the release (if all else fails; these are marked with a time zone of
-0000 and an "is missing!" comment).
the release (if all else fails; these are marked with a time zone
abbreviation of -0000 and an "is missing!" comment).
Earlier versions of the code and data were not announced on the tz
list and are not summarized here.
+7 -9
View File
@@ -4,7 +4,7 @@ README for the tz distribution
"Any time you want it to be." -- Frank Baxter as The Scientist
(from the Bell System film "About Time")
The Time Zone Database (often called tz or zoneinfo) contains code and
The Time Zone Database (called tz, tzdb or zoneinfo) contains code and
data that represent the history of local time for many representative
locations around the globe. It is updated periodically to reflect
changes made by political bodies to time zone boundaries, UTC offsets,
@@ -20,17 +20,15 @@ substituting your desired installation directory for "$HOME/tzdir":
make TOPDIR=$HOME/tzdir install
$HOME/tzdir/usr/bin/zdump -v America/Los_Angeles
Historical local time information has been included here to:
This database of historical local time information has several goals:
* provide a compendium of data about the history of civil time
that is useful even if not 100% accurate;
* Provide a compendium of data about the history of civil time that
is useful even if not 100% accurate.
* give an idea of the variety of local time rules that have
existed in the past and thus an idea of the variety that may be
expected in the future;
* Give an idea of the variety of local time rules that have existed
in the past and thus may be expected in the future.
* provide a test of the generality of the local time rule description
system.
* Test the generality of the local time rule description system.
The information in the time zone data files is by no means authoritative;
fixes and enhancements are welcome. Please see the file CONTRIBUTING
+50 -71
View File
@@ -1,3 +1,5 @@
# tzdb data for Africa and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -6,7 +8,7 @@
# [email protected] for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2017-04-09):
# From Paul Eggert (2018-05-27):
#
# Unless otherwise specified, the source for data through 1990 is:
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
@@ -51,13 +53,15 @@
# I vaguely recall 'WAT' also being used for -01 in the past but
# cannot now come up with solid citations.
#
# I invented the following abbreviations; corrections are welcome!
# +02 WAST West Africa Summer Time (no longer used)
# +03 CAST Central Africa Summer Time (no longer used)
# +03 SAST South Africa Summer Time (no longer used)
# I invented the following abbreviations in the 1990s:
# +02 WAST West Africa Summer Time
# +03 CAST Central Africa Summer Time
# +03 SAST South Africa Summer Time
# +03 EAT East Africa Time
# 'EAT' also seems to have caught on; the others are rare but are paired
# with better-attested non-DST abbreviations.
# 'EAT' seems to have caught on and is in current timestamps, and though
# the other abbreviations are rarer and are only in past timestamps,
# they are paired with better-attested non-DST abbreviations.
# Corrections are welcome.
# Algeria
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
@@ -362,6 +366,13 @@ Zone Africa/Cairo 2:05:09 - LMT 1900 Oct
# Eritrea
# Ethiopia
# See Africa/Nairobi.
#
# Unfortunately tzdb records only Western clock time in use in Ethiopia,
# as the tzdb format is not up to properly recording a common Ethiopian
# timekeeping practice that is based on solar time. See:
# Mortada D. If you have a meeting in Ethiopia, you'd better double
# check the time. PRI's The World. 2015-01-30 15:15 -05.
# https://www.pri.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time
# Gabon
# See Africa/Lagos.
@@ -833,94 +844,61 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
# <https://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
# with the patch.
# From Paul Eggert (2015-06-08):
# For now, guess that later spring and fall transitions will use 2015's rules,
# and guess that Morocco will switch to standard time at 03:00 the last
# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
# Ramadan. To implement this, transition dates for 2016 through 2037 were
# determined by running the following program under GNU Emacs 24.3, with the
# results integrated by hand into the table below.
# (let ((islamic-year 1437))
# (require 'cal-islam)
# (while (< islamic-year 1460)
# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
# (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
# (sunday 0))
# (while (/= sunday (mod (setq a (1- a)) 7)))
# (while (/= sunday (mod b 7))
# (setq b (1+ b)))
# (setq a (calendar-gregorian-from-absolute a))
# (setq b (calendar-gregorian-from-absolute b))
# (insert
# (format
# (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n"
# "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n")
# (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
# (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)))))
# (setq islamic-year (+ 1 islamic-year))))
# From Mohamed Essedik Najd (2018-10-26):
# Today, a Moroccan government council approved the perpetual addition
# of 60 minutes to the regular Moroccan timezone.
# From Brian Inglis (2018-10-26):
# http://www.maroc.ma/fr/actualites/le-conseil-de-gouvernement-adopte-un-projet-de-decret-relatif-lheure-legale-stipulant-le
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Morocco 1939 only - Sep 12 0:00 1:00 S
Rule Morocco 1939 only - Sep 12 0:00 1:00 -
Rule Morocco 1939 only - Nov 19 0:00 0 -
Rule Morocco 1940 only - Feb 25 0:00 1:00 S
Rule Morocco 1940 only - Feb 25 0:00 1:00 -
Rule Morocco 1945 only - Nov 18 0:00 0 -
Rule Morocco 1950 only - Jun 11 0:00 1:00 S
Rule Morocco 1950 only - Jun 11 0:00 1:00 -
Rule Morocco 1950 only - Oct 29 0:00 0 -
Rule Morocco 1967 only - Jun 3 12:00 1:00 S
Rule Morocco 1967 only - Jun 3 12:00 1:00 -
Rule Morocco 1967 only - Oct 1 0:00 0 -
Rule Morocco 1974 only - Jun 24 0:00 1:00 S
Rule Morocco 1974 only - Jun 24 0:00 1:00 -
Rule Morocco 1974 only - Sep 1 0:00 0 -
Rule Morocco 1976 1977 - May 1 0:00 1:00 S
Rule Morocco 1976 1977 - May 1 0:00 1:00 -
Rule Morocco 1976 only - Aug 1 0:00 0 -
Rule Morocco 1977 only - Sep 28 0:00 0 -
Rule Morocco 1978 only - Jun 1 0:00 1:00 S
Rule Morocco 1978 only - Jun 1 0:00 1:00 -
Rule Morocco 1978 only - Aug 4 0:00 0 -
Rule Morocco 2008 only - Jun 1 0:00 1:00 S
Rule Morocco 2008 only - Jun 1 0:00 1:00 -
Rule Morocco 2008 only - Sep 1 0:00 0 -
Rule Morocco 2009 only - Jun 1 0:00 1:00 S
Rule Morocco 2009 only - Jun 1 0:00 1:00 -
Rule Morocco 2009 only - Aug 21 0:00 0 -
Rule Morocco 2010 only - May 2 0:00 1:00 S
Rule Morocco 2010 only - May 2 0:00 1:00 -
Rule Morocco 2010 only - Aug 8 0:00 0 -
Rule Morocco 2011 only - Apr 3 0:00 1:00 S
Rule Morocco 2011 only - Apr 3 0:00 1:00 -
Rule Morocco 2011 only - Jul 31 0:00 0 -
Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 S
Rule Morocco 2012 2013 - Apr lastSun 2:00 1:00 -
Rule Morocco 2012 only - Jul 20 3:00 0 -
Rule Morocco 2012 only - Aug 20 2:00 1:00 S
Rule Morocco 2012 only - Aug 20 2:00 1:00 -
Rule Morocco 2012 only - Sep 30 3:00 0 -
Rule Morocco 2013 only - Jul 7 3:00 0 -
Rule Morocco 2013 only - Aug 10 2:00 1:00 S
Rule Morocco 2013 max - Oct lastSun 3:00 0 -
Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S
Rule Morocco 2013 only - Aug 10 2:00 1:00 -
Rule Morocco 2013 2018 - Oct lastSun 3:00 0 -
Rule Morocco 2014 2018 - Mar lastSun 2:00 1:00 -
Rule Morocco 2014 only - Jun 28 3:00 0 -
Rule Morocco 2014 only - Aug 2 2:00 1:00 S
Rule Morocco 2014 only - Aug 2 2:00 1:00 -
Rule Morocco 2015 only - Jun 14 3:00 0 -
Rule Morocco 2015 only - Jul 19 2:00 1:00 S
Rule Morocco 2015 only - Jul 19 2:00 1:00 -
Rule Morocco 2016 only - Jun 5 3:00 0 -
Rule Morocco 2016 only - Jul 10 2:00 1:00 S
Rule Morocco 2016 only - Jul 10 2:00 1:00 -
Rule Morocco 2017 only - May 21 3:00 0 -
Rule Morocco 2017 only - Jul 2 2:00 1:00 S
Rule Morocco 2017 only - Jul 2 2:00 1:00 -
Rule Morocco 2018 only - May 13 3:00 0 -
Rule Morocco 2018 only - Jun 17 2:00 1:00 S
Rule Morocco 2019 only - May 5 3:00 0 -
Rule Morocco 2019 only - Jun 9 2:00 1:00 S
Rule Morocco 2020 only - Apr 19 3:00 0 -
Rule Morocco 2020 only - May 24 2:00 1:00 S
Rule Morocco 2021 only - Apr 11 3:00 0 -
Rule Morocco 2021 only - May 16 2:00 1:00 S
Rule Morocco 2022 only - May 8 2:00 1:00 S
Rule Morocco 2023 only - Apr 23 2:00 1:00 S
Rule Morocco 2024 only - Apr 14 2:00 1:00 S
Rule Morocco 2025 only - Apr 6 2:00 1:00 S
Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S
Rule Morocco 2036 only - Oct 19 3:00 0 -
Rule Morocco 2037 only - Oct 4 3:00 0 -
Rule Morocco 2018 only - Jun 17 2:00 1:00 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
0:00 Morocco WE%sT 1984 Mar 16
1:00 - CET 1986
0:00 Morocco WE%sT
0:00 Morocco +00/+01 1984 Mar 16
1:00 - +01 1986
0:00 Morocco +00/+01 2018 Oct 27
1:00 - +01
# Western Sahara
#
@@ -935,7 +913,8 @@ Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
Zone Africa/El_Aaiun -0:52:48 - LMT 1934 Jan # El Aaiún
-1:00 - -01 1976 Apr 14
0:00 Morocco WE%sT
0:00 Morocco +00/+01 2018 Oct 27
1:00 - +01
# Mozambique
#
+2
View File
@@ -1,3 +1,5 @@
# tzdb data for Antarctica and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
+267 -47
View File
@@ -1,3 +1,5 @@
# tzdb data for Asia and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -6,7 +8,7 @@
# [email protected] for general use in the future). For more, please see
# the file CONTRIBUTING in the tz distribution.
# From Paul Eggert (2017-01-13):
# From Paul Eggert (2018-06-19):
#
# Unless otherwise specified, the source for data through 1990 is:
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
@@ -35,7 +37,8 @@
# A reliable and entertaining source about time zones is
# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
#
# The following alphabetic abbreviations appear in these tables:
# The following alphabetic abbreviations appear in these tables
# (corrections are welcome):
# std dst
# LMT Local Mean Time
# 2:00 EET EEST Eastern European Time
@@ -44,11 +47,13 @@
# 7:00 WIB west Indonesia (Waktu Indonesia Barat)
# 8:00 WITA central Indonesia (Waktu Indonesia Tengah)
# 8:00 CST China
# 8:00 PST PDT* Philippine Standard Time
# 8:30 KST KDT Korea when at +0830
# 9:00 WIT east Indonesia (Waktu Indonesia Timur)
# 9:00 JST JDT Japan
# 9:00 KST KDT Korea when at +09
# 9:30 ACST Australian Central Standard Time
# *I invented the abbreviation PDT; see "Philippines" below.
# Otherwise, these tables typically use numeric abbreviations like +03
# and +0330 for integer hour and minute UT offsets. Although earlier
# editions invented alphabetic time zone abbreviations for every
@@ -281,6 +286,29 @@ Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon
# China
# From Paul Eggert (2018-10-02):
# The following comes from Table 1 of:
# Li Yu. Research on the daylight saving movement in 1940s Shanghai.
# Nanjing Journal of Social Sciences. 2014;(2):144-50.
# http://oversea.cnki.net/kns55/detail.aspx?dbname=CJFD2014&filename=NJSH201402020
# The table lists dates only; I am guessing 00:00 and 24:00 transition times.
# Also, the table lists the planned end of DST in 1949, but the corresponding
# zone line cuts this off on May 28, when the Communists took power.
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Shang 1940 only - Jun 1 0:00 1:00 D
Rule Shang 1940 only - Oct 12 24:00 0 S
Rule Shang 1941 only - Mar 15 0:00 1:00 D
Rule Shang 1941 only - Nov 1 24:00 0 S
Rule Shang 1942 only - Jan 31 0:00 1:00 D
Rule Shang 1945 only - Sep 1 24:00 0 S
Rule Shang 1946 only - May 15 0:00 1:00 D
Rule Shang 1946 only - Sep 30 24:00 0 S
Rule Shang 1947 only - Apr 15 0:00 1:00 D
Rule Shang 1947 only - Oct 31 24:00 0 S
Rule Shang 1948 1949 - May 1 0:00 1:00 D
Rule Shang 1948 1949 - Sep 30 24:00 0 S #plan
# From Guy Harris:
# People's Republic of China. Yes, they really have only one time zone.
@@ -307,18 +335,33 @@ Zone Asia/Yangon 6:24:47 - LMT 1880 # or Rangoon
# time - sort of", Los Angeles Times, 1986-05-05 ... [says] that China began
# observing daylight saving time in 1986.
# From Paul Eggert (2014-06-30):
# Shanks & Pottenger have China switching to a single time zone in 1980, but
# this doesn't seem to be correct. They also write that China observed summer
# DST from 1986 through 1991, which seems to match the above commentary, so
# go with them for DST rules as follows:
# From P Chan (2018-05-07):
# The start and end time of DST in China [from 1986 on] should be 2:00
# (i.e. 2:00 to 3:00 at the start and 2:00 to 1:00 at the end)....
# Government notices about summer time:
#
# 1986-04-12 http://www.zj.gov.cn/attach/zfgb/198608.pdf p.21-22
# (To establish summer time from 1986. On 4 May, set the clocks ahead one hour
# at 2 am. On 14 September, set the clocks backward one hour at 2 am.)
#
# 1987-02-15 http://www.gov.cn/gongbao/shuju/1987/gwyb198703.pdf p.114
# (Summer time in 1987 to start from 12 April until 13 September)
#
# 1987-09-09 http://www.gov.cn/gongbao/shuju/1987/gwyb198721.pdf p.709
# (From 1988, summer time to start from 2 am of the first Sunday of mid-April
# until 2 am of the first Sunday of mid-September)
#
# 1992-03-03 http://www.gov.cn/gongbao/shuju/1992/gwyb199205.pdf p.152
# (To suspend summer time from 1992)
#
# The first page of People's Daily on 12 April 1988 stating that summer time
# to begin on 17 April.
# http://data.people.com.cn/pic/101p/1988/04/1988041201.jpg
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Shang 1940 only - Jun 3 0:00 1:00 D
Rule Shang 1940 1941 - Oct 1 0:00 0 S
Rule Shang 1941 only - Mar 16 0:00 1:00 D
Rule PRC 1986 only - May 4 0:00 1:00 D
Rule PRC 1986 1991 - Sep Sun>=11 0:00 0 S
Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D
Rule PRC 1986 only - May 4 2:00 1:00 D
Rule PRC 1986 1991 - Sep Sun>=11 2:00 0 S
Rule PRC 1987 1991 - Apr Sun>=11 2:00 1:00 D
# From Anthony Fok (2001-12-20):
# BTW, I did some research on-line and found some info regarding these five
@@ -340,10 +383,11 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D
# Alois Treindl kindly sent me translations of the following two sources:
#
# (1)
# Guo Qingsheng (National Time-Service Center, CAS, Xi'an 710600, China)
# Guo Qing-sheng (National Time-Service Center, CAS, Xi'an 710600, China)
# Beijing Time at the Beginning of the PRC
# China Historical Materials of Science and Technology
# (Zhongguo ke ji shi liao, 中国科技史料), Vol. 24, No. 1 (2003)
# (Zhongguo ke ji shi liao, 中国科技史料). 2003;24(1):5-9.
# http://oversea.cnki.net/kcms/detail/detail.aspx?filename=ZGKS200301000&dbname=CJFD2003
# It gives evidence that at the beginning of the PRC, Beijing time was
# officially apparent solar time! However, Guo also says that the
# evidence is dubious, as the relevant institute of astronomy had not
@@ -520,7 +564,7 @@ Rule PRC 1987 1991 - Apr Sun>=10 0:00 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Beijing time, used throughout China; represented by Shanghai.
Zone Asia/Shanghai 8:05:43 - LMT 1901
8:00 Shang C%sT 1949
8:00 Shang C%sT 1949 May 28
8:00 PRC C%sT
# Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi
# / Wulumuqi. (Please use Asia/Shanghai if you prefer Beijing time.)
@@ -749,24 +793,140 @@ Zone Asia/Taipei 8:06:00 - LMT 1896 Jan 1
8:00 Taiwan C%sT
# Macau (Macao, Aomen)
#
# From P Chan (2018-05-10):
# * LegisMac
# http://legismac.safp.gov.mo/legismac/descqry/Descqry.jsf?lang=pt
# A database for searching titles of legal documents of Macau in
# Chinese and Portuguese. The term "HORÁRIO DE VERÃO" can be used for
# searching decrees about summer time.
# * Archives of Macao
# http://www.archives.gov.mo/en/bo/
# It contains images of old official gazettes.
# * The Macao Meteorological and Geophysical Bureau have a page listing the
# summer time history. But it is not complete and has some mistakes.
# http://www.smg.gov.mo/smg/geophysics/e_t_Summer%20Time.htm
# Macau adopted GMT+8 on 30 Oct 1904 to follow Hong Kong. Clocks were
# advanced by 25 minutes and 50 seconds. Which means the LMT used was
# +7:34:10. As stated in the "Portaria No. 204" dated 21 October 1904
# and published in the Official Gazette on 29 October 1904.
# http://igallery.icm.gov.mo/Images/Archives/BO/MO_AH_PUB_BO_1904_10/MO_AH_PUB_BO_1904_10_00025_Grey.JPG
#
# Therefore the 1911 decree of Portugal did not change time in Macau.
#
# From LegisMac, here is a list of decrees that changed the time ...
# [Decree Gazette-no. date; titles omitted in this quotation]
# DIL 732 BOCM 51 1941.12.20
# DIL 764 BOCM 9S 1942.04.30
# DIL 781 BOCM 21 1942.10.10
# PT 3434 BOCM 8S 1943.04.17
# PT 3504 BOCM 20 1943.09.25
# PT 3843 BOCM 39 1945.09.29
# PT 3961 BOCM 17 1946.04.27
# PT 4026 BOCM 39 1946.09.28
# PT 4153 BOCM 16 1947.04.10
# PT 4271 BOCM 48 1947.11.29
# PT 4374 BOCM 18 1948.05.01
# PT 4465 BOCM 44 1948.10.30
# PT 4590 BOCM 14 1949.04.02
# PT 4666 BOCM 44 1949.10.29
# PT 4771 BOCM 12 1950.03.25
# PT 4838 BOCM 43 1950.10.28
# PT 4946 BOCM 12 1951.03.24
# PT 5025 BO 43 1951.10.27
# PT 5149 BO 14 1952.04.05
# PT 5251 BO 43 1952.10.25
# PT 5366 BO 13 1953.03.28
# PT 5444 BO 44 1953.10.31
# PT 5540 BO 12 1954.03.20
# PT 5589 BO 44 1954.10.30
# PT 5676 BO 12 1955.03.19
# PT 5739 BO 45 1955.11.05
# PT 5823 BO 11 1956.03.17
# PT 5891 BO 44 1956.11.03
# PT 5981 BO 12 1957.03.23
# PT 6064 BO 43 1957.10.26
# PT 6172 BO 12 1958.03.22
# PT 6243 BO 43 1958.10.25
# PT 6341 BO 12 1959.03.21
# PT 6411 BO 43 1959.10.24
# PT 6514 BO 11 1960.03.12
# PT 6584 BO 44 1960.10.29
# PT 6721 BO 10 1961.03.11
# PT 6815 BO 43 1961.10.28
# PT 6947 BO 10 1962.03.10
# PT 7080 BO 43 1962.10.27
# PT 7218 BO 12 1963.03.23
# PT 7340 BO 43 1963.10.26
# PT 7491 BO 11 1964.03.14
# PT 7664 BO 43 1964.10.24
# PT 7846 BO 15 1965.04.10
# PT 7979 BO 42 1965.10.16
# PT 8146 BO 15 1966.04.09
# PT 8252 BO 41 1966.10.08
# PT 8429 BO 15 1967.04.15
# PT 8540 BO 41 1967.10.14
# PT 8735 BO 15 1968.04.13
# PT 8860 BO 41 1968.10.12
# PT 9035 BO 16 1969.04.19
# PT 9156 BO 42 1969.10.18
# PT 9328 BO 15 1970.04.11
# PT 9418 BO 41 1970.10.10
# PT 9587 BO 14 1971.04.03
# PT 9702 BO 41 1971.10.09
# PT 38-A/72 BO 14 1972.04.01
# PT 126-A/72 BO 41 1972.10.07
# PT 61/73 BO 14 1973.04.07
# PT 182/73 BO 40 1973.10.06
# PT 282/73 BO 51 1973.12.22
# PT 177/74 BO 41 1974.10.12
# PT 51/75 BO 15 1975.04.12
# PT 173/75 BO 41 1975.10.11
# PT 67/76/M BO 14 1976.04.03
# PT 169/76/M BO 41 1976.10.09
# PT 78/79/M BO 19 1979.05.12
# PT 166/79/M BO 42 1979.10.20
# Note that DIL 732 does not belong to "HORÁRIO DE VERÃO" according to
# LegisMac.... Note that between 1942 and 1945, the time switched
# between GMT+9 and GMT+10. Also in 1965 and 1965 the DST ended at 2:30am.
# From Paul Eggert (2018-05-10):
# The 1904 decree says that Macau changed from the meridian of
# Fortaleza do Monte, presumably the basis for the 7:34:10 for LMT.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Macau 1961 1962 - Mar Sun>=16 3:30 1:00 D
Rule Macau 1961 1964 - Nov Sun>=1 3:30 0 S
Rule Macau 1963 only - Mar Sun>=16 0:00 1:00 D
Rule Macau 1964 only - Mar Sun>=16 3:30 1:00 D
Rule Macau 1965 only - Mar Sun>=16 0:00 1:00 D
Rule Macau 1965 only - Oct 31 0:00 0 S
Rule Macau 1966 1971 - Apr Sun>=16 3:30 1:00 D
Rule Macau 1966 1971 - Oct Sun>=16 3:30 0 S
Rule Macau 1972 1974 - Apr Sun>=15 0:00 1:00 D
Rule Macau 1972 1973 - Oct Sun>=15 0:00 0 S
Rule Macau 1974 1977 - Oct Sun>=15 3:30 0 S
Rule Macau 1975 1977 - Apr Sun>=15 3:30 1:00 D
Rule Macau 1978 1980 - Apr Sun>=15 0:00 1:00 D
Rule Macau 1978 1980 - Oct Sun>=15 0:00 0 S
# See Europe/Lisbon for info about the 1912 transition.
Rule Macau 1942 1943 - Apr 30 23:00 1:00 -
Rule Macau 1942 only - Nov 17 23:00 0 -
Rule Macau 1943 only - Sep 30 23:00 0 S
Rule Macau 1946 only - Apr 30 23:00s 1:00 D
Rule Macau 1946 only - Sep 30 23:00s 0 S
Rule Macau 1947 only - Apr 19 23:00s 1:00 D
Rule Macau 1947 only - Nov 30 23:00s 0 S
Rule Macau 1948 only - May 2 23:00s 1:00 D
Rule Macau 1948 only - Oct 31 23:00s 0 S
Rule Macau 1949 1950 - Apr Sat>=1 23:00s 1:00 D
Rule Macau 1949 1950 - Oct lastSat 23:00s 0 S
Rule Macau 1951 only - Mar 31 23:00s 1:00 D
Rule Macau 1951 only - Oct 28 23:00s 0 S
Rule Macau 1952 1953 - Apr Sat>=1 23:00s 1:00 D
Rule Macau 1952 only - Nov 1 23:00s 0 S
Rule Macau 1953 1954 - Oct lastSat 23:00s 0 S
Rule Macau 1954 1956 - Mar Sat>=17 23:00s 1:00 D
Rule Macau 1955 only - Nov 5 23:00s 0 S
Rule Macau 1956 1964 - Nov Sun>=1 03:30 0 S
Rule Macau 1957 1964 - Mar Sun>=18 03:30 1:00 D
Rule Macau 1965 1973 - Apr Sun>=16 03:30 1:00 D
Rule Macau 1965 1966 - Oct Sun>=16 02:30 0 S
Rule Macau 1967 1976 - Oct Sun>=16 03:30 0 S
Rule Macau 1973 only - Dec 30 03:30 1:00 D
Rule Macau 1975 1976 - Apr Sun>=16 03:30 1:00 D
Rule Macau 1979 only - May 13 03:30 1:00 D
Rule Macau 1979 only - Oct Sun>=16 03:30 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Macau 7:34:20 - LMT 1911 Dec 31 16:00u
Zone Asia/Macau 7:34:10 - LMT 1904 Oct 30
8:00 - CST 1941 Dec 21 23:00
9:00 Macau +09/+10 1945 Sep 30 24:00
8:00 Macau C%sT
@@ -1471,9 +1631,29 @@ Zone Asia/Jerusalem 2:20:54 - LMT 1880
# http://www.shugiin.go.jp/internet/itdb_housei.nsf/html/houritsu/00719500331039.htm
# ... In summary, it is written as follows. From 24:00 on the first Saturday
# in May, until 0:00 on the day after the second Saturday in September.
# From Phake Nick (2018-09-27):
# [T]he webpage authored by National Astronomical Observatory of Japan
# https://eco.mtk.nao.ac.jp/koyomi/wiki/BBFEB9EF2FB2C6BBFEB9EF.html
# ... mentioned that using Showa 23 (year 1948) as example, 13pm of September
# 11 in summer time will equal to 0am of September 12 in standard time.
# It cited a document issued by the Liaison Office which briefly existed
# during the postwar period of Japan, where the detail on implementation
# of the summer time is described in the document.
# https://eco.mtk.nao.ac.jp/koyomi/wiki/BBFEB9EF2FB2C6BBFEB9EFB2C6BBFEB9EFA4CEBCC2BBDCA4CBA4C4A4A4A4C6.pdf
# The text in the document do instruct a fall back to occur at
# September 11, 13pm in summer time, while ordinary citizens can
# change the clock before they sleep.
#
# From Paul Eggert (2018-09-27):
# This instruction is equivalent to "Sat>=8 25:00", so use that. zic treats
# it like "Sun>=9 01:00", which is not quite the same but is the best we can
# do in any POSIX or C platform. The "25:00" assumes zic from 2007 or later,
# which should be safe now.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Japan 1948 only - May Sat>=1 24:00 1:00 D
Rule Japan 1948 1951 - Sep Sun>=9 0:00 0 S
Rule Japan 1948 1951 - Sep Sat>=8 25:00 0 S
Rule Japan 1949 only - Apr Sat>=1 24:00 1:00 D
Rule Japan 1950 1951 - May Sat>=1 24:00 1:00 D
@@ -1855,7 +2035,7 @@ Zone Asia/Aqtobe 3:48:40 - LMT 1924 May 2
5:00 - +05
# Mangghystaū (KZ-MAN)
# Aqtau was not founded until 1963, but it represents an inhabited region,
# so include time stamps before 1963.
# so include timestamps before 1963.
Zone Asia/Aqtau 3:21:04 - LMT 1924 May 2
4:00 - +04 1930 Jun 21
5:00 - +05 1981 Oct 1
@@ -1995,6 +2175,10 @@ Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S
# Assembly, as published in Rodong Sinmun.
# From Tim Parenti (2018-04-29):
# It appears to be the front page story at the top in the right-most column.
#
# From Paul Eggert (2018-05-04):
# The BBC reported that the transition was from 23:30 to 24:00 today.
# https://www.bbc.com/news/world-asia-44010705
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1
@@ -2007,7 +2191,7 @@ Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1
8:30 - KST 1912 Jan 1
9:00 - JST 1945 Aug 24
9:00 - KST 2015 Aug 15 00:00
8:30 - KST 2018 May 5
8:30 - KST 2018 May 4 23:30
9:00 - KST
###############################################################################
@@ -2757,19 +2941,35 @@ Zone Asia/Hebron 2:20:23 - LMT 1900 Oct
# Philippine Star 2014-08-05
# http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time
# From Paul Goyette (2018-06-15):
# In the Philippines, there is a national law, Republic Act No. 10535
# which declares the official time here as "Philippine Standard Time".
# The act [1] even specifies use of PST as the abbreviation, although
# the FAQ provided by PAGASA [2] uses the "acronym PhST to distinguish
# it from the Pacific Standard Time (PST)."
# [1] http://www.officialgazette.gov.ph/2013/05/15/republic-act-no-10535/
# [2] https://www1.pagasa.dost.gov.ph/index.php/astronomy/philippine-standard-time#republic-act-10535
#
# From Paul Eggert (2018-06-19):
# I surveyed recent news reports, and my impression is that "PST" is
# more popular among reliable English-language news sources. This is
# not just a measure of Google hit counts: it's also the sizes and
# influence of the sources. There is no current abbreviation for DST,
# so use "PDT", the usual American style.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Phil 1936 only - Nov 1 0:00 1:00 -
Rule Phil 1937 only - Feb 1 0:00 0 -
Rule Phil 1954 only - Apr 12 0:00 1:00 -
Rule Phil 1954 only - Jul 1 0:00 0 -
Rule Phil 1978 only - Mar 22 0:00 1:00 -
Rule Phil 1978 only - Sep 21 0:00 0 -
Rule Phil 1936 only - Nov 1 0:00 1:00 D
Rule Phil 1937 only - Feb 1 0:00 0 S
Rule Phil 1954 only - Apr 12 0:00 1:00 D
Rule Phil 1954 only - Jul 1 0:00 0 S
Rule Phil 1978 only - Mar 22 0:00 1:00 D
Rule Phil 1978 only - Sep 21 0:00 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Manila -15:56:00 - LMT 1844 Dec 31
8:04:00 - LMT 1899 May 11
8:00 Phil +08/+09 1942 May
9:00 - +09 1944 Nov
8:00 Phil +08/+09
8:00 Phil P%sT 1942 May
9:00 - JST 1944 Nov
8:00 Phil P%sT
# Qatar
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
@@ -2780,15 +2980,34 @@ Link Asia/Qatar Asia/Bahrain
# Saudi Arabia
#
# From Paul Eggert (2014-07-15):
# From Paul Eggert (2018-08-29):
# Time in Saudi Arabia and other countries in the Arabian peninsula was not
# standardized until relatively recently; we don't know when, and possibly it
# standardized until 1968 or so; we don't know exactly when, and possibly it
# has never been made official. Richard P Hunt, in "Islam city yielding to
# modern times", New York Times (1961-04-09), p 20, wrote that only airlines
# observed standard time, and that people in Jeddah mostly observed quasi-solar
# time, doing so by setting their watches at sunrise to 6 o'clock (or to 12
# o'clock for "Arab" time).
#
# Timekeeping differed depending on who you were and which part of Saudi
# Arabia you were in. In 1969, Elias Antar wrote that although a common
# practice had been to set one's watch to 12:00 (i.e., midnight) at sunset -
# which meant that the time on one side of a mountain could differ greatly from
# the time on the other side - many foreigners set their watches to 6pm
# instead, while airlines instead used UTC +03 (except in Dhahran, where they
# used UTC +04), Aramco used UTC +03 with DST, and the Trans-Arabian Pipe Line
# Company used Aramco time in eastern Saudi Arabia and airline time in western.
# (The American Military Aid Advisory Group used plain UTC.) Antar writes,
# "A man named Higgins, so the story goes, used to run a local power
# station. One day, the whole thing became too much for Higgins and he
# assembled his staff and laid down the law. 'I've had enough of this,' he
# shrieked. 'It is now 12 o'clock Higgins Time, and from now on this station is
# going to run on Higgins Time.' And so, until last year, it did." See:
# Antar E. Dinner at When? Saudi Aramco World, 1969 March/April. 2-3.
# http://archive.aramcoworld.com/issue/196902/dinner.at.when.htm
# newspapers.com says a similar story about Higgins was published in the Port
# Angeles (WA) Evening News, 1965-03-10, page 5, but I lack access to the text.
#
# The TZ database cannot represent quasi-solar time; airline time is the best
# we can do. The 1946 foreign air news digest of the U.S. Civil Aeronautics
# Board (OCLC 42299995) reported that the "... Arabian Government, inaugurated
@@ -2798,7 +3017,8 @@ Link Asia/Qatar Asia/Bahrain
#
# Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two
# time zones; the other zone, at UT +04, was in the far eastern part of
# the country. Ignore this, as it's before our 1970 cutoff.
# the country. Presumably this is documenting airline time. Ignore this,
# as it's before our 1970 cutoff.
#
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Riyadh 3:06:52 - LMT 1947 Mar 14
+11 -2
View File
@@ -1,3 +1,5 @@
# tzdb data for Australasia and environs, and for much of the Pacific
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -361,8 +363,15 @@ Zone Indian/Cocos 6:27:40 - LMT 1900
# Dominic Fok writes (2017-08-20) that DST ends 2018-01-14, citing
# Extraordinary Government of Fiji Gazette Supplement No. 21 (2017-08-27),
# [Legal Notice No. 41] of an order of the previous day by J Usamate.
# From Raymond Kumar (2018-07-13):
# http://www.fijitimes.com/government-approves-2018-daylight-saving/
# ... The daylight saving period will end at 3am on Sunday January 13, 2019.
#
# From Paul Eggert (2018-07-15):
# For now, guess DST from 02:00 the first Sunday in November to 03:00
# the first Sunday on or after January 14. Although ad hoc, it matches
# the first Sunday on or after January 13. January transitions reportedly
# depend on when school terms start. Although the guess is ad hoc, it matches
# transitions since late 2014 and seems more likely to match future
# practice than guessing no DST.
@@ -376,7 +385,7 @@ Rule Fiji 2011 only - Mar Sun>=1 3:00 0 -
Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 -
Rule Fiji 2014 only - Jan Sun>=18 2:00 0 -
Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 -
Rule Fiji 2015 max - Jan Sun>=14 3:00 0 -
Rule Fiji 2015 max - Jan Sun>=13 3:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva
12:00 Fiji +12/+13
+3 -1
View File
@@ -1,7 +1,9 @@
# tzdb links for backward compatibility
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# This file provides links between current names for time zones
# This file provides links between current names for timezones
# and their old names. Many names changed in late 1993.
# Link TARGET LINK-NAME
+2 -2
View File
@@ -16,13 +16,13 @@
# the file 'backward'.
# Although zones in this file may be of some use for analyzing
# pre-1970 time stamps, they are less reliable, cover only a tiny
# pre-1970 timestamps, they are less reliable, cover only a tiny
# sliver of the pre-1970 era, and cannot feasibly be improved to cover
# most of the era. Because the zones are out of normal scope for the
# database, less effort is put into maintaining this file. Many of
# the zones were formerly in other source files, but were removed or
# replaced by links as their data entries were questionable and/or they
# differed from other zones only in pre-1970 time stamps.
# differed from other zones only in pre-1970 timestamps.
# Unless otherwise specified, the source for data through 1990 is:
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
+3 -1
View File
@@ -1,9 +1,11 @@
# tzdb data for ships at sea and other miscellany
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# These entries are mostly present for historical reasons, so that
# people in areas not otherwise covered by the tz files could "zic -l"
# to a time zone that was right for their area. These days, the
# to a timezone that was right for their area. These days, the
# tz files cover almost all the inhabited world, and the only practical
# need now for the entries that are not on UTC are for ships at sea
# that cannot use POSIX TZ settings.
+67 -10
View File
@@ -1,3 +1,5 @@
# tzdb data for Europe and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -517,7 +519,7 @@ Link Europe/London Europe/Isle_of_Man
#
# To work around this problem, the build procedure can translate the
# following data into two forms, one with negative SAVE values and the
# other form with a traditional approximation for Irish time stamps
# other form with a traditional approximation for Irish timestamps
# after 1971-10-31 02:00 UTC; although this approximation has tm_isdst
# flags that are reversed, its UTC offsets are correct and this often
# suffices. This source file currently uses only nonnegative SAVE
@@ -2427,6 +2429,33 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct
# administratively part of Sakhalin oblast', they appear to have
# remained on UTC+11 along with Magadan.
# From Marat Nigametzianov (2018-07-16):
# this is link to order from 1956 about timezone in USSR
# http://astro.uni-altai.ru/~orion/blog/2011/11/novyie-granitsyi-chasovyih-poyasov-v-sssr/
#
# From Paul Eggert (2018-07-16):
# Perhaps someone could translate the above-mentioned link and use it
# to correct our data for the ex-Soviet Union. It cites the following:
# «Поясное время и новые границы часовых поясов» / сост. П.Н. Долгов,
# отв. ред. Г.Д. Бурдун - М: Комитет стандартов, мер и измерительных
# приборов при Совете Министров СССР, Междуведомственная комиссия
# единой службы времени, 1956 г.
# This book looks like it would be a helpful resource for the Soviet
# Union through 1956. Although a copy was in the Scientific Library
# of Tomsk State University, I have not been able to track down a copy nearby.
#
# From Stepan Golosunov (2018-07-21):
# http://astro.uni-altai.ru/~orion/blog/2015/05/center-reforma-ischisleniya-vremeni-br-na-territorii-sssr-v-1957-godu-center/
# says that the 1956 decision to change time belts' borders was not
# implemented as planned in 1956 and the change happened in 1957.
# There is also the problem that actual time zones were different from
# the official time belts (and from many time belts' maps) as there were
# numerous exceptions to application of time belt rules. For example,
# https://ru.wikipedia.org/wiki/Московское_время#Перемещение_границы_применения_московского_времени_на_восток
# says that by 1962 there were many regions in the 3rd time belt that
# were on Moscow time, referring to a 1962 map. By 1989 number of such
# exceptions grew considerably.
# From Tim Parenti (2014-07-06):
# The comments detailing the coverage of each Russian zone are meant to assist
# with maintenance only and represent our best guesses as to which regions
@@ -2437,9 +2466,6 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct
# future stability. ISO 3166-2:RU codes are also listed for first-level
# divisions where available.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# From Tim Parenti (2014-07-03):
# Europe/Kaliningrad covers...
# 39 RU-KGD Kaliningrad Oblast
@@ -2707,6 +2733,15 @@ Zone Europe/Astrakhan 3:12:12 - LMT 1924 May
# 34 RU-VGG Volgograd Oblast
# The 1988 transition is from USSR act No. 5 (1988-01-04).
# From Alexander Fetisov (2018-09-20):
# Volgograd region in southern Russia (Europe/Volgograd) change
# timezone from UTC+3 to UTC+4 from 28oct2018.
# http://sozd.parliament.gov.ru/bill/452878-7
#
# From Stepan Golosunov (2018-10-11):
# The law has been published today on
# http://publication.pravo.gov.ru/Document/View/0001201810110037
Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3
3:00 - +03 1930 Jun 21
4:00 - +04 1961 Nov 11
@@ -2715,7 +2750,8 @@ Zone Europe/Volgograd 2:57:40 - LMT 1920 Jan 3
4:00 - +04 1992 Mar 29 2:00s
3:00 Russia +03/+04 2011 Mar 27 2:00s
4:00 - +04 2014 Oct 26 2:00s
3:00 - +03
3:00 - +03 2018 Oct 28 2:00s
4:00 - +04
# From Paul Eggert (2016-11-11):
# Europe/Saratov covers:
@@ -3404,7 +3440,8 @@ Rule Spain 1978 only - Oct 1 2:00s 0 -
#Rule NatSpain 1937 only - May 22 23:00 1:00 S
#Rule NatSpain 1937 1938 - Oct Sat>=1 24:00s 0 -
#Rule NatSpain 1938 only - Mar 26 23:00 1:00 S
# The following rules are copied from Morocco from 1967 through 1978.
# The following rules are copied from Morocco from 1967 through 1978,
# except with "S" letters.
Rule SpainAfrica 1967 only - Jun 3 12:00 1:00 S
Rule SpainAfrica 1967 only - Oct 1 0:00 0 -
Rule SpainAfrica 1974 only - Jun 24 0:00 1:00 S
@@ -3424,6 +3461,7 @@ Zone Africa/Ceuta -0:21:16 - LMT 1900 Dec 31 23:38:44
0:00 1:00 WEST 1918 Oct 7 23:00
0:00 - WET 1924
0:00 Spain WE%sT 1929
0:00 - WET 1967 # Help zishrink.awk.
0:00 SpainAfrica WE%sT 1984 Mar 16
1:00 - CET 1986
1:00 EU CE%sT
@@ -3609,7 +3647,7 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See above comment.
# http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001
# http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006
# From Paul Eggert (2016-09-25):
# Prefer the above sources to Shanks & Pottenger for time stamps after 1985.
# Prefer the above sources to Shanks & Pottenger for timestamps after 1985.
# From Steffen Thorsen (2007-03-09):
# Starting 2007 though, it seems that they are adopting EU's 1:00 UTC
@@ -3819,10 +3857,29 @@ Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
# From Paul Eggert (2018-10-03):
# As is usual in tzdb, Ukrainian zones use the most common English spellings.
# For example, tzdb uses Europe/Kiev, as "Kiev" is the most common spelling in
# English for Ukraine's capital, even though it is certainly wrong as a
# transliteration of the Ukrainian "Київ". This is similar to tzdb's use of
# Europe/Prague, which is certainly wrong as a transliteration of the Czech
# "Praha". ("Kiev" came from old Slavic via Russian to English, and "Prague"
# came from old Slavic via French to English, so the two cases have something
# in common.) Admittedly English-language spelling of Ukrainian names is
# controversial, and some day "Kyiv" may become substantially more popular in
# English; in the meantime, stick with the traditional English "Kiev" as that
# means less disruption for our users.
#
# Anyway, none of the common English-language spellings (Kiev, Kyiv, Kieff,
# Kijeff, Kijev, Kiyef, Kiyeff) do justice to the common pronunciation in
# Ukrainian, namely [ˈkɪjiu̯] (IPA). This pronunciation has nothing like an
# English "v" or "f", and instead trails off with what an English-speaker
# would call a demure "oo" sound, and it would would be better anglicized as
# "Kuiyu". Here's a sound file, if you would like to do as the Kuiyuvians do:
# https://commons.wikimedia.org/wiki/File:Uk-Київ.ogg
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
# Most of Ukraine since 1970 has been like Kiev.
# "Kyiv" is the transliteration of the Ukrainian name, but
# "Kiev" is more common in English.
# This represents most of Ukraine. See above for the spelling of "Kiev".
Zone Europe/Kiev 2:02:04 - LMT 1880
2:02:04 - KMT 1924 May 2 # Kiev Mean Time
2:00 - EET 1930 Jun 21
+4 -2
View File
@@ -1,8 +1,10 @@
# tzdb data for noncommittal factory settings
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# For distributors who don't want to put time zone specification in
# their installation procedures. Users that run 'date' will get the
# For distributors who don't want to specify a timezone in their
# installation procedures. Users who run 'date' will get the
# time zone abbreviation "-00", indicating that the actual time zone
# is unknown.
+4 -4
View File
@@ -204,10 +204,10 @@
# current -- the update time stamp, the data and the name of the file
# will not change.
#
# Updated through IERS Bulletin C55
# File expires on: 28 December 2018
# Updated through IERS Bulletin C56
# File expires on: 28 June 2019
#
#@ 3754944000
#@ 3770668800
#
2272060800 10 # 1 Jan 1972
2287785600 11 # 1 Jul 1972
@@ -252,4 +252,4 @@
# the hash line is also ignored in the
# computation.
#
#h 44dcf58c e28d25aa b36612c8 f3d3e8b5 a8fdf478
#h 62ca19f6 96a4ae0a 3708451c 9f8693f4 016604eb
+18 -13
View File
@@ -3,21 +3,25 @@
# This file is in the public domain.
# This file is generated automatically from the data in the public-domain
# leap-seconds.list file, which is copied from:
# ftp://ftp.nist.gov/pub/time/leap-seconds.list
# leap-seconds.list file, which can be copied from
# <ftp://ftp.nist.gov/pub/time/leap-seconds.list>
# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>
# or <ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.list>.
# For more about leap-seconds.list, please see
# The NTP Timescale and Leap Seconds
# https://www.eecis.udel.edu/~mills/leap.html
# <https://www.eecis.udel.edu/~mills/leap.html>.
# The International Earth Rotation and Reference Systems Service
# periodically uses leap seconds to keep UTC to within 0.9 s of UT1
# (which measures the true angular orientation of the earth in space); see
# Levine J. Coordinated Universal Time and the leap second.
# (which measures the true angular orientation of the earth in space)
# and publishes leap second data in a copyrighted file
# <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>.
# See: Levine J. Coordinated Universal Time and the leap second.
# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995
# http://ieeexplore.ieee.org/document/7909995/
# <https://ieeexplore.ieee.org/document/7909995>.
# There were no leap seconds before 1972, because the official mechanism
# accounting for the discrepancy between atomic time and the earth's rotation
# did not exist until the early 1970s.
# did not exist.
# The correction (+ or -) is made at the given time, so lines
# will typically look like:
@@ -25,10 +29,7 @@
# or
# Leap YEAR MON DAY 23:59:59 - R/S
# If the leapsecond is Rolling (R) the given time is local time.
# If the leapsecond is Stationary (S) the given time is UTC.
# Leap YEAR MONTH DAY HH:MM:SS CORR R/S
# If the leap second is Rolling (R) the given time is local time (unused here).
Leap 1972 Jun 30 23:59:60 + S
Leap 1972 Dec 31 23:59:60 + S
Leap 1973 Dec 31 23:59:60 + S
@@ -57,5 +58,9 @@ Leap 2012 Jun 30 23:59:60 + S
Leap 2015 Jun 30 23:59:60 + S
Leap 2016 Dec 31 23:59:60 + S
# Updated through IERS Bulletin C55
# File expires on: 28 December 2018
# POSIX timestamps for the data in this file:
#updated 1467936000
#expires 1561680000
# Updated through IERS Bulletin C56
# File expires on: 28 June 2019
+49 -19
View File
@@ -8,21 +8,25 @@ BEGIN {
print "# This file is in the public domain."
print ""
print "# This file is generated automatically from the data in the public-domain"
print "# leap-seconds.list file, which is copied from:"
print "# ftp://ftp.nist.gov/pub/time/leap-seconds.list"
print "# leap-seconds.list file, which can be copied from"
print "# <ftp://ftp.nist.gov/pub/time/leap-seconds.list>"
print "# or <ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.list>"
print "# or <ftp://tycho.usno.navy.mil/pub/ntp/leap-seconds.list>."
print "# For more about leap-seconds.list, please see"
print "# The NTP Timescale and Leap Seconds"
print "# https://www.eecis.udel.edu/~mills/leap.html"
print "# <https://www.eecis.udel.edu/~mills/leap.html>."
print ""
print "# The International Earth Rotation and Reference Systems Service"
print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1"
print "# (which measures the true angular orientation of the earth in space); see"
print "# Levine J. Coordinated Universal Time and the leap second."
print "# (which measures the true angular orientation of the earth in space)"
print "# and publishes leap second data in a copyrighted file"
print "# <https://hpiers.obspm.fr/iers/bul/bulc/Leap_Second.dat>."
print "# See: Levine J. Coordinated Universal Time and the leap second."
print "# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995"
print "# http://ieeexplore.ieee.org/document/7909995/"
print "# <https://ieeexplore.ieee.org/document/7909995>."
print "# There were no leap seconds before 1972, because the official mechanism"
print "# accounting for the discrepancy between atomic time and the earth's rotation"
print "# did not exist until the early 1970s."
print "# did not exist."
print ""
print "# The correction (+ or -) is made at the given time, so lines"
print "# will typically look like:"
@@ -30,18 +34,35 @@ BEGIN {
print "# or"
print "# Leap YEAR MON DAY 23:59:59 - R/S"
print ""
print "# If the leapsecond is Rolling (R) the given time is local time."
print "# If the leapsecond is Stationary (S) the given time is UTC."
print ""
print "# Leap YEAR MONTH DAY HH:MM:SS CORR R/S"
}
print "# If the leap second is Rolling (R) the given time is local time (unused here)."
/^ *$/ { next }
monthabbr[ 1] = "Jan"
monthabbr[ 2] = "Feb"
monthabbr[ 3] = "Mar"
monthabbr[ 4] = "Apr"
monthabbr[ 5] = "May"
monthabbr[ 6] = "Jun"
monthabbr[ 7] = "Jul"
monthabbr[ 8] = "Aug"
monthabbr[ 9] = "Sep"
monthabbr[10] = "Oct"
monthabbr[11] = "Nov"
monthabbr[12] = "Dec"
for (i in monthabbr) {
monthnum[monthabbr[i]] = i
monthlen[i] = 31
}
monthlen[2] = 28
monthlen[4] = monthlen[6] = monthlen[9] = monthlen[11] = 30
}
/^#\tUpdated through/ || /^#\tFile expires on:/ {
last_lines = last_lines $0 "\n"
}
/^#[$][ \t]/ { updated = $2 }
/^#[@][ \t]/ { expires = $2 }
/^#/ { next }
{
@@ -57,19 +78,28 @@ BEGIN {
} else {
sign = "23:59:59\t-"
}
if (month == "Jan") {
m = monthnum[month] - 1
if (m == 0) {
year--;
month = "Dec";
day = 31
} else if (month == "Jul") {
month = "Jun";
day = 30
m = 12
}
month = monthabbr[m]
day = monthlen[m]
day += m == 2 && year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)
printf "Leap\t%s\t%s\t%s\t%s\tS\n", year, month, day, sign
}
old_TAI_minus_UTC = TAI_minus_UTC
}
END {
# The difference between the NTP and POSIX epochs is 70 years
# (including 17 leap days), each 24 hours of 60 minutes of 60
# seconds each.
epoch_minus_NTP = ((1970 - 1900) * 365 + 17) * 24 * 60 * 60
print ""
print "# POSIX timestamps for the data in this file:"
printf "#updated %s\n", updated - epoch_minus_NTP
printf "#expires %s\n", expires - epoch_minus_NTP
printf "\n%s", last_lines
}
+17 -4
View File
@@ -1,3 +1,5 @@
# tzdb data for North and Central America and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -48,7 +50,7 @@
#
# Most of the US soon followed suit. See:
# Bartky IR. The adoption of standard time. Technol Cult 1989 Jan;30(1):25-56.
# http://dx.doi.org/10.2307/3105430
# https://dx.doi.org/10.2307/3105430
# From Paul Eggert (2005-04-16):
# That 1883 transition occurred at 12:00 new time, not at 12:00 old time.
@@ -437,6 +439,19 @@ Zone America/North_Dakota/Beulah -6:47:07 - LMT 1883 Nov 18 12:12:53
# western South Dakota, far western Texas (El Paso County, Hudspeth County,
# and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming
#
# From Paul Eggert (2018-10-25):
# On 1921-03-04 federal law placed all of Texas into the central time zone.
# However, El Paso ignored the law for decades and continued to observe
# mountain time, on the grounds that that's what they had always done
# and they weren't about to let the federal government tell them what to do.
# Eventually the federal government gave in and changed the law on
# 1970-04-10 to match what El Paso was actually doing. Although
# that's slightly after our 1970 cutoff, there is no need to create a
# separate zone for El Paso since they were ignoring the law anyway. See:
# Long T. El Pasoans were time rebels, fought to stay in Mountain zone.
# El Paso Times. 2018-10-24 06:40 -06.
# https://www.elpasotimes.com/story/news/local/el-paso/2018/10/24/el-pasoans-were-time-rebels-fought-stay-mountain-zone/1744509002/
#
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER
Rule Denver 1920 1921 - Mar lastSun 2:00 1:00 D
Rule Denver 1920 only - Oct lastSun 2:00 0 S
@@ -706,9 +721,7 @@ Zone America/Adak 12:13:22 - LMT 1867 Oct 19 12:44:35
Zone Pacific/Honolulu -10:31:26 - LMT 1896 Jan 13 12:00
-10:30 - HST 1933 Apr 30 2:00
-10:30 1:00 HDT 1933 May 21 12:00
-10:30 - HST 1942 Feb 9 2:00
-10:30 1:00 HDT 1945 Sep 30 2:00
-10:30 - HST 1947 Jun 8 2:00
-10:30 US H%sT 1947 Jun 8 2:00
-10:00 - HST
# Now we turn to US areas that have diverged from the consensus since 1970.
+2
View File
@@ -1,3 +1,5 @@
# tzdb data for proposed US election time (this file is obsolete)
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
+33 -3
View File
@@ -1,3 +1,5 @@
# tzdb data for South America and environs
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
@@ -392,7 +394,7 @@ Rule Arg 2008 only - Oct Sun>=15 0:00 1:00 -
# standard time, so let's do that here too. This does not change UTC
# offsets, only tm_isdst and the time zone abbreviations. One minor
# plus is that this silences a zic complaint that there's no POSIX TZ
# setting for time stamps past 2038.
# setting for timestamps past 2038.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
#
@@ -925,6 +927,14 @@ Rule Brazil 2016 2022 - Feb Sun>=15 0:00 0 -
# ... https://www.timeanddate.com/news/time/brazil-delays-dst-2018.html
# From Steffen Thorsen (2017-12-20):
# http://www.planalto.gov.br/ccivil_03/_ato2015-2018/2017/decreto/D9242.htm
#
# From Fábio Gomes (2018-10-04):
# The Brazilian president just announced a new change on this year DST.
# It was scheduled to start on November 4th and it was changed to November 18th.
# From Rodrigo Brüning Wessler (2018-10-15):
# The Brazilian government just announced that the change in DST was
# canceled.... Maybe the president Michel Temer also woke up one hour
# earlier today. :)
Rule Brazil 2018 max - Nov Sun>=1 0:00 1:00 -
Rule Brazil 2023 only - Feb Sun>=22 0:00 0 -
Rule Brazil 2024 2025 - Feb Sun>=15 0:00 0 -
@@ -1231,6 +1241,24 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# they will switch from -03 to -04 one hour after Santiago does that day.
# For now, assume that they will not revert.
# From Juan Correa (2018-08-13):
# As of moments ago, the Ministry of Energy in Chile has announced the new
# schema for DST. ... Announcement in video (in Spanish):
# https://twitter.com/MinEnergia/status/1029000399129374720
# From Yonathan Dossow (2018-08-13):
# The video says "first Saturday of September", we all know it means Sunday at
# midnight.
# From Tim Parenti (2018-08-13):
# Translating the captions on the video at 0:44-0:55, "We want to announce as
# Government that from 2019, Winter Time will be increased to 5 months, between
# the first Saturday of April and the first Saturday of September."
# At 2:08-2:20, "The Magallanes region will maintain its current time, as
# decided by the citizens during 2017, but our Government will promote a
# regional dialogue table to gather their opinion on this matter."
# https://twitter.com/MinEnergia/status/1029009354001973248
# "We will keep the new time policy unchanged for at least the next 4 years."
# So we extend the new rules on Saturdays at 24:00 mainland time indefinitely.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1931 - Sep 1 0:00 1:00 -
Rule Chile 1928 1932 - Apr 1 0:00 0 -
@@ -1264,8 +1292,10 @@ Rule Chile 2011 only - May Sun>=2 3:00u 0 -
Rule Chile 2011 only - Aug Sun>=16 4:00u 1:00 -
Rule Chile 2012 2014 - Apr Sun>=23 3:00u 0 -
Rule Chile 2012 2014 - Sep Sun>=2 4:00u 1:00 -
Rule Chile 2016 max - May Sun>=9 3:00u 0 -
Rule Chile 2016 max - Aug Sun>=9 4:00u 1:00 -
Rule Chile 2016 2018 - May Sun>=9 3:00u 0 -
Rule Chile 2016 2018 - Aug Sun>=9 4:00u 1:00 -
Rule Chile 2019 max - Apr Sun>=2 3:00u 0 -
Rule Chile 2019 max - Sep Sun>=2 4:00u 1:00 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
+2
View File
@@ -1,3 +1,5 @@
# tzdb data for System V rules (this file is obsolete)
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
+127 -78
View File
@@ -1,7 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Theory and pragmatics of the tz code and data</title>
<meta charset="UTF-8">
<style>
pre {margin-left: 2em; white-space: pre-wrap;}
</style>
</head>
<body>
@@ -11,7 +15,7 @@
<ul>
<li><a href="#scope">Scope of the <code><abbr>tz</abbr></code>
database</a></li>
<li><a href="#naming">Names of time zone rulesets</a></li>
<li><a href="#naming">Names of timezones</a></li>
<li><a href="#abbreviations">Time zone abbreviations</a></li>
<li><a href="#accuracy">Accuracy of the <code><abbr>tz</abbr></code>
database</a></li>
@@ -31,13 +35,13 @@ database</a> attempts to record the history and predicted future of
all computer-based clocks that track civil time.
It organizes <a href="tz-link.html">time zone and daylight saving time
data</a> by partitioning the world into <a
href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">regions</a>
href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"><dfn>timezones</dfn></a>
whose clocks all agree about timestamps that occur after the <a
href="https://en.wikipedia.org/wiki/Unix_time">POSIX Epoch</a>
(1970-01-01 00:00:00 <a
href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time"><abbr
title="Coordinated Universal Time">UTC</abbr></a>).
The database labels each such region with a notable location and
The database labels each timezone with a notable location and
records all known clock transitions for that location.
Although 1970 is a somewhat-arbitrary cutoff, there are significant
challenges to moving the cutoff earlier even by a decade or two, due
@@ -46,7 +50,24 @@ became prevalent.
</p>
<p>
Clock transitions before 1970 are recorded for each such location,
Each timezone typically corresponds to a geographical region that is
smaller than a traditional time zone, because clocks in a timezone
all agree after 1970 whereas a traditional time zone merely
specifies current standard time. For example, applications that deal
with current and future timestamps in the traditional North
American mountain time zone can choose from the timezones
<code>America/Denver</code> which observes US-style daylight saving
time, <code>America/Mazatlan</code> which observes Mexican-style DST,
and <code>America/Phoenix</code> which does not observe DST.
Applications that also deal with past timestamps in the mountain time
zone can choose from over a dozen timezones, such as
<code>America/Boise</code>, <code>America/Edmonton</code>, and
<code>America/Hermosillo</code>, each of which currently uses mountain
time but differs from other timezones for some timestamps after 1970.
</p>
<p>
Clock transitions before 1970 are recorded for each timezone,
because most systems support timestamps before 1970 and could
misbehave if data entries were omitted for pre-1970 transitions.
However, the database is not designed for and does not suffice for
@@ -73,30 +94,36 @@ Edition.
Because the database's scope encompasses real-world changes to civil
timekeeping, its model for describing time is more complex than the
standard and daylight saving times supported by POSIX.
A <code><abbr>tz</abbr></code> region corresponds to a ruleset that can
A <code><abbr>tz</abbr></code> timezone corresponds to a ruleset that can
have more than two changes per year, these changes need not merely
flip back and forth between two alternatives, and the rules themselves
can change at times.
Whether and when a <code><abbr>tz</abbr></code> region changes its
clock, and even the region's notional base offset from UTC, are variable.
It does not always make sense to talk about a region's
"base offset", since it is not necessarily a single number.
Whether and when a timezone changes its
clock, and even the timezone's notional base offset from UTC, are variable.
It does not always make sense to talk about a timezone's
"base offset", which is not necessarily a single number.
</p>
</section>
<section>
<h2 id="naming">Names of time zone rulesets</h2>
<h2 id="naming">Names of timezones</h2>
<p>
Each <code><abbr>tz</abbr></code> region has a unique name that
corresponds to a set of time zone rules.
Each timezone has a unique name.
Inexperienced users are not expected to select these names unaided.
Distributors should provide documentation and/or a simple selection
interface that explains the names; for one example, see the
interface that explains each name via a map or via descriptive text like
"Ruthenia" instead of the timezone name "<code>Europe/Uzhgorod</code>".
If geolocation information is available, a selection interface can
locate the user on a timezone map or prioritize names that are
geographically close. For an example selection interface, see the
<code>tzselect</code> program in the <code><abbr>tz</abbr></code> code.
The <a href="http://cldr.unicode.org/">Unicode Common Locale Data
Repository</a> contains data that may be useful for other selection
interfaces.
interfaces; it maps timezone names like <code>Europe/Uzhgorod</code>
to CLDR names like <code>uauzh</code> which are in turn mapped to
locale-dependent strings like "Uzhhorod", "Ungvár", "Ужгород", and
"乌日哥罗德".
</p>
<p>
@@ -106,12 +133,12 @@ among the following goals:
<ul>
<li>
Uniquely identify every region where clocks have agreed since 1970.
Uniquely identify every timezone where clocks have agreed since 1970.
This is essential for the intended use: static clocks keeping local
civil time.
</li>
<li>
Indicate to experts where that region is.
Indicate to experts where the timezone's clocks typically are.
</li>
<li>
Be robust in the presence of political changes.
@@ -131,9 +158,8 @@ among the following goals:
<p>
Names normally have the form
<var>AREA</var><code>/</code><var>LOCATION</var>, where
<var>AREA</var> is the name of a continent or ocean, and
<var>LOCATION</var> is the name of a specific location within that
region.
<var>AREA</var> is a continent or ocean, and
<var>LOCATION</var> is a specific location within the area.
North and South America share the same area, '<code>America</code>'.
Typical names are '<code>Africa/Cairo</code>',
'<code>America/New_York</code>', and '<code>Pacific/Honolulu</code>'.
@@ -144,7 +170,7 @@ Indiana from other Petersburgs in America.
<p>
Here are the general guidelines used for
choosing <code><abbr>tz</abbr></code> region names,
choosing timezone names,
in decreasing order of importance:
</p>
@@ -196,9 +222,9 @@ in decreasing order of importance:
country or territory.
</li>
<li>
If all the clocks in a region have agreed since 1970,
do not bother to include more than one location
even if subregions' clocks disagreed before 1970.
If all the clocks in a timezone have agreed since 1970,
do not bother to include more than one timezone
even if some of the clocks disagreed before 1970.
Otherwise these tables would become annoyingly large.
</li>
<li>
@@ -212,7 +238,7 @@ in decreasing order of importance:
Keep locations compact.
Use cities or small islands, not countries or regions, so that any
future changes do not split individual locations into different
<code><abbr>tz</abbr></code> regions.
timezones.
E.g., prefer <code>Europe/Paris</code> to <code>Europe/France</code>,
since
<a href="https://en.wikipedia.org/wiki/Time_in_France#History">France
@@ -220,10 +246,10 @@ in decreasing order of importance:
</li>
<li>
Use mainstream English spelling, e.g., prefer
<code>Europe/Rome</code> to <code>Europe/Roma</code>, and
<code>Europe/Rome</code> to <code>Europa/Roma</code>, and
prefer <code>Europe/Athens</code> to the Greek
<code>Europe/Αθήνα</code> or the Romanized
<code>Europe/Athína</code>.
<code>Ευρώπη/Αθήνα</code> or the Romanized
<code>Evrópi/Athína</code>.
The POSIX file name restrictions encourage this guideline.
</li>
<li>
@@ -274,9 +300,9 @@ in decreasing order of importance:
<p>
The file '<code>zone1970.tab</code>' lists geographical locations used
to name <code><abbr>tz</abbr></code> regions.
to name timezones.
It is intended to be an exhaustive list of names for geographic
regions as described above; this is a subset of the names in the data.
regions as described above; this is a subset of the timezones in the data.
Although a '<code>zone1970.tab</code>' location's
<a href="https://en.wikipedia.org/wiki/Longitude">longitude</a>
corresponds to
@@ -381,7 +407,7 @@ in decreasing order of importance:
EST/EDT/EWT/EPT/EDDT Eastern [North America],
EET/EEST Eastern European,
GST Guam,
HST/HDT Hawaii,
HST/HDT/HWT/HPT Hawaii,
HKT/HKST Hong Kong,
IST India,
IST/GMT Irish,
@@ -398,6 +424,7 @@ in decreasing order of importance:
NZST/NZDT New Zealand 1946&ndash;present,
PKT/PKST Pakistan,
PST/PDT/PWT/PPT/PDDT Pacific,
PST/PDT Philippine,
SAST South Africa,
SST Samoa,
WAT/WAST West Africa,
@@ -453,7 +480,7 @@ in decreasing order of importance:
<p>
<small>A few abbreviations also follow the pattern that
<abbr>GMT<abbr>/<abbr>BST</abbr> established for time in the UK.
<abbr>GMT</abbr>/<abbr>BST</abbr> established for time in the UK.
They are:
CMT/BST for Calamarca Mean Time and Bolivian Summer Time
1890&ndash;1932,
@@ -473,7 +500,7 @@ in decreasing order of importance:
</li>
<li>
If there is no common English abbreviation, use numeric offsets like
<code>-</code>05 and <code>+</code>0830 that are generated
<code>-</code>05 and <code>+</code>0530 that are generated
by <code>zic</code>'s <code>%z</code> notation.
</li>
<li>
@@ -488,8 +515,8 @@ in decreasing order of importance:
usage.
</li>
<li>
Use a consistent style in a <code><abbr>tz</abbr></code> region's history.
For example, if history tends to use numeric
Use a consistent style in a timezone's history.
For example, if a history tends to use numeric
abbreviations and a particular entry could go either way, use a
numeric abbreviation.
</li>
@@ -501,7 +528,7 @@ in decreasing order of importance:
The leading '<code>-</code>' is a flag that the <abbr>UT</abbr> offset is in
some sense undefined; this notation is derived
from <a href="https://tools.ietf.org/html/rfc3339">Internet
<abbr title="Request For Comments">RFC 3339</a>.
<abbr title="Request For Comments">RFC</abbr> 3339</a>.
</li>
</ul>
@@ -543,7 +570,7 @@ Errors in the <code><abbr>tz</abbr></code> database arise from many sources:
The pre-1970 entries in this database cover only a tiny sliver of how
clocks actually behaved; the vast majority of the necessary
information was lost or never recorded.
Thousands more <code><abbr>tz</abbr></code> regions would be needed if
Thousands more timezones would be needed if
the <code><abbr>tz</abbr></code> database's scope were extended to
cover even just the known or guessed history of standard time; for
example, the current single entry for France would need to split
@@ -608,19 +635,19 @@ href="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanes
</li>
<li>
The <code><abbr>tz</abbr></code> database does not record the
earliest time for which a <code><abbr>tz</abbr></code> region's
earliest time for which a timezone's
data entries are thereafter valid for every location in the region.
For example, <code>Europe/London</code> is valid for all locations
in its region after <abbr>GMT</abbr> was made the standard time,
but the date of standardization (1880-08-02) is not in the
<code><abbr>tz</abbr></code> database, other than in commentary.
For many <code><abbr>tz</abbr></code> regions the earliest time of
For many timezones the earliest time of
validity is unknown.
</li>
<li>
The <code><abbr>tz</abbr></code> database does not record a
region's boundaries, and in many cases the boundaries are not known.
For example, the <code><abbr>tz</abbr></code> region
For example, the timezone
<code>America/Kentucky/Louisville</code> represents a region
around the city of Louisville, the boundaries of which are
unclear.
@@ -664,19 +691,39 @@ href="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanes
way to specify Easter, these exceptional years are entered as
separate <code><abbr>tz</abbr> Rule</code> lines, even though the
legal rules did not change.
When transitions are known but the historical rules behind them are not,
the database contains <code>Zone</code> and <code>Rule</code>
entries that are intended to represent only the generated
transitions, not any underlying historical rules; however, this
intent is recorded at best only in commentary.
</li>
<li>
The <code><abbr>tz</abbr></code> database models pre-standard time
The <code><abbr>tz</abbr></code> database models time
using the <a
href="https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">proleptic
Gregorian calendar</a> and local mean time, but many people used
other calendars and other timescales.
Gregorian calendar</a> with days containing 24 equal-length hours
numbered 00 through 23, except when clock transitions occur.
Pre-standard time is modeled as local mean time.
However, historically many people used other calendars and other timescales.
For example, the Roman Empire used
the <a href="https://en.wikipedia.org/wiki/Julian_calendar">Julian
calendar</a>,
and <a href="https://en.wikipedia.org/wiki/Roman_timekeeping">Roman
timekeeping</a> had twelve varying-length daytime hours with a
non-hour-based system at night.
And even today, some local practices diverge from the Gregorian
calendar with 24-hour days. These divergences range from
relatively minor, such as Japanese bars giving times like "24:30" for the
wee hours of the morning, to more-significant differences such as <a
href="https://www.pri.org/stories/2015-01-30/if-you-have-meeting-ethiopia-you-better-double-check-time">the
east African practice of starting the day at dawn</a>, renumbering
the Western 06:00 to be 12:00. These practices are largely outside
the scope of the <code><abbr>tz</abbr></code> code and data, which
provide only limited support for date and time localization
such as that required by POSIX. If DST is not used a different time zone
can often do the trick; for example, in Kenya a <code>TZ</code> setting
like <code>&lt;-03&gt;3</code> or <code>America/Cayenne</code> starts
the day six hours later than <code>Africa/Nairobi</code> does.
</li>
<li>
Early clocks were less reliable, and data entries do not represent
@@ -710,7 +757,7 @@ href="https://www.dissentmagazine.org/blog/booked-a-global-history-of-time-vanes
historical <a href="https://en.wikipedia.org/wiki/Solar_time">solar time</a>
to more than about one-hour accuracy.
See: Stephenson FR, Morrison LV, Hohenkerk CY.
<a href="http://dx.doi.org/10.1098/rspa.2016.0404">Measurement of
<a href="https://dx.doi.org/10.1098/rspa.2016.0404">Measurement of
the Earth's rotation: 720 BC to AD 2015</a>.
<cite>Proc Royal Soc A</cite>. 2016 Dec 7;472:20160404.
Also see: Espenak F. <a
@@ -746,7 +793,7 @@ Any attempt to pass the
should be unacceptable to anybody who cares about the facts.
In particular, the <code><abbr>tz</abbr></code> database's
<abbr>LMT</abbr> offsets should not be considered meaningful, and
should not prompt creation of <code><abbr>tz</abbr></code> regions
should not prompt creation of timezones
merely because two locations
differ in <abbr>LMT</abbr> or transitioned to standard time at
different dates.
@@ -798,7 +845,7 @@ an older <code>zic</code>.
<dl>
<dt><var>std</var> and <var>dst</var></dt><dd>
are 3 or more characters specifying the standard
and daylight saving time (<abbr>DST</abbr>) zone names.
and daylight saving time (<abbr>DST</abbr>) zone abbreviations.
Starting with POSIX.1-2001, <var>std</var> and <var>dst</var>
may also be in a quoted form like '<code>&lt;+09&gt;</code>';
this allows "<code>+</code>" and "<code>-</code>" in the names.
@@ -870,38 +917,38 @@ an older <code>zic</code>.
<pre><code>TZ='Pacific/Auckland'</code></pre>
</li>
<li>
POSIX does not define the exact meaning of <code>TZ</code> values like
POSIX does not define the <abbr>DST</abbr> transitions
for <code>TZ</code> values like
"<code>EST5EDT</code>".
Typically the current <abbr>US</abbr> <abbr>DST</abbr> rules
are used to interpret such values, but this means that the
<abbr>US</abbr> <abbr>DST</abbr> rules are compiled into each
program that does time conversion.
This means that when
<abbr>US</abbr> time conversion rules change (as in the United
States in 1987), all programs that do time conversion must be
Traditionally the current <abbr>US</abbr> <abbr>DST</abbr> rules
were used to interpret such values, but this meant that the
<abbr>US</abbr> <abbr>DST</abbr> rules were compiled into each
program that did time conversion. This meant that when
<abbr>US</abbr> time conversion rules changed (as in the United
States in 1987), all programs that did time conversion had to be
recompiled to ensure proper results.
</li>
<li>
The <code>TZ</code> environment variable is process-global, which
makes it hard to write efficient, thread-safe applications that
need access to multiple time zone rulesets.
need access to multiple timezones.
</li>
<li>
In POSIX, there is no tamper-proof way for a process to learn the
system's best idea of local wall clock.
(This is important for applications that an administrator wants
This is important for applications that an administrator wants
used only at certain times &ndash; without regard to whether the
user has fiddled the
<code>TZ</code> environment variable.
While an administrator can "do everything in <abbr>UT</abbr>" to
get around the problem, doing so is inconvenient and precludes
handling daylight saving time shifts - as might be required to
limit phone calls to off-peak hours.)
handling daylight saving time shifts &ndash; as might be required to
limit phone calls to off-peak hours.
</li>
<li>
POSIX provides no convenient and efficient way to determine
the <abbr>UT</abbr> offset and time zone abbreviation of arbitrary
timestamps, particularly for <code><abbr>tz</abbr></code> regions
timestamps, particularly for timezones
that do not fit into the POSIX model.
</li>
<li>
@@ -919,7 +966,7 @@ an older <code>zic</code>.
Unsigned 32-bit integers are used on one or two platforms, and 36-bit
and 40-bit integers are also used occasionally.
Although earlier POSIX versions allowed <code>time_t</code> to be a
floating-point type, this was not supported by any practical systems,
floating-point type, this was not supported by any practical system,
and POSIX.1-2013 and the <code><abbr>tz</abbr></code> code both
require <code>time_t</code> to be an integer type.
</li>
@@ -931,15 +978,16 @@ an older <code>zic</code>.
<li>
<p>
The <code>TZ</code> environment variable is used in generating
the name of a binary file from which time-related information is read
the name of a file from which time-related information is read
(or is interpreted à la POSIX); <code>TZ</code> is no longer
constrained to be a three-letter time zone
abbreviation followed by a number of hours and an optional three-letter
daylight time zone abbreviation.
constrained to be a string containing abbreviations
and numeric data as described <a href="#POSIX">above</a>.
The file's format is <dfn><abbr>TZif</abbr></dfn>,
a timezone information format that contains binary data.
The daylight saving time rules to be used for a
particular <code><abbr>tz</abbr></code> region are encoded in the
binary file; the format of the file
allows U.S., Australian, and other rules to be encoded, and
particular timezone are encoded in the
<abbr>TZif</abbr> file; the format of the file allows <abbr>US</abbr>,
Australian, and other rules to be encoded, and
allows for situations where more than two time zone
abbreviations are used.
</p>
@@ -949,15 +997,15 @@ an older <code>zic</code>.
might cause "old" programs (that expect <code>TZ</code> to have a
certain form) to operate incorrectly; consideration was given to using
some other environment variable (for example, <code>TIMEZONE</code>)
to hold the string used to generate the binary file's name.
to hold the string used to generate the <abbr>TZif</abbr> file's name.
In the end, however, it was decided to continue using
<code>TZ</code>: it is widely used for time zone purposes;
separately maintaining both <code>TZ</code>
and <code>TIMEZONE</code> seemed a nuisance; and systems where
"new" forms of <code>TZ</code> might cause problems can simply
use <code>TZ</code> values such as "<code>EST5EDT</code>" which
can be used both by "new" programs (à la POSIX) and "old"
programs (as zone names and offsets).
use legacy <code>TZ</code> values such as "<code>EST5EDT</code>" which
can be used by "new" programs as well as by "old" programs that
assume pre-POSIX <code>TZ</code> values.
</p>
</li>
<li>
@@ -972,7 +1020,7 @@ an older <code>zic</code>.
Functions <code>tzalloc</code>, <code>tzfree</code>,
<code>localtime_rz</code>, and <code>mktime_z</code> for
more-efficient thread-safe applications that need to use multiple
time zone rulesets.
timezones.
The <code>tzalloc</code> and <code>tzfree</code> functions
allocate and free objects of type <code>timezone_t</code>,
and <code>localtime_rz</code> and <code>mktime_z</code> are
@@ -1093,8 +1141,9 @@ The vestigial <abbr>API</abbr>s are:
standardization proposals.
</li>
<li>
Other time conversion proposals, in particular the one developed
by folks at Hewlett Packard, offer a wider selection of functions
Other time conversion proposals, in particular those supported by the
<a href="https://howardhinnant.github.io/date/tz.html">Time Zone
Database Parser</a>, offer a wider selection of functions
that provide capabilities beyond those provided here.
The absence of such functions from this package is not meant to
discourage the development, standardization, or use of such
@@ -1116,8 +1165,8 @@ The <code><abbr>tz</abbr></code> code and data supply the following interfaces:
<ul>
<li>
A set of <code><abbr>tz</abbr></code> region names as per
"<a href="#naming">Names of time zone rulesets</a>" above.
A set of timezone names as per
"<a href="#naming">Names of timezones</a>" above.
</li>
<li>
Library functions described in "<a href="#functions">Time and date
@@ -1186,7 +1235,7 @@ They sometimes disagree.
<h2 id="planets">Time and time zones on other planets</h2>
<p>
Some people's work schedules
use <a href="https://en.wikipedia.org/wiki/Timekeeping on Mars">Mars time</a>.
use <a href="https://en.wikipedia.org/wiki/Timekeeping_on_Mars">Mars time</a>.
Jet Propulsion Laboratory (JPL) coordinators kept Mars time on
and off during the
<a href="https://en.wikipedia.org/wiki/Mars_Pathfinder#End_of_mission">Mars
@@ -1218,7 +1267,7 @@ Coordinated Time (<abbr>MTC</abbr>)</a>.
<p>
Each landed mission on Mars has adopted a different reference for
solar time keeping, so there is no real standard for Mars time zones.
solar timekeeping, so there is no real standard for Mars time zones.
For example, the
<a href="https://en.wikipedia.org/wiki/Mars_Exploration_Rover">Mars
Exploration Rover</a> project (2004) defined two time zones "Local
@@ -1290,7 +1339,7 @@ Sources for time on other planets:
Matt Williams,
"<a href="https://www.universetoday.com/37481/days-of-the-planets/">How
long is a day on the other planets of the solar system?</a>"
(2017-04-27).
(2016-01-20).
</li>
</ul>
</section>
+1 -1
View File
@@ -1 +1 @@
2018e
2018g
+1
View File
@@ -1,4 +1,5 @@
#! /bin/sh
: 'Determine whether year is of appropriate type (this file is obsolete).'
: 'This file is in the public domain, so clarified as of'
: '2006-07-17 by Arthur David Olson.'
+7
View File
@@ -80,6 +80,13 @@ DATAFORM != "main" {
if (comment_out) {
sub(/^/, "#")
}
# In rearguard format, change the Japan rule line with "Sat>=8 25:00"
# to "Sun>=9 1:00", to cater to zic before 2007 and to older Java.
if (!vanguard && $1 == "Rule" && $7 == "Sat>=8" && $8 == "25:00") {
sub(/Sat>=8/, "Sun>=9")
sub(/25:00/, " 1:00")
}
}
# If a Link line is followed by a Zone line for the same data, comment
+182 -19
View File
@@ -6,28 +6,146 @@
# 'zic' should treat this script's output as if it were identical to
# this script's input.
# Record a hash N for the new name NAME, checking for collisions.
# Return a new rule name.
# N_RULE_NAMES keeps track of how many rule names have been generated.
function gen_rule_name(alphabet, base, rule_name, n, digit)
function record_hash(n, name)
{
alphabet = ""
alphabet = alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
alphabet = alphabet "abcdefghijklmnopqrstuvwxyz"
alphabet = alphabet "!$%&'()*+,./:;<=>?@[\\]^_`{|}~"
base = length(alphabet)
rule_name = ""
n = n_rule_names++
if (used_hashes[n]) {
printf "# ! collision: %s %s\n", used_hashes[n], name
exit 1
}
used_hashes[n] = name
}
do {
n -= rule_name && n <= base
digit = n % base
rule_name = substr(alphabet, digit + 1, 1) rule_name
n = (n - digit) / base
} while (n);
# Return a shortened rule name representing NAME,
# and record this relationship to the hash table.
return rule_name
function gen_rule_name(name, n)
{
# Use a simple memonic: the first two letters.
n = substr(name, 1, 2)
record_hash(n, name)
# printf "# %s = %s\n", n, name
return n
}
function prehash_rule_names(name)
{
# Rule names are not part of the tzdb API, so substitute shorter
# ones. Shortening them consistently from one release to the next
# simplifies comparison of the output. That being said, the
# 1-letter names below are not standardized in any way, and can
# change arbitrarily from one release to the next, as the main goal
# here is compression not comparison.
# Abbreviating these rules names to one letter saved the most space
# circa 2018e.
rule["Arg"] = "A"
rule["Brazil"] = "B"
rule["Canada"] = "C"
rule["Denmark"] = "D"
rule["EU"] = "E"
rule["France"] = "F"
rule["GB-Eire"] = "G"
rule["Halifax"] = "H"
rule["Italy"] = "I"
rule["Jordan"] = "J"
rule["Egypt"] = "K" # "Kemet" in ancient Egyptian
rule["Libya"] = "L"
rule["Morocco"] = "M"
rule["Neth"] = "N"
rule["Poland"] = "O" # arbitrary
rule["Palestine"] = "P"
rule["Cuba"] = "Q" # Its start sounds like "Q".
rule["Russia"] = "R"
rule["Syria"] = "S"
rule["Turkey"] = "T"
rule["Uruguay"] = "U"
rule["Vincennes"] = "V"
rule["Winn"] = "W"
rule["Mongol"] = "X" # arbitrary
rule["NT_YK"] = "Y"
rule["Zion"] = "Z"
rule["Austria"] = "a"
rule["Belgium"] = "b"
rule["C-Eur"] = "c"
rule["Algeria"] = "d" # country code DZ
rule["E-Eur"] = "e"
rule["Taiwan"] = "f" # Formosa
rule["Greece"] = "g"
rule["Hungary"] = "h"
rule["Iran"] = "i"
rule["StJohns"] = "j"
rule["Chatham"] = "k" # arbitrary
rule["Lebanon"] = "l"
rule["Mexico"] = "m"
rule["Tunisia"] = "n" # country code TN
rule["Moncton"] = "o" # arbitrary
rule["Port"] = "p"
rule["Albania"] = "q" # arbitrary
rule["Regina"] = "r"
rule["Spain"] = "s"
rule["Toronto"] = "t"
rule["US"] = "u"
rule["Louisville"] = "v" # ville
rule["Iceland"] = "w" # arbitrary
rule["Chile"] = "x" # arbitrary
rule["Para"] = "y" # country code PY
rule["Romania"] = "z" # arbitrary
rule["Macau"] = "_" # arbitrary
# Use ISO 3166 alpha-2 country codes for remaining names that are countries.
# This is more systematic, and avoids collisions (e.g., Malta and Moldova).
rule["Armenia"] = "AM"
rule["Aus"] = "AU"
rule["Azer"] = "AZ"
rule["Barb"] = "BB"
rule["Dhaka"] = "BD"
rule["Bulg"] = "BG"
rule["Bahamas"] = "BS"
rule["Belize"] = "BZ"
rule["Swiss"] = "CH"
rule["Cook"] = "CK"
rule["PRC"] = "CN"
rule["Cyprus"] = "CY"
rule["Czech"] = "CZ"
rule["Germany"] = "DE"
rule["DR"] = "DO"
rule["Ecuador"] = "EC"
rule["Finland"] = "FI"
rule["Fiji"] = "FJ"
rule["Falk"] = "FK"
rule["Ghana"] = "GH"
rule["Guat"] = "GT"
rule["Hond"] = "HN"
rule["Haiti"] = "HT"
rule["Eire"] = "IE"
rule["Iraq"] = "IQ"
rule["Japan"] = "JP"
rule["Kyrgyz"] = "KG"
rule["ROK"] = "KR"
rule["Latvia"] = "LV"
rule["Lux"] = "LX"
rule["Moldova"] = "MD"
rule["Malta"] = "MT"
rule["Mauritius"] = "MU"
rule["Namibia"] = "NA"
rule["Nic"] = "NI"
rule["Norway"] = "NO"
rule["Peru"] = "PE"
rule["Phil"] = "PH"
rule["Pakistan"] = "PK"
rule["Sudan"] = "SD"
rule["Salv"] = "SV"
rule["Tonga"] = "TO"
rule["Vanuatu"] = "VU"
# Avoid collisions.
rule["Detroit"] = "Dt" # De = Denver
for (name in rule) {
record_hash(rule[name], name)
}
}
# Process an input line and save it for later output.
@@ -106,7 +224,7 @@ function process_input_line(line, field, end, i, n, startdef)
i = field[1] == "Z" ? 4 : field[1] == "Li" ? 0 : 2
if (i && field[i] ~ /^[^-+0-9]/) {
if (!rule[field[i]])
rule[field[i]] = gen_rule_name()
rule[field[i]] = gen_rule_name(field[i])
field[i] = rule[field[i]]
}
@@ -144,8 +262,53 @@ function output_saved_lines(i)
}
BEGIN {
# Files that the output normally depends on.
default_dep["africa"] = 1
default_dep["antarctica"] = 1
default_dep["asia"] = 1
default_dep["australasia"] = 1
default_dep["backward"] = 1
default_dep["etcetera"] = 1
default_dep["europe"] = 1
default_dep["factory"] = 1
default_dep["northamerica"] = 1
default_dep["southamerica"] = 1
default_dep["systemv"] = 1
default_dep["ziguard.awk"] = 1
default_dep["zishrink.awk"] = 1
# Output a version string from 'version' and related configuration variables
# supported by tzdb's Makefile. If you change the makefile or any other files
# that affect the output of this script, you should append '-SOMETHING'
# to the contents of 'version', where SOMETHING identifies what was changed.
ndeps = split(deps, dep)
ddeps = ""
for (i = 1; i <= ndeps; i++) {
if (default_dep[dep[i]]) {
default_dep[dep[i]]++
} else {
ddeps = ddeps " " dep[i]
}
}
for (d in default_dep) {
if (default_dep[d] == 1) {
ddeps = ddeps " !" d
}
}
print "# version", version
if (dataform != "main") {
print "# dataform", dataform
}
if (redo != "posix_right") {
print "# redo " redo
}
if (ddeps) {
print "# ddeps" ddeps
}
print "# This zic input file is in the public domain."
prehash_rule_names()
}
/^[\t ]*[^#\t ]/ {
+7 -7
View File
@@ -1,9 +1,9 @@
# tz zone descriptions (deprecated version)
# tzdb timezone descriptions (deprecated version)
#
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
#
# From Paul Eggert (2014-07-31):
# From Paul Eggert (2018-06-27):
# This file is intended as a backward-compatibility aid for older programs.
# New programs should use zone1970.tab. This file is like zone1970.tab (see
# zone1970.tab's comments), but with the following additional restrictions:
@@ -12,13 +12,13 @@
# 2. The first data column contains exactly one country code.
#
# Because of (2), each row stands for an area that is the intersection
# of a region identified by a country code and of a zone where civil
# of a region identified by a country code and of a timezone where civil
# clocks have agreed since 1970; this is a narrower definition than
# that of zone1970.tab.
#
# This table is intended as an aid for users, to help them select time
# zone data entries appropriate for their practical needs. It is not
# intended to take or endorse any position on legal or territorial claims.
# This table is intended as an aid for users, to help them select timezones
# appropriate for their practical needs. It is not intended to take or
# endorse any position on legal or territorial claims.
#
#country-
#code coordinates TZ comments
@@ -268,7 +268,7 @@ MM +1647+09610 Asia/Yangon
MN +4755+10653 Asia/Ulaanbaatar Mongolia (most areas)
MN +4801+09139 Asia/Hovd Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
MN +4804+11430 Asia/Choibalsan Dornod, Sukhbaatar
MO +2214+11335 Asia/Macau
MO +221150+1133230 Asia/Macau
MP +1512+14545 Pacific/Saipan
MQ +1436-06105 America/Martinique
MR +1806-01557 Africa/Nouakchott
+16 -16
View File
@@ -1,36 +1,36 @@
# tz zone descriptions
# tzdb timezone descriptions
#
# This file is in the public domain.
#
# From Paul Eggert (2017-10-01):
# This file contains a table where each row stands for a zone where
# civil time stamps have agreed since 1970. Columns are separated by
# From Paul Eggert (2018-06-27):
# This file contains a table where each row stands for a timezone where
# civil timestamps have agreed since 1970. Columns are separated by
# a single tab. Lines beginning with '#' are comments. All text uses
# UTF-8 encoding. The columns of the table are as follows:
#
# 1. The countries that overlap the zone, as a comma-separated list
# 1. The countries that overlap the timezone, as a comma-separated list
# of ISO 3166 2-character country codes.
# See the file '/usr/share/misc/iso3166'.
# 2. Latitude and longitude of the zone's principal location
# 2. Latitude and longitude of the timezone's principal location
# in ISO 6709 sign-degrees-minutes-seconds format,
# either ±DDMM±DDDMM or ±DDMMSS±DDDMMSS,
# first latitude (+ is north), then longitude (+ is east).
# 3. Zone name used in value of TZ environment variable.
# Please see the theory.html file for how zone names are chosen.
# If multiple zones overlap a country, each has a row in the
# 3. Timezone name used in value of TZ environment variable.
# Please see the theory.html file for how these names are chosen.
# If multiple timezones overlap a country, each has a row in the
# table, with each column 1 containing the country code.
# 4. Comments; present if and only if a country has multiple zones.
# 4. Comments; present if and only if a country has multiple timezones.
#
# If a zone covers multiple countries, the most-populous city is used,
# If a timezone covers multiple countries, the most-populous city is used,
# and that country is listed first in column 1; any other countries
# are listed alphabetically by country code. The table is sorted
# first by country code, then (if possible) by an order within the
# country that (1) makes some geographical sense, and (2) puts the
# most populous zones first, where that does not contradict (1).
# most populous timezones first, where that does not contradict (1).
#
# This table is intended as an aid for users, to help them select time
# zone data entries appropriate for their practical needs. It is not
# intended to take or endorse any position on legal or territorial claims.
# This table is intended as an aid for users, to help them select timezones
# appropriate for their practical needs. It is not intended to take or
# endorse any position on legal or territorial claims.
#
#country-
#codes coordinates TZ comments
@@ -232,7 +232,7 @@ MM +1647+09610 Asia/Yangon
MN +4755+10653 Asia/Ulaanbaatar Mongolia (most areas)
MN +4801+09139 Asia/Hovd Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan
MN +4804+11430 Asia/Choibalsan Dornod, Sükhbaatar
MO +2214+11335 Asia/Macau
MO +221150+1133230 Asia/Macau
MQ +1436-06105 America/Martinique
MT +3554+01431 Europe/Malta
MU -2010+05730 Indian/Mauritius
+1
View File
@@ -1,4 +1,5 @@
#! /usr/bin/perl -w
# Summarize .zi input in a .zi-like format.
# Courtesy Ken Pizzini.
+3
View File
@@ -664,6 +664,9 @@
/* Define as the return type of signal handlers (`int' or `void'). */
#define RETSIGTYPE void
/* if REUSEPORT is enabled by default */
#define REUSEPORT_DEFAULT 0
/* default rootkey location */
#define ROOT_ANCHOR_FILE "/var/unbound/root.key"
+3
View File
@@ -663,6 +663,9 @@
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* if REUSEPORT is enabled by default */
#undef REUSEPORT_DEFAULT
/* default rootkey location */
#undef ROOT_ANCHOR_FILE
+11
View File
@@ -15966,6 +15966,17 @@ fi
done
# check if we can use SO_REUSEPORT
if echo "$host" | grep -i -e linux -e dragonfly >/dev/null; then
$as_echo "#define REUSEPORT_DEFAULT 1" >>confdefs.h
else
$as_echo "#define REUSEPORT_DEFAULT 0" >>confdefs.h
fi
# set memory allocation checking if requested
# Check whether --enable-alloc-checks was given.
if test "${enable_alloc_checks+set}" = set; then :
+7
View File
@@ -461,6 +461,13 @@ ACX_CHECK_NONBLOCKING_BROKEN
ACX_MKDIR_ONE_ARG
AC_CHECK_FUNCS([strptime],[AC_CHECK_STRPTIME_WORKS],[AC_LIBOBJ([strptime])])
# check if we can use SO_REUSEPORT
if echo "$host" | grep -i -e linux -e dragonfly >/dev/null; then
AC_DEFINE(REUSEPORT_DEFAULT, 1, [if REUSEPORT is enabled by default])
else
AC_DEFINE(REUSEPORT_DEFAULT, 0, [if REUSEPORT is enabled by default])
fi
# set memory allocation checking if requested
AC_ARG_ENABLE(alloc-checks, AC_HELP_STRING([--enable-alloc-checks],
[ enable to memory allocation statistics, for debug purposes ]),
+1 -1
View File
@@ -177,7 +177,7 @@ config_create(void)
cfg->if_automatic = 0;
cfg->so_rcvbuf = 0;
cfg->so_sndbuf = 0;
cfg->so_reuseport = 1;
cfg->so_reuseport = REUSEPORT_DEFAULT;
cfg->ip_transparent = 0;
cfg->ip_freebind = 0;
cfg->num_ifs = 0;
+36 -1
View File
@@ -7,6 +7,42 @@
https://github.com/openssl/openssl/commits/ and pick the appropriate
release branch.
Changes between 1.1.1 and 1.1.1a [20 Nov 2018]
*) Timing vulnerability in DSA signature generation
The OpenSSL DSA signature algorithm has been shown to be vulnerable to a
timing side channel attack. An attacker could use variations in the signing
algorithm to recover the private key.
This issue was reported to OpenSSL on 16th October 2018 by Samuel Weiser.
(CVE-2018-0734)
[Paul Dale]
*) Timing vulnerability in ECDSA signature generation
The OpenSSL ECDSA signature algorithm has been shown to be vulnerable to a
timing side channel attack. An attacker could use variations in the signing
algorithm to recover the private key.
This issue was reported to OpenSSL on 25th October 2018 by Samuel Weiser.
(CVE-2018-0735)
[Paul Dale]
*) Added EVP_PKEY_ECDH_KDF_X9_63 and ecdh_KDF_X9_63() as replacements for
the EVP_PKEY_ECDH_KDF_X9_62 KDF type and ECDH_KDF_X9_62(). The old names
are retained for backwards compatibility.
[Antoine Salon]
*) Fixed the issue that RAND_add()/RAND_seed() silently discards random input
if its length exceeds 4096 bytes. The limit has been raised to a buffer size
of two gigabytes and the error handling improved.
This issue was reported to OpenSSL by Dr. Falko Strenzke. It has been
categorized as a normal bug, not a security issue, because the DRBG reseeds
automatically and is fully functional even without additional randomness
provided by the application.
Changes between 1.1.0i and 1.1.1 [11 Sep 2018]
*) Add a new ClientHello callback. Provides a callback interface that gives
@@ -13103,4 +13139,3 @@ des-cbc 3624.96k 5258.21k 5530.91k 5624.30k 5628.26k
*) A minor bug in ssl/s3_clnt.c where there would always be 4 0
bytes sent in the client random.
[Edward Bishop <[email protected]>]
+68 -11
View File
@@ -1013,13 +1013,18 @@ if (scalar(@seed_sources) == 0) {
if (scalar(grep { $_ eq 'none' } @seed_sources) > 0) {
die "Cannot seed with none and anything else" if scalar(@seed_sources) > 1;
warn <<_____ if scalar(@seed_sources) == 1;
You have selected the --with-rand-seed=none option, which effectively disables
automatic reseeding of the OpenSSL random generator. All operations depending
on the random generator such as creating keys will not work unless the random
generator is seeded manually by the application.
Please read the 'Note on random number generation' section in the INSTALL
instructions and the RAND_DRBG(7) manual page for more details.
============================== WARNING ===============================
You have selected the --with-rand-seed=none option, which effectively
disables automatic reseeding of the OpenSSL random generator.
All operations depending on the random generator such as creating keys
will not work unless the random generator is seeded manually by the
application.
Please read the 'Note on random number generation' section in the
INSTALL instructions and the RAND_DRBG(7) manual page for more details.
============================== WARNING ===============================
_____
}
push @{$config{openssl_other_defines}},
@@ -2174,6 +2179,16 @@ EOF
# Massage the result
# If the user configured no-shared, we allow no shared sources
if ($disabled{shared}) {
foreach (keys %{$unified_info{shared_sources}}) {
foreach (keys %{$unified_info{shared_sources}->{$_}}) {
delete $unified_info{sources}->{$_};
}
}
$unified_info{shared_sources} = {};
}
# If we depend on a header file or a perl module, add an inclusion of
# its directory to allow smoothe inclusion
foreach my $dest (keys %{$unified_info{depends}}) {
@@ -2198,8 +2213,8 @@ EOF
next unless defined($unified_info{includes}->{$dest}->{$k});
my @incs = reverse @{$unified_info{includes}->{$dest}->{$k}};
foreach my $obj (grep /\.o$/,
(keys %{$unified_info{sources}->{$dest}},
keys %{$unified_info{shared_sources}->{$dest}})) {
(keys %{$unified_info{sources}->{$dest} // {}},
keys %{$unified_info{shared_sources}->{$dest} // {}})) {
foreach my $inc (@incs) {
unshift @{$unified_info{includes}->{$obj}->{$k}}, $inc
unless grep { $_ eq $inc } @{$unified_info{includes}->{$obj}->{$k}};
@@ -2238,6 +2253,42 @@ EOF
[ @{$unified_info{includes}->{$dest}->{source}} ];
}
}
# For convenience collect information regarding directories where
# files are generated, those generated files and the end product
# they end up in where applicable. Then, add build rules for those
# directories
my %loopinfo = ( "lib" => [ @{$unified_info{libraries}} ],
"dso" => [ @{$unified_info{engines}} ],
"bin" => [ @{$unified_info{programs}} ],
"script" => [ @{$unified_info{scripts}} ] );
foreach my $type (keys %loopinfo) {
foreach my $product (@{$loopinfo{$type}}) {
my %dirs = ();
my $pd = dirname($product);
foreach (@{$unified_info{sources}->{$product} // []},
@{$unified_info{shared_sources}->{$product} // []}) {
my $d = dirname($_);
# We don't want to create targets for source directories
# when building out of source
next if ($config{sourcedir} ne $config{builddir}
&& $d =~ m|^\Q$config{sourcedir}\E|);
# We already have a "test" target, and the current directory
# is just silly to make a target for
next if $d eq "test" || $d eq ".";
$dirs{$d} = 1;
push @{$unified_info{dirinfo}->{$d}->{deps}}, $_
if $d ne $pd;
}
foreach (keys %dirs) {
push @{$unified_info{dirinfo}->{$_}->{products}->{$type}},
$product;
}
}
}
}
# For the schemes that need it, we provide the old *_obj configs
@@ -2712,10 +2763,16 @@ print <<"EOF";
**********************************************************************
*** ***
*** If you want to report a building issue, please include the ***
*** output from this command: ***
*** OpenSSL has been successfully configured ***
*** ***
*** perl configdata.pm --dump ***
*** If you encounter a problem while building, please open an ***
*** issue on GitHub <https://github.com/openssl/openssl/issues> ***
*** and include the output from the following command: ***
*** ***
*** perl configdata.pm --dump ***
*** ***
*** (If you are new to OpenSSL, you might want to consult the ***
*** 'Troubleshooting' section in the INSTALL file first) ***
*** ***
**********************************************************************
EOF
+5 -5
View File
@@ -614,8 +614,8 @@
Windows, and as a comma separated list of
libraries on VMS.
RANLIB The library archive indexer.
RC The Windows resources manipulator.
RCFLAGS Flags for the Windows reources manipulator.
RC The Windows resource compiler.
RCFLAGS Flags for the Windows resource compiler.
RM The command to remove files and directories.
These cannot be mixed with compiling / linking flags given
@@ -969,7 +969,7 @@
BUILDFILE
Use a different build file name than the platform default
("Makefile" on Unixly platforms, "makefile" on native Windows,
("Makefile" on Unix-like platforms, "makefile" on native Windows,
"descrip.mms" on OpenVMS). This requires that there is a
corresponding build file template. See Configurations/README
for further information.
@@ -1171,7 +1171,7 @@
part of the file name, i.e. for OpenSSL 1.1.x, 1.1 is somehow part of
the name.
On most POSIXly platforms, shared libraries are named libcrypto.so.1.1
On most POSIX platforms, shared libraries are named libcrypto.so.1.1
and libssl.so.1.1.
on Cygwin, shared libraries are named cygcrypto-1.1.dll and cygssl-1.1.dll
@@ -1202,7 +1202,7 @@
The seeding method can be configured using the --with-rand-seed option,
which can be used to specify a comma separated list of seed methods.
However in most cases OpenSSL will choose a suitable default method,
so it is not necessary to explicitely provide this option. Note also
so it is not necessary to explicitly provide this option. Note also
that not all methods are available on all platforms.
I) On operating systems which provide a suitable randomness source (in
+5
View File
@@ -5,6 +5,11 @@
This file gives a brief overview of the major changes between each OpenSSL
release. For more details please read the CHANGES file.
Major changes between OpenSSL 1.1.1 and OpenSSL 1.1.1a [20 Nov 2018]
o Timing vulnerability in DSA signature generation (CVE-2018-0734)
o Timing vulnerability in ECDSA signature generation (CVE-2018-0735)
Major changes between OpenSSL 1.1.0i and OpenSSL 1.1.1 [11 Sep 2018]
o Support for TLSv1.3 added (see https://wiki.openssl.org/index.php/TLS1.3
+1 -1
View File
@@ -1,5 +1,5 @@
OpenSSL 1.1.1 11 Sep 2018
OpenSSL 1.1.1a 20 Nov 2018
Copyright (c) 1998-2018 The OpenSSL Project
Copyright (c) 1995-1998 Eric A. Young, Tim J. Hudson
+1 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -26,7 +26,6 @@ void app_RAND_load_conf(CONF *c, const char *section)
if (RAND_load_file(randfile, -1) < 0) {
BIO_printf(bio_err, "Can't load %s into RNG\n", randfile);
ERR_print_errors(bio_err);
return;
}
if (save_rand_file == NULL)
save_rand_file = OPENSSL_strdup(randfile);
+6
View File
@@ -1831,6 +1831,12 @@ X509_NAME *parse_name(const char *cp, long chtype, int canmulti)
opt_getprog(), typestr);
continue;
}
if (*valstr == '\0') {
BIO_printf(bio_err,
"%s: No value provided for Subject Attribute %s, skipped\n",
opt_getprog(), typestr);
continue;
}
if (!X509_NAME_add_entry_by_NID(n, nid, chtype,
valstr, strlen((char *)valstr),
-1, ismulti ? -1 : 0))
+3 -3
View File
@@ -369,7 +369,7 @@ typedef struct string_int_pair_st {
# define OPT_FMT_SMIME (1L << 3)
# define OPT_FMT_ENGINE (1L << 4)
# define OPT_FMT_MSBLOB (1L << 5)
# define OPT_FMT_NETSCAPE (1L << 6)
/* (1L << 6) was OPT_FMT_NETSCAPE, but wasn't used */
# define OPT_FMT_NSS (1L << 7)
# define OPT_FMT_TEXT (1L << 8)
# define OPT_FMT_HTTP (1L << 9)
@@ -378,8 +378,8 @@ typedef struct string_int_pair_st {
# define OPT_FMT_PDS (OPT_FMT_PEMDER | OPT_FMT_SMIME)
# define OPT_FMT_ANY ( \
OPT_FMT_PEMDER | OPT_FMT_PKCS12 | OPT_FMT_SMIME | \
OPT_FMT_ENGINE | OPT_FMT_MSBLOB | OPT_FMT_NETSCAPE | \
OPT_FMT_NSS | OPT_FMT_TEXT | OPT_FMT_HTTP | OPT_FMT_PVK)
OPT_FMT_ENGINE | OPT_FMT_MSBLOB | OPT_FMT_NSS | \
OPT_FMT_TEXT | OPT_FMT_HTTP | OPT_FMT_PVK)
char *opt_progname(const char *argv0);
char *opt_getprog(void);
+11 -10
View File
@@ -605,7 +605,7 @@ end_of_options:
/*
* outdir is a directory spec, but access() for VMS demands a
* filename. We could use the DEC C routine to convert the
* directory syntax to Unixly, and give that to app_isdir,
* directory syntax to Unix, and give that to app_isdir,
* but for now the fopen will catch the error if it's not a
* directory
*/
@@ -976,7 +976,7 @@ end_of_options:
BIO_printf(bio_err, "Write out database with %d new entries\n",
sk_X509_num(cert_sk));
if (!rand_ser
if (serialfile != NULL
&& !save_serial(serialfile, "new", serial, NULL))
goto end;
@@ -1044,7 +1044,8 @@ end_of_options:
if (sk_X509_num(cert_sk)) {
/* Rename the database and the serial file */
if (!rotate_serial(serialfile, "new", "old"))
if (serialfile != NULL
&& !rotate_serial(serialfile, "new", "old"))
goto end;
if (!rotate_index(dbfile, "new", "old"))
@@ -1177,10 +1178,9 @@ end_of_options:
}
/* we have a CRL number that need updating */
if (crlnumberfile != NULL)
if (!rand_ser
&& !save_serial(crlnumberfile, "new", crlnumber, NULL))
goto end;
if (crlnumberfile != NULL
&& !save_serial(crlnumberfile, "new", crlnumber, NULL))
goto end;
BN_free(crlnumber);
crlnumber = NULL;
@@ -1195,9 +1195,10 @@ end_of_options:
PEM_write_bio_X509_CRL(Sout, crl);
if (crlnumberfile != NULL) /* Rename the crlnumber file */
if (!rotate_serial(crlnumberfile, "new", "old"))
goto end;
/* Rename the crlnumber file */
if (crlnumberfile != NULL
&& !rotate_serial(crlnumberfile, "new", "old"))
goto end;
}
/*****************************************************************/
+2
View File
@@ -950,6 +950,7 @@ static void spawn_loop(void)
sleep(30);
break;
case 0: /* child */
OPENSSL_free(kidpids);
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
if (termsig)
@@ -976,6 +977,7 @@ static void spawn_loop(void)
}
/* The loop above can only break on termsig */
OPENSSL_free(kidpids);
syslog(LOG_INFO, "terminating on signal: %d", termsig);
killall(0, kidpids);
}
-2
View File
@@ -11,7 +11,6 @@
# This definition stops the following lines choking if HOME isn't
# defined.
HOME = .
RANDFILE = $ENV::HOME/.rnd
# Extra OBJECT IDENTIFIER info:
#oid_file = $ENV::HOME/.oid
@@ -58,7 +57,6 @@ crlnumber = $dir/crlnumber # the current crl number
# must be commented out to leave a V1 CRL
crl = $dir/crl.pem # The current CRL
private_key = $dir/private/cakey.pem# The private key
RANDFILE = $dir/private/.rand # private random number file
x509_extensions = usr_cert # The extensions to add to the cert
-1
View File
@@ -168,7 +168,6 @@ static OPT_PAIR formats[] = {
{"smime", OPT_FMT_SMIME},
{"engine", OPT_FMT_ENGINE},
{"msblob", OPT_FMT_MSBLOB},
{"netscape", OPT_FMT_NETSCAPE},
{"nss", OPT_FMT_NSS},
{"text", OPT_FMT_TEXT},
{"http", OPT_FMT_HTTP},
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
* Copyright (c) 2013-2014 Timo Teräs <timo.teras@gmail.com>
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
+5 -2
View File
@@ -38,8 +38,8 @@ typedef enum OPTION_choice {
const OPTIONS rsa_options[] = {
{"help", OPT_HELP, '-', "Display this summary"},
{"inform", OPT_INFORM, 'f', "Input format, one of DER NET PEM"},
{"outform", OPT_OUTFORM, 'f', "Output format, one of DER NET PEM PVK"},
{"inform", OPT_INFORM, 'f', "Input format, one of DER PEM"},
{"outform", OPT_OUTFORM, 'f', "Output format, one of DER PEM PVK"},
{"in", OPT_IN, 's', "Input file"},
{"out", OPT_OUT, '>', "Output file"},
{"pubin", OPT_PUBIN, '-', "Expect a public key in input file"},
@@ -269,6 +269,9 @@ int rsa_main(int argc, char **argv)
} else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
EVP_PKEY *pk;
pk = EVP_PKEY_new();
if (pk == NULL)
goto end;
EVP_PKEY_set1_RSA(pk, rsa);
if (outformat == FORMAT_PVK) {
if (pubin) {
+2 -1
View File
@@ -394,7 +394,8 @@ int ssl_print_groups(BIO *out, SSL *s, int noshared)
int ssl_print_tmp_key(BIO *out, SSL *s)
{
EVP_PKEY *key;
if (!SSL_get_server_tmp_key(s, &key))
if (!SSL_get_peer_tmp_key(s, &key))
return 1;
BIO_puts(out, "Server Temp Key: ");
switch (EVP_PKEY_id(key)) {
+7 -3
View File
@@ -193,9 +193,8 @@ static int psk_find_session_cb(SSL *ssl, const unsigned char *identity,
if (strlen(psk_identity) != identity_len
|| memcmp(psk_identity, identity, identity_len) != 0) {
BIO_printf(bio_s_out,
"PSK warning: client identity not what we expected"
" (got '%s' expected '%s')\n", identity, psk_identity);
*sess = NULL;
return 1;
}
if (psksess != NULL) {
@@ -1622,6 +1621,11 @@ int s_server_main(int argc, char *argv[])
goto end;
}
#endif
if (early_data && (www > 0 || rev)) {
BIO_printf(bio_err,
"Can't use -early_data in combination with -www, -WWW, -HTTP, or -rev\n");
goto end;
}
#ifndef OPENSSL_NO_SCTP
if (protocol == IPPROTO_SCTP) {
+1 -1
View File
@@ -2896,7 +2896,7 @@ int speed_main(int argc, char **argv)
if (rsa_count <= 1) {
/* if longer than 10s, don't do any more */
for (testnum++; testnum < EC_NUM; testnum++)
for (testnum++; testnum < ECDSA_NUM; testnum++)
ecdsa_doit[testnum] = 0;
}
}
+2 -2
View File
@@ -67,10 +67,10 @@ typedef enum OPTION_choice {
const OPTIONS x509_options[] = {
{"help", OPT_HELP, '-', "Display this summary"},
{"inform", OPT_INFORM, 'f',
"Input format - default PEM (one of DER, NET or PEM)"},
"Input format - default PEM (one of DER or PEM)"},
{"in", OPT_IN, '<', "Input file - default stdin"},
{"outform", OPT_OUTFORM, 'f',
"Output format - default PEM (one of DER, NET or PEM)"},
"Output format - default PEM (one of DER or PEM)"},
{"out", OPT_OUT, '>', "Output file - default stdout"},
{"keyform", OPT_KEYFORM, 'F', "Private key format - default PEM"},
{"passin", OPT_PASSIN, 's', "Private key password/pass-phrase source"},
+1 -1
View File
@@ -51,7 +51,7 @@
#endif
/*
* The POSIXly macro for the maximum number of characters in a file path is
* The POSIX macro for the maximum number of characters in a file path is
* NAME_MAX. However, some operating systems use PATH_MAX instead.
* Therefore, it seems natural to first check for PATH_MAX and use that, and
* if it doesn't exist, use NAME_MAX.
@@ -17,7 +17,8 @@
# include <unistd.h>
# if _POSIX_VERSION >= 200112L
# if _POSIX_VERSION >= 200112L \
&& (_POSIX_VERSION < 200809L || defined(__GLIBC__))
# include <pthread.h>
+2
View File
@@ -133,7 +133,9 @@ int BIO_connect(int sock, const BIO_ADDR *addr, int options)
*/
int BIO_bind(int sock, const BIO_ADDR *addr, int options)
{
# ifndef OPENSSL_SYS_WINDOWS
int on = 1;
# endif
if (sock == -1) {
BIOerr(BIO_F_BIO_BIND, BIO_R_INVALID_SOCKET);
+2 -2
View File
@@ -52,7 +52,7 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len,
argi = (int)len;
}
if (inret && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
if (inret > 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
if (*processed > INT_MAX)
return -1;
inret = *processed;
@@ -60,7 +60,7 @@ static long bio_call_callback(BIO *b, int oper, const char *argp, size_t len,
ret = b->callback(b, oper, argp, argi, argl, inret);
if (ret >= 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
if (ret > 0 && (oper & BIO_CB_RETURN) && bareoper != BIO_CB_CTRL) {
*processed = (size_t)ret;
ret = 1;
}
+5
View File
@@ -408,4 +408,9 @@ static void xcloselog(BIO *bp)
# endif /* Unix */
#else /* NO_SYSLOG */
const BIO_METHOD *BIO_s_log(void)
{
return NULL;
}
#endif /* NO_SYSLOG */
+1 -7
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2002-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -64,12 +64,6 @@
* machine.
*/
# if defined(_WIN64) || !defined(__LP64__)
# define BN_ULONG unsigned long long
# else
# define BN_ULONG unsigned long
# endif
# undef mul
# undef mul_add
+1 -1
View File
@@ -1077,7 +1077,7 @@ int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
* is not only slower but also makes each bit vulnerable to
* EM (and likely other) side-channel attacks like One&Done
* (for details see "One&Done: A Single-Decryption EM-Based
* Attack on OpenSSL’s Constant-Time Blinded RSA" by M. Alam,
* Attack on OpenSSL's Constant-Time Blinded RSA" by M. Alam,
* H. Khan, M. Dey, N. Sinha, R. Callan, A. Zajic, and
* M. Prvulovic, in USENIX Security'18)
*/
+23 -19
View File
@@ -767,26 +767,30 @@ void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords)
b->neg ^= t;
/*-
* Idea behind BN_FLG_STATIC_DATA is actually to
* indicate that data may not be written to.
* Intention is actually to treat it as it's
* read-only data, and some (if not most) of it does
* reside in read-only segment. In other words
* observation of BN_FLG_STATIC_DATA in
* BN_consttime_swap should be treated as fatal
* condition. It would either cause SEGV or
* effectively cause data corruption.
* BN_FLG_MALLOCED refers to BN structure itself,
* and hence must be preserved. Remaining flags are
* BN_FLG_CONSTIME and BN_FLG_SECURE. Latter must be
* preserved, because it determines how x->d was
* allocated and hence how to free it. This leaves
* BN_FLG_CONSTTIME that one can do something about.
* To summarize it's sufficient to mask and swap
* BN_FLG_CONSTTIME alone. BN_FLG_STATIC_DATA should
* be treated as fatal.
* BN_FLG_STATIC_DATA: indicates that data may not be written to. Intention
* is actually to treat it as it's read-only data, and some (if not most)
* of it does reside in read-only segment. In other words observation of
* BN_FLG_STATIC_DATA in BN_consttime_swap should be treated as fatal
* condition. It would either cause SEGV or effectively cause data
* corruption.
*
* BN_FLG_MALLOCED: refers to BN structure itself, and hence must be
* preserved.
*
* BN_FLG_SECURE: must be preserved, because it determines how x->d was
* allocated and hence how to free it.
*
* BN_FLG_CONSTTIME: sufficient to mask and swap
*
* BN_FLG_FIXED_TOP: indicates that we haven't called bn_correct_top() on
* the data, so the d array may be padded with additional 0 values (i.e.
* top could be greater than the minimal value that it could be). We should
* be swapping it
*/
t = ((a->flags ^ b->flags) & BN_FLG_CONSTTIME) & condition;
#define BN_CONSTTIME_SWAP_FLAGS (BN_FLG_CONSTTIME | BN_FLG_FIXED_TOP)
t = ((a->flags ^ b->flags) & BN_CONSTTIME_SWAP_FLAGS) & condition;
a->flags ^= t;
b->flags ^= t;
+1 -1
View File
@@ -2,7 +2,7 @@ LIBS=../libcrypto
SOURCE[../libcrypto]=\
cryptlib.c mem.c mem_dbg.c cversion.c ex_data.c cpt_err.c \
ebcdic.c uid.c o_time.c o_str.c o_dir.c o_fopen.c ctype.c \
threads_pthread.c threads_win.c threads_none.c \
threads_pthread.c threads_win.c threads_none.c getenv.c \
o_init.c o_fips.c mem_sec.c init.c {- $target{cpuid_asm_src} -} \
{- $target{uplink_aux_src} -}
EXTRA= ../ms/uplink-x86.pl ../ms/uplink.c ../ms/applink.c \
+3 -2
View File
@@ -10,6 +10,7 @@
/* Part of the code in here was originally in conf.c, which is now removed */
#include "e_os.h"
#include "internal/cryptlib.h"
#include <stdlib.h>
#include <string.h>
#include <openssl/conf.h>
@@ -82,7 +83,7 @@ char *_CONF_get_string(const CONF *conf, const char *section,
if (v != NULL)
return v->value;
if (strcmp(section, "ENV") == 0) {
p = getenv(name);
p = ossl_safe_getenv(name);
if (p != NULL)
return p;
}
@@ -95,7 +96,7 @@ char *_CONF_get_string(const CONF *conf, const char *section,
else
return NULL;
} else
return getenv(name);
return ossl_safe_getenv(name);
}
static unsigned long conf_value_hash(const CONF_VALUE *v)
+2 -5
View File
@@ -480,11 +480,8 @@ char *CONF_get1_default_config_file(void)
char *file, *sep = "";
int len;
if (!OPENSSL_issetugid()) {
file = getenv("OPENSSL_CONF");
if (file)
return OPENSSL_strdup(file);
}
if ((file = ossl_safe_getenv("OPENSSL_CONF")) != NULL)
return OPENSSL_strdup(file);
len = strlen(X509_get_default_cert_area());
#ifndef OPENSSL_SYS_VMS
+1 -1
View File
@@ -204,7 +204,7 @@ int OPENSSL_isservice(void)
if (_OPENSSL_isservice.p == NULL) {
HANDLE mod = GetModuleHandle(NULL);
FARPROC f;
FARPROC f = NULL;
if (mod != NULL)
f = GetProcAddress(mod, "_OPENSSL_isservice");
+1 -1
View File
@@ -137,7 +137,7 @@ static int ctlog_new_from_conf(CTLOG **ct_log, const CONF *conf, const char *sec
int CTLOG_STORE_load_default_file(CTLOG_STORE *store)
{
const char *fpath = getenv(CTLOG_FILE_EVP);
const char *fpath = ossl_safe_getenv(CTLOG_FILE_EVP);
if (fpath == NULL)
fpath = CTLOG_FILE;
+6
View File
@@ -327,6 +327,12 @@ int dsa_builtin_paramgen2(DSA *ret, size_t L, size_t N,
if (mctx == NULL)
goto err;
/* make sure L > N, otherwise we'll get trapped in an infinite loop */
if (L <= N) {
DSAerr(DSA_F_DSA_BUILTIN_PARAMGEN2, DSA_R_INVALID_PARAMETERS);
goto err;
}
if (evpmd == NULL) {
if (N == 160)
evpmd = EVP_sha1();
+47 -14
View File
@@ -9,6 +9,7 @@
#include <stdio.h>
#include "internal/cryptlib.h"
#include "internal/bn_int.h"
#include <openssl/bn.h>
#include <openssl/sha.h>
#include "dsa_locl.h"
@@ -23,6 +24,8 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len,
DSA_SIG *sig, DSA *dsa);
static int dsa_init(DSA *dsa);
static int dsa_finish(DSA *dsa);
static BIGNUM *dsa_mod_inverse_fermat(const BIGNUM *k, const BIGNUM *q,
BN_CTX *ctx);
static DSA_METHOD openssl_dsa_meth = {
"OpenSSL DSA method",
@@ -178,9 +181,9 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
{
BN_CTX *ctx = NULL;
BIGNUM *k, *kinv = NULL, *r = *rp;
BIGNUM *l, *m;
BIGNUM *l;
int ret = 0;
int q_bits;
int q_bits, q_words;
if (!dsa->p || !dsa->q || !dsa->g) {
DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_MISSING_PARAMETERS);
@@ -189,8 +192,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
k = BN_new();
l = BN_new();
m = BN_new();
if (k == NULL || l == NULL || m == NULL)
if (k == NULL || l == NULL)
goto err;
if (ctx_in == NULL) {
@@ -201,9 +203,9 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
/* Preallocate space */
q_bits = BN_num_bits(dsa->q);
if (!BN_set_bit(k, q_bits)
|| !BN_set_bit(l, q_bits)
|| !BN_set_bit(m, q_bits))
q_words = bn_get_top(dsa->q);
if (!bn_wexpand(k, q_words + 2)
|| !bn_wexpand(l, q_words + 2))
goto err;
/* Get random k */
@@ -221,6 +223,7 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
} while (BN_is_zero(k));
BN_set_flags(k, BN_FLG_CONSTTIME);
BN_set_flags(l, BN_FLG_CONSTTIME);
if (dsa->flags & DSA_FLAG_CACHE_MONT_P) {
if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p,
@@ -238,14 +241,17 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
* small timing information leakage. We then choose the sum that is
* one bit longer than the modulus.
*
* TODO: revisit the BN_copy aiming for a memory access agnostic
* conditional copy.
* There are some concerns about the efficacy of doing this. More
* specificly refer to the discussion starting with:
* https://github.com/openssl/openssl/pull/7486#discussion_r228323705
* The fix is to rework BN so these gymnastics aren't required.
*/
if (!BN_add(l, k, dsa->q)
|| !BN_add(m, l, dsa->q)
|| !BN_copy(k, BN_num_bits(l) > q_bits ? l : m))
|| !BN_add(k, l, dsa->q))
goto err;
BN_consttime_swap(BN_is_bit_set(l, q_bits), k, l, q_words + 2);
if ((dsa)->meth->bn_mod_exp != NULL) {
if (!dsa->meth->bn_mod_exp(dsa, r, dsa->g, k, dsa->p, ctx,
dsa->method_mont_p))
@@ -258,8 +264,8 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
if (!BN_mod(r, r, dsa->q, ctx))
goto err;
/* Compute part of 's = inv(k) (m + xr) mod q' */
if ((kinv = BN_mod_inverse(NULL, k, dsa->q, ctx)) == NULL)
/* Compute part of 's = inv(k) (m + xr) mod q' */
if ((kinv = dsa_mod_inverse_fermat(k, dsa->q, ctx)) == NULL)
goto err;
BN_clear_free(*kinvp);
@@ -273,7 +279,6 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
BN_CTX_free(ctx);
BN_clear_free(k);
BN_clear_free(l);
BN_clear_free(m);
return ret;
}
@@ -393,3 +398,31 @@ static int dsa_finish(DSA *dsa)
BN_MONT_CTX_free(dsa->method_mont_p);
return 1;
}
/*
* Compute the inverse of k modulo q.
* Since q is prime, Fermat's Little Theorem applies, which reduces this to
* mod-exp operation. Both the exponent and modulus are public information
* so a mod-exp that doesn't leak the base is sufficient. A newly allocated
* BIGNUM is returned which the caller must free.
*/
static BIGNUM *dsa_mod_inverse_fermat(const BIGNUM *k, const BIGNUM *q,
BN_CTX *ctx)
{
BIGNUM *res = NULL;
BIGNUM *r, *e;
if ((r = BN_new()) == NULL)
return NULL;
BN_CTX_start(ctx);
if ((e = BN_CTX_get(ctx)) != NULL
&& BN_set_word(r, 2)
&& BN_sub(e, q, r)
&& BN_mod_exp_mont(r, k, e, q, ctx, NULL))
res = r;
else
BN_free(r);
BN_CTX_end(ctx);
return res;
}
+2 -2
View File
@@ -699,7 +699,7 @@ static int ecdh_cms_set_kdf_param(EVP_PKEY_CTX *pctx, int eckdf_nid)
if (EVP_PKEY_CTX_set_ecdh_cofactor_mode(pctx, cofactor) <= 0)
return 0;
if (EVP_PKEY_CTX_set_ecdh_kdf_type(pctx, EVP_PKEY_ECDH_KDF_X9_62) <= 0)
if (EVP_PKEY_CTX_set_ecdh_kdf_type(pctx, EVP_PKEY_ECDH_KDF_X9_63) <= 0)
return 0;
kdf_md = EVP_get_digestbynid(kdfmd_nid);
@@ -864,7 +864,7 @@ static int ecdh_cms_encrypt(CMS_RecipientInfo *ri)
ecdh_nid = NID_dh_cofactor_kdf;
if (kdf_type == EVP_PKEY_ECDH_KDF_NONE) {
kdf_type = EVP_PKEY_ECDH_KDF_X9_62;
kdf_type = EVP_PKEY_ECDH_KDF_X9_63;
if (EVP_PKEY_CTX_set_ecdh_kdf_type(pctx, kdf_type) <= 0)
goto err;
} else
+3 -3
View File
@@ -206,8 +206,8 @@ int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r,
*/
cardinality_bits = BN_num_bits(cardinality);
group_top = bn_get_top(cardinality);
if ((bn_wexpand(k, group_top + 1) == NULL)
|| (bn_wexpand(lambda, group_top + 1) == NULL)) {
if ((bn_wexpand(k, group_top + 2) == NULL)
|| (bn_wexpand(lambda, group_top + 2) == NULL)) {
ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
goto err;
}
@@ -244,7 +244,7 @@ int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r,
* k := scalar + 2*cardinality
*/
kbit = BN_is_bit_set(lambda, cardinality_bits);
BN_consttime_swap(kbit, k, lambda, group_top + 1);
BN_consttime_swap(kbit, k, lambda, group_top + 2);
group_top = bn_get_top(group->field);
if ((bn_wexpand(s->X, group_top) == NULL)
+2 -2
View File
@@ -209,7 +209,7 @@ static int pkey_ec_kdf_derive(EVP_PKEY_CTX *ctx,
if (!pkey_ec_derive(ctx, ktmp, &ktmplen))
goto err;
/* Do KDF stuff */
if (!ECDH_KDF_X9_62(key, *keylen, ktmp, ktmplen,
if (!ecdh_KDF_X9_63(key, *keylen, ktmp, ktmplen,
dctx->kdf_ukm, dctx->kdf_ukmlen, dctx->kdf_md))
goto err;
rv = 1;
@@ -281,7 +281,7 @@ static int pkey_ec_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
case EVP_PKEY_CTRL_EC_KDF_TYPE:
if (p1 == -2)
return dctx->kdf_type;
if (p1 != EVP_PKEY_ECDH_KDF_NONE && p1 != EVP_PKEY_ECDH_KDF_X9_62)
if (p1 != EVP_PKEY_ECDH_KDF_NONE && p1 != EVP_PKEY_ECDH_KDF_X9_63)
return -2;
dctx->kdf_type = p1;
return 1;
+16 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -10,12 +10,13 @@
#include <string.h>
#include <openssl/ec.h>
#include <openssl/evp.h>
#include "ec_lcl.h"
/* Key derivation function from X9.62/SECG */
/* Key derivation function from X9.63/SECG */
/* Way more than we will ever need */
#define ECDH_KDF_MAX (1 << 30)
int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
const unsigned char *Z, size_t Zlen,
const unsigned char *sinfo, size_t sinfolen,
const EVP_MD *md)
@@ -66,3 +67,15 @@ int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
EVP_MD_CTX_free(mctx);
return rv;
}
/*-
* The old name for ecdh_KDF_X9_63
* Retained for ABI compatibility
*/
int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
const unsigned char *Z, size_t Zlen,
const unsigned char *sinfo, size_t sinfolen,
const EVP_MD *md)
{
return ecdh_KDF_X9_63(out, outlen, Z, Zlen, sinfo, sinfolen, md);
}
+71 -61
View File
@@ -28,6 +28,13 @@
# define CHECK_BSD_STYLE_MACROS
#endif
/*
* ONE global file descriptor for all sessions. This allows operations
* such as digest session data copying (see digest_copy()), but is also
* saner... why re-open /dev/crypto for every session?
*/
static int cfd;
/******************************************************************************
*
* Ciphers
@@ -39,7 +46,6 @@
*****/
struct cipher_ctx {
int cfd;
struct session_op sess;
/* to pass from init to do_cipher */
@@ -69,7 +75,7 @@ static const struct cipher_data_st {
{ NID_aes_192_cbc, 16, 192 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC },
{ NID_aes_256_cbc, 16, 256 / 8, 16, EVP_CIPH_CBC_MODE, CRYPTO_AES_CBC },
#ifndef OPENSSL_NO_RC4
{ NID_rc4, 1, 16, 0, CRYPTO_ARC4 },
{ NID_rc4, 1, 16, 0, EVP_CIPH_STREAM_CIPHER, CRYPTO_ARC4 },
#endif
#if !defined(CHECK_BSD_STYLE_MACROS) || defined(CRYPTO_AES_CTR)
{ NID_aes_128_ctr, 16, 128 / 8, 16, EVP_CIPH_CTR_MODE, CRYPTO_AES_CTR },
@@ -135,19 +141,13 @@ static int cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const struct cipher_data_st *cipher_d =
get_cipher_data(EVP_CIPHER_CTX_nid(ctx));
if ((cipher_ctx->cfd = open("/dev/crypto", O_RDWR, 0)) < 0) {
SYSerr(SYS_F_OPEN, errno);
return 0;
}
memset(&cipher_ctx->sess, 0, sizeof(cipher_ctx->sess));
cipher_ctx->sess.cipher = cipher_d->devcryptoid;
cipher_ctx->sess.keylen = cipher_d->keylen;
cipher_ctx->sess.key = (void *)key;
cipher_ctx->op = enc ? COP_ENCRYPT : COP_DECRYPT;
if (ioctl(cipher_ctx->cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) {
if (ioctl(cfd, CIOCGSESSION, &cipher_ctx->sess) < 0) {
SYSerr(SYS_F_IOCTL, errno);
close(cipher_ctx->cfd);
return 0;
}
@@ -186,7 +186,7 @@ static int cipher_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
cryp.flags = COP_FLAG_WRITE_IV;
#endif
if (ioctl(cipher_ctx->cfd, CIOCCRYPT, &cryp) < 0) {
if (ioctl(cfd, CIOCCRYPT, &cryp) < 0) {
SYSerr(SYS_F_IOCTL, errno);
return 0;
}
@@ -212,14 +212,10 @@ static int cipher_cleanup(EVP_CIPHER_CTX *ctx)
struct cipher_ctx *cipher_ctx =
(struct cipher_ctx *)EVP_CIPHER_CTX_get_cipher_data(ctx);
if (ioctl(cipher_ctx->cfd, CIOCFSESSION, &cipher_ctx->sess) < 0) {
if (ioctl(cfd, CIOCFSESSION, &cipher_ctx->sess.ses) < 0) {
SYSerr(SYS_F_IOCTL, errno);
return 0;
}
if (close(cipher_ctx->cfd) < 0) {
SYSerr(SYS_F_CLOSE, errno);
return 0;
}
return 1;
}
@@ -233,14 +229,10 @@ static int known_cipher_nids[OSSL_NELEM(cipher_data)];
static int known_cipher_nids_amount = -1; /* -1 indicates not yet initialised */
static EVP_CIPHER *known_cipher_methods[OSSL_NELEM(cipher_data)] = { NULL, };
static void prepare_cipher_methods()
static void prepare_cipher_methods(void)
{
size_t i;
struct session_op sess;
int cfd;
if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0)
return;
memset(&sess, 0, sizeof(sess));
sess.key = (void *)"01234567890123456789012345678901234567890123456789";
@@ -255,7 +247,7 @@ static void prepare_cipher_methods()
sess.cipher = cipher_data[i].devcryptoid;
sess.keylen = cipher_data[i].keylen;
if (ioctl(cfd, CIOCGSESSION, &sess) < 0
|| ioctl(cfd, CIOCFSESSION, &sess) < 0)
|| ioctl(cfd, CIOCFSESSION, &sess.ses) < 0)
continue;
if ((known_cipher_methods[i] =
@@ -281,8 +273,6 @@ static void prepare_cipher_methods()
cipher_data[i].nid;
}
}
close(cfd);
}
static const EVP_CIPHER *get_cipher_method(int nid)
@@ -308,7 +298,7 @@ static void destroy_cipher_method(int nid)
known_cipher_methods[i] = NULL;
}
static void destroy_all_cipher_methods()
static void destroy_all_cipher_methods(void)
{
size_t i;
@@ -329,11 +319,12 @@ static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
/*
* We only support digests if the cryptodev implementation supports multiple
* data updates. Otherwise, we would be forced to maintain a cache, which is
* perilous if there's a lot of data coming in (if someone wants to checksum
* an OpenSSL tarball, for example).
* data updates and session copying. Otherwise, we would be forced to maintain
* a cache, which is perilous if there's a lot of data coming in (if someone
* wants to checksum an OpenSSL tarball, for example).
*/
#if defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL)
#if defined(CIOCCPHASH) && defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL)
#define IMPLEMENT_DIGEST
/******************************************************************************
*
@@ -346,7 +337,6 @@ static int devcrypto_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
*****/
struct digest_ctx {
int cfd;
struct session_op sess;
int init;
};
@@ -413,19 +403,12 @@ static int digest_init(EVP_MD_CTX *ctx)
const struct digest_data_st *digest_d =
get_digest_data(EVP_MD_CTX_type(ctx));
if (digest_ctx->init == 0
&& (digest_ctx->cfd = open("/dev/crypto", O_RDWR, 0)) < 0) {
SYSerr(SYS_F_OPEN, errno);
return 0;
}
digest_ctx->init = 1;
memset(&digest_ctx->sess, 0, sizeof(digest_ctx->sess));
digest_ctx->sess.mac = digest_d->devcryptoid;
if (ioctl(digest_ctx->cfd, CIOCGSESSION, &digest_ctx->sess) < 0) {
if (ioctl(cfd, CIOCGSESSION, &digest_ctx->sess) < 0) {
SYSerr(SYS_F_IOCTL, errno);
close(digest_ctx->cfd);
return 0;
}
@@ -444,7 +427,7 @@ static int digest_op(struct digest_ctx *ctx, const void *src, size_t srclen,
cryp.dst = NULL;
cryp.mac = res;
cryp.flags = flags;
return ioctl(ctx->cfd, CIOCCRYPT, &cryp);
return ioctl(cfd, CIOCCRYPT, &cryp);
}
static int digest_update(EVP_MD_CTX *ctx, const void *data, size_t count)
@@ -472,7 +455,7 @@ static int digest_final(EVP_MD_CTX *ctx, unsigned char *md)
SYSerr(SYS_F_IOCTL, errno);
return 0;
}
if (ioctl(digest_ctx->cfd, CIOCFSESSION, &digest_ctx->sess) < 0) {
if (ioctl(cfd, CIOCFSESSION, &digest_ctx->sess.ses) < 0) {
SYSerr(SYS_F_IOCTL, errno);
return 0;
}
@@ -480,16 +463,38 @@ static int digest_final(EVP_MD_CTX *ctx, unsigned char *md)
return 1;
}
static int digest_cleanup(EVP_MD_CTX *ctx)
static int digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from)
{
struct digest_ctx *digest_ctx =
(struct digest_ctx *)EVP_MD_CTX_md_data(ctx);
struct digest_ctx *digest_from =
(struct digest_ctx *)EVP_MD_CTX_md_data(from);
struct digest_ctx *digest_to =
(struct digest_ctx *)EVP_MD_CTX_md_data(to);
struct cphash_op cphash;
if (close(digest_ctx->cfd) < 0) {
SYSerr(SYS_F_CLOSE, errno);
if (digest_from == NULL)
return 1;
if (digest_from->init != 1) {
SYSerr(SYS_F_IOCTL, EINVAL);
return 0;
}
if (!digest_init(to)) {
SYSerr(SYS_F_IOCTL, errno);
return 0;
}
cphash.src_ses = digest_from->sess.ses;
cphash.dst_ses = digest_to->sess.ses;
if (ioctl(cfd, CIOCCPHASH, &cphash) < 0) {
SYSerr(SYS_F_IOCTL, errno);
return 0;
}
return 1;
}
static int digest_cleanup(EVP_MD_CTX *ctx)
{
return 1;
}
@@ -502,14 +507,10 @@ static int known_digest_nids[OSSL_NELEM(digest_data)];
static int known_digest_nids_amount = -1; /* -1 indicates not yet initialised */
static EVP_MD *known_digest_methods[OSSL_NELEM(digest_data)] = { NULL, };
static void prepare_digest_methods()
static void prepare_digest_methods(void)
{
size_t i;
struct session_op sess;
int cfd;
if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0)
return;
memset(&sess, 0, sizeof(sess));
@@ -522,7 +523,7 @@ static void prepare_digest_methods()
*/
sess.mac = digest_data[i].devcryptoid;
if (ioctl(cfd, CIOCGSESSION, &sess) < 0
|| ioctl(cfd, CIOCFSESSION, &sess) < 0)
|| ioctl(cfd, CIOCFSESSION, &sess.ses) < 0)
continue;
if ((known_digest_methods[i] = EVP_MD_meth_new(digest_data[i].nid,
@@ -532,6 +533,7 @@ static void prepare_digest_methods()
|| !EVP_MD_meth_set_init(known_digest_methods[i], digest_init)
|| !EVP_MD_meth_set_update(known_digest_methods[i], digest_update)
|| !EVP_MD_meth_set_final(known_digest_methods[i], digest_final)
|| !EVP_MD_meth_set_copy(known_digest_methods[i], digest_copy)
|| !EVP_MD_meth_set_cleanup(known_digest_methods[i], digest_cleanup)
|| !EVP_MD_meth_set_app_datasize(known_digest_methods[i],
sizeof(struct digest_ctx))) {
@@ -541,8 +543,6 @@ static void prepare_digest_methods()
known_digest_nids[known_digest_nids_amount++] = digest_data[i].nid;
}
}
close(cfd);
}
static const EVP_MD *get_digest_method(int nid)
@@ -568,7 +568,7 @@ static void destroy_digest_method(int nid)
known_digest_methods[i] = NULL;
}
static void destroy_all_digest_methods()
static void destroy_all_digest_methods(void)
{
size_t i;
@@ -598,9 +598,12 @@ static int devcrypto_digests(ENGINE *e, const EVP_MD **digest,
static int devcrypto_unload(ENGINE *e)
{
destroy_all_cipher_methods();
#if defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL)
#ifdef IMPLEMENT_DIGEST
destroy_all_digest_methods();
#endif
close(cfd);
return 1;
}
/*
@@ -611,23 +614,30 @@ void engine_load_devcrypto_int()
{
ENGINE *e = NULL;
if (access("/dev/crypto", R_OK | W_OK) < 0) {
fprintf(stderr,
"/dev/crypto not present, not enabling devcrypto engine\n");
if ((cfd = open("/dev/crypto", O_RDWR, 0)) < 0) {
fprintf(stderr, "Could not open /dev/crypto: %s\n", strerror(errno));
return;
}
prepare_cipher_methods();
#if defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL)
#ifdef IMPLEMENT_DIGEST
prepare_digest_methods();
#endif
if ((e = ENGINE_new()) == NULL)
if ((e = ENGINE_new()) == NULL
|| !ENGINE_set_destroy_function(e, devcrypto_unload)) {
ENGINE_free(e);
/*
* We know that devcrypto_unload() won't be called when one of the
* above two calls have failed, so we close cfd explicitly here to
* avoid leaking resources.
*/
close(cfd);
return;
}
if (!ENGINE_set_id(e, "devcrypto")
|| !ENGINE_set_name(e, "/dev/crypto engine")
|| !ENGINE_set_destroy_function(e, devcrypto_unload)
/*
* Asymmetric ciphers aren't well supported with /dev/crypto. Among the BSD
@@ -664,7 +674,7 @@ void engine_load_devcrypto_int()
# endif
#endif
|| !ENGINE_set_ciphers(e, devcrypto_ciphers)
#if defined(COP_FLAG_UPDATE) && defined(COP_FLAG_FINAL)
#ifdef IMPLEMENT_DIGEST
|| !ENGINE_set_digests(e, devcrypto_digests)
#endif
) {
+1 -2
View File
@@ -317,8 +317,7 @@ ENGINE *ENGINE_by_id(const char *id)
* Prevent infinite recursion if we're looking for the dynamic engine.
*/
if (strcmp(id, "dynamic")) {
if (OPENSSL_issetugid()
|| (load_dir = getenv("OPENSSL_ENGINES")) == NULL)
if ((load_dir = ossl_safe_getenv("OPENSSL_ENGINES")) == NULL)
load_dir = ENGINESDIR;
iterator = ENGINE_by_id("dynamic");
if (!iterator || !ENGINE_ctrl_cmd_string(iterator, "ID", id, 0) ||
+1
View File
@@ -1014,6 +1014,7 @@ RAND_F_RAND_POOL_ACQUIRE_ENTROPY:122:rand_pool_acquire_entropy
RAND_F_RAND_POOL_ADD:103:rand_pool_add
RAND_F_RAND_POOL_ADD_BEGIN:113:rand_pool_add_begin
RAND_F_RAND_POOL_ADD_END:114:rand_pool_add_end
RAND_F_RAND_POOL_ATTACH:124:rand_pool_attach
RAND_F_RAND_POOL_BYTES_NEEDED:115:rand_pool_bytes_needed
RAND_F_RAND_POOL_NEW:116:rand_pool_new
RAND_F_RAND_WRITE_FILE:112:RAND_write_file
+1 -1
View File
@@ -2241,7 +2241,7 @@ static int s390x_aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
if (!cctx->aes.ccm.len_set) {
/*-
* In case message length was not previously set explicitely via
* In case message length was not previously set explicitly via
* Update(), set it now.
*/
ivec = EVP_CIPHER_CTX_iv_noconst(ctx);
+6 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -92,7 +92,8 @@ static int rc2_meth_to_magic(EVP_CIPHER_CTX *e)
{
int i;
EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i);
if (EVP_CIPHER_CTX_ctrl(e, EVP_CTRL_GET_RC2_KEY_BITS, 0, &i) <= 0)
return 0;
if (i == 128)
return RC2_128_MAGIC;
else if (i == 64)
@@ -136,8 +137,9 @@ static int rc2_get_asn1_type_and_iv(EVP_CIPHER_CTX *c, ASN1_TYPE *type)
return -1;
if (i > 0 && !EVP_CipherInit_ex(c, NULL, NULL, NULL, iv, -1))
return -1;
EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits, NULL);
if (EVP_CIPHER_CTX_set_key_length(c, key_bits / 8) <= 0)
if (EVP_CIPHER_CTX_ctrl(c, EVP_CTRL_SET_RC2_KEY_BITS, key_bits,
NULL) <= 0
|| EVP_CIPHER_CTX_set_key_length(c, key_bits / 8) <= 0)
return -1;
}
return i;
+3 -3
View File
@@ -837,21 +837,21 @@ void EVP_PKEY_meth_get_ctrl(const EVP_PKEY_METHOD *pmeth,
void EVP_PKEY_meth_get_check(const EVP_PKEY_METHOD *pmeth,
int (**pcheck) (EVP_PKEY *pkey))
{
if (*pcheck)
if (pcheck != NULL)
*pcheck = pmeth->check;
}
void EVP_PKEY_meth_get_public_check(const EVP_PKEY_METHOD *pmeth,
int (**pcheck) (EVP_PKEY *pkey))
{
if (*pcheck)
if (pcheck != NULL)
*pcheck = pmeth->public_check;
}
void EVP_PKEY_meth_get_param_check(const EVP_PKEY_METHOD *pmeth,
int (**pcheck) (EVP_PKEY *pkey))
{
if (*pcheck)
if (pcheck != NULL)
*pcheck = pmeth->param_check;
}
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright 2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <stdlib.h>
#include "internal/cryptlib.h"
char *ossl_safe_getenv(const char *name)
{
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
# if __GLIBC_PREREQ(2, 17)
# define SECURE_GETENV
return secure_getenv(name);
# endif
#endif
#ifndef SECURE_GETENV
if (OPENSSL_issetugid())
return NULL;
return getenv(name);
#endif
}
@@ -41,5 +41,13 @@
__owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
const BIGNUM *x, BN_CTX *ctx);
/*-
* ECDH Key Derivation Function as defined in ANSI X9.63
*/
int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
const unsigned char *Z, size_t Zlen,
const unsigned char *sinfo, size_t sinfolen,
const EVP_MD *md);
# endif /* OPENSSL_NO_EC */
#endif
@@ -45,18 +45,21 @@ size_t rand_drbg_get_nonce(RAND_DRBG *drbg,
void rand_drbg_cleanup_nonce(RAND_DRBG *drbg,
unsigned char *out, size_t outlen);
size_t rand_drbg_get_additional_data(unsigned char **pout, size_t max_len);
size_t rand_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout);
void rand_drbg_cleanup_additional_data(unsigned char *out, size_t outlen);
void rand_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out);
/*
* RAND_POOL functions
*/
RAND_POOL *rand_pool_new(int entropy_requested, size_t min_len, size_t max_len);
RAND_POOL *rand_pool_attach(const unsigned char *buffer, size_t len,
size_t entropy);
void rand_pool_free(RAND_POOL *pool);
const unsigned char *rand_pool_buffer(RAND_POOL *pool);
unsigned char *rand_pool_detach(RAND_POOL *pool);
void rand_pool_reattach(RAND_POOL *pool, unsigned char *buffer);
size_t rand_pool_entropy(RAND_POOL *pool);
size_t rand_pool_length(RAND_POOL *pool);
+13 -1
View File
@@ -175,6 +175,18 @@ static int pkey_hkdf_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
return -2;
}
static int pkey_hkdf_derive_init(EVP_PKEY_CTX *ctx)
{
HKDF_PKEY_CTX *kctx = ctx->data;
OPENSSL_clear_free(kctx->key, kctx->key_len);
OPENSSL_clear_free(kctx->salt, kctx->salt_len);
OPENSSL_cleanse(kctx->info, kctx->info_len);
memset(kctx, 0, sizeof(*kctx));
return 1;
}
static int pkey_hkdf_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
size_t *keylen)
{
@@ -236,7 +248,7 @@ const EVP_PKEY_METHOD hkdf_pkey_meth = {
0, 0,
0,
pkey_hkdf_derive_init,
pkey_hkdf_derive,
pkey_hkdf_ctrl,
pkey_hkdf_ctrl_str
+23 -27
View File
@@ -20,12 +20,8 @@
#include <string.h>
/* e_os.h includes unistd.h, which defines _POSIX_VERSION */
#if !defined(OPENSSL_NO_SECURE_MEMORY) && defined(OPENSSL_SYS_UNIX) \
&& ( (defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L) \
|| defined(__sun) || defined(__hpux) || defined(__sgi) \
|| defined(__osf__) )
# define IMPLEMENTED
/* e_os.h defines OPENSSL_SECURE_MEMORY if secure memory can be implemented */
#ifdef OPENSSL_SECURE_MEMORY
# include <stdlib.h>
# include <assert.h>
# include <unistd.h>
@@ -51,7 +47,7 @@
# define MAP_ANON MAP_ANONYMOUS
#endif
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
static size_t secure_mem_used;
static int secure_mem_initialized;
@@ -71,7 +67,7 @@ static int sh_allocated(const char *ptr);
int CRYPTO_secure_malloc_init(size_t size, int minsize)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
int ret = 0;
if (!secure_mem_initialized) {
@@ -89,12 +85,12 @@ int CRYPTO_secure_malloc_init(size_t size, int minsize)
return ret;
#else
return 0;
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
int CRYPTO_secure_malloc_done(void)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
if (secure_mem_used == 0) {
sh_done();
secure_mem_initialized = 0;
@@ -102,22 +98,22 @@ int CRYPTO_secure_malloc_done(void)
sec_malloc_lock = NULL;
return 1;
}
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
return 0;
}
int CRYPTO_secure_malloc_initialized(void)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
return secure_mem_initialized;
#else
return 0;
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
void *CRYPTO_secure_malloc(size_t num, const char *file, int line)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
void *ret;
size_t actual_size;
@@ -132,12 +128,12 @@ void *CRYPTO_secure_malloc(size_t num, const char *file, int line)
return ret;
#else
return CRYPTO_malloc(num, file, line);
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
if (secure_mem_initialized)
/* CRYPTO_secure_malloc() zeroes allocations when it is implemented */
return CRYPTO_secure_malloc(num, file, line);
@@ -147,7 +143,7 @@ void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)
void CRYPTO_secure_free(void *ptr, const char *file, int line)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
size_t actual_size;
if (ptr == NULL)
@@ -164,13 +160,13 @@ void CRYPTO_secure_free(void *ptr, const char *file, int line)
CRYPTO_THREAD_unlock(sec_malloc_lock);
#else
CRYPTO_free(ptr, file, line);
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
void CRYPTO_secure_clear_free(void *ptr, size_t num,
const char *file, int line)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
size_t actual_size;
if (ptr == NULL)
@@ -191,12 +187,12 @@ void CRYPTO_secure_clear_free(void *ptr, size_t num,
return;
OPENSSL_cleanse(ptr, num);
CRYPTO_free(ptr, file, line);
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
int CRYPTO_secure_allocated(const void *ptr)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
int ret;
if (!secure_mem_initialized)
@@ -207,21 +203,21 @@ int CRYPTO_secure_allocated(const void *ptr)
return ret;
#else
return 0;
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
size_t CRYPTO_secure_used(void)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
return secure_mem_used;
#else
return 0;
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
}
size_t CRYPTO_secure_actual_size(void *ptr)
{
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
size_t actual_size;
CRYPTO_THREAD_write_lock(sec_malloc_lock);
@@ -239,7 +235,7 @@ size_t CRYPTO_secure_actual_size(void *ptr)
/*
* SECURE HEAP IMPLEMENTATION
*/
#ifdef IMPLEMENTED
#ifdef OPENSSL_SECURE_MEMORY
/*
@@ -647,4 +643,4 @@ static size_t sh_actual_size(char *ptr)
OPENSSL_assert(sh_testbit(ptr, list, sh.bittable));
return sh.arena_size / (ONE << list);
}
#endif /* IMPLEMENTED */
#endif /* OPENSSL_SECURE_MEMORY */
+1 -3
View File
@@ -25,14 +25,12 @@
# endif
# endif
#include "e_os.h"
#include "internal/cryptlib.h"
#if !defined(OPENSSL_NO_STDIO)
# include <stdio.h>
# ifdef _WIN32
# include <windows.h>
# endif
# ifdef __DJGPP__
# include <unistd.h>
# endif
+9 -9
View File
@@ -7,13 +7,13 @@
* https://www.openssl.org/source/license.html
*/
# include <stdio.h>
# include "internal/cryptlib.h"
# include <openssl/crypto.h>
# include <openssl/hmac.h>
# include <openssl/rand.h>
# include <openssl/pkcs12.h>
# include "p12_lcl.h"
#include <stdio.h>
#include "internal/cryptlib.h"
#include <openssl/crypto.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
#include <openssl/pkcs12.h>
#include "p12_lcl.h"
int PKCS12_mac_present(const PKCS12 *p12)
{
@@ -44,7 +44,7 @@ void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac,
}
}
# define TK26_MAC_KEY_LEN 32
#define TK26_MAC_KEY_LEN 32
static int pkcs12_gen_gost_mac_key(const char *pass, int passlen,
const unsigned char *salt, int saltlen,
@@ -112,7 +112,7 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
if ((md_type_nid == NID_id_GostR3411_94
|| md_type_nid == NID_id_GostR3411_2012_256
|| md_type_nid == NID_id_GostR3411_2012_512)
&& !getenv("LEGACY_GOST_PKCS12")) {
&& ossl_safe_getenv("LEGACY_GOST_PKCS12") == NULL) {
md_size = TK26_MAC_KEY_LEN;
if (!pkcs12_gen_gost_mac_key(pass, passlen, salt, saltlen, iter,
md_size, key, md_type)) {
@@ -1,5 +1,5 @@
/*
* Copyright 2016-20018 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
+6 -6
View File
@@ -402,10 +402,10 @@ int drbg_ctr_init(RAND_DRBG *drbg)
if ((drbg->flags & RAND_DRBG_FLAG_CTR_NO_DF) == 0) {
/* df initialisation */
static const unsigned char df_key[32] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f
};
if (ctr->ctx_df == NULL)
@@ -417,9 +417,9 @@ int drbg_ctr_init(RAND_DRBG *drbg)
return 0;
drbg->min_entropylen = ctr->keylen;
drbg->max_entropylen = DRBG_MINMAX_FACTOR * drbg->min_entropylen;
drbg->max_entropylen = DRBG_MAX_LENGTH;
drbg->min_noncelen = drbg->min_entropylen / 2;
drbg->max_noncelen = DRBG_MINMAX_FACTOR * drbg->min_noncelen;
drbg->max_noncelen = DRBG_MAX_LENGTH;
drbg->max_perslen = DRBG_MAX_LENGTH;
drbg->max_adinlen = DRBG_MAX_LENGTH;
} else {
+157 -68
View File
@@ -82,6 +82,10 @@ static unsigned int slave_reseed_interval = SLAVE_RESEED_INTERVAL;
static time_t master_reseed_time_interval = MASTER_RESEED_TIME_INTERVAL;
static time_t slave_reseed_time_interval = SLAVE_RESEED_TIME_INTERVAL;
/* A logical OR of all used DRBG flag bits (currently there is only one) */
static const unsigned int rand_drbg_used_flags =
RAND_DRBG_FLAG_CTR_NO_DF;
static RAND_DRBG *drbg_setup(RAND_DRBG *parent);
static RAND_DRBG *rand_drbg_new(int secure,
@@ -105,16 +109,27 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags)
flags = rand_drbg_flags;
}
/* If set is called multiple times - clear the old one */
if (drbg->type != 0 && (type != drbg->type || flags != drbg->flags)) {
drbg->meth->uninstantiate(drbg);
rand_pool_free(drbg->adin_pool);
drbg->adin_pool = NULL;
}
drbg->state = DRBG_UNINITIALISED;
drbg->flags = flags;
drbg->type = type;
switch (type) {
default:
drbg->type = 0;
drbg->flags = 0;
drbg->meth = NULL;
RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_UNSUPPORTED_DRBG_TYPE);
return 0;
case 0:
/* Uninitialized; that's okay. */
drbg->meth = NULL;
return 1;
case NID_aes_128_ctr:
case NID_aes_192_ctr:
@@ -123,8 +138,10 @@ int RAND_DRBG_set(RAND_DRBG *drbg, int type, unsigned int flags)
break;
}
if (ret == 0)
if (ret == 0) {
drbg->state = DRBG_ERROR;
RANDerr(RAND_F_RAND_DRBG_SET, RAND_R_ERROR_INITIALISING_DRBG);
}
return ret;
}
@@ -147,7 +164,7 @@ int RAND_DRBG_set_defaults(int type, unsigned int flags)
break;
}
if ((flags & ~RAND_DRBG_USED_FLAGS) != 0) {
if ((flags & ~rand_drbg_used_flags) != 0) {
RANDerr(RAND_F_RAND_DRBG_SET_DEFAULTS, RAND_R_UNSUPPORTED_DRBG_FLAGS);
return 0;
}
@@ -224,11 +241,8 @@ static RAND_DRBG *rand_drbg_new(int secure,
return drbg;
err:
if (drbg->secure)
OPENSSL_secure_free(drbg);
else
OPENSSL_free(drbg);
err:
RAND_DRBG_free(drbg);
return NULL;
}
@@ -253,6 +267,7 @@ void RAND_DRBG_free(RAND_DRBG *drbg)
if (drbg->meth != NULL)
drbg->meth->uninstantiate(drbg);
rand_pool_free(drbg->adin_pool);
CRYPTO_THREAD_lock_free(drbg->lock);
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data);
@@ -312,11 +327,18 @@ int RAND_DRBG_instantiate(RAND_DRBG *drbg,
max_entropylen += drbg->max_noncelen;
}
drbg->reseed_next_counter = tsan_load(&drbg->reseed_prop_counter);
if (drbg->reseed_next_counter) {
drbg->reseed_next_counter++;
if(!drbg->reseed_next_counter)
drbg->reseed_next_counter = 1;
}
if (drbg->get_entropy != NULL)
entropylen = drbg->get_entropy(drbg, &entropy, min_entropy,
min_entropylen, max_entropylen, 0);
if (entropylen < min_entropylen
|| entropylen > max_entropylen) {
|| entropylen > max_entropylen) {
RANDerr(RAND_F_RAND_DRBG_INSTANTIATE, RAND_R_ERROR_RETRIEVING_ENTROPY);
goto end;
}
@@ -337,29 +359,15 @@ int RAND_DRBG_instantiate(RAND_DRBG *drbg,
}
drbg->state = DRBG_READY;
drbg->generate_counter = 0;
drbg->reseed_gen_counter = 1;
drbg->reseed_time = time(NULL);
if (drbg->reseed_counter > 0) {
if (drbg->parent == NULL)
drbg->reseed_counter++;
else
drbg->reseed_counter = drbg->parent->reseed_counter;
}
tsan_store(&drbg->reseed_prop_counter, drbg->reseed_next_counter);
end:
end:
if (entropy != NULL && drbg->cleanup_entropy != NULL)
drbg->cleanup_entropy(drbg, entropy, entropylen);
if (nonce != NULL && drbg->cleanup_nonce!= NULL )
if (nonce != NULL && drbg->cleanup_nonce != NULL)
drbg->cleanup_nonce(drbg, nonce, noncelen);
if (drbg->pool != NULL) {
if (drbg->state == DRBG_READY) {
RANDerr(RAND_F_RAND_DRBG_INSTANTIATE,
RAND_R_ERROR_ENTROPY_POOL_WAS_IGNORED);
drbg->state = DRBG_ERROR;
}
rand_pool_free(drbg->pool);
drbg->pool = NULL;
}
if (drbg->state == DRBG_READY)
return 1;
return 0;
@@ -375,6 +383,7 @@ end:
int RAND_DRBG_uninstantiate(RAND_DRBG *drbg)
{
if (drbg->meth == NULL) {
drbg->state = DRBG_ERROR;
RANDerr(RAND_F_RAND_DRBG_UNINSTANTIATE,
RAND_R_NO_DRBG_IMPLEMENTATION_SELECTED);
return 0;
@@ -419,13 +428,21 @@ int RAND_DRBG_reseed(RAND_DRBG *drbg,
}
drbg->state = DRBG_ERROR;
drbg->reseed_next_counter = tsan_load(&drbg->reseed_prop_counter);
if (drbg->reseed_next_counter) {
drbg->reseed_next_counter++;
if(!drbg->reseed_next_counter)
drbg->reseed_next_counter = 1;
}
if (drbg->get_entropy != NULL)
entropylen = drbg->get_entropy(drbg, &entropy, drbg->strength,
drbg->min_entropylen,
drbg->max_entropylen,
prediction_resistance);
if (entropylen < drbg->min_entropylen
|| entropylen > drbg->max_entropylen) {
|| entropylen > drbg->max_entropylen) {
RANDerr(RAND_F_RAND_DRBG_RESEED, RAND_R_ERROR_RETRIEVING_ENTROPY);
goto end;
}
@@ -434,16 +451,11 @@ int RAND_DRBG_reseed(RAND_DRBG *drbg,
goto end;
drbg->state = DRBG_READY;
drbg->generate_counter = 0;
drbg->reseed_gen_counter = 1;
drbg->reseed_time = time(NULL);
if (drbg->reseed_counter > 0) {
if (drbg->parent == NULL)
drbg->reseed_counter++;
else
drbg->reseed_counter = drbg->parent->reseed_counter;
}
tsan_store(&drbg->reseed_prop_counter, drbg->reseed_next_counter);
end:
end:
if (entropy != NULL && drbg->cleanup_entropy != NULL)
drbg->cleanup_entropy(drbg, entropy, entropylen);
if (drbg->state == DRBG_READY)
@@ -475,10 +487,12 @@ int rand_drbg_restart(RAND_DRBG *drbg,
const unsigned char *adin = NULL;
size_t adinlen = 0;
if (drbg->pool != NULL) {
if (drbg->seed_pool != NULL) {
RANDerr(RAND_F_RAND_DRBG_RESTART, ERR_R_INTERNAL_ERROR);
rand_pool_free(drbg->pool);
drbg->pool = NULL;
drbg->state = DRBG_ERROR;
rand_pool_free(drbg->seed_pool);
drbg->seed_pool = NULL;
return 0;
}
if (buffer != NULL) {
@@ -486,24 +500,25 @@ int rand_drbg_restart(RAND_DRBG *drbg,
if (drbg->max_entropylen < len) {
RANDerr(RAND_F_RAND_DRBG_RESTART,
RAND_R_ENTROPY_INPUT_TOO_LONG);
drbg->state = DRBG_ERROR;
return 0;
}
if (entropy > 8 * len) {
RANDerr(RAND_F_RAND_DRBG_RESTART, RAND_R_ENTROPY_OUT_OF_RANGE);
drbg->state = DRBG_ERROR;
return 0;
}
/* will be picked up by the rand_drbg_get_entropy() callback */
drbg->pool = rand_pool_new(entropy, len, len);
if (drbg->pool == NULL)
drbg->seed_pool = rand_pool_attach(buffer, len, entropy);
if (drbg->seed_pool == NULL)
return 0;
rand_pool_add(drbg->pool, buffer, len, entropy);
} else {
if (drbg->max_adinlen < len) {
RANDerr(RAND_F_RAND_DRBG_RESTART,
RAND_R_ADDITIONAL_INPUT_TOO_LONG);
drbg->state = DRBG_ERROR;
return 0;
}
adin = buffer;
@@ -543,14 +558,8 @@ int rand_drbg_restart(RAND_DRBG *drbg,
}
}
/* check whether a given entropy pool was cleared properly during reseed */
if (drbg->pool != NULL) {
drbg->state = DRBG_ERROR;
RANDerr(RAND_F_RAND_DRBG_RESTART, ERR_R_INTERNAL_ERROR);
rand_pool_free(drbg->pool);
drbg->pool = NULL;
return 0;
}
rand_pool_free(drbg->seed_pool);
drbg->seed_pool = NULL;
return drbg->state == DRBG_READY;
}
@@ -600,7 +609,7 @@ int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,
}
if (drbg->reseed_interval > 0) {
if (drbg->generate_counter >= drbg->reseed_interval)
if (drbg->reseed_gen_counter >= drbg->reseed_interval)
reseed_required = 1;
}
if (drbg->reseed_time_interval > 0) {
@@ -609,8 +618,11 @@ int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,
|| now - drbg->reseed_time >= drbg->reseed_time_interval)
reseed_required = 1;
}
if (drbg->reseed_counter > 0 && drbg->parent != NULL) {
if (drbg->reseed_counter != drbg->parent->reseed_counter)
if (drbg->parent != NULL) {
unsigned int reseed_counter = tsan_load(&drbg->reseed_prop_counter);
if (reseed_counter > 0
&& tsan_load(&drbg->parent->reseed_prop_counter)
!= reseed_counter)
reseed_required = 1;
}
@@ -629,7 +641,7 @@ int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen,
return 0;
}
drbg->generate_counter++;
drbg->reseed_gen_counter++;
return 1;
}
@@ -647,9 +659,18 @@ int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen)
unsigned char *additional = NULL;
size_t additional_len;
size_t chunk;
size_t ret;
size_t ret = 0;
additional_len = rand_drbg_get_additional_data(&additional, drbg->max_adinlen);
if (drbg->adin_pool == NULL) {
if (drbg->type == 0)
goto err;
drbg->adin_pool = rand_pool_new(0, 0, drbg->max_adinlen);
if (drbg->adin_pool == NULL)
goto err;
}
additional_len = rand_drbg_get_additional_data(drbg->adin_pool,
&additional);
for ( ; outlen > 0; outlen -= chunk, out += chunk) {
chunk = outlen;
@@ -661,9 +682,9 @@ int RAND_DRBG_bytes(RAND_DRBG *drbg, unsigned char *out, size_t outlen)
}
ret = 1;
err:
if (additional_len != 0)
OPENSSL_secure_clear_free(additional, additional_len);
err:
if (additional != NULL)
rand_drbg_cleanup_additional_data(drbg->adin_pool, additional);
return ret;
}
@@ -682,7 +703,8 @@ int RAND_DRBG_set_callbacks(RAND_DRBG *drbg,
RAND_DRBG_get_nonce_fn get_nonce,
RAND_DRBG_cleanup_nonce_fn cleanup_nonce)
{
if (drbg->state != DRBG_UNINITIALISED)
if (drbg->state != DRBG_UNINITIALISED
|| drbg->parent != NULL)
return 0;
drbg->get_entropy = get_entropy;
drbg->cleanup_entropy = cleanup_entropy;
@@ -859,7 +881,7 @@ static RAND_DRBG *drbg_setup(RAND_DRBG *parent)
goto err;
/* enable seed propagation */
drbg->reseed_counter = 1;
tsan_store(&drbg->reseed_prop_counter, 1);
/*
* Ignore instantiation error to support just-in-time instantiation.
@@ -948,11 +970,49 @@ static int drbg_bytes(unsigned char *out, int count)
return ret;
}
/*
* Calculates the minimum length of a full entropy buffer
* which is necessary to seed (i.e. instantiate) the DRBG
* successfully.
*/
size_t rand_drbg_seedlen(RAND_DRBG *drbg)
{
/*
* If no os entropy source is available then RAND_seed(buffer, bufsize)
* is expected to succeed if and only if the buffer length satisfies
* the following requirements, which follow from the calculations
* in RAND_DRBG_instantiate().
*/
size_t min_entropy = drbg->strength;
size_t min_entropylen = drbg->min_entropylen;
/*
* Extra entropy for the random nonce in the absence of a
* get_nonce callback, see comment in RAND_DRBG_instantiate().
*/
if (drbg->min_noncelen > 0 && drbg->get_nonce == NULL) {
min_entropy += drbg->strength / 2;
min_entropylen += drbg->min_noncelen;
}
/*
* Convert entropy requirement from bits to bytes
* (dividing by 8 without rounding upwards, because
* all entropy requirements are divisible by 8).
*/
min_entropy >>= 3;
/* Return a value that satisfies both requirements */
return min_entropy > min_entropylen ? min_entropy : min_entropylen;
}
/* Implements the default OpenSSL RAND_add() method */
static int drbg_add(const void *buf, int num, double randomness)
{
int ret = 0;
RAND_DRBG *drbg = RAND_DRBG_get0_master();
size_t buflen;
size_t seedlen;
if (drbg == NULL)
return 0;
@@ -960,20 +1020,49 @@ static int drbg_add(const void *buf, int num, double randomness)
if (num < 0 || randomness < 0.0)
return 0;
if (randomness > (double)drbg->max_entropylen) {
rand_drbg_lock(drbg);
seedlen = rand_drbg_seedlen(drbg);
buflen = (size_t)num;
if (buflen < seedlen || randomness < (double) seedlen) {
#if defined(OPENSSL_RAND_SEED_NONE)
/*
* If no os entropy source is available, a reseeding will fail
* inevitably. So we use a trick to mix the buffer contents into
* the DRBG state without forcing a reseeding: we generate a
* dummy random byte, using the buffer content as additional data.
* Note: This won't work with RAND_DRBG_FLAG_CTR_NO_DF.
*/
unsigned char dummy[1];
ret = RAND_DRBG_generate(drbg, dummy, sizeof(dummy), 0, buf, buflen);
rand_drbg_unlock(drbg);
return ret;
#else
/*
* If an os entropy source is avaible then we declare the buffer content
* as additional data by setting randomness to zero and trigger a regular
* reseeding.
*/
randomness = 0.0;
#endif
}
if (randomness > (double)seedlen) {
/*
* The purpose of this check is to bound |randomness| by a
* relatively small value in order to prevent an integer
* overflow when multiplying by 8 in the rand_drbg_restart()
* call below.
* call below. Note that randomness is measured in bytes,
* not bits, so this value corresponds to eight times the
* security strength.
*/
return 0;
randomness = (double)seedlen;
}
rand_drbg_lock(drbg);
ret = rand_drbg_restart(drbg, buf,
(size_t)(unsigned int)num,
(size_t)(8*randomness));
ret = rand_drbg_restart(drbg, buf, buflen, (size_t)(8 * randomness));
rand_drbg_unlock(drbg);
return ret;
+1
View File
@@ -44,6 +44,7 @@ static const ERR_STRING_DATA RAND_str_functs[] = {
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_ADD_BEGIN, 0),
"rand_pool_add_begin"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_ADD_END, 0), "rand_pool_add_end"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_ATTACH, 0), "rand_pool_attach"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_BYTES_NEEDED, 0),
"rand_pool_bytes_needed"},
{ERR_PACK(ERR_LIB_RAND, RAND_F_RAND_POOL_NEW, 0), "rand_pool_new"},
+52 -17
View File
@@ -16,6 +16,9 @@
# include <openssl/hmac.h>
# include <openssl/ec.h>
# include <openssl/rand_drbg.h>
# include "internal/tsan_assist.h"
# include "internal/numbers.h"
/* How many times to read the TSC as a randomness source. */
# define TSC_READ_COUNT 4
@@ -32,18 +35,42 @@
/* Max size of additional input and personalization string. */
# define DRBG_MAX_LENGTH 4096
/*
* Maximum input size for the DRBG (entropy, nonce, personalization string)
*
* NIST SP800 90Ar1 allows a maximum of (1 << 35) bits i.e., (1 << 32) bytes.
*
* We lower it to 'only' INT32_MAX bytes, which is equivalent to 2 gigabytes.
*/
# define DRBG_MAX_LENGTH INT32_MAX
/*
* The quotient between max_{entropy,nonce}len and min_{entropy,nonce}len
* Maximum allocation size for RANDOM_POOL buffers
*
* The current factor is large enough that the RAND_POOL can store a
* random input which has a lousy entropy rate of 0.0625 bits per byte.
* This input will be sent through the derivation function which 'compresses'
* the low quality input into a high quality output.
* The max_len value for the buffer provided to the rand_drbg_get_entropy()
* callback is currently 2^31 bytes (2 gigabytes), if a derivation function
* is used. Since this is much too large to be allocated, the rand_pool_new()
* function chooses more modest values as default pool length, bounded
* by RAND_POOL_MIN_LENGTH and RAND_POOL_MAX_LENGTH
*
* The choice of the RAND_POOL_FACTOR is large enough such that the
* RAND_POOL can store a random input which has a lousy entropy rate of
* 8/256 (= 0.03125) bits per byte. This input will be sent through the
* derivation function which 'compresses' the low quality input into a
* high quality output.
*
* The factor 1.5 below is the pessimistic estimate for the extra amount
* of entropy required when no get_nonce() callback is defined.
*/
# define RAND_POOL_FACTOR 256
# define RAND_POOL_MAX_LENGTH (RAND_POOL_FACTOR * \
3 * (RAND_DRBG_STRENGTH / 16))
/*
* = (RAND_POOL_FACTOR * \
* 1.5 * (RAND_DRBG_STRENGTH / 8))
*/
# define DRBG_MINMAX_FACTOR 128
/* DRBG status values */
@@ -54,7 +81,7 @@ typedef enum drbg_status_e {
} DRBG_STATUS;
/* intantiate */
/* instantiate */
typedef int (*RAND_DRBG_instantiate_fn)(RAND_DRBG *ctx,
const unsigned char *ent,
size_t entlen,
@@ -68,7 +95,7 @@ typedef int (*RAND_DRBG_reseed_fn)(RAND_DRBG *ctx,
size_t entlen,
const unsigned char *adin,
size_t adinlen);
/* generat output */
/* generate output */
typedef int (*RAND_DRBG_generate_fn)(RAND_DRBG *ctx,
unsigned char *out,
size_t outlen,
@@ -122,10 +149,12 @@ struct rand_pool_st {
unsigned char *buffer; /* points to the beginning of the random pool */
size_t len; /* current number of random bytes contained in the pool */
int attached; /* true pool was attached to existing buffer */
size_t min_len; /* minimum number of random bytes requested */
size_t max_len; /* maximum number of random bytes (allocated buffer size) */
size_t entropy; /* current entropy count in bits */
size_t requested_entropy; /* requested entropy count in bits */
size_t entropy_requested; /* requested entropy count in bits */
};
/*
@@ -139,7 +168,7 @@ struct rand_drbg_st {
int type; /* the nid of the underlying algorithm */
/*
* Stores the value of the rand_fork_count global as of when we last
* reseeded. The DRG reseeds automatically whenever drbg->fork_count !=
* reseeded. The DRBG reseeds automatically whenever drbg->fork_count !=
* rand_fork_count. Used to provide fork-safety and reseed this DRBG in
* the child process.
*/
@@ -147,14 +176,19 @@ struct rand_drbg_st {
unsigned short flags; /* various external flags */
/*
* The random pool is used by RAND_add()/drbg_add() to attach random
* The random_data is used by RAND_add()/drbg_add() to attach random
* data to the global drbg, such that the rand_drbg_get_entropy() callback
* can pull it during instantiation and reseeding. This is necessary to
* reconcile the different philosophies of the RAND and the RAND_DRBG
* with respect to how randomness is added to the RNG during reseeding
* (see PR #4328).
*/
struct rand_pool_st *pool;
struct rand_pool_st *seed_pool;
/*
* Auxiliary pool for additional data.
*/
struct rand_pool_st *adin_pool;
/*
* The following parameters are setup by the per-type "init" function.
@@ -180,7 +214,7 @@ struct rand_drbg_st {
size_t max_perslen, max_adinlen;
/* Counts the number of generate requests since the last reseed. */
unsigned int generate_counter;
unsigned int reseed_gen_counter;
/*
* Maximum number of generate requests until a reseed is required.
* This value is ignored if it is zero.
@@ -203,7 +237,8 @@ struct rand_drbg_st {
* is added by RAND_add() or RAND_seed() will have an immediate effect on
* the output of RAND_bytes() resp. RAND_priv_bytes().
*/
unsigned int reseed_counter;
TSAN_QUALIFIER unsigned int reseed_prop_counter;
unsigned int reseed_next_counter;
size_t seedlen;
DRBG_STATUS state;
@@ -245,7 +280,7 @@ extern int rand_fork_count;
/* DRBG helpers */
int rand_drbg_restart(RAND_DRBG *drbg,
const unsigned char *buffer, size_t len, size_t entropy);
size_t rand_drbg_seedlen(RAND_DRBG *drbg);
/* locking api */
int rand_drbg_lock(RAND_DRBG *drbg);
int rand_drbg_unlock(RAND_DRBG *drbg);
+98 -38
View File
@@ -31,7 +31,7 @@ int rand_fork_count;
static CRYPTO_RWLOCK *rand_nonce_lock;
static int rand_nonce_count;
static int rand_cleaning_up = 0;
static int rand_inited = 0;
#ifdef OPENSSL_RAND_SEED_RDTSC
/*
@@ -146,17 +146,13 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
return 0;
}
pool = rand_pool_new(entropy, min_len, max_len);
if (pool == NULL)
return 0;
if (drbg->pool) {
rand_pool_add(pool,
rand_pool_buffer(drbg->pool),
rand_pool_length(drbg->pool),
rand_pool_entropy(drbg->pool));
rand_pool_free(drbg->pool);
drbg->pool = NULL;
if (drbg->seed_pool != NULL) {
pool = drbg->seed_pool;
pool->entropy_requested = entropy;
} else {
pool = rand_pool_new(entropy, min_len, max_len);
if (pool == NULL)
return 0;
}
if (drbg->parent) {
@@ -178,6 +174,8 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
prediction_resistance,
NULL, 0) != 0)
bytes = bytes_needed;
drbg->reseed_next_counter
= tsan_load(&drbg->parent->reseed_prop_counter);
rand_drbg_unlock(drbg->parent);
rand_pool_add_end(pool, bytes, 8 * bytes);
@@ -206,7 +204,8 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
}
err:
rand_pool_free(pool);
if (drbg->seed_pool == NULL)
rand_pool_free(pool);
return ret;
}
@@ -217,7 +216,8 @@ size_t rand_drbg_get_entropy(RAND_DRBG *drbg,
void rand_drbg_cleanup_entropy(RAND_DRBG *drbg,
unsigned char *out, size_t outlen)
{
OPENSSL_secure_clear_free(out, outlen);
if (drbg->seed_pool == NULL)
OPENSSL_secure_clear_free(out, outlen);
}
@@ -279,14 +279,9 @@ void rand_drbg_cleanup_nonce(RAND_DRBG *drbg,
* On success it allocates a buffer at |*pout| and returns the length of
* the data. The buffer should get freed using OPENSSL_secure_clear_free().
*/
size_t rand_drbg_get_additional_data(unsigned char **pout, size_t max_len)
size_t rand_drbg_get_additional_data(RAND_POOL *pool, unsigned char **pout)
{
size_t ret = 0;
RAND_POOL *pool;
pool = rand_pool_new(0, 0, max_len);
if (pool == NULL)
return 0;
if (rand_pool_add_additional_data(pool) == 0)
goto err;
@@ -295,14 +290,12 @@ size_t rand_drbg_get_additional_data(unsigned char **pout, size_t max_len)
*pout = rand_pool_detach(pool);
err:
rand_pool_free(pool);
return ret;
}
void rand_drbg_cleanup_additional_data(unsigned char *out, size_t outlen)
void rand_drbg_cleanup_additional_data(RAND_POOL *pool, unsigned char *out)
{
OPENSSL_secure_clear_free(out, outlen);
rand_pool_reattach(pool, out);
}
void rand_fork(void)
@@ -326,13 +319,15 @@ DEFINE_RUN_ONCE_STATIC(do_rand_init)
if (rand_nonce_lock == NULL)
goto err2;
if (!rand_cleaning_up && !rand_pool_init())
if (!rand_pool_init())
goto err3;
rand_inited = 1;
return 1;
err3:
rand_pool_cleanup();
CRYPTO_THREAD_lock_free(rand_nonce_lock);
rand_nonce_lock = NULL;
err2:
CRYPTO_THREAD_lock_free(rand_meth_lock);
rand_meth_lock = NULL;
@@ -348,7 +343,8 @@ void rand_cleanup_int(void)
{
const RAND_METHOD *meth = default_RAND_meth;
rand_cleaning_up = 1;
if (!rand_inited)
return;
if (meth != NULL && meth->cleanup != NULL)
meth->cleanup();
@@ -362,6 +358,7 @@ void rand_cleanup_int(void)
rand_meth_lock = NULL;
CRYPTO_THREAD_lock_free(rand_nonce_lock);
rand_nonce_lock = NULL;
rand_inited = 0;
}
/*
@@ -370,7 +367,8 @@ void rand_cleanup_int(void)
*/
void RAND_keep_random_devices_open(int keep)
{
rand_pool_keep_random_devices_open(keep);
if (RUN_ONCE(&rand_init, do_rand_init))
rand_pool_keep_random_devices_open(keep);
}
/*
@@ -405,7 +403,7 @@ int RAND_poll(void)
/* fill random pool and seed the current legacy RNG */
pool = rand_pool_new(RAND_DRBG_STRENGTH,
RAND_DRBG_STRENGTH / 8,
DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8));
RAND_POOL_MAX_LENGTH);
if (pool == NULL)
return 0;
@@ -430,17 +428,18 @@ err:
* Allocate memory and initialize a new random pool
*/
RAND_POOL *rand_pool_new(int entropy, size_t min_len, size_t max_len)
RAND_POOL *rand_pool_new(int entropy_requested, size_t min_len, size_t max_len)
{
RAND_POOL *pool = OPENSSL_zalloc(sizeof(*pool));
if (pool == NULL) {
RANDerr(RAND_F_RAND_POOL_NEW, ERR_R_MALLOC_FAILURE);
goto err;
return NULL;
}
pool->min_len = min_len;
pool->max_len = max_len;
pool->max_len = (max_len > RAND_POOL_MAX_LENGTH) ?
RAND_POOL_MAX_LENGTH : max_len;
pool->buffer = OPENSSL_secure_zalloc(pool->max_len);
if (pool->buffer == NULL) {
@@ -448,7 +447,7 @@ RAND_POOL *rand_pool_new(int entropy, size_t min_len, size_t max_len)
goto err;
}
pool->requested_entropy = entropy;
pool->entropy_requested = entropy_requested;
return pool;
@@ -457,6 +456,38 @@ err:
return NULL;
}
/*
* Attach new random pool to the given buffer
*
* This function is intended to be used only for feeding random data
* provided by RAND_add() and RAND_seed() into the <master> DRBG.
*/
RAND_POOL *rand_pool_attach(const unsigned char *buffer, size_t len,
size_t entropy)
{
RAND_POOL *pool = OPENSSL_zalloc(sizeof(*pool));
if (pool == NULL) {
RANDerr(RAND_F_RAND_POOL_ATTACH, ERR_R_MALLOC_FAILURE);
return NULL;
}
/*
* The const needs to be cast away, but attached buffers will not be
* modified (in contrary to allocated buffers which are zeroed and
* freed in the end).
*/
pool->buffer = (unsigned char *) buffer;
pool->len = len;
pool->attached = 1;
pool->min_len = pool->max_len = pool->len;
pool->entropy = entropy;
return pool;
}
/*
* Free |pool|, securely erasing its buffer.
*/
@@ -465,7 +496,14 @@ void rand_pool_free(RAND_POOL *pool)
if (pool == NULL)
return;
OPENSSL_secure_clear_free(pool->buffer, pool->max_len);
/*
* Although it would be advisable from a cryptographical viewpoint,
* we are not allowed to clear attached buffers, since they are passed
* to rand_pool_attach() as `const unsigned char*`.
* (see corresponding comment in rand_pool_attach()).
*/
if (!pool->attached)
OPENSSL_secure_clear_free(pool->buffer, pool->max_len);
OPENSSL_free(pool);
}
@@ -496,15 +534,27 @@ size_t rand_pool_length(RAND_POOL *pool)
/*
* Detach the |pool| buffer and return it to the caller.
* It's the responsibility of the caller to free the buffer
* using OPENSSL_secure_clear_free().
* using OPENSSL_secure_clear_free() or to re-attach it
* again to the pool using rand_pool_reattach().
*/
unsigned char *rand_pool_detach(RAND_POOL *pool)
{
unsigned char *ret = pool->buffer;
pool->buffer = NULL;
pool->entropy = 0;
return ret;
}
/*
* Re-attach the |pool| buffer. It is only allowed to pass
* the |buffer| which was previously detached from the same pool.
*/
void rand_pool_reattach(RAND_POOL *pool, unsigned char *buffer)
{
pool->buffer = buffer;
OPENSSL_cleanse(pool->buffer, pool->len);
pool->len = 0;
}
/*
* If |entropy_factor| bits contain 1 bit of entropy, how many bytes does one
@@ -524,7 +574,7 @@ unsigned char *rand_pool_detach(RAND_POOL *pool)
*/
size_t rand_pool_entropy_available(RAND_POOL *pool)
{
if (pool->entropy < pool->requested_entropy)
if (pool->entropy < pool->entropy_requested)
return 0;
if (pool->len < pool->min_len)
@@ -540,8 +590,8 @@ size_t rand_pool_entropy_available(RAND_POOL *pool)
size_t rand_pool_entropy_needed(RAND_POOL *pool)
{
if (pool->entropy < pool->requested_entropy)
return pool->requested_entropy - pool->entropy;
if (pool->entropy < pool->entropy_requested)
return pool->entropy_requested - pool->entropy;
return 0;
}
@@ -601,6 +651,11 @@ int rand_pool_add(RAND_POOL *pool,
return 0;
}
if (pool->buffer == NULL) {
RANDerr(RAND_F_RAND_POOL_ADD, ERR_R_INTERNAL_ERROR);
return 0;
}
if (len > 0) {
memcpy(pool->buffer + pool->len, buffer, len);
pool->len += len;
@@ -632,6 +687,11 @@ unsigned char *rand_pool_add_begin(RAND_POOL *pool, size_t len)
return NULL;
}
if (pool->buffer == NULL) {
RANDerr(RAND_F_RAND_POOL_ADD_BEGIN, ERR_R_INTERNAL_ERROR);
return 0;
}
return pool->buffer + pool->len;
}
+27 -29
View File
@@ -77,6 +77,17 @@ static uint64_t get_timer_bits(void);
# endif
#endif /* defined(OPENSSL_SYS_UNIX) || defined(__DJGPP__) */
#if defined(OPENSSL_RAND_SEED_NONE)
/* none means none. this simplifies the following logic */
# undef OPENSSL_RAND_SEED_OS
# undef OPENSSL_RAND_SEED_GETRANDOM
# undef OPENSSL_RAND_SEED_LIBRANDOM
# undef OPENSSL_RAND_SEED_DEVRANDOM
# undef OPENSSL_RAND_SEED_RDTSC
# undef OPENSSL_RAND_SEED_RDCPU
# undef OPENSSL_RAND_SEED_EGD
#endif
#if (defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)) && \
!defined(OPENSSL_RAND_SEED_NONE)
# error "UEFI and VXWorks only support seeding NONE"
@@ -86,8 +97,6 @@ static uint64_t get_timer_bits(void);
|| defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_VXWORKS) \
|| defined(OPENSSL_SYS_UEFI))
static ssize_t syscall_random(void *buf, size_t buflen);
# if defined(OPENSSL_SYS_VOS)
# ifndef OPENSSL_RAND_SEED_OS
@@ -244,6 +253,7 @@ static ssize_t sysctl_random(char *buf, size_t buflen)
}
# endif
# if defined(OPENSSL_RAND_SEED_GETRANDOM)
/*
* syscall_random(): Try to get random data using a system call
* returns the number of bytes returned in buf, or < 0 on error.
@@ -254,7 +264,7 @@ static ssize_t syscall_random(void *buf, size_t buflen)
* Note: 'buflen' equals the size of the buffer which is used by the
* get_entropy() callback of the RAND_DRBG. It is roughly bounded by
*
* 2 * DRBG_MINMAX_FACTOR * (RAND_DRBG_STRENGTH / 8) = 2^13
* 2 * RAND_POOL_FACTOR * (RAND_DRBG_STRENGTH / 8) = 2^14
*
* which is way below the OSSL_SSIZE_MAX limit. Therefore sign conversion
* between size_t and ssize_t is safe even without a range check.
@@ -302,8 +312,9 @@ static ssize_t syscall_random(void *buf, size_t buflen)
return -1;
# endif
}
# endif /* defined(OPENSSL_RAND_SEED_GETRANDOM) */
#if !defined(OPENSSL_RAND_SEED_NONE) && defined(OPENSSL_RAND_SEED_DEVRANDOM)
# if defined(OPENSSL_RAND_SEED_DEVRANDOM)
static const char *random_device_paths[] = { DEVRANDOM };
static struct random_device {
int fd;
@@ -375,21 +386,13 @@ static void close_random_device(size_t n)
rd->fd = -1;
}
static void open_random_devices(void)
{
size_t i;
for (i = 0; i < OSSL_NELEM(random_devices); i++)
(void)get_random_device(i);
}
int rand_pool_init(void)
{
size_t i;
for (i = 0; i < OSSL_NELEM(random_devices); i++)
random_devices[i].fd = -1;
open_random_devices();
return 1;
}
@@ -403,16 +406,13 @@ void rand_pool_cleanup(void)
void rand_pool_keep_random_devices_open(int keep)
{
if (keep)
open_random_devices();
else
if (!keep)
rand_pool_cleanup();
keep_random_devices_open = keep;
}
# else /* defined(OPENSSL_RAND_SEED_NONE)
* || !defined(OPENSSL_RAND_SEED_DEVRANDOM)
*/
# else /* !defined(OPENSSL_RAND_SEED_DEVRANDOM) */
int rand_pool_init(void)
{
@@ -427,9 +427,7 @@ void rand_pool_keep_random_devices_open(int keep)
{
}
# endif /* !defined(OPENSSL_RAND_SEED_NONE)
* && defined(OPENSSL_RAND_SEED_DEVRANDOM)
*/
# endif /* defined(OPENSSL_RAND_SEED_DEVRANDOM) */
/*
* Try the various seeding methods in turn, exit when successful.
@@ -450,14 +448,14 @@ void rand_pool_keep_random_devices_open(int keep)
*/
size_t rand_pool_acquire_entropy(RAND_POOL *pool)
{
# ifdef OPENSSL_RAND_SEED_NONE
# if defined(OPENSSL_RAND_SEED_NONE)
return rand_pool_entropy_available(pool);
# else
size_t bytes_needed;
size_t entropy_available = 0;
unsigned char *buffer;
# ifdef OPENSSL_RAND_SEED_GETRANDOM
# if defined(OPENSSL_RAND_SEED_GETRANDOM)
{
ssize_t bytes;
/* Maximum allowed number of consecutive unsuccessful attempts */
@@ -487,7 +485,7 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
}
# endif
# ifdef OPENSSL_RAND_SEED_DEVRANDOM
# if defined(OPENSSL_RAND_SEED_DEVRANDOM)
bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
{
size_t i;
@@ -524,19 +522,19 @@ size_t rand_pool_acquire_entropy(RAND_POOL *pool)
}
# endif
# ifdef OPENSSL_RAND_SEED_RDTSC
# if defined(OPENSSL_RAND_SEED_RDTSC)
entropy_available = rand_acquire_entropy_from_tsc(pool);
if (entropy_available > 0)
return entropy_available;
# endif
# ifdef OPENSSL_RAND_SEED_RDCPU
# if defined(OPENSSL_RAND_SEED_RDCPU)
entropy_available = rand_acquire_entropy_from_cpu(pool);
if (entropy_available > 0)
return entropy_available;
# endif
# ifdef OPENSSL_RAND_SEED_EGD
# if defined(OPENSSL_RAND_SEED_EGD)
bytes_needed = rand_pool_bytes_needed(pool, 1 /*entropy_factor*/);
if (bytes_needed > 0) {
static const char *paths[] = { DEVRANDOM_EGD, NULL };
@@ -577,7 +575,7 @@ int rand_pool_add_nonce_data(RAND_POOL *pool)
/*
* Add process id, thread id, and a high resolution timestamp to
* ensure that the nonce is unique whith high probability for
* ensure that the nonce is unique with high probability for
* different process instances.
*/
data.pid = getpid();
+31 -13
View File
@@ -16,6 +16,7 @@
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <openssl/rand_drbg.h>
#include <openssl/buffer.h>
#ifdef OPENSSL_SYS_VMS
@@ -48,7 +49,7 @@
# define S_ISREG(m) ((m) & S_IFREG)
# endif
#define RAND_FILE_SIZE 1024
#define RAND_BUF_SIZE 1024
#define RFILE ".rnd"
#ifdef OPENSSL_SYS_VMS
@@ -74,7 +75,16 @@ static __FILE_ptr32 (*const vms_fopen)(const char *, const char *, ...) =
*/
int RAND_load_file(const char *file, long bytes)
{
unsigned char buf[RAND_FILE_SIZE];
/*
* The load buffer size exceeds the chunk size by the comfortable amount
* of 'RAND_DRBG_STRENGTH' bytes (not bits!). This is done on purpose
* to avoid calling RAND_add() with a small final chunk. Instead, such
* a small final chunk will be added together with the previous chunk
* (unless it's the only one).
*/
#define RAND_LOAD_BUF_SIZE (RAND_BUF_SIZE + RAND_DRBG_STRENGTH)
unsigned char buf[RAND_LOAD_BUF_SIZE];
#ifndef OPENSSL_NO_POSIX_IO
struct stat sb;
#endif
@@ -98,8 +108,12 @@ int RAND_load_file(const char *file, long bytes)
return -1;
}
if (!S_ISREG(sb.st_mode) && bytes < 0)
bytes = 256;
if (bytes < 0) {
if (S_ISREG(sb.st_mode))
bytes = sb.st_size;
else
bytes = RAND_DRBG_STRENGTH;
}
#endif
/*
* On VMS, setbuf() will only take 32-bit pointers, and a compilation
@@ -124,9 +138,9 @@ int RAND_load_file(const char *file, long bytes)
for ( ; ; ) {
if (bytes > 0)
n = (bytes < RAND_FILE_SIZE) ? (int)bytes : RAND_FILE_SIZE;
n = (bytes <= RAND_LOAD_BUF_SIZE) ? (int)bytes : RAND_BUF_SIZE;
else
n = RAND_FILE_SIZE;
n = RAND_LOAD_BUF_SIZE;
i = fread(buf, 1, n, in);
#ifdef EINTR
if (ferror(in) && errno == EINTR){
@@ -148,12 +162,18 @@ int RAND_load_file(const char *file, long bytes)
OPENSSL_cleanse(buf, sizeof(buf));
fclose(in);
if (!RAND_status()) {
RANDerr(RAND_F_RAND_LOAD_FILE, RAND_R_RESEED_ERROR);
ERR_add_error_data(2, "Filename=", file);
return -1;
}
return ret;
}
int RAND_write_file(const char *file)
{
unsigned char buf[RAND_FILE_SIZE];
unsigned char buf[RAND_BUF_SIZE];
int ret = -1;
FILE *out = NULL;
#ifndef OPENSSL_NO_POSIX_IO
@@ -222,9 +242,9 @@ int RAND_write_file(const char *file)
chmod(file, 0600);
#endif
ret = fwrite(buf, 1, RAND_FILE_SIZE, out);
ret = fwrite(buf, 1, RAND_BUF_SIZE, out);
fclose(out);
OPENSSL_cleanse(buf, RAND_FILE_SIZE);
OPENSSL_cleanse(buf, RAND_BUF_SIZE);
return ret;
}
@@ -262,11 +282,9 @@ const char *RAND_file_name(char *buf, size_t size)
}
}
#else
if (OPENSSL_issetugid() != 0) {
if ((s = ossl_safe_getenv("RANDFILE")) == NULL || *s == '\0') {
use_randfile = 0;
} else if ((s = getenv("RANDFILE")) == NULL || *s == '\0') {
use_randfile = 0;
s = getenv("HOME");
s = ossl_safe_getenv("HOME");
}
#endif
+8 -8
View File
@@ -125,8 +125,8 @@ void RSA_free(RSA *r)
CRYPTO_THREAD_lock_free(r->lock);
BN_clear_free(r->n);
BN_clear_free(r->e);
BN_free(r->n);
BN_free(r->e);
BN_clear_free(r->d);
BN_clear_free(r->p);
BN_clear_free(r->q);
@@ -196,7 +196,7 @@ int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
r->e = e;
}
if (d != NULL) {
BN_free(r->d);
BN_clear_free(r->d);
r->d = d;
}
@@ -213,11 +213,11 @@ int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
return 0;
if (p != NULL) {
BN_free(r->p);
BN_clear_free(r->p);
r->p = p;
}
if (q != NULL) {
BN_free(r->q);
BN_clear_free(r->q);
r->q = q;
}
@@ -235,15 +235,15 @@ int RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
return 0;
if (dmp1 != NULL) {
BN_free(r->dmp1);
BN_clear_free(r->dmp1);
r->dmp1 = dmp1;
}
if (dmq1 != NULL) {
BN_free(r->dmq1);
BN_clear_free(r->dmq1);
r->dmq1 = dmq1;
}
if (iqmp != NULL) {
BN_free(r->iqmp);
BN_clear_free(r->iqmp);
r->iqmp = iqmp;
}
Loaded 100 of 1067 files, more files were not shown because too many files have changed in this diff. Show more