Adding upstream version 1.9.14.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
ddf4b25f8f
commit
49fcf7364a
88 changed files with 62468 additions and 0 deletions
19
.github/workflows/ci.yaml
vendored
Normal file
19
.github/workflows/ci.yaml
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
name: Continuous Integration
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: reconfigure
|
||||
run: autoreconf -fi
|
||||
- name: configure
|
||||
run: ./configure --prefix="/usr"
|
||||
- name: make
|
||||
run: make
|
||||
- name: make check
|
||||
run: make check
|
||||
- name: make install
|
||||
run: sudo make install
|
5
AUTHORS
Normal file
5
AUTHORS
Normal file
|
@ -0,0 +1,5 @@
|
|||
Contact Information:
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Gary Wuertz (gary_at_issiweb_com)
|
||||
http://www.issihosts.com/haveged
|
674
COPYING
Normal file
674
COPYING
Normal file
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
178
ChangeLog
Normal file
178
ChangeLog
Normal file
|
@ -0,0 +1,178 @@
|
|||
v1.9.14 (Jan 01, 2021)
|
||||
* made enttest configurable
|
||||
* havegecmd.c - new command added to close the communication socket [Werner Fink]
|
||||
|
||||
v1.9.13 (Jun 28, 2020)
|
||||
* added support for --version [Jirka Hladky]
|
||||
* updated systemd service file [Jirka Hladky]
|
||||
|
||||
v1.9.12 (Jun 18, 2020)
|
||||
* fix a memory leak in havege_destroy [Anakin Zhang]
|
||||
|
||||
v1.9.11 (Jun 11, 2020)
|
||||
* updated version reported by program [Jirka Hladky]
|
||||
|
||||
v1.9.10 (Jun 11, 2020)
|
||||
* fix ordering cycle with private tmp [Christian Hesse]
|
||||
|
||||
v1.9.9 (Jun 9, 2020)
|
||||
* Updated systemd service file [nicoo]
|
||||
* Bump soname [nicoo]
|
||||
* Fix crash on shutdown in threaded mode [Sergei Trofimovich]
|
||||
* Fix compilation with --enable-threads [Lars Wendler]
|
||||
|
||||
v1.9.8 (Sep 30, 2019)
|
||||
* Fix for Unresolved symbol error_exit in libhavege #20 by pld-gitsync [Jirka Hladky]
|
||||
* order after systemd-tmpfiles-setup-dev.service (origin/pr/21) [Christian Hesse]
|
||||
* use systemd security features [Christian Hesse]
|
||||
* do not run in container [Christian Hesse]
|
||||
* do not use carriage return in line break [Christian Hesse]
|
||||
* Fixed invalid UTF-8 codes in ChangeLog [Jirka Hladky]
|
||||
|
||||
|
||||
v1.9.5 (Aug 20, 2019)
|
||||
* Added test for /dev/random symlink [Jirka Hladky]
|
||||
* Update to automake 1.16 [Jirka Hladky]
|
||||
* Fix segv at start [Andrew]
|
||||
* Fixed built issue on Cygwin [jbaker6953]
|
||||
* Fix segfault on arm machines (origin/pr/7) [Natanael Copa]
|
||||
* init.d/Makefile.am - add missing dependency [Jackie Huang]
|
||||
* service.redhat - update PIDFile [Pierre-Jean Texier]
|
||||
* Fix type mismatch in get_poolsize [Andreas Schwab]
|
||||
* Fixup upstream changelog [Nicolas Braud-Santoni]
|
||||
* Remove support for CPUID on ia64 (origin/pr/19) [Jeremy Bobbio]
|
||||
* Output some progress during CUSUM and RANDOM EXCURSION test [Sven Hartge]
|
||||
* Diagnostics capture mode now works correctly [Ethan Rahn]
|
||||
|
||||
v1.9.4 (Aug 11, 2018)
|
||||
* Avoid misleading message if cmd socket is in use
|
||||
|
||||
v1.9.3 (Aug 10, 2018)
|
||||
* Implemented a command mode and use it for chroot - contributed Dr. Werner Fink
|
||||
|
||||
v1.9.2 (Nov 16, 2017)
|
||||
* Add cross compile fixes contributed by Robert Schwebel
|
||||
* Limit watermark max to less than pool size to avoid 100% cpu condition
|
||||
* Add service.suse init script contributed by Tomas Chvatal
|
||||
|
||||
v1.9.1 (Feb 11, 2014)
|
||||
* Documentation and sample file touch-up for v1.9.
|
||||
|
||||
v1.9 (Feb 10, 2014)
|
||||
* Fix dead man limit in test procedure B. Fix broken AIS retry logic.
|
||||
* Correct online test defaults
|
||||
* Improve diagnostic display of test results, output summary, testing retries
|
||||
* Add test/output summary to all abnormal app terminations
|
||||
* Add required <stddef.h> include to havege.h. Add quick version check for lib users.
|
||||
* Improve diagnostic build for testing online tests. Fix broken inject features.
|
||||
* Rework major portions of havegetest,c for better performance with -fpic
|
||||
* Correct test procedure B to match independent clean room implementation of reference
|
||||
* Tweak configure.ac for arm build, make --disable-clock_gettime consistent
|
||||
* Major edit of man pages, haveged.8 and libhavege.3
|
||||
* Many other documentation changes: havege.h, README, etc...
|
||||
|
||||
v1.8 (Jan 02, 2014)
|
||||
* Fix return code for signalled termination.
|
||||
* Update init.d/service.fedora - new return code + simple, not forking
|
||||
* Add --enable_unitdir as DESTDIR for systemd install
|
||||
|
||||
v1.7c (Jun 08, 2013)
|
||||
* Fix alignment fault on mips in havegetest.c, procedure B.
|
||||
|
||||
v1.7b (Jun 06, 2013)
|
||||
* Fix alignment fault on sparc in havegetest.c, procedure A, test5XOR().
|
||||
* Fix build ppc detection in configure.ac
|
||||
|
||||
v1.7a (Feb 13, 2013)
|
||||
* Fix parallel build (LDADD fix + VPATH fixes to test programs)
|
||||
* Fix check target for automake v1.13 and previous (use check-local)
|
||||
* Add option to suppress tuning code build
|
||||
* Improve sample spec file for library
|
||||
|
||||
v1.7 (Jan 15, 2013)
|
||||
* Add havege_status_dump() as basis for haveged diagnostics
|
||||
* Provide sample spec to build haveged and haveged-devel
|
||||
* Add contrib/build to provide build support
|
||||
* Modify build to use libtool
|
||||
* Rename base types to alias stdint.h types to allow 'fixes' if necessary
|
||||
* Rename all public functions to follow havege_* naming convention
|
||||
* Sanitize havege.h to be include file for devel package
|
||||
* Add destroy() to havege for library use.
|
||||
* Move all remaining static vars to allocated memory.
|
||||
* Rework include file structure to eliminate include sequence errors.
|
||||
* Fix (rare) segfault in test0 caused by 1.6 alignment fix
|
||||
|
||||
v1.6a (Dec 18, 2012)
|
||||
* Fix typo in configure.ac
|
||||
|
||||
v1.6 (Dec 15, 2012)
|
||||
* Correct makefile encoding and defaults description
|
||||
* Make clock_gettime a build option and correct dependencies when used.
|
||||
* Fix alignment fault on arm64 in procedure A test0.
|
||||
|
||||
v1.5 (Aug 12, 2012)
|
||||
* Add online tests based on AIS-31 controlled by --enable-olt build option
|
||||
* Add -o option to specify online tests to perform
|
||||
* Add -p option to specify the pid location.
|
||||
* Fix -F option to not take argument - i.e. now a switch
|
||||
* Factor diagnostic methods for capture and inject for better performance
|
||||
* Fix install target, move to bin and eliminate script if not daemon, now use sysv and systemd templates
|
||||
|
||||
v1.4 (Feb 07, 2012)
|
||||
* Add s390 architecture. Thanks to Dan Horak and Jiri Hladky
|
||||
* Add generic architecture with clock_gettime() timer.
|
||||
* Rewrite collection loop to support multiple instances and new diagnostics
|
||||
* Rewrite tuning mechanism to add virtual file system mining and correct cpuid bugs
|
||||
* Add prototype multi-thread collection option
|
||||
* Reduce collection buffer size to .5MB
|
||||
* Improve/correct build and install
|
||||
* Add new invocation options to support new features.
|
||||
|
||||
v1.3 (Oct 23, 2011)
|
||||
* Integrate contributions by Jirka Hladky to fine tune collection implementation.
|
||||
* Add non-daemon interface with option to send continuous stream of output to stdout.
|
||||
|
||||
v1.2 (June 26, 2011))
|
||||
* Address compiler issues by using compiler intrinsics.
|
||||
* Fix cpuid pic issues once again.
|
||||
|
||||
v1.01 (Jan 04,2011)
|
||||
* Add detached option for those who use a supervising daemon
|
||||
* Build cleanup for non-cpuid environments
|
||||
|
||||
v1.0 (Nov 28,2010)
|
||||
* Fix gcc 4.5 optimization of HARDCLOCK
|
||||
* Add contrib section
|
||||
|
||||
v0.9 (Sep 01, 2009)
|
||||
* Refine collection for gcc 4.4 on Intel i7 (gentoo)
|
||||
* Update auto tune to Intel latest cpuid spec
|
||||
* Add check for cpuid instruction on i386
|
||||
* Add man(8) page
|
||||
* Cleanup check target to build with -Wall
|
||||
|
||||
v0.8 (Jul 30, 2009)
|
||||
* Correct pool size related calculations.
|
||||
|
||||
v0.7 (May 1, 2009)
|
||||
* More package contents confusion.
|
||||
|
||||
v0.6 (Apr 29, 2009)
|
||||
* Correct mix up in package contents
|
||||
|
||||
v0.5 (Apr 28, 2009)
|
||||
* Migrated project to GNU build
|
||||
|
||||
v04 (Apr 26, 2009)
|
||||
* Fix documentation typos!
|
||||
|
||||
v03 (Apr 24, 2009)
|
||||
* Reworked build/test for more general install.
|
||||
* Integrate init script changes from A Bartlett
|
||||
|
||||
v02 (Jan 19, 2009)
|
||||
* Reworked daemon with run-time loop tuning.
|
||||
* Submitted to freshmeat
|
||||
|
||||
v (Jan 10, 2009)
|
||||
* Original daemon based on libhavege.
|
368
INSTALL
Normal file
368
INSTALL
Normal file
|
@ -0,0 +1,368 @@
|
|||
Installation Instructions
|
||||
*************************
|
||||
|
||||
Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Copying and distribution of this file, with or without modification,
|
||||
are permitted in any medium without royalty provided the copyright
|
||||
notice and this notice are preserved. This file is offered as-is,
|
||||
without warranty of any kind.
|
||||
|
||||
Basic Installation
|
||||
==================
|
||||
|
||||
Briefly, the shell command './configure && make && make install'
|
||||
should configure, build, and install this package. The following
|
||||
more-detailed instructions are generic; see the 'README' file for
|
||||
instructions specific to this package. Some packages provide this
|
||||
'INSTALL' file but do not implement all of the features documented
|
||||
below. The lack of an optional feature in a given package is not
|
||||
necessarily a bug. More recommendations for GNU packages can be found
|
||||
in *note Makefile Conventions: (standards)Makefile Conventions.
|
||||
|
||||
The 'configure' shell script attempts to guess correct values for
|
||||
various system-dependent variables used during compilation. It uses
|
||||
those values to create a 'Makefile' in each directory of the package.
|
||||
It may also create one or more '.h' files containing system-dependent
|
||||
definitions. Finally, it creates a shell script 'config.status' that
|
||||
you can run in the future to recreate the current configuration, and a
|
||||
file 'config.log' containing compiler output (useful mainly for
|
||||
debugging 'configure').
|
||||
|
||||
It can also use an optional file (typically called 'config.cache' and
|
||||
enabled with '--cache-file=config.cache' or simply '-C') that saves the
|
||||
results of its tests to speed up reconfiguring. Caching is disabled by
|
||||
default to prevent problems with accidental use of stale cache files.
|
||||
|
||||
If you need to do unusual things to compile the package, please try
|
||||
to figure out how 'configure' could check whether to do them, and mail
|
||||
diffs or instructions to the address given in the 'README' so they can
|
||||
be considered for the next release. If you are using the cache, and at
|
||||
some point 'config.cache' contains results you don't want to keep, you
|
||||
may remove or edit it.
|
||||
|
||||
The file 'configure.ac' (or 'configure.in') is used to create
|
||||
'configure' by a program called 'autoconf'. You need 'configure.ac' if
|
||||
you want to change it or regenerate 'configure' using a newer version of
|
||||
'autoconf'.
|
||||
|
||||
The simplest way to compile this package is:
|
||||
|
||||
1. 'cd' to the directory containing the package's source code and type
|
||||
'./configure' to configure the package for your system.
|
||||
|
||||
Running 'configure' might take a while. While running, it prints
|
||||
some messages telling which features it is checking for.
|
||||
|
||||
2. Type 'make' to compile the package.
|
||||
|
||||
3. Optionally, type 'make check' to run any self-tests that come with
|
||||
the package, generally using the just-built uninstalled binaries.
|
||||
|
||||
4. Type 'make install' to install the programs and any data files and
|
||||
documentation. When installing into a prefix owned by root, it is
|
||||
recommended that the package be configured and built as a regular
|
||||
user, and only the 'make install' phase executed with root
|
||||
privileges.
|
||||
|
||||
5. Optionally, type 'make installcheck' to repeat any self-tests, but
|
||||
this time using the binaries in their final installed location.
|
||||
This target does not install anything. Running this target as a
|
||||
regular user, particularly if the prior 'make install' required
|
||||
root privileges, verifies that the installation completed
|
||||
correctly.
|
||||
|
||||
6. You can remove the program binaries and object files from the
|
||||
source code directory by typing 'make clean'. To also remove the
|
||||
files that 'configure' created (so you can compile the package for
|
||||
a different kind of computer), type 'make distclean'. There is
|
||||
also a 'make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
7. Often, you can also type 'make uninstall' to remove the installed
|
||||
files again. In practice, not all packages have tested that
|
||||
uninstallation works correctly, even though it is required by the
|
||||
GNU Coding Standards.
|
||||
|
||||
8. Some packages, particularly those that use Automake, provide 'make
|
||||
distcheck', which can by used by developers to test that all other
|
||||
targets like 'make install' and 'make uninstall' work correctly.
|
||||
This target is generally not run by end users.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the 'configure' script does not know about. Run './configure --help'
|
||||
for details on some of the pertinent environment variables.
|
||||
|
||||
You can give 'configure' initial values for configuration parameters
|
||||
by setting variables in the command line or in the environment. Here is
|
||||
an example:
|
||||
|
||||
./configure CC=c99 CFLAGS=-g LIBS=-lposix
|
||||
|
||||
*Note Defining Variables::, for more details.
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you can use GNU 'make'. 'cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the 'configure' script. 'configure' automatically checks for the source
|
||||
code in the directory that 'configure' is in and in '..'. This is known
|
||||
as a "VPATH" build.
|
||||
|
||||
With a non-GNU 'make', it is safer to compile the package for one
|
||||
architecture at a time in the source code directory. After you have
|
||||
installed the package for one architecture, use 'make distclean' before
|
||||
reconfiguring for another architecture.
|
||||
|
||||
On MacOS X 10.5 and later systems, you can create libraries and
|
||||
executables that work on multiple system types--known as "fat" or
|
||||
"universal" binaries--by specifying multiple '-arch' options to the
|
||||
compiler but only a single '-arch' option to the preprocessor. Like
|
||||
this:
|
||||
|
||||
./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
||||
CPP="gcc -E" CXXCPP="g++ -E"
|
||||
|
||||
This is not guaranteed to produce working output in all cases, you
|
||||
may have to build one architecture at a time and combine the results
|
||||
using the 'lipo' tool if you have problems.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, 'make install' installs the package's commands under
|
||||
'/usr/local/bin', include files under '/usr/local/include', etc. You
|
||||
can specify an installation prefix other than '/usr/local' by giving
|
||||
'configure' the option '--prefix=PREFIX', where PREFIX must be an
|
||||
absolute file name.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
|
||||
PREFIX as the prefix for installing programs and libraries.
|
||||
Documentation and other data files still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like '--bindir=DIR' to specify different values for particular
|
||||
kinds of files. Run 'configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them. In general, the default
|
||||
for these options is expressed in terms of '${prefix}', so that
|
||||
specifying just '--prefix' will affect all of the other directory
|
||||
specifications that were not explicitly provided.
|
||||
|
||||
The most portable way to affect installation locations is to pass the
|
||||
correct locations to 'configure'; however, many packages provide one or
|
||||
both of the following shortcuts of passing variable assignments to the
|
||||
'make install' command line to change installation locations without
|
||||
having to reconfigure or recompile.
|
||||
|
||||
The first method involves providing an override variable for each
|
||||
affected directory. For example, 'make install
|
||||
prefix=/alternate/directory' will choose an alternate location for all
|
||||
directory configuration variables that were expressed in terms of
|
||||
'${prefix}'. Any directories that were specified during 'configure',
|
||||
but not in terms of '${prefix}', must each be overridden at install time
|
||||
for the entire installation to be relocated. The approach of makefile
|
||||
variable overrides for each directory variable is required by the GNU
|
||||
Coding Standards, and ideally causes no recompilation. However, some
|
||||
platforms have known limitations with the semantics of shared libraries
|
||||
that end up requiring recompilation when using this method, particularly
|
||||
noticeable in packages that use GNU Libtool.
|
||||
|
||||
The second method involves providing the 'DESTDIR' variable. For
|
||||
example, 'make install DESTDIR=/alternate/directory' will prepend
|
||||
'/alternate/directory' before all installation names. The approach of
|
||||
'DESTDIR' overrides is not required by the GNU Coding Standards, and
|
||||
does not work on platforms that have drive letters. On the other hand,
|
||||
it does better at avoiding recompilation issues, and works well even
|
||||
when some directory options were not specified in terms of '${prefix}'
|
||||
at 'configure' time.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving 'configure' the
|
||||
option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'.
|
||||
|
||||
Some packages pay attention to '--enable-FEATURE' options to
|
||||
'configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to '--with-PACKAGE' options, where PACKAGE
|
||||
is something like 'gnu-as' or 'x' (for the X Window System). The
|
||||
'README' should mention any '--enable-' and '--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, 'configure' can usually
|
||||
find the X include and library files automatically, but if it doesn't,
|
||||
you can use the 'configure' options '--x-includes=DIR' and
|
||||
'--x-libraries=DIR' to specify their locations.
|
||||
|
||||
Some packages offer the ability to configure how verbose the
|
||||
execution of 'make' will be. For these packages, running './configure
|
||||
--enable-silent-rules' sets the default to minimal output, which can be
|
||||
overridden with 'make V=1'; while running './configure
|
||||
--disable-silent-rules' sets the default to verbose, which can be
|
||||
overridden with 'make V=0'.
|
||||
|
||||
Particular systems
|
||||
==================
|
||||
|
||||
On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC
|
||||
is not installed, it is recommended to use the following options in
|
||||
order to use an ANSI C compiler:
|
||||
|
||||
./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
|
||||
|
||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
|
||||
|
||||
HP-UX 'make' updates targets which have the same time stamps as their
|
||||
prerequisites, which makes it generally unusable when shipped generated
|
||||
files such as 'configure' are involved. Use GNU 'make' instead.
|
||||
|
||||
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
|
||||
parse its '<wchar.h>' header file. The option '-nodtk' can be used as a
|
||||
workaround. If GNU CC is not installed, it is therefore recommended to
|
||||
try
|
||||
|
||||
./configure CC="cc"
|
||||
|
||||
and if that doesn't work, try
|
||||
|
||||
./configure CC="cc -nodtk"
|
||||
|
||||
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
|
||||
directory contains several dysfunctional programs; working variants of
|
||||
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
|
||||
in your 'PATH', put it _after_ '/usr/bin'.
|
||||
|
||||
On Haiku, software installed for all users goes in '/boot/common',
|
||||
not '/usr/local'. It is recommended to use the following options:
|
||||
|
||||
./configure --prefix=/boot/common
|
||||
|
||||
Specifying the System Type
|
||||
==========================
|
||||
|
||||
There may be some features 'configure' cannot figure out
|
||||
automatically, but needs to determine by the type of machine the package
|
||||
will run on. Usually, assuming the package is built to be run on the
|
||||
_same_ architectures, 'configure' can figure that out, but if it prints
|
||||
a message saying it cannot guess the machine type, give it the
|
||||
'--build=TYPE' option. TYPE can either be a short name for the system
|
||||
type, such as 'sun4', or a canonical name which has the form:
|
||||
|
||||
CPU-COMPANY-SYSTEM
|
||||
|
||||
where SYSTEM can have one of these forms:
|
||||
|
||||
OS
|
||||
KERNEL-OS
|
||||
|
||||
See the file 'config.sub' for the possible values of each field. If
|
||||
'config.sub' isn't included in this package, then this package doesn't
|
||||
need to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should
|
||||
use the option '--target=TYPE' to select the type of system they will
|
||||
produce code for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a
|
||||
platform different from the build platform, you should specify the
|
||||
"host" platform (i.e., that on which the generated programs will
|
||||
eventually be run) with '--host=TYPE'.
|
||||
|
||||
Sharing Defaults
|
||||
================
|
||||
|
||||
If you want to set default values for 'configure' scripts to share,
|
||||
you can create a site shell script called 'config.site' that gives
|
||||
default values for variables like 'CC', 'cache_file', and 'prefix'.
|
||||
'configure' looks for 'PREFIX/share/config.site' if it exists, then
|
||||
'PREFIX/etc/config.site' if it exists. Or, you can set the
|
||||
'CONFIG_SITE' environment variable to the location of the site script.
|
||||
A warning: not all 'configure' scripts look for a site script.
|
||||
|
||||
Defining Variables
|
||||
==================
|
||||
|
||||
Variables not defined in a site shell script can be set in the
|
||||
environment passed to 'configure'. However, some packages may run
|
||||
configure again during the build, and the customized values of these
|
||||
variables may be lost. In order to avoid this problem, you should set
|
||||
them in the 'configure' command line, using 'VAR=value'. For example:
|
||||
|
||||
./configure CC=/usr/local2/bin/gcc
|
||||
|
||||
causes the specified 'gcc' to be used as the C compiler (unless it is
|
||||
overridden in the site shell script).
|
||||
|
||||
Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an
|
||||
Autoconf limitation. Until the limitation is lifted, you can use this
|
||||
workaround:
|
||||
|
||||
CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
|
||||
|
||||
'configure' Invocation
|
||||
======================
|
||||
|
||||
'configure' recognizes the following options to control how it
|
||||
operates.
|
||||
|
||||
'--help'
|
||||
'-h'
|
||||
Print a summary of all of the options to 'configure', and exit.
|
||||
|
||||
'--help=short'
|
||||
'--help=recursive'
|
||||
Print a summary of the options unique to this package's
|
||||
'configure', and exit. The 'short' variant lists options used only
|
||||
in the top level, while the 'recursive' variant lists options also
|
||||
present in any nested packages.
|
||||
|
||||
'--version'
|
||||
'-V'
|
||||
Print the version of Autoconf used to generate the 'configure'
|
||||
script, and exit.
|
||||
|
||||
'--cache-file=FILE'
|
||||
Enable the cache: use and save the results of the tests in FILE,
|
||||
traditionally 'config.cache'. FILE defaults to '/dev/null' to
|
||||
disable caching.
|
||||
|
||||
'--config-cache'
|
||||
'-C'
|
||||
Alias for '--cache-file=config.cache'.
|
||||
|
||||
'--quiet'
|
||||
'--silent'
|
||||
'-q'
|
||||
Do not print messages saying which checks are being made. To
|
||||
suppress all normal output, redirect it to '/dev/null' (any error
|
||||
messages will still be shown).
|
||||
|
||||
'--srcdir=DIR'
|
||||
Look for the package's source code in directory DIR. Usually
|
||||
'configure' can determine that directory automatically.
|
||||
|
||||
'--prefix=DIR'
|
||||
Use DIR as the installation prefix. *note Installation Names:: for
|
||||
more details, including other options available for fine-tuning the
|
||||
installation locations.
|
||||
|
||||
'--no-create'
|
||||
'-n'
|
||||
Run the configure checks, but stop before creating any output
|
||||
files.
|
||||
|
||||
'configure' also accepts some other, not widely useful, options. Run
|
||||
'configure --help' for more details.
|
18
Makefile.am
Normal file
18
Makefile.am
Normal file
|
@ -0,0 +1,18 @@
|
|||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# Files to be included in distribution
|
||||
EXTRA_DIST = ent/entitle.gif init.d/service.fedora init.d/service.redhat \
|
||||
init.d/sysv.lsb init.d/sysv.redhat nist/template9 \
|
||||
contrib/diags/data_prep.c contrib/diags/bins.p contrib/diags/inc.p \
|
||||
contrib/diags/lognorm.r contrib/diags/lognorm.sh \
|
||||
haveged.spec contrib/build/build.sh contrib/build/lib.spec contrib/build/nolib.spec \
|
||||
contrib/build/havege_sample.c contrib/build/fedora.spec
|
||||
|
||||
# programs used in check targets
|
||||
EXTRA_PROGRAMS = ent/entest nist/nist
|
||||
|
||||
# Build install script and tests as necessary
|
||||
SUBDIRS = src init.d man ent nist
|
||||
|
||||
# check entire package
|
||||
DISTCHECK_CONFIGURE_FLAGS = "--enable-nistest"
|
900
Makefile.in
Normal file
900
Makefile.in
Normal file
|
@ -0,0 +1,900 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
EXTRA_PROGRAMS = ent/entest$(EXEEXT) nist/nist$(EXEEXT)
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
|
||||
$(am__configure_deps) $(am__DIST_COMMON)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
ent_entest_SOURCES = ent/entest.c
|
||||
am__dirstamp = $(am__leading_dot)dirstamp
|
||||
ent_entest_OBJECTS = ent/entest.$(OBJEXT)
|
||||
ent_entest_LDADD = $(LDADD)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
nist_nist_SOURCES = nist/nist.c
|
||||
nist_nist_OBJECTS = nist/nist.$(OBJEXT)
|
||||
nist_nist_LDADD = $(LDADD)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = ent/entest.c nist/nist.c
|
||||
DIST_SOURCES = ent/entest.c nist/nist.c
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
|
||||
ctags-recursive dvi-recursive html-recursive info-recursive \
|
||||
install-data-recursive install-dvi-recursive \
|
||||
install-exec-recursive install-html-recursive \
|
||||
install-info-recursive install-pdf-recursive \
|
||||
install-ps-recursive install-recursive installcheck-recursive \
|
||||
installdirs-recursive pdf-recursive ps-recursive \
|
||||
tags-recursive uninstall-recursive
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
am__recursive_targets = \
|
||||
$(RECURSIVE_TARGETS) \
|
||||
$(RECURSIVE_CLEAN_TARGETS) \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir distdir-am dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
|
||||
$(LISP)config.h.in
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(top_srcdir)/config/compile $(top_srcdir)/config/config.guess \
|
||||
$(top_srcdir)/config/config.sub \
|
||||
$(top_srcdir)/config/install-sh $(top_srcdir)/config/ltmain.sh \
|
||||
$(top_srcdir)/config/missing AUTHORS COPYING ChangeLog INSTALL \
|
||||
NEWS README config/compile config/config.guess \
|
||||
config/config.sub config/install-sh config/ltmain.sh \
|
||||
config/missing
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
if test -d "$(distdir)"; then \
|
||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -rf "$(distdir)" \
|
||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
||||
else :; fi
|
||||
am__post_remove_distdir = $(am__remove_distdir)
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-gzip
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@
|
||||
HA_DISTRO = @HA_DISTRO@
|
||||
HA_LDFLAGS = @HA_LDFLAGS@
|
||||
HA_UNITD = @HA_UNITD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
# Files to be included in distribution
|
||||
EXTRA_DIST = ent/entitle.gif init.d/service.fedora init.d/service.redhat \
|
||||
init.d/sysv.lsb init.d/sysv.redhat nist/template9 \
|
||||
contrib/diags/data_prep.c contrib/diags/bins.p contrib/diags/inc.p \
|
||||
contrib/diags/lognorm.r contrib/diags/lognorm.sh \
|
||||
haveged.spec contrib/build/build.sh contrib/build/lib.spec contrib/build/nolib.spec \
|
||||
contrib/build/havege_sample.c contrib/build/fedora.spec
|
||||
|
||||
|
||||
# Build install script and tests as necessary
|
||||
SUBDIRS = src init.d man ent nist
|
||||
|
||||
# check entire package
|
||||
DISTCHECK_CONFIGURE_FLAGS = "--enable-nistest"
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
am--refresh: Makefile
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@test -f $@ || rm -f stamp-h1
|
||||
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
ent/$(am__dirstamp):
|
||||
@$(MKDIR_P) ent
|
||||
@: > ent/$(am__dirstamp)
|
||||
ent/entest.$(OBJEXT): ent/$(am__dirstamp)
|
||||
|
||||
ent/entest$(EXEEXT): $(ent_entest_OBJECTS) $(ent_entest_DEPENDENCIES) $(EXTRA_ent_entest_DEPENDENCIES) ent/$(am__dirstamp)
|
||||
@rm -f ent/entest$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(ent_entest_OBJECTS) $(ent_entest_LDADD) $(LIBS)
|
||||
nist/$(am__dirstamp):
|
||||
@$(MKDIR_P) nist
|
||||
@: > nist/$(am__dirstamp)
|
||||
nist/nist.$(OBJEXT): nist/$(am__dirstamp)
|
||||
|
||||
nist/nist$(EXEEXT): $(nist_nist_OBJECTS) $(nist_nist_DEPENDENCIES) $(EXTRA_nist_nist_DEPENDENCIES) nist/$(am__dirstamp)
|
||||
@rm -f nist/nist$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(nist_nist_OBJECTS) $(nist_nist_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
-rm -f ent/*.$(OBJEXT)
|
||||
-rm -f nist/*.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
-rm -rf ent/.libs ent/_libs
|
||||
-rm -rf nist/.libs nist/_libs
|
||||
|
||||
distclean-libtool:
|
||||
-rm -f libtool config.lt
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run 'make' without going through this Makefile.
|
||||
# To change the values of 'make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in 'config.status', edit 'config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run 'make');
|
||||
# (2) otherwise, pass the desired values on the 'make' command line.
|
||||
$(am__recursive_targets):
|
||||
@fail=; \
|
||||
if $(am__make_keepgoing); then \
|
||||
failcom='fail=yes'; \
|
||||
else \
|
||||
failcom='exit 1'; \
|
||||
fi; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-recursive
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-recursive
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscope: cscope.files
|
||||
test ! -s cscope.files \
|
||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
||||
clean-cscope:
|
||||
-rm -f cscope.files
|
||||
cscope.files: clean-cscope cscopelist
|
||||
cscopelist: cscopelist-recursive
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
$(am__make_dryrun) \
|
||||
|| test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-lzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
@echo WARNING: "Support for shar distribution archives is" \
|
||||
"deprecated." >&2
|
||||
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
|
||||
shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist dist-all:
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lz*) \
|
||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build/sub \
|
||||
&& ../../configure \
|
||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__post_remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@test -n '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: trying to run $@ with an empty' \
|
||||
'$$(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
||||
exit 1; \
|
||||
}; \
|
||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
-rm -f ent/$(am__dirstamp)
|
||||
-rm -f nist/$(am__dirstamp)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-libtool distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(am__recursive_targets) all install-am install-strip
|
||||
|
||||
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
clean-libtool cscope cscopelist-am ctags ctags-am dist \
|
||||
dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \
|
||||
dist-xz dist-zip distcheck distclean distclean-compile \
|
||||
distclean-generic distclean-hdr distclean-libtool \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs installdirs-am \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
|
||||
pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
81
NEWS
Normal file
81
NEWS
Normal file
|
@ -0,0 +1,81 @@
|
|||
v1.9.8 (Sep 30, 2019)
|
||||
* Various bug fixes - please see ChangeLog for the detailed list of changes
|
||||
|
||||
v1.9.5 (Aug 11, 2018)
|
||||
* Various bug fixes - please see ChangeLog for the detailed list of changes
|
||||
|
||||
v1.9.4 (Aug 11, 2018)
|
||||
* Avoid misleading message if cmd socket is in use
|
||||
|
||||
v1.9.3 (Aug 10, 2018)
|
||||
I (Jirka Hladky) took over haveged upstream development and moved it to GiHub
|
||||
https://github.com/jirka-h/haveged
|
||||
This version implements a command mode and use it for chroot -it was
|
||||
contributed by Dr. Werner Fink.
|
||||
|
||||
v1.9.2 (Nov 16, 2017)
|
||||
|
||||
This release cleans up issues that have accumulated since the last release. I retired
|
||||
several years ago, and haveged is no longer under active development. This release only
|
||||
attempts to collect and document the downstream reports I have received.
|
||||
|
||||
v1.9.1 (Feb 11, 2014)
|
||||
Documentation and sample file touch-up for v1.9.
|
||||
|
||||
v1.9 (Feb 10, 2014)
|
||||
|
||||
A Fedora bugzilla request was received to harden the haveged build. Since haveged has
|
||||
traditionally been fussy with compiler options, Jirka Hladky set up a large scale test
|
||||
using using TestU01's BigCrush and PractRand. A normally harmless bug inadvertently sent
|
||||
the 8TB data sets through the haveged run-time continuous test. This accident revealed
|
||||
many problems with the run-time test implementation, including incorrect test defaults
|
||||
based on app/daemon selection, broken dead man limit in test procedure B, broken retry
|
||||
logic, and implementation bugs in both test procedure A and B. Attempting to diagnose
|
||||
these problems also revealed the injection feature of the diagnostic build was also
|
||||
broken.
|
||||
|
||||
Once the injection facility was fixed, an independent implementation of the AIS reference
|
||||
for procedure B was used to verify the haveged implementation down to bit level. Portions
|
||||
of the run-time test suite were rewritten to correct defects and improve performance of the
|
||||
run-time test suite in PIE builds. The procedure A tests were rewritten to remove the need
|
||||
to overlap the previous test to attain byte alignment - all test procedures are now bit
|
||||
oriented. Unrelated changes included in the release include adding a quick version check
|
||||
for libhavege use, many small improvements to diagnostics, and more cleanup man pages,
|
||||
sample files, and other documentation.
|
||||
|
||||
Special thanks to Jirka Hladky for help in sorting out the procedure B bugs, verifying
|
||||
the haveged RNG is statistically comparable to RDRAND, and the first formal testing of
|
||||
haveged on ARM.
|
||||
|
||||
v1.8 (Jan 02, 2014)
|
||||
|
||||
Fix return code for signaled termination. Update init.d/service.fedora to use new
|
||||
return code and simple service type. Add --enable_unitdir as DESTDIR for systemd
|
||||
install. Cleanup documentation and man file.
|
||||
|
||||
v1.7c (Jun 08, 2013)
|
||||
|
||||
Additional fix for run-time test alignment problems on mips.
|
||||
|
||||
v1.7b (Jun 06, 2013)
|
||||
|
||||
Fix run-time test alignment problems on sparc and mips. Fix ppc detection in build.
|
||||
|
||||
v1.7a (Feb 13, 2013)
|
||||
|
||||
Fix broken parallel builds - fix LDADD problem in build, VPATH problems in check targets.
|
||||
Move to check-local for check target to work with automake v1.13 but retain backward
|
||||
compatibility. Modify build to make tuning component optional in build. Improve sample
|
||||
spec file and docs.
|
||||
|
||||
v1.7 (Jan 15, 2013)
|
||||
|
||||
The build has been restructured to provide a devel package. This introduces a new libtool
|
||||
dependency. The new contrib/build/build.sh script is intended to toggle this requirement
|
||||
as well as providing a bootstrap to recover from automake mismatches. The script will also
|
||||
build and run devel sample code for those interested in using the devel package.
|
||||
|
||||
Other build related changes include updating AC_PREQ to a more reasonable, 2.59 and changing
|
||||
the build option for init scripts to default to --enable-init=none. The format of the
|
||||
haveged diagnostic display has changed to provided more information and the output is now
|
||||
displayed after output is generated in the non-daemon case.
|
474
README
Normal file
474
README
Normal file
|
@ -0,0 +1,474 @@
|
|||
Haveged, an entropy source
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
Complete documentation on haveged can be found at http://www.issihosts.com/haveged/
|
||||
|
||||
Linux provides device interfaces (/dev/random and /dev/urandom) to a pool of
|
||||
random numbers collected from system interrupt service routines. On some
|
||||
systems, especially on those systems with high needs or limited user
|
||||
interaction, the standard collection mechanism cannot meet demand. In those
|
||||
cases, an adequate supply of random numbers can be maintained by feeding
|
||||
additional entropy into /dev/random pool via a file system interface. The
|
||||
haveged daemon was created to fulfill this function using random data generated
|
||||
by the HAVEGE algorithm.
|
||||
|
||||
The HAVEGE algorithm is based upon the indirect effects of unrelated hardware
|
||||
events on the instruction timing of a calculation that is sensitive to processor
|
||||
features such as branch predictors and instruction/data access mechanisms.
|
||||
Samples from a high-resolution timer are input into the algorithm to produce a
|
||||
stream of random data in a collection buffer. The algorithm requires no special
|
||||
privilege other than access to a high resolution timer, as provided by hardware
|
||||
instruction or a system call.
|
||||
|
||||
The HAVEGE mechanism is implemented in C using in-line assembly only where
|
||||
direct hardware access is needed. On modern compilers, compiler intrinsics are
|
||||
used to replace much if not all in-line assembly. The haveged implementation of
|
||||
HAVEGE adds two crucial features: automated tuning of the algorithm to an
|
||||
environment and a run time facility to verify the data generated in the
|
||||
collection buffer.
|
||||
|
||||
The haveged collection loop is tuned at run-time to match the size of the hosts
|
||||
L1 data and instruction caches. The size determination is made on the basis of
|
||||
the best fit to the following (low to high):
|
||||
|
||||
1. as a compiled default
|
||||
2. as determined by cpuid, if available
|
||||
3. as determined by the /sys file system, if available
|
||||
4. as specified by initialization parameters.
|
||||
|
||||
Run-time verification of collection buffer contents is based upon the
|
||||
methodology from the proposed AIS-31 standard from BSI, the German Federal
|
||||
Office for Information Security (Bundesamt für Sicherheit in der
|
||||
Informationstechnik). In the suggested configuration, haveged passes most of the
|
||||
requirements for a NTG.1 class device described in version two of the AIS-31
|
||||
specification.
|
||||
|
||||
The haveged implementation also provides an experimental feature to multiplex
|
||||
havege collections over multiple cpu cores. Interprocess coordination in this
|
||||
configuration sacrifices a significant fraction of haveged throughput in
|
||||
exchange for a cpu load spread over a number of processors.
|
||||
|
||||
All of the above features are contained within the haveged-devel sub package of
|
||||
haveged. The haveged package can be built with libtool to expose the devel sub
|
||||
package or without libtool if the devel library is not needed. In either case,
|
||||
the executable built contains a file system interface to haveged-devel features
|
||||
and an optional facility to feed havege output into the random device. The build
|
||||
system also provides "check" targets to test the output of the executable's
|
||||
random number generator through the file system interface.
|
||||
|
||||
TESTING haveged
|
||||
|
||||
Testing via build check targets has been part of the haveged distribution since
|
||||
the project moved to automake. Original tests were limited to a quick evaluation
|
||||
implemented as an adaptation of the open source ent tool from Fourmilab and a
|
||||
more thorough evaluation based upon the NIST SP800 test suite. Run time testing
|
||||
was added to haveged version 1.5 as part of an effort to loosely follow the RNG
|
||||
testing AIS-31 framework of the German Common Criteria organization, BSI.
|
||||
|
||||
The significant features of the AIS-31 framework are:
|
||||
|
||||
Run-time tests are broken into 2 groups, Procedure A containing 5 tests, and
|
||||
Procedure B containing 3 tests. Procedure A consists of performing a 48-bit
|
||||
disjointedness test on 64K sequences, followed by 257 repetitions of the four
|
||||
FIPS-140-1 tests and an auto-correlation test on successive 2000 bit sequences.
|
||||
Procedure B performs distribution tests for 10,000 occurrences of 1, 2, 3, 4 bit
|
||||
runs in successive samples, followed by a entropy estimate based upon on another
|
||||
256000+2560 bit sample. A sample must pass all individual tests to pass the
|
||||
procedure. An ideal RNG is expected to pass Procedure A with a probability of
|
||||
0.9987 and pass Procedure B with with a probability of 0.9998. One retry will be
|
||||
attempted to recover from the the failure of a single test in either procedure.
|
||||
The probability an ideal generator would fail the retry is nill.
|
||||
|
||||
Special features of the haveged implementation:
|
||||
|
||||
1) A failure of either procedure is a fatal error. In the case of haveged, the
|
||||
instance will terminate.
|
||||
2) The tests operate directly on the collection buffer after a fill. Performance
|
||||
costs are acceptable except for the auto-correlation test, test5. An option
|
||||
to skip test5 on some repetitions mitigates this problem.
|
||||
3) Tests can take place at start up (a "tot" test) or continuously as specified
|
||||
by a haveged parameter. In the continuous case, there is no implied alignment
|
||||
between the collection buffer and the testing context. Collection buffer
|
||||
contents will be released for consumption provided the buffer does not contain
|
||||
a failed individual test.
|
||||
4) The size of the input required to complete procedure B depends on the content.
|
||||
This means there is no fixed alignment of the test input in the collection
|
||||
buffer.
|
||||
5) Procedure retries are logged. Extended information is available with -v3. Retries
|
||||
are expected (see failure rates above) but normally only seen with output
|
||||
ranges north of a few GB.
|
||||
|
||||
More detailed information on the adaptation of the BIS framework can be found
|
||||
at http://www.issihosts.com/haveged/ais31.html
|
||||
|
||||
BUILDING haveged
|
||||
|
||||
This package originated on "Enterprise Linux 5" systems (RHEL 5 / CentOS 5 / SL
|
||||
5), but every effort has been made to retain and broaden the hardware support of
|
||||
the original HAVEGE implementation. The package uses the automake build system.
|
||||
By default, the build uses a libtool build to expose haveged-devel. The
|
||||
contrib/build directory contains a build.sh script to toggle the libtool
|
||||
requirement and recover from some autotools failures. Change directory to the
|
||||
build directory and type ./build.sh for options.
|
||||
|
||||
The configure process uses hardware detection via config.sub or the configure
|
||||
"-host" command line argument. The configure "host" variable is used to select
|
||||
in-line assembly or compiler intrinsics appropriate to the build target.
|
||||
|
||||
Currently supported hosts are:
|
||||
|
||||
1. x86 (x86_64 and i686)
|
||||
2. aarch64
|
||||
3. armv7hl
|
||||
4. ppc64le
|
||||
5. ia64
|
||||
6. powerpc
|
||||
7. s390
|
||||
|
||||
|
||||
The generic host type is provided for those systems without user level access to
|
||||
a high-resolution system timer. In this case, the --enable-clock_gettime option
|
||||
is set to 'yes'.
|
||||
|
||||
The following build options are available to "./configure":
|
||||
|
||||
1. --enable-clock_gettime (default 'no' for recognized hosts)
|
||||
2. --enable-daemon (default 'yes' if Linux)
|
||||
3. --enable-diagnostic (default 'no')
|
||||
4. --enable-init (type, default 'no')
|
||||
5. --enable-initdir (default '' unless enable--init="service.*")
|
||||
6. --enable-nistest (default 'no' but recommended)
|
||||
7. --enable-olt (default 'yes')
|
||||
8. --enable-threads (experimental)
|
||||
9. --enable-tune (default 'yes')
|
||||
|
||||
Detailed option information is available by typing "./configure --help". For
|
||||
options xxx that take "yes/no" arguments, --disable-xxx may be used as the
|
||||
inverse of --enable-xxx.
|
||||
|
||||
If --enable-clock_gettime() is 'yes', the clock_gettime(CLOCK_MONOTONIC) system
|
||||
call will be used as a timer source. This option defaults to 'yes' for generic
|
||||
host builds and 'no' otherwise. This option may proved useful if access to time
|
||||
hardware is privileged. Due to variability of clock_gettime() implementations,
|
||||
the adequacy of the clock_gettime() resolution cannot be known until run time.
|
||||
It is strongly advised to use run-time testing if this option is used.
|
||||
|
||||
If --enable-daemon is 'yes', ioctl access required to the random device and
|
||||
read-write access to the /proc virtual file system is required. The daemon may
|
||||
be run in the foreground or fork into the background based upon a command line
|
||||
argument. The daemon interface targets the 2.6 and later kernel and may not work
|
||||
on 2.4 kernels due to difference in the random interface between those two
|
||||
kernel versions. The change in the proc file system from pool size expressed in
|
||||
bytes to pool size expressed in bits has been taken into account, other changes
|
||||
may be required. This option is 'no' when diagnostic modes are enabled. If
|
||||
the option is no the executable is installed in the user bin directory instead
|
||||
of the sbin directory.
|
||||
|
||||
If --enable-diagnostic is 'yes', the capture and inject diagnostic interfaces
|
||||
are enabled. The capture or inject diagnostic may be enabled singly by setting
|
||||
the option to 'capture' or 'inject'. A setting for any value other than 'no'
|
||||
for this option forces --enable-daemon=no. See DIAGNOSTICS below for details.
|
||||
|
||||
The --enable-init option is active only when --enable-daemon is 'yes'. This
|
||||
value can specify a template to be used in the installation of an init method
|
||||
by the build's install target. The default value, 'no', disables the feature.
|
||||
Other values can be used to install a traditional systemv init script or
|
||||
systemd unit definition. See INSTALLATION for details.
|
||||
|
||||
The --enable-initdir is active only when --enable-init='service.*', i.e. a
|
||||
systemd install. See INSTALLATION for details.
|
||||
|
||||
The --enable-nistest option enables more thorough testing for the check target.
|
||||
See CHECKING for details.
|
||||
|
||||
The --enable-olt option is provided to suppress the entire online test facility.
|
||||
This option is provided for systems with a very limited resource budget and the
|
||||
ability to thoroughly test the RNG output by other means. When enabled, the online
|
||||
test system tests the output of the haveged random number generator using AIS-31
|
||||
test procedures A and B. Either or both tests may be run as a total failure check
|
||||
(a "tot" test) at initialization and/or continuously during all subsequent haveged
|
||||
operation - See the man page and the description at
|
||||
http://www.issihosts.com/haveged/ais31.html for further information.
|
||||
|
||||
The --enable-threads option is an experimental prototype for running multiple
|
||||
collection threads in a single haveged instance. The goal is to create a
|
||||
multi-core haveged that would spread collection overhead more evenly over the
|
||||
available cpu resources.
|
||||
|
||||
The --enable-tune option allows the on-line tuning facility to be suppressed.
|
||||
This is intended for systems with special needs and or a limited resource budget.
|
||||
Setting the option to 'yes' enables both the cpuid and virtual file system methods,
|
||||
a value of 'no' suppresses both methods. Individual tuning methods can be selected
|
||||
by setting the option to either 'cpuid' or 'vfs'. Note that the 'cpuid' method
|
||||
is always conditional on host type and will not be present if the hardware
|
||||
architecture does not support the instruction.
|
||||
|
||||
The haveged build does not modify CFLAGS and DFLAGS, so for example:
|
||||
|
||||
CFLAGS="-fpic -DGENERIC_DCACHE=32" LDFLAGS="-z now" ./configure --disable-tune
|
||||
|
||||
would configure the build for a manually-tuned, hardened daemon with a default
|
||||
data cache size of 32kb.
|
||||
|
||||
|
||||
CHECKING haveged
|
||||
|
||||
The build check target provides two test procedures for the build.
|
||||
|
||||
1. A "quick" check based upon and adaptation of the public domain ENT program.
|
||||
The "entest" program uses the ENT sources to subject a sample to the following:
|
||||
|
||||
a) The Chi-Square result must fall within acceptable bounds (>1% and <99 %)
|
||||
b) The entropy/character must exceed a minimum (7.5)
|
||||
c) The arithmetic mean must exceed a minimum (127.0)
|
||||
d) The monte-carlo approximation of PI must lie within error bounds (.5%)
|
||||
e) The Sequential Correlation Coefficient must be below a minimum (.8)
|
||||
|
||||
The program provides a pass-fail indication and an optional display of the
|
||||
results to stdout. The entest checks are quite weak and intended only as a
|
||||
quick sanity check.
|
||||
|
||||
2. An adaptation of the NIST Statistical Test Suite as adapted by Oliver
|
||||
Rochecouste of irisa.fr as part of the original havege project. More that 400
|
||||
tests are performed in a typical run. The program provides as pass-fail
|
||||
indication with detailed results reported in the nist.out file in the
|
||||
nist directory. You will need sit down with SP800-*.pdf available from the
|
||||
NIST to review the detailed results. AIS31 provides recommendations for the
|
||||
NIST test suite as 'additional tests'. See testing documentation at
|
||||
http://www.issihosts.com/haveged/ais31.html for further information.
|
||||
|
||||
The "quick" test is always part of the check target. The NIST suite is run only
|
||||
when --enable-nistest is 'yes'.
|
||||
|
||||
Both checks function the same way, haveged is run to collect a sample file in
|
||||
the test directory which is then analyzed by the test program. A pass-fail return
|
||||
is given in both cases, additional information is written to stdout. The input
|
||||
samples and the nist.out report are deleted by the clean make target.
|
||||
|
||||
Both test mechanisms are statistical and even a fully functional random number
|
||||
generator will experience occasional failures. It is not uncommon to see one or
|
||||
two failures in the NIST suite and the entest will occasionally fail with a small
|
||||
sample size (usually the Chi-Square test barks). Early haveged releases used a
|
||||
entest sample size of 1MB, this has been increased to 16MB because failures with
|
||||
that sample size were all too common. A 16MB sample will also deplete and refill
|
||||
the haveged collection area to exercise all buffer logic.
|
||||
|
||||
Users are encouraged to run their own external tests. The --number==0 option is
|
||||
a convenient means to pipe haveged output into external suites such as Dieharder,
|
||||
the TESTU01 batteries, or PractRand.
|
||||
|
||||
|
||||
RUNNING haveged
|
||||
|
||||
The following invocation arguments are always available:
|
||||
|
||||
--buffer , -b [] Buffer size [KW] - default : 128
|
||||
--data , -d [] Data cache size [KB], with fallback to 16
|
||||
--inst , -i [] Instruction cache size [KB], with fallback to 16
|
||||
--file , -f [] Sample output file - default: 'sample', '-' for stdout
|
||||
--number , -n [] Output size in [k|m|g|t]. 0 = unlimited to stdout
|
||||
--verbose , -v [] Verbose mask 0=none,1=summary,2=retries,4=timing,8=loop,16=code,32=test
|
||||
--help , -h This help
|
||||
|
||||
The "-b", "-d", "-i" options are needed only in special cases. Generator output
|
||||
should be validated after changes to these values.
|
||||
|
||||
If haveged is built with online testing enabled, the following is present
|
||||
|
||||
--onlinetest , -o [] [t<x>][c<x>] x=[a[n][w]][b[w]] 't'ot, 'c'ontinuous, default: ta8b"
|
||||
|
||||
The default configuration executes the "tot" test using AIS procedure B. At the completion
|
||||
of the tot test, the buffer is reloaded and any continuous tests will be run before
|
||||
data becomes available.
|
||||
|
||||
If haveged is built with threads support, the following is present
|
||||
|
||||
--threads , -t [] Number of threads
|
||||
|
||||
If daemon interface is enabled, the following options are available:
|
||||
|
||||
--Foreground , -F Run daemon in foreground, do not fork and detach,
|
||||
--pid , -p [] The location of the daemon pid file, default: /var/run/haveged.pid
|
||||
--run , -r [] 0=daemon,1=config info,>1=Write <r>KB sample file
|
||||
--write , -w [] Set write_wakeup_threshold [bits]
|
||||
|
||||
If haveged is running detached, diagnostic output is written to syslog, otherwise
|
||||
output is written to stderr.
|
||||
|
||||
If the daemon interface is enabled, non-zero "-r" options are used to test the
|
||||
haveged random number generator; the random number generator will be configured,
|
||||
the initial data collection pass will be executed, configuration details will be
|
||||
written to stdout, and a "-r" KB sample of output will be written to the sample
|
||||
output file for all "-r" > 1. The "-n" option provides a more friendly version
|
||||
of r > 1.
|
||||
|
||||
If the daemon interface and --run==1 is specified, or if --run is not available
|
||||
and --number is not specified a summary of build, tuning, and execution
|
||||
is displayed and haveged exits without generating data:
|
||||
|
||||
<prog>: ver: <ver>; arch: <arch>; vend: <vend>, build: (<opts>); collect: <collect>
|
||||
<prog>: cpu: <cpu> (<tune>);data: <data> (<tune>); inst: <inst> (<tune>); idx: <idx>; sz: <sz>
|
||||
<prog>: tot tests(<spec>): <score>; continuous tests(<spec>):<score> last entropy estimate <ent>
|
||||
<prog>: fills: <fills>, generated: <total>
|
||||
|
||||
where
|
||||
<prog> build: program name - normally haveged
|
||||
<ver> build: package version
|
||||
<arch> build: architecture: ia64, generic, ppc, s390, sparc, sparclite, x86
|
||||
<vend> build: vendor string of host from cpuid if available else 'generic'
|
||||
<opts> build: version of gcc used and build option flags - see below.
|
||||
<collect> tuning: collection buffer size
|
||||
<cpu> tuning: (sources list for cpu info, see below)
|
||||
<data> tuning: size, (sources list for L1 data cache)
|
||||
<inst> tuning: size, (sources list for L1 instruction cache)
|
||||
<idx> tuning: collector loops used/collector loops available
|
||||
<sz> tuning: collector size used/collector size available.
|
||||
<tune> tuning: tuning sources - see below
|
||||
<spec> exec: tests to be executed in --onlinetest format
|
||||
<ent> exec: last entropy estimate from procedure B.
|
||||
<score> exec: pass/fail counts for AIS test procedures
|
||||
<fills> exec: number of times buffer was filled
|
||||
<total> exec: number of bytes output
|
||||
|
||||
build option flags represent the ./configure options as:
|
||||
C=clock_gettime, D=diagnostic I=tune with cpuid, M=multi-core, T=online tests, V=tune with vfs
|
||||
|
||||
tuning sources are:
|
||||
D=default value, P=instance parameter, C=cpuid present,
|
||||
H=hyperthreading, A=AMD cpuid, A5=AMD fn5, A6=AMD fn6, A8=AMD fn8
|
||||
L2=Intel has leaf2, L4=Intel has leaf4, B=Intel leaf b,
|
||||
4=intel leaf4, V=virtual file system available
|
||||
VS=/sys/devices/system/cpu/cpu%d/cache/index<n>/level,
|
||||
VO=/sys/devices/system/cpu/online, VI=/proc/cpuinfo
|
||||
VC=/sys/devices/system/cpu
|
||||
|
||||
Sources displayed in parenthesis are white space separated lists of the above
|
||||
tokens. The "collector * used/collector *available" values indicate the fit of
|
||||
the haveged collection loop to the L1 instruction cache.
|
||||
|
||||
Items marked 'exec:' above have meaning only when data is generated. The display
|
||||
of test results is customized to match the test options specified. The last few
|
||||
lines of the build/tuning summary (those items marked 'exec:' above) also
|
||||
appear by themselves as the 'exec summary' in other circumstances.
|
||||
|
||||
In other circumstances, the completion of initialization is announced by a banner
|
||||
written to the log:
|
||||
|
||||
"<prog>: starting up"
|
||||
"Writing <n> byte output to <file>"
|
||||
|
||||
The first line above is used when running as a daemon, the second otherwise. If
|
||||
one or more online tests are running, test failures are logged as:
|
||||
|
||||
<prog>: AIS-31 <stage> procedure <proc>: <action> <bytes> bytes fill <fill>
|
||||
|
||||
where
|
||||
<stage> is either 'tot' or 'continuous'
|
||||
<proc> is either 'A' or 'B'
|
||||
<action> is either 'retry' or 'fail'
|
||||
<bytes> is number of bytes processed in procedure before failure
|
||||
<fill> is the number of times the buffer was filled
|
||||
|
||||
The exec summary is logged upon error or signal terminations. Other log output is
|
||||
controlled by --verbose:
|
||||
|
||||
A --verbose bit mask to obtain additional diagnostic information:
|
||||
|
||||
0x01 Show exec summary on termination, retry summary
|
||||
0x02 Show online test retry details
|
||||
0x04 Show timing for collections
|
||||
0x08 Show collection loop characteristics
|
||||
0x10 Show code offsets
|
||||
0x20 Show all online test completion details
|
||||
|
||||
The "--write" option will set proc/sys/kernel/random/write_wakeup_threshold to
|
||||
the given value. This is useful because this threshold is very small on some
|
||||
systems. A minimum of 1024 is recommended.
|
||||
|
||||
The file system interface supports file creation of up data setups up to 16tb or
|
||||
can be part of a piped command set. See the man(8) page for examples.
|
||||
|
||||
DIAGNOSTIC haveged build
|
||||
|
||||
The diagnostic build is a special version of the non-daemon configuration with a
|
||||
specialized --run option. The --run levels 0 and 1 correspond duplicate the
|
||||
equivalent application functions. One or more of the addition commands may be
|
||||
included depending on the --enable-diagnostic value chosen.
|
||||
|
||||
capture (--run 2)
|
||||
Run the RNG but collect the timer inputs in a separate buffer. The normal
|
||||
RNG output is discarded and replaced by the timer inputs. Requires additional
|
||||
buffering, performance is poor because 8 times as many fills are required to
|
||||
generate same amount of output.
|
||||
|
||||
inject tics (--run 4)
|
||||
Replace timer source with file input. Requires additional buffering, source
|
||||
must account for generator warmup.
|
||||
|
||||
inject data (--run 8)
|
||||
Bypass the normal RNG completely and read input directly into the output
|
||||
buffer. Generator warmup is skipped. This option is useful for validating
|
||||
the online test suite.
|
||||
|
||||
Knowledge of haveged internals is needed to use the special features effectively
|
||||
and interpret the results. The diagnostic build identifies itself as
|
||||
'havege_diagnostic' in -help display and other outputs.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
If the daemon interface is not enabled, the install places the executable in
|
||||
automake's bin_PROGRAMS directory and provides a man(8) page. A man(3) page
|
||||
is provided for the libtool build. If the daemon interface is enabled, the
|
||||
executable is installed in automake's sbin_PROGRAMS directory.
|
||||
|
||||
If the daemon interface is enabled, the --enable-init setting provides a simple
|
||||
template system to setup the init method. If --enable-init is set to none
|
||||
no action is taken. Otherwise, the template must reside in the init.d build
|
||||
directory and is selected by the setting. Template names "service.*" indicate
|
||||
that a systemd style init, while template names "sysv.*" are used for sysv
|
||||
style init scripts.
|
||||
|
||||
Sample sysv style templates are provided for linux standard base, sysv.lsb,
|
||||
and redhat systems, sysv.redhat , such as centos which have not moved to
|
||||
systemd style inits.
|
||||
|
||||
For systemd style installs, --enable-initdir specifies the systemd unit
|
||||
directory. If the setting is not specified (or is ''), the default value is
|
||||
obtained from hosts pkg-config query for systemdsystemunitdir. Sample systemd
|
||||
templates are provided for forking, service.forking, and non-forking,
|
||||
service.fedora, configurations. The non-forking configuration is recommended to
|
||||
avoid the overhead of PID file and minimize start-up cost.
|
||||
|
||||
Examples:
|
||||
|
||||
./configure --enable-init=service.redhat
|
||||
./configure --enable-init=sysv.lsb
|
||||
|
||||
Custom init scripts can be added as necessary by adding templates to the
|
||||
init.d directory.
|
||||
|
||||
A sample file, haveged.spec, is provided in the build root as a guide for
|
||||
those who want to build a rpm. As with init scripts, the sample may need
|
||||
customization before use. Other SPEC file examples can be found in the
|
||||
contrib directory (see EXTRAS for details).
|
||||
|
||||
|
||||
EXTRAS
|
||||
|
||||
The contrib directory contains bits and pieces that are not integrated into the
|
||||
distribution. Currently this directory contains build related utilities in
|
||||
the build directory and an unorganized collection of some of the tools used
|
||||
to analyze haveged in the diags directory.
|
||||
|
||||
The script contrib/build/build.sh organizes the build utilities. The script
|
||||
provides methods to toggle the use of libtool in the build in particularly
|
||||
problematic environments, a bootstrap to recover from automake error states
|
||||
and the option to build and run a devel sample program after the devel
|
||||
sub package has been built.
|
||||
|
||||
Several sample package spec files are provided as contrib/build/*.spec. The
|
||||
havege_sample.c source demonstrates usage of the havege.h API.
|
||||
|
||||
|
473
README.md
Normal file
473
README.md
Normal file
|
@ -0,0 +1,473 @@
|
|||
![Continuous Integration](https://github.com/jirka-h/haveged/workflows/Continuous%20Integration/badge.svg)
|
||||
|
||||
Haveged, an entropy source
|
||||
|
||||
INTRODUCTION
|
||||
|
||||
Complete documentation on haveged can be found at http://www.issihosts.com/haveged/
|
||||
|
||||
Linux provides device interfaces (/dev/random and /dev/urandom) to a pool of
|
||||
random numbers collected from system interrupt service routines. On some
|
||||
systems, especially on those systems with high needs or limited user
|
||||
interaction, the standard collection mechanism cannot meet demand. In those
|
||||
cases, an adequate supply of random numbers can be maintained by feeding
|
||||
additional entropy into /dev/random pool via a file system interface. The
|
||||
haveged daemon was created to fulfill this function using random data generated
|
||||
by the HAVEGE algorithm.
|
||||
|
||||
The HAVEGE algorithm is based upon the indirect effects of unrelated hardware
|
||||
events on the instruction timing of a calculation that is sensitive to processor
|
||||
features such as branch predictors and instruction/data access mechanisms.
|
||||
Samples from a high-resolution timer are input into the algorithm to produce a
|
||||
stream of random data in a collection buffer. The algorithm requires no special
|
||||
privilege other than access to a high resolution timer, as provided by hardware
|
||||
instruction or a system call.
|
||||
|
||||
The HAVEGE mechanism is implemented in C using in-line assembly only where
|
||||
direct hardware access is needed. On modern compilers, compiler intrinsics are
|
||||
used to replace much if not all in-line assembly. The haveged implementation of
|
||||
HAVEGE adds two crucial features: automated tuning of the algorithm to an
|
||||
environment and a run time facility to verify the data generated in the
|
||||
collection buffer.
|
||||
|
||||
The haveged collection loop is tuned at run-time to match the size of the hosts
|
||||
L1 data and instruction caches. The size determination is made on the basis of
|
||||
the best fit to the following (low to high):
|
||||
|
||||
1. as a compiled default
|
||||
2. as determined by cpuid, if available
|
||||
3. as determined by the /sys file system, if available
|
||||
4. as specified by initialization parameters.
|
||||
|
||||
Run-time verification of collection buffer contents is based upon the
|
||||
methodology from the proposed AIS-31 standard from BSI, the German Federal
|
||||
Office for Information Security (Bundesamt für Sicherheit in der
|
||||
Informationstechnik). In the suggested configuration, haveged passes most of the
|
||||
requirements for a NTG.1 class device described in version two of the AIS-31
|
||||
specification.
|
||||
|
||||
The haveged implementation also provides an experimental feature to multiplex
|
||||
havege collections over multiple cpu cores. Interprocess coordination in this
|
||||
configuration sacrifices a significant fraction of haveged throughput in
|
||||
exchange for a cpu load spread over a number of processors.
|
||||
|
||||
All of the above features are contained within the haveged-devel sub package of
|
||||
haveged. The haveged package can be built with libtool to expose the devel sub
|
||||
package or without libtool if the devel library is not needed. In either case,
|
||||
the executable built contains a file system interface to haveged-devel features
|
||||
and an optional facility to feed havege output into the random device. The build
|
||||
system also provides "check" targets to test the output of the executable's
|
||||
random number generator through the file system interface.
|
||||
|
||||
TESTING haveged
|
||||
|
||||
Testing via build check targets has been part of the haveged distribution since
|
||||
the project moved to automake. Original tests were limited to a quick evaluation
|
||||
implemented as an adaptation of the open source ent tool from Fourmilab and a
|
||||
more thorough evaluation based upon the NIST SP800 test suite. Run time testing
|
||||
was added to haveged version 1.5 as part of an effort to loosely follow the RNG
|
||||
testing AIS-31 framework of the German Common Criteria organization, BSI.
|
||||
|
||||
The significant features of the AIS-31 framework are:
|
||||
|
||||
Run-time tests are broken into 2 groups, Procedure A containing 5 tests, and
|
||||
Procedure B containing 3 tests. Procedure A consists of performing a 48-bit
|
||||
disjointedness test on 64K sequences, followed by 257 repetitions of the four
|
||||
FIPS-140-1 tests and an auto-correlation test on successive 2000 bit sequences.
|
||||
Procedure B performs distribution tests for 10,000 occurrences of 1, 2, 3, 4 bit
|
||||
runs in successive samples, followed by a entropy estimate based upon on another
|
||||
256000+2560 bit sample. A sample must pass all individual tests to pass the
|
||||
procedure. An ideal RNG is expected to pass Procedure A with a probability of
|
||||
0.9987 and pass Procedure B with with a probability of 0.9998. One retry will be
|
||||
attempted to recover from the the failure of a single test in either procedure.
|
||||
The probability an ideal generator would fail the retry is nill.
|
||||
|
||||
Special features of the haveged implementation:
|
||||
|
||||
1) A failure of either procedure is a fatal error. In the case of haveged, the
|
||||
instance will terminate.
|
||||
2) The tests operate directly on the collection buffer after a fill. Performance
|
||||
costs are acceptable except for the auto-correlation test, test5. An option
|
||||
to skip test5 on some repetitions mitigates this problem.
|
||||
3) Tests can take place at start up (a "tot" test) or continuously as specified
|
||||
by a haveged parameter. In the continuous case, there is no implied alignment
|
||||
between the collection buffer and the testing context. Collection buffer
|
||||
contents will be released for consumption provided the buffer does not contain
|
||||
a failed individual test.
|
||||
4) The size of the input required to complete procedure B depends on the content.
|
||||
This means there is no fixed alignment of the test input in the collection
|
||||
buffer.
|
||||
5) Procedure retries are logged. Extended information is available with -v3. Retries
|
||||
are expected (see failure rates above) but normally only seen with output
|
||||
ranges north of a few GB.
|
||||
|
||||
More detailed information on the adaptation of the BIS framework can be found
|
||||
at http://www.issihosts.com/haveged/ais31.html
|
||||
|
||||
BUILDING haveged
|
||||
|
||||
This package originated on "Enterprise Linux 5" systems (RHEL 5 / CentOS 5 / SL
|
||||
5), but every effort has been made to retain and broaden the hardware support of
|
||||
the original HAVEGE implementation. The package uses the automake build system.
|
||||
By default, the build uses a libtool build to expose haveged-devel. The
|
||||
contrib/build directory contains a build.sh script to toggle the libtool
|
||||
requirement and recover from some autotools failures. Change directory to the
|
||||
build directory and type ./build.sh for options.
|
||||
|
||||
The configure process uses hardware detection via config.sub or the configure
|
||||
"-host" command line argument. The configure "host" variable is used to select
|
||||
in-line assembly or compiler intrinsics appropriate to the build target.
|
||||
|
||||
Currently supported hosts are:
|
||||
|
||||
1. x86
|
||||
2. ia64
|
||||
3. powerpc
|
||||
4. s390
|
||||
5. sparc
|
||||
6. sparclite
|
||||
7. generic
|
||||
|
||||
The generic host type is provided for those systems without user level access to
|
||||
a high-resolution system timer. In this case, the --enable-clock_gettime option
|
||||
is set to 'yes'.
|
||||
|
||||
The following build options are available to "./configure":
|
||||
|
||||
1. --enable-clock_gettime (default 'no' for recognized hosts)
|
||||
2. --enable-daemon (default 'yes' if Linux)
|
||||
3. --enable-diagnostic (default 'no')
|
||||
4. --enable-init (type, default 'no')
|
||||
5. --enable-initdir (default '' unless enable--init="service.*")
|
||||
6. --enable-nistest (default 'no' but recommended)
|
||||
7. --enable-olt (default 'yes')
|
||||
8. --enable-threads (experimental)
|
||||
9. --enable-tune (default 'yes')
|
||||
|
||||
Detailed option information is available by typing "./configure --help". For
|
||||
options xxx that take "yes/no" arguments, --disable-xxx may be used as the
|
||||
inverse of --enable-xxx.
|
||||
|
||||
If --enable-clock_gettime() is 'yes', the clock_gettime(CLOCK_MONOTONIC) system
|
||||
call will be used as a timer source. This option defaults to 'yes' for generic
|
||||
host builds and 'no' otherwise. This option may proved useful if access to time
|
||||
hardware is privileged. Due to variability of clock_gettime() implementations,
|
||||
the adequacy of the clock_gettime() resolution cannot be known until run time.
|
||||
It is strongly advised to use run-time testing if this option is used.
|
||||
|
||||
If --enable-daemon is 'yes', ioctl access required to the random device and
|
||||
read-write access to the /proc virtual file system is required. The daemon may
|
||||
be run in the foreground or fork into the background based upon a command line
|
||||
argument. The daemon interface targets the 2.6 and later kernel and may not work
|
||||
on 2.4 kernels due to difference in the random interface between those two
|
||||
kernel versions. The change in the proc file system from pool size expressed in
|
||||
bytes to pool size expressed in bits has been taken into account, other changes
|
||||
may be required. This option is 'no' when diagnostic modes are enabled. If
|
||||
the option is no the executable is installed in the user bin directory instead
|
||||
of the sbin directory.
|
||||
|
||||
If --enable-diagnostic is 'yes', the capture and inject diagnostic interfaces
|
||||
are enabled. The capture or inject diagnostic may be enabled singly by setting
|
||||
the option to 'capture' or 'inject'. A setting for any value other than 'no'
|
||||
for this option forces --enable-daemon=no. See DIAGNOSTICS below for details.
|
||||
|
||||
The --enable-init option is active only when --enable-daemon is 'yes'. This
|
||||
value can specify a template to be used in the installation of an init method
|
||||
by the build's install target. The default value, 'no', disables the feature.
|
||||
Other values can be used to install a traditional systemv init script or
|
||||
systemd unit definition. See INSTALLATION for details.
|
||||
|
||||
The --enable-initdir is active only when --enable-init='service.*', i.e. a
|
||||
systemd install. See INSTALLATION for details.
|
||||
|
||||
The --enable-nistest option enables more thorough testing for the check target.
|
||||
See CHECKING for details.
|
||||
|
||||
The --enable-olt option is provided to suppress the entire online test facility.
|
||||
This option is provided for systems with a very limited resource budget and the
|
||||
ability to thoroughly test the RNG output by other means. When enabled, the online
|
||||
test system tests the output of the haveged random number generator using AIS-31
|
||||
test procedures A and B. Either or both tests may be run as a total failure check
|
||||
(a "tot" test) at initialization and/or continuously during all subsequent haveged
|
||||
operation - See the man page and the description at
|
||||
http://www.issihosts.com/haveged/ais31.html for further information.
|
||||
|
||||
The --enable-threads option is an experimental prototype for running multiple
|
||||
collection threads in a single haveged instance. The goal is to create a
|
||||
multi-core haveged that would spread collection overhead more evenly over the
|
||||
available cpu resources.
|
||||
|
||||
The --enable-tune option allows the on-line tuning facility to be suppressed.
|
||||
This is intended for systems with special needs and or a limited resource budget.
|
||||
Setting the option to 'yes' enables both the cpuid and virtual file system methods,
|
||||
a value of 'no' suppresses both methods. Individual tuning methods can be selected
|
||||
by setting the option to either 'cpuid' or 'vfs'. Note that the 'cpuid' method
|
||||
is always conditional on host type and will not be present if the hardware
|
||||
architecture does not support the instruction.
|
||||
|
||||
The haveged build does not modify CFLAGS and DFLAGS, so for example:
|
||||
|
||||
CFLAGS="-fpic -DGENERIC_DCACHE=32" LDFLAGS="-z now" ./configure --disable-tune
|
||||
|
||||
would configure the build for a manually-tuned, hardened daemon with a default
|
||||
data cache size of 32kb.
|
||||
|
||||
|
||||
CHECKING haveged
|
||||
|
||||
The build check target provides two test procedures for the build.
|
||||
|
||||
1. A "quick" check based upon and adaptation of the public domain ENT program.
|
||||
The "entest" program uses the ENT sources to subject a sample to the following:
|
||||
|
||||
a) The Chi-Square result must fall within acceptable bounds (>1% and <99 %)
|
||||
b) The entropy/character must exceed a minimum (7.5)
|
||||
c) The arithmetic mean must exceed a minimum (127.0)
|
||||
d) The monte-carlo approximation of PI must lie within error bounds (.5%)
|
||||
e) The Sequential Correlation Coefficient must be below a minimum (.8)
|
||||
|
||||
The program provides a pass-fail indication and an optional display of the
|
||||
results to stdout. The entest checks are quite weak and intended only as a
|
||||
quick sanity check.
|
||||
|
||||
2. An adaptation of the NIST Statistical Test Suite as adapted by Oliver
|
||||
Rochecouste of irisa.fr as part of the original havege project. More that 400
|
||||
tests are performed in a typical run. The program provides as pass-fail
|
||||
indication with detailed results reported in the nist.out file in the
|
||||
nist directory. You will need sit down with SP800-*.pdf available from the
|
||||
NIST to review the detailed results. AIS31 provides recommendations for the
|
||||
NIST test suite as 'additional tests'. See testing documentation at
|
||||
http://www.issihosts.com/haveged/ais31.html for further information.
|
||||
|
||||
The "quick" test is always part of the check target. The NIST suite is run only
|
||||
when --enable-nistest is 'yes'.
|
||||
|
||||
Both checks function the same way, haveged is run to collect a sample file in
|
||||
the test directory which is then analyzed by the test program. A pass-fail return
|
||||
is given in both cases, additional information is written to stdout. The input
|
||||
samples and the nist.out report are deleted by the clean make target.
|
||||
|
||||
Both test mechanisms are statistical and even a fully functional random number
|
||||
generator will experience occasional failures. It is not uncommon to see one or
|
||||
two failures in the NIST suite and the entest will occasionally fail with a small
|
||||
sample size (usually the Chi-Square test barks). Early haveged releases used a
|
||||
entest sample size of 1MB, this has been increased to 16MB because failures with
|
||||
that sample size were all too common. A 16MB sample will also deplete and refill
|
||||
the haveged collection area to exercise all buffer logic.
|
||||
|
||||
Users are encouraged to run their own external tests. The --number==0 option is
|
||||
a convenient means to pipe haveged output into external suites such as Dieharder,
|
||||
the TESTU01 batteries, or PractRand.
|
||||
|
||||
|
||||
RUNNING haveged
|
||||
|
||||
The following invocation arguments are always available:
|
||||
|
||||
--buffer , -b [] Buffer size [KW] - default : 128
|
||||
--data , -d [] Data cache size [KB], with fallback to 16
|
||||
--inst , -i [] Instruction cache size [KB], with fallback to 16
|
||||
--file , -f [] Sample output file - default: 'sample', '-' for stdout
|
||||
--number , -n [] Output size in [k|m|g|t]. 0 = unlimited to stdout
|
||||
--verbose , -v [] Verbose mask 0=none,1=summary,2=retries,4=timing,8=loop,16=code,32=test
|
||||
--help , -h This help
|
||||
|
||||
The "-b", "-d", "-i" options are needed only in special cases. Generator output
|
||||
should be validated after changes to these values.
|
||||
|
||||
If haveged is built with online testing enabled, the following is present
|
||||
|
||||
--onlinetest , -o [] [t<x>][c<x>] x=[a[n][w]][b[w]] 't'ot, 'c'ontinuous, default: ta8b"
|
||||
|
||||
The default configuration executes the "tot" test using AIS procedure B. At the completion
|
||||
of the tot test, the buffer is reloaded and any continuous tests will be run before
|
||||
data becomes available.
|
||||
|
||||
If haveged is built with threads support, the following is present
|
||||
|
||||
--threads , -t [] Number of threads
|
||||
|
||||
If daemon interface is enabled, the following options are available:
|
||||
|
||||
--Foreground , -F Run daemon in foreground, do not fork and detach,
|
||||
--pid , -p [] The location of the daemon pid file, default: /var/run/haveged.pid
|
||||
--run , -r [] 0=daemon,1=config info,>1=Write <r>KB sample file
|
||||
--write , -w [] Set write_wakeup_threshold [bits]
|
||||
|
||||
If haveged is running detached, diagnostic output is written to syslog, otherwise
|
||||
output is written to stderr.
|
||||
|
||||
If the daemon interface is enabled, non-zero "-r" options are used to test the
|
||||
haveged random number generator; the random number generator will be configured,
|
||||
the initial data collection pass will be executed, configuration details will be
|
||||
written to stdout, and a "-r" KB sample of output will be written to the sample
|
||||
output file for all "-r" > 1. The "-n" option provides a more friendly version
|
||||
of r > 1.
|
||||
|
||||
If the daemon interface and --run==1 is specified, or if --run is not available
|
||||
and --number is not specified a summary of build, tuning, and execution
|
||||
is displayed and haveged exits without generating data:
|
||||
|
||||
<prog>: ver: <ver>; arch: <arch>; vend: <vend>, build: (<opts>); collect: <collect>
|
||||
<prog>: cpu: <cpu> (<tune>);data: <data> (<tune>); inst: <inst> (<tune>); idx: <idx>; sz: <sz>
|
||||
<prog>: tot tests(<spec>): <score>; continuous tests(<spec>):<score> last entropy estimate <ent>
|
||||
<prog>: fills: <fills>, generated: <total>
|
||||
|
||||
where
|
||||
<prog> build: program name - normally haveged
|
||||
<ver> build: package version
|
||||
<arch> build: architecture: ia64, generic, ppc, s390, sparc, sparclite, x86
|
||||
<vend> build: vendor string of host from cpuid if available else 'generic'
|
||||
<opts> build: version of gcc used and build option flags - see below.
|
||||
<collect> tuning: collection buffer size
|
||||
<cpu> tuning: (sources list for cpu info, see below)
|
||||
<data> tuning: size, (sources list for L1 data cache)
|
||||
<inst> tuning: size, (sources list for L1 instruction cache)
|
||||
<idx> tuning: collector loops used/collector loops available
|
||||
<sz> tuning: collector size used/collector size available.
|
||||
<tune> tuning: tuning sources - see below
|
||||
<spec> exec: tests to be executed in --onlinetest format
|
||||
<ent> exec: last entropy estimate from procedure B.
|
||||
<score> exec: pass/fail counts for AIS test procedures
|
||||
<fills> exec: number of times buffer was filled
|
||||
<total> exec: number of bytes output
|
||||
|
||||
build option flags represent the ./configure options as:
|
||||
C=clock_gettime, D=diagnostic I=tune with cpuid, M=multi-core, T=online tests, V=tune with vfs
|
||||
|
||||
tuning sources are:
|
||||
D=default value, P=instance parameter, C=cpuid present,
|
||||
H=hyperthreading, A=AMD cpuid, A5=AMD fn5, A6=AMD fn6, A8=AMD fn8
|
||||
L2=Intel has leaf2, L4=Intel has leaf4, B=Intel leaf b,
|
||||
4=intel leaf4, V=virtual file system available
|
||||
VS=/sys/devices/system/cpu/cpu%d/cache/index<n>/level,
|
||||
VO=/sys/devices/system/cpu/online, VI=/proc/cpuinfo
|
||||
VC=/sys/devices/system/cpu
|
||||
|
||||
Sources displayed in parenthesis are white space separated lists of the above
|
||||
tokens. The "collector * used/collector *available" values indicate the fit of
|
||||
the haveged collection loop to the L1 instruction cache.
|
||||
|
||||
Items marked 'exec:' above have meaning only when data is generated. The display
|
||||
of test results is customized to match the test options specified. The last few
|
||||
lines of the build/tuning summary (those items marked 'exec:' above) also
|
||||
appear by themselves as the 'exec summary' in other circumstances.
|
||||
|
||||
In other circumstances, the completion of initialization is announced by a banner
|
||||
written to the log:
|
||||
|
||||
"<prog>: starting up"
|
||||
"Writing <n> byte output to <file>"
|
||||
|
||||
The first line above is used when running as a daemon, the second otherwise. If
|
||||
one or more online tests are running, test failures are logged as:
|
||||
|
||||
<prog>: AIS-31 <stage> procedure <proc>: <action> <bytes> bytes fill <fill>
|
||||
|
||||
where
|
||||
<stage> is either 'tot' or 'continuous'
|
||||
<proc> is either 'A' or 'B'
|
||||
<action> is either 'retry' or 'fail'
|
||||
<bytes> is number of bytes processed in procedure before failure
|
||||
<fill> is the number of times the buffer was filled
|
||||
|
||||
The exec summary is logged upon error or signal terminations. Other log output is
|
||||
controlled by --verbose:
|
||||
|
||||
A --verbose bit mask to obtain additional diagnostic information:
|
||||
|
||||
0x01 Show exec summary on termination, retry summary
|
||||
0x02 Show online test retry details
|
||||
0x04 Show timing for collections
|
||||
0x08 Show collection loop characteristics
|
||||
0x10 Show code offsets
|
||||
0x20 Show all online test completion details
|
||||
|
||||
The "--write" option will set proc/sys/kernel/random/write_wakeup_threshold to
|
||||
the given value. This is useful because this threshold is very small on some
|
||||
systems. A minimum of 1024 is recommended.
|
||||
|
||||
The file system interface supports file creation of up data setups up to 16tb or
|
||||
can be part of a piped command set. See the man(8) page for examples.
|
||||
|
||||
DIAGNOSTIC haveged build
|
||||
|
||||
The diagnostic build is a special version of the non-daemon configuration with a
|
||||
specialized --run option. The --run levels 0 and 1 correspond duplicate the
|
||||
equivalent application functions. One or more of the addition commands may be
|
||||
included depending on the --enable-diagnostic value chosen.
|
||||
|
||||
capture (--run 2)
|
||||
Run the RNG but collect the timer inputs in a separate buffer. The normal
|
||||
RNG output is discarded and replaced by the timer inputs. Requires additional
|
||||
buffering, performance is poor because 8 times as many fills are required to
|
||||
generate same amount of output.
|
||||
|
||||
inject tics (--run 4)
|
||||
Replace timer source with file input. Requires additional buffering, source
|
||||
must account for generator warmup.
|
||||
|
||||
inject data (--run 8)
|
||||
Bypass the normal RNG completely and read input directly into the output
|
||||
buffer. Generator warmup is skipped. This option is useful for validating
|
||||
the online test suite.
|
||||
|
||||
Knowledge of haveged internals is needed to use the special features effectively
|
||||
and interpret the results. The diagnostic build identifies itself as
|
||||
'havege_diagnostic' in -help display and other outputs.
|
||||
|
||||
|
||||
INSTALLATION
|
||||
|
||||
If the daemon interface is not enabled, the install places the executable in
|
||||
automake's bin_PROGRAMS directory and provides a man(8) page. A man(3) page
|
||||
is provided for the libtool build. If the daemon interface is enabled, the
|
||||
executable is installed in automake's sbin_PROGRAMS directory.
|
||||
|
||||
If the daemon interface is enabled, the --enable-init setting provides a simple
|
||||
template system to setup the init method. If --enable-init is set to none
|
||||
no action is taken. Otherwise, the template must reside in the init.d build
|
||||
directory and is selected by the setting. Template names "service.*" indicate
|
||||
that a systemd style init, while template names "sysv.*" are used for sysv
|
||||
style init scripts.
|
||||
|
||||
Sample sysv style templates are provided for linux standard base, sysv.lsb,
|
||||
and redhat systems, sysv.redhat , such as centos which have not moved to
|
||||
systemd style inits.
|
||||
|
||||
For systemd style installs, --enable-initdir specifies the systemd unit
|
||||
directory. If the setting is not specified (or is ''), the default value is
|
||||
obtained from hosts pkg-config query for systemdsystemunitdir. Sample systemd
|
||||
templates are provided for forking, service.forking, and non-forking,
|
||||
service.fedora, configurations. The non-forking configuration is recommended to
|
||||
avoid the overhead of PID file and minimize start-up cost.
|
||||
|
||||
Examples:
|
||||
|
||||
./configure --enable-init=service.redhat
|
||||
./configure --enable-init=sysv.lsb
|
||||
|
||||
Custom init scripts can be added as necessary by adding templates to the
|
||||
init.d directory.
|
||||
|
||||
A sample file, haveged.spec, is provided in the build root as a guide for
|
||||
those who want to build a rpm. As with init scripts, the sample may need
|
||||
customization before use. Other SPEC file examples can be found in the
|
||||
contrib directory (see EXTRAS for details).
|
||||
|
||||
|
||||
EXTRAS
|
||||
|
||||
The contrib directory contains bits and pieces that are not integrated into the
|
||||
distribution. Currently this directory contains build related utilities in
|
||||
the build directory and an unorganized collection of some of the tools used
|
||||
to analyze haveged in the diags directory.
|
||||
|
||||
The script contrib/build/build.sh organizes the build utilities. The script
|
||||
provides methods to toggle the use of libtool in the build in particularly
|
||||
problematic environments, a bootstrap to recover from automake error states
|
||||
and the option to build and run a devel sample program after the devel
|
||||
sub package has been built.
|
||||
|
||||
Several sample package spec files are provided as contrib/build/*.spec. The
|
||||
havege_sample.c source demonstrates usage of the havege.h API.
|
9869
aclocal.m4
vendored
Normal file
9869
aclocal.m4
vendored
Normal file
File diff suppressed because it is too large
Load diff
285
config.h.in
Normal file
285
config.h.in
Normal file
|
@ -0,0 +1,285 @@
|
|||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 for clock_gettime */
|
||||
#undef ENABLE_CLOCK_GETTIME
|
||||
|
||||
/* Library version */
|
||||
#undef HAVEGE_LIB_VERSION
|
||||
|
||||
/* Define to 1 if you have the `accept' function. */
|
||||
#undef HAVE_ACCEPT
|
||||
|
||||
/* Define to 1 if you have the `accept4' function. */
|
||||
#undef HAVE_ACCEPT4
|
||||
|
||||
/* Define to 1 if you have the `bind' function. */
|
||||
#undef HAVE_BIND
|
||||
|
||||
/* Define to 1 if you have the `connect' function. */
|
||||
#undef HAVE_CONNECT
|
||||
|
||||
/* Define to 1 if you have the <cpuid.h> header file. */
|
||||
#undef HAVE_CPUID_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `execv' function. */
|
||||
#undef HAVE_EXECV
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the `floor' function. */
|
||||
#undef HAVE_FLOOR
|
||||
|
||||
/* Define to 1 if you have the `getsockopt' function. */
|
||||
#undef HAVE_GETSOCKOPT
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define generic host */
|
||||
#undef HAVE_ISA_GENERIC
|
||||
|
||||
/* Define to 1 for ia64 */
|
||||
#undef HAVE_ISA_IA64
|
||||
|
||||
/* Define to 1 for ppc */
|
||||
#undef HAVE_ISA_PPC
|
||||
|
||||
/* Define to 1 for s390 */
|
||||
#undef HAVE_ISA_S390
|
||||
|
||||
/* Define to 1 for sparc */
|
||||
#undef HAVE_ISA_SPARC
|
||||
|
||||
/* Define to 1 for sparclite */
|
||||
#undef HAVE_ISA_SPARCLITE
|
||||
|
||||
/* Define to 1 for x86 */
|
||||
#undef HAVE_ISA_X86
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define to 1 if you have the <linux/random.h> header file. */
|
||||
#undef HAVE_LINUX_RANDOM_H
|
||||
|
||||
/* Define to 1 if you have the `listen' function. */
|
||||
#undef HAVE_LISTEN
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
#undef HAVE_POW
|
||||
|
||||
/* Define to 1 if you have the `pselect' function. */
|
||||
#undef HAVE_PSELECT
|
||||
|
||||
/* Define to 1 if you have the `recv' function. */
|
||||
#undef HAVE_RECV
|
||||
|
||||
/* Define to 1 if you have the <sched.h> header file. */
|
||||
#undef HAVE_SCHED_H
|
||||
|
||||
/* Define to 1 if you have the `sched_yield' function. */
|
||||
#undef HAVE_SCHED_YIELD
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#undef HAVE_SELECT
|
||||
|
||||
/* Define to 1 if you have the <semaphore.h> header file. */
|
||||
#undef HAVE_SEMAPHORE_H
|
||||
|
||||
/* Define to 1 if you have the `send' function. */
|
||||
#undef HAVE_SEND
|
||||
|
||||
/* Define to 1 if you have the `setsockopt' function. */
|
||||
#undef HAVE_SETSOCKOPT
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have the `sqrt' function. */
|
||||
#undef HAVE_SQRT
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#undef HAVE_STDARG_H
|
||||
|
||||
/* Define to 1 if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdio.h> header file. */
|
||||
#undef HAVE_STDIO_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* User visible structure for SCM_CREDENTIALS message */
|
||||
#undef HAVE_STRUCT_UCRED
|
||||
|
||||
/* Define to 1 if you have the <syslog.h> header file. */
|
||||
#undef HAVE_SYSLOG_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#undef HAVE_SYS_IOCTL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#undef HAVE_SYS_MMAN_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#undef HAVE_SYS_SELECT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#undef HAVE_SYS_SOCKET_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
||||
/* Define to 1 if you have the <sys/wait.h> header file. */
|
||||
#undef HAVE_SYS_WAIT_H
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#undef HAVE_TIME_H
|
||||
|
||||
/* Define to 1 if the system has the type `uint32_t'. */
|
||||
#undef HAVE_UINT32_T
|
||||
|
||||
/* Define to 1 if the system has the type `uint8_t'. */
|
||||
#undef HAVE_UINT8_T
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <x86intrin.h> header file. */
|
||||
#undef HAVE_X86INTRIN_H
|
||||
|
||||
/* Define to 1 if you have the `__rdtsc' function. */
|
||||
#undef HAVE___RDTSC
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Define to 1 to suppress daemon interface */
|
||||
#undef NO_DAEMON
|
||||
|
||||
/* Define to single collection thread */
|
||||
#undef NUMBER_CORES
|
||||
|
||||
/* Define to 1 for online test features */
|
||||
#undef ONLINE_TESTS_ENABLE
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 for injection diagnostic */
|
||||
#undef RAW_IN_ENABLE
|
||||
|
||||
/* Define to 1 for capture diagnostic */
|
||||
#undef RAW_OUT_ENABLE
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#undef RETSIGTYPE
|
||||
|
||||
/* Define to the type of arg 1 for `select'. */
|
||||
#undef SELECT_TYPE_ARG1
|
||||
|
||||
/* Define to the type of args 2, 3 and 4 for `select'. */
|
||||
#undef SELECT_TYPE_ARG234
|
||||
|
||||
/* Define to the type of arg 5 for `select'. */
|
||||
#undef SELECT_TYPE_ARG5
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 to tune with host cpuid */
|
||||
#undef TUNING_CPUID_ENABLE
|
||||
|
||||
/* Define to 1 to tune wiht host vfs */
|
||||
#undef TUNING_VFS_ENABLE
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#undef _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#undef _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#undef _POSIX_SOURCE
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
348
config/compile
Executable file
348
config/compile
Executable file
|
@ -0,0 +1,348 @@
|
|||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1486
config/config.guess
vendored
Executable file
1486
config/config.guess
vendored
Executable file
File diff suppressed because it is too large
Load diff
1790
config/config.sub
vendored
Executable file
1790
config/config.sub
vendored
Executable file
File diff suppressed because it is too large
Load diff
518
config/install-sh
Executable file
518
config/install-sh
Executable file
|
@ -0,0 +1,518 @@
|
|||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
11149
config/ltmain.sh
Normal file
11149
config/ltmain.sh
Normal file
File diff suppressed because it is too large
Load diff
215
config/missing
Executable file
215
config/missing
Executable file
|
@ -0,0 +1,215 @@
|
|||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
262
configure.ac
Normal file
262
configure.ac
Normal file
|
@ -0,0 +1,262 @@
|
|||
## Process this file with autoconf to produce a configure script.
|
||||
|
||||
## Minimum Autoconf version
|
||||
|
||||
AC_PREREQ([2.59])
|
||||
AC_INIT([haveged],[1.9.14])
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
AC_CONFIG_HEADER([config.h])
|
||||
AM_INIT_AUTOMAKE([subdir-objects no-dependencies])
|
||||
AC_CONFIG_SRCDIR([src/haveged.c])
|
||||
AC_CHECK_TYPES([uint32_t, uint8_t])
|
||||
HA_LDFLAGS=""
|
||||
|
||||
##libtool_start##
|
||||
LT_INIT
|
||||
AC_PROG_LIBTOOL
|
||||
AM_ENABLE_SHARED
|
||||
AM_DISABLE_STATIC
|
||||
LT_LANG([C])
|
||||
HAVEGE_LT_VERSION="2:0:0"
|
||||
AC_SUBST(HAVEGE_LT_VERSION)
|
||||
AC_DEFINE_UNQUOTED(HAVEGE_LIB_VERSION, "$HAVEGE_LT_VERSION", [Library version])
|
||||
##libtool_end##
|
||||
|
||||
## Make clock_gettime configurable
|
||||
AC_ARG_ENABLE(clock_gettime,
|
||||
AS_HELP_STRING([--enable-clock_gettime=[no/yes]],[Enable clock_gettime [default=yes if no rdtsc]]),
|
||||
, enable_clock_gettime="x")
|
||||
|
||||
## Make build w/o daemon interface configurable
|
||||
AC_ARG_ENABLE(daemon,
|
||||
AS_HELP_STRING([--enable-daemon=[yes/no]],[Enable daemon [default=yes if linux]]),
|
||||
, enable_daemon="x" )
|
||||
|
||||
## Make diagnostic modes configurable
|
||||
AC_ARG_ENABLE(diagnostic,
|
||||
AS_HELP_STRING([--enable-diagnostic=[no/capture/inject/yes]],[Enable diagnostic mode [default=no]]),
|
||||
, enable_diagnostic="no")
|
||||
if test "x$enable_diagnostic" = "xyes"; then
|
||||
AC_DEFINE(RAW_OUT_ENABLE, 1, [Define to 1 for capture diagnostic])
|
||||
AC_DEFINE(RAW_IN_ENABLE, 1, [Define to 1 for injection diagnostic])
|
||||
enable_daemon="no";
|
||||
elif test "x$enable_diagnostic" = "xcapture"; then
|
||||
AC_DEFINE(RAW_OUT_ENABLE, 1, [Define to 1 for capture diagnostic])
|
||||
enable_daemon="no";
|
||||
elif test "x$enable_diagnostic" = "xinject"; then
|
||||
AC_DEFINE(RAW_IN_ENABLE, 1, [Define to 1 for injection diagnostic])
|
||||
enable_daemon="no";
|
||||
fi
|
||||
|
||||
## Make init configurable
|
||||
AC_ARG_ENABLE(init,
|
||||
AS_HELP_STRING([--enable-init=[type]],[Enable service.* or sysv.* template [default=no]]),
|
||||
, enable_init="no" )
|
||||
AC_ARG_ENABLE(initdir,
|
||||
AS_HELP_STRING([--enable-initdir=DIR], [Directory for systemd service files [default=pkg-config var if init==service.*]]),
|
||||
, enable_initdir="?")
|
||||
|
||||
## Make nist self-test configurable
|
||||
AC_ARG_ENABLE(nistest,
|
||||
AS_HELP_STRING([--enable-nistest=[no/yes]],[Run NIST test suite [default=no]]),
|
||||
, enable_nistest="no")
|
||||
|
||||
## Make ent self-test configurable
|
||||
AC_ARG_ENABLE(enttest,
|
||||
AS_HELP_STRING([--enable-enttest=[no/yes]],[Run ENT test suite [default=yes]]),
|
||||
, enable_enttest="yes")
|
||||
|
||||
## Make self test features configurable
|
||||
AC_ARG_ENABLE(olt,
|
||||
AS_HELP_STRING([--enable-olt=[yes/no]],[Enable online tests [default=yes]]),
|
||||
, enable_olt="yes" )
|
||||
if test "x$enable_olt" = "xyes"; then
|
||||
AC_DEFINE(ONLINE_TESTS_ENABLE, 1, [Define to 1 for online test features])
|
||||
fi
|
||||
|
||||
## Make multi-thread feature configurable
|
||||
AC_ARG_ENABLE(threads,
|
||||
AS_HELP_STRING([--enable-threads=[no/yes]],[Enable threads [default=no]]),
|
||||
, enable_threads="no")
|
||||
if test "x$enable_threads" = "xyes"; then
|
||||
AC_DEFINE(NUMBER_CORES, 4, [Define maxium number of collection threads])
|
||||
HA_LDFLAGS="-pthread"
|
||||
else
|
||||
AC_DEFINE(NUMBER_CORES, 1, [Define to single collection thread])
|
||||
fi
|
||||
|
||||
## Make tuning features configurable
|
||||
AC_ARG_ENABLE(tune,
|
||||
AS_HELP_STRING([--enable-tune=[yes/cpuid/vfs/no]],[Enable host tune methods [default=yes]]),
|
||||
, enable_tune="yes" )
|
||||
if test "x$enable_tune" = "xyes"; then
|
||||
AC_DEFINE(TUNING_CPUID_ENABLE, 1, [Define to 1 to tune with host cpuid])
|
||||
AC_DEFINE(TUNING_VFS_ENABLE, 1, [Define to 1 to tune with host vfs])
|
||||
elif test "x$enable_tune" = "xcpuid"; then
|
||||
AC_DEFINE(TUNING_CPUID_ENABLE, 1, [Define to 1 to tune with host cpuid])
|
||||
elif test "x$enable_tune" = "xvfs"; then
|
||||
AC_DEFINE(TUNING_VFS_ENABLE, 1, [Define to 1 to tune wiht host vfs])
|
||||
fi
|
||||
|
||||
## Checks for programs.
|
||||
AC_PROG_CC([gcc])
|
||||
|
||||
## Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
AC_HEADER_TIME
|
||||
|
||||
## Checks for library functions.
|
||||
AC_PROG_GCC_TRADITIONAL
|
||||
AC_FUNC_SELECT_ARGTYPES
|
||||
AC_TYPE_SIGNAL
|
||||
AC_CHECK_FUNCS([__rdtsc accept accept4 bind connect execv floor getsockopt gettimeofday listen memset pow pselect recv sched_yield select send setsockopt socket sqrt])
|
||||
|
||||
## Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h)
|
||||
AC_CHECK_HEADERS(limits.h)
|
||||
AC_CHECK_HEADERS(sched.h)
|
||||
AC_CHECK_HEADERS(semaphore.h)
|
||||
AC_CHECK_HEADERS(stdarg.h)
|
||||
AC_CHECK_HEADERS(stddef.h)
|
||||
AC_CHECK_HEADERS(stdint.h)
|
||||
AC_CHECK_HEADERS(stdio.h)
|
||||
AC_CHECK_HEADERS(stdlib.h)
|
||||
AC_CHECK_HEADERS(string.h)
|
||||
AC_CHECK_HEADERS(sys/ioctl.h)
|
||||
AC_CHECK_HEADERS(sys/mman.h)
|
||||
AC_CHECK_HEADERS(sys/types.h)
|
||||
AC_CHECK_HEADERS(sys/socket.h)
|
||||
AC_CHECK_HEADERS(sys/un.h)
|
||||
AC_CHECK_HEADERS(sys/wait.h)
|
||||
AC_CHECK_HEADERS(time.h)
|
||||
AC_CHECK_HEADERS(sys/time.h)
|
||||
AC_CHECK_HEADERS(unistd.h)
|
||||
AC_CHECK_HEADERS(cpuid.h)
|
||||
AC_CHECK_HEADERS(x86intrin.h)
|
||||
AC_CHECK_HEADERS(syslog.h)
|
||||
AC_CHECK_HEADERS(linux/random.h)
|
||||
|
||||
AH_TEMPLATE([HAVE_STRUCT_UCRED],[User visible structure for SCM_CREDENTIALS message])
|
||||
AC_TRY_LINK([#include <sys/socket.h>],
|
||||
[struct ucred cred; cred.pid=0;],[AC_DEFINE([HAVE_STRUCT_UCRED],[1],[User visible structure for SCM_CREDENTIALS message])])
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
## Determine if daemon interface to be included
|
||||
|
||||
if test "x$enable_daemon" = "xyes"; then
|
||||
daemon_type="yes"
|
||||
elif test "x$enable_daemon" = "xno"; then
|
||||
daemon_type="none"
|
||||
else
|
||||
case "$host_os" in
|
||||
linux*)
|
||||
daemon_type="yes"
|
||||
;;
|
||||
*)
|
||||
daemon_type="none"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Match host to havegedef macros
|
||||
case "$host" in
|
||||
x86_64-*)
|
||||
AC_DEFINE(HAVE_ISA_X86, 1, [Define to 1 for x86_64])
|
||||
;;
|
||||
|
||||
i*86*-*)
|
||||
AC_DEFINE(HAVE_ISA_X86, 1, [Define to 1 for x86])
|
||||
;;
|
||||
|
||||
ia64-*)
|
||||
AC_DEFINE(HAVE_ISA_IA64, 1, [Define to 1 for ia64])
|
||||
;;
|
||||
|
||||
powerpc-*|pcc-*|powerpc64-*|ppc64-*)
|
||||
AC_DEFINE(HAVE_ISA_PPC, 1, [Define to 1 for ppc])
|
||||
;;
|
||||
|
||||
s390*-*)
|
||||
AC_DEFINE(HAVE_ISA_S390, 1, [Define to 1 for s390])
|
||||
;;
|
||||
|
||||
sparclite*-*)
|
||||
AC_DEFINE(HAVE_ISA_SPARCLITE, 1, [Define to 1 for sparclite])
|
||||
;;
|
||||
|
||||
sparc*-*)
|
||||
AC_DEFINE(HAVE_ISA_SPARC, 1, [Define to 1 for sparc])
|
||||
;;
|
||||
|
||||
*)
|
||||
if test "x$enable_clock_gettime" = "xx"; then
|
||||
enable_clock_gettime="yes"
|
||||
elif test "x$enable_clock_gettime" = "xyes"; then
|
||||
enable_clock_gettime="yes"
|
||||
else
|
||||
AC_MSG_ERROR([no timer source for host :"$host".])
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(HAVE_ISA_GENERIC, "$host", [Define generic host])
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
## Check clock_gettime option
|
||||
|
||||
if test "x$enable_clock_gettime" = "xyes"; then
|
||||
saved_libs=$LIBS
|
||||
LIB_CLOCK_GETTIME=
|
||||
AC_SEARCH_LIBS([clock_gettime], [rt posix4],
|
||||
[test "$ac_cv_search_clock_gettime" = "none required" || LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime],
|
||||
AC_MSG_ERROR([clock_gettime is required for host :"$host".]))
|
||||
LIBS=$saved_libs
|
||||
HA_LDFLAGS="$HA_LDFLAGS $LIB_CLOCK_GETTIME"
|
||||
AC_DEFINE(ENABLE_CLOCK_GETTIME, 1, [Define to 1 for clock_gettime])
|
||||
fi
|
||||
|
||||
|
||||
## Determine init type
|
||||
|
||||
if test "$daemon_type" = "none"; then
|
||||
AC_DEFINE(NO_DAEMON, 1, [Define to 1 to suppress daemon interface])
|
||||
init_type="none"
|
||||
else
|
||||
case "$enable_init" in
|
||||
service.*)
|
||||
init_type="systemd"
|
||||
;;
|
||||
sysv.*)
|
||||
init_type="sysv"
|
||||
;;
|
||||
*)
|
||||
init_type="none"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## Fixup install and test options
|
||||
|
||||
AC_SUBST(HA_DISTRO,$enable_init)
|
||||
AC_SUBST(HA_UNITD,$enable_initdir)
|
||||
AM_CONDITIONAL(ENABLE_BIN, test "$daemon_type" = "none")
|
||||
AM_CONDITIONAL(ENABLE_SYSV, test "$init_type" = "sysv")
|
||||
AM_CONDITIONAL(ENABLE_SYSTEMD, test "$init_type" = "systemd")
|
||||
AM_CONDITIONAL(ENABLE_SYSTEMD_LOOKUP, test "$enable_initdir" = "?")
|
||||
AM_CONDITIONAL(ENABLE_NOINIT, test "$init_type" = "none")
|
||||
AM_CONDITIONAL(ENABLE_ENT_TEST, test "$enable_enttest" = "yes")
|
||||
AM_CONDITIONAL(ENABLE_NIST_TEST, test "$enable_nistest" = "yes")
|
||||
|
||||
## Set hardware dependent define for the build
|
||||
|
||||
AC_SUBST(HA_LDFLAGS)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/Makefile
|
||||
man/Makefile
|
||||
init.d/Makefile
|
||||
ent/Makefile
|
||||
nist/Makefile])
|
||||
AC_OUTPUT
|
5
contrib/Fedora/90-haveged.rules
Normal file
5
contrib/Fedora/90-haveged.rules
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Start the haveged service as soon as the random device is available
|
||||
# to avoid starting other services while starved of entropy
|
||||
|
||||
ACTION=="add", KERNEL=="random" , SUBSYSTEM=="mem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="haveged.service"
|
||||
|
26
contrib/Fedora/haveged-dracut.module
Executable file
26
contrib/Fedora/haveged-dracut.module
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
# /usr/lib/dracut/modules.d/98haveged/module-setup.sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o \
|
||||
/usr/sbin/haveged \
|
||||
$systemdsystemunitdir/haveged.service \
|
||||
$systemdsystemunitdir/haveged-switch-root.service
|
||||
mkdir -p "$initdir/$systemdsystemunitdir/sysinit.target.wants"
|
||||
mkdir -p "$initdir/$systemdsystemunitdir/initrd-switch-root.target.wants"
|
||||
mkdir -p "$initdir/$systemdsystemunitdir/systemd-journald.service.wants"
|
||||
ln_r "$systemdsystemunitdir/haveged.service" "$systemdsystemunitdir/systemd-journald.service.wants/haveged.service"
|
||||
ln_r "$systemdsystemunitdir/haveged-switch-root.service" "$systemdsystemunitdir/initrd-switch-root.target.wants/haveged-switch-root.service"
|
||||
}
|
17
contrib/Fedora/haveged-switch-root.service
Normal file
17
contrib/Fedora/haveged-switch-root.service
Normal file
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Tell haveged about new root
|
||||
DefaultDependencies=no
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
Before=initrd-switch-root.service
|
||||
JoinsNamespaceOf=haveged.service
|
||||
|
||||
[Service]
|
||||
ExecStart=-@SBIN_DIR@/haveged -c root=/sysroot
|
||||
PrivateNetwork=yes
|
||||
Type=oneshot
|
||||
StandardInput=null
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
|
||||
[Install]
|
||||
WantedBy=initrd-switch-root.target
|
36
contrib/Fedora/haveged.service
Normal file
36
contrib/Fedora/haveged.service
Normal file
|
@ -0,0 +1,36 @@
|
|||
[Unit]
|
||||
Description=Entropy Daemon based on the HAVEGE algorithm
|
||||
Documentation=man:haveged(8) http://www.issihosts.com/haveged/
|
||||
DefaultDependencies=no
|
||||
After=systemd-tmpfiles-setup-dev.service
|
||||
Before=sysinit.target shutdown.target systemd-journald.service
|
||||
|
||||
[Service]
|
||||
ExecStart=@SBIN_DIR@/haveged -w 1024 -v 1 --Foreground
|
||||
Restart=always
|
||||
SuccessExitStatus=137 143
|
||||
|
||||
SecureBits=noroot-locked
|
||||
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_SYS_CHROOT
|
||||
# We can *not* set PrivateTmp=true as it can cause an ordering cycle.
|
||||
PrivateTmp=false
|
||||
PrivateDevices=true
|
||||
# We can *not* set PrivateNetwork=true to allow command mode (chroot when included in initramfs)
|
||||
#PrivateNetwork=true
|
||||
ProtectSystem=full
|
||||
ProtectHome=true
|
||||
ProtectHostname=true
|
||||
ProtectKernelLogs=true
|
||||
ProtectKernelModules=true
|
||||
RestrictNamespaces=true
|
||||
RestrictRealtime=true
|
||||
|
||||
LockPersonality=true
|
||||
MemoryDenyWriteExecute=true
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallFilter=~@mount
|
||||
SystemCallErrorNumber=EPERM
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
232
contrib/Fedora/haveged.spec
Normal file
232
contrib/Fedora/haveged.spec
Normal file
|
@ -0,0 +1,232 @@
|
|||
%define dracutlibdir lib/dracut
|
||||
Summary: A Linux entropy source using the HAVEGE algorithm
|
||||
Name: haveged
|
||||
Version: 1.9.14
|
||||
Release: 1%{?dist}
|
||||
License: GPLv3+
|
||||
URL: https://github.com/jirka-h/haveged
|
||||
Source0: https://github.com/jirka-h/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz
|
||||
Requires(post): systemd
|
||||
Requires(preun): systemd
|
||||
Requires(postun): systemd
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: automake coreutils glibc-common systemd-units
|
||||
Enhances: apache2 gpg2 openssl openvpn php5 smtp_daemon systemd
|
||||
|
||||
%description
|
||||
A Linux entropy source using the HAVEGE algorithm
|
||||
|
||||
Haveged is a user space entropy daemon which is not dependent upon the
|
||||
standard mechanisms for harvesting randomness for the system entropy
|
||||
pool. This is important in systems with high entropy needs or limited
|
||||
user interaction (e.g. headless servers).
|
||||
|
||||
Haveged uses HAVEGE (HArdware Volatile Entropy Gathering and Expansion)
|
||||
to maintain a 1M pool of random bytes used to fill /dev/random
|
||||
whenever the supply of random bits in /dev/random falls below the low
|
||||
water mark of the device. The principle inputs to haveged are the
|
||||
sizes of the processor instruction and data caches used to setup the
|
||||
HAVEGE collector. The haveged default is a 4kb data cache and a 16kb
|
||||
instruction cache. On machines with a cpuid instruction, haveged will
|
||||
attempt to select appropriate values from internal tables.
|
||||
|
||||
%package devel
|
||||
Summary: Headers and shared development libraries for HAVEGE algorithm
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description devel
|
||||
Headers and shared object symbolic links for the HAVEGE algorithm
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
#autoreconf -fiv
|
||||
%configure --disable-enttest --enable-nistest --disable-static
|
||||
#SMP build is not working
|
||||
#make %{?_smp_mflags}
|
||||
make
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot} INSTALL="install -p"
|
||||
|
||||
chmod 0644 COPYING README ChangeLog AUTHORS
|
||||
|
||||
#Install systemd service file
|
||||
sed -e 's:@SBIN_DIR@:%{_sbindir}:g' -i contrib/Fedora/*service
|
||||
install -Dpm 0644 contrib/Fedora/haveged.service %{buildroot}%{_unitdir}/%{name}.service
|
||||
install -Dpm 0644 contrib/Fedora/haveged-switch-root.service %{buildroot}%{_unitdir}/%{name}-switch-root.service
|
||||
install -Dpm 0755 contrib/Fedora/haveged-dracut.module %{buildroot}/%{_prefix}/%{dracutlibdir}/modules.d/98%{name}/module-setup.sh
|
||||
install -Dpm 0644 contrib/Fedora/90-haveged.rules %{buildroot}%{_udevrulesdir}/90-%{name}.rules
|
||||
|
||||
# We don't ship .la files.
|
||||
rm -rf %{buildroot}%{_libdir}/libhavege.*a
|
||||
|
||||
mkdir -p %{buildroot}%{_defaultdocdir}/%{name}
|
||||
cp -p COPYING README ChangeLog AUTHORS contrib/build/havege_sample.c %{buildroot}%{_defaultdocdir}/%{name}
|
||||
|
||||
%post
|
||||
/sbin/ldconfig
|
||||
%systemd_post %{name}.service %{name}-switch-root.service
|
||||
|
||||
%preun
|
||||
%systemd_preun %{name}.service %{name}-switch-root.service
|
||||
|
||||
%postun
|
||||
%systemd_postun_with_restart %{name}.service %{name}-switch-root.service
|
||||
/sbin/ldconfig
|
||||
|
||||
%files
|
||||
%{_mandir}/man8/haveged.8*
|
||||
%{_sbindir}/haveged
|
||||
%{_unitdir}/*.service
|
||||
%{_libdir}/*so.*
|
||||
%{_defaultdocdir}/*
|
||||
%{_udevrulesdir}/*-%{name}.rules
|
||||
%dir %{_prefix}/%{dracutlibdir}/modules.d/98%{name}
|
||||
%{_prefix}/%{dracutlibdir}/modules.d/98%{name}/*
|
||||
|
||||
%files devel
|
||||
%{_mandir}/man3/libhavege.3*
|
||||
%dir %{_includedir}/%{name}
|
||||
%{_includedir}/%{name}/havege.h
|
||||
%doc contrib/build/havege_sample.c
|
||||
%{_libdir}/*.so
|
||||
|
||||
|
||||
%changelog
|
||||
* Sun Jun 28 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.14-1
|
||||
- Update to 1.9.14
|
||||
- BZ1835006 - Added dracut module
|
||||
- Start the service as soon as the random device is available with
|
||||
the help of udev, as starting services while starved of entropy
|
||||
is no good.
|
||||
|
||||
* Sun Jun 28 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.13-1
|
||||
- Update to 1.9.13
|
||||
|
||||
* Thu Jun 18 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.12-1
|
||||
- Update to 1.9.12
|
||||
|
||||
* Fri Jun 12 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.11-1
|
||||
- Update to 1.9.11
|
||||
|
||||
* Thu Jun 11 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.10-1
|
||||
- Update to 1.9.10
|
||||
|
||||
* Thu Jun 11 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.9-2
|
||||
- Fixed haveged.service file
|
||||
|
||||
* Tue Jun 09 2020 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.9-1
|
||||
- Update to 1.9.9
|
||||
|
||||
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.8-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Mon Sep 30 2019 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.8-1
|
||||
- Update to 1.9.8
|
||||
|
||||
* Mon Aug 26 2019 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.6-1
|
||||
- Update to 1.9.6
|
||||
|
||||
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-12
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-11
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
|
||||
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-9
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
||||
|
||||
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-8
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
|
||||
|
||||
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-7
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
|
||||
|
||||
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
||||
|
||||
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.1-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
||||
|
||||
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.1-4
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
|
||||
|
||||
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.1-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
|
||||
|
||||
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.1-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
|
||||
|
||||
* Thu Feb 13 2014 Jirka Hladky <hladky.jiri@gmail.com> - 1.9.1-1
|
||||
- Update to 1.9.1
|
||||
|
||||
* Sat Jan 04 2014 Jirka Hladky <hladky.jiri@gmail.com> - 1.8-1
|
||||
- Unversioned docdir change, more info on
|
||||
https://fedoraproject.org/wiki/Changes/UnversionedDocdirs
|
||||
|
||||
* Fri Jan 03 2014 Jirka Hladky <hladky.jiri@gmail.com> - 1.8-0
|
||||
- Updated to the version 1.8
|
||||
- Improvement to systemd service file
|
||||
- Fixed exit status
|
||||
|
||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||
|
||||
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.7-1
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
|
||||
|
||||
* Sat Jan 19 2013 Jirka Hladky <hladky.jiri@gmail.com> - 1.7-0
|
||||
- Updated to the version 1.7
|
||||
- Version 1.7 brings developement libraries
|
||||
- Added devel package
|
||||
* Sat Oct 13 2012 Jirka Hladky <hladky.jiri@gmail.com> - 1.5-2
|
||||
- BZ 850144
|
||||
- Introduce new systemd-rpm macros in haveged spec file
|
||||
- Fedora 19 changes the way how to work with services in spec files.
|
||||
- It introduces new macros - systemd_post, systemd_preun and systemd_postun;
|
||||
- which replace scriptlets from Fedora 18 and older
|
||||
- see https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd
|
||||
|
||||
* Tue Aug 14 2012 Jirka Hladky <hladky.jiri@gmail.com> - 1.5-1
|
||||
- Update to the version 1.5
|
||||
- Main new feature is a run time verification of the produced random numbers
|
||||
- PIDFILE set to /run/haveged.pid
|
||||
- converted README and man page to UTF-8. Informed the upstream to fix it.
|
||||
* Wed Feb 15 2012 Jirka Hladky <hladky.jiri@gmail.com> - 1.4-3
|
||||
- PIDFile should be stored at /run instead of the default location /var/run
|
||||
- There is long term plan that directory /var/run will not further exist in the future Fedora versions
|
||||
- Asked upstream to add -p <PID_FILE_location> switch to influence the location of the PID File
|
||||
- Set PIDFile=/var/run/haveged.pid This is needed as long -p option is not implemented
|
||||
- https://bugzilla.redhat.com/show_bug.cgi?id=770306#c10
|
||||
* Wed Feb 15 2012 Jirka Hladky <hladky.jiri@gmail.com> - 1.4-2
|
||||
- Updated systemd service file, https://bugzilla.redhat.com/show_bug.cgi?id=770306
|
||||
* Tue Feb 14 2012 Jirka Hladky <hladky.jiri@gmail.com> - 1.4-1
|
||||
- Update to the version 1.4
|
||||
- Conversion to systemd, drop init script
|
||||
* Sun Nov 06 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.3-2
|
||||
- Fixed a bug on non x86 systems
|
||||
* Sat Nov 05 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.3-1
|
||||
- update from the upstream (1.3 stable)
|
||||
* Mon Oct 03 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.3-0
|
||||
-version 1.3 beta
|
||||
* Fri Sep 30 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.2-4
|
||||
- ppc64 build
|
||||
* Mon Sep 26 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.2-3
|
||||
- Cleaned spec file according to https://bugzilla.redhat.com/show_bug.cgi?id=739347#c11
|
||||
* Sat Sep 24 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.2-2
|
||||
- Added comment to explain why we need use Fedora specific start script
|
||||
* Wed Sep 21 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.2-1
|
||||
- Cleaned spec file according to https://bugzilla.redhat.com/show_bug.cgi?id=739347#c1
|
||||
* Wed Sep 07 2011 Jirka Hladky <hladky.jiri@gmail.com> - 1.2-0
|
||||
- Initial build
|
5
contrib/SUSE/90-haveged.rules
Normal file
5
contrib/SUSE/90-haveged.rules
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Start the haveged service as soon as the random device is available
|
||||
# to avoid starting other services while starved of entropy
|
||||
|
||||
ACTION=="add", KERNEL=="random" , SUBSYSTEM=="mem", TAG+="systemd", ENV{SYSTEMD_WANTS}+="haveged.service"
|
||||
|
26
contrib/SUSE/haveged-dracut.module
Executable file
26
contrib/SUSE/haveged-dracut.module
Executable file
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
# /usr/lib/dracut/modules.d/98haveged/module-setup.sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_multiple -o \
|
||||
/usr/sbin/haveged \
|
||||
$systemdsystemunitdir/haveged.service \
|
||||
$systemdsystemunitdir/haveged-switch-root.service
|
||||
mkdir -p "$initdir/$systemdsystemunitdir/sysinit.target.wants"
|
||||
mkdir -p "$initdir/$systemdsystemunitdir/initrd-switch-root.target.wants"
|
||||
mkdir -p "$initdir/$systemdsystemunitdir/systemd-journald.service.wants"
|
||||
ln_r "$systemdsystemunitdir/haveged.service" "$systemdsystemunitdir/systemd-journald.service.wants/haveged.service"
|
||||
ln_r "$systemdsystemunitdir/haveged-switch-root.service" "$systemdsystemunitdir/initrd-switch-root.target.wants/haveged-switch-root.service"
|
||||
}
|
17
contrib/SUSE/haveged-switch-root.service
Normal file
17
contrib/SUSE/haveged-switch-root.service
Normal file
|
@ -0,0 +1,17 @@
|
|||
[Unit]
|
||||
Description=Tell haveged about new root
|
||||
DefaultDependencies=no
|
||||
ConditionPathExists=/etc/initrd-release
|
||||
Before=initrd-switch-root.service
|
||||
JoinsNamespaceOf=haveged.service
|
||||
|
||||
[Service]
|
||||
ExecStart=-/usr/sbin/haveged -c root=/sysroot
|
||||
PrivateNetwork=yes
|
||||
Type=oneshot
|
||||
StandardInput=null
|
||||
StandardOutput=null
|
||||
StandardError=null
|
||||
|
||||
[Install]
|
||||
WantedBy=initrd-switch-root.target
|
38
contrib/build/build.sh
Executable file
38
contrib/build/build.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
##
|
||||
## Toggle between library and non-library builds. Fix messed up libtool environment
|
||||
## Build and run haveged-devel sample
|
||||
##
|
||||
case "$1" in
|
||||
nolib)
|
||||
sed -i.bak -e '/^##libtool_start##/,/^##libtool_end##/s,^,##,g' ../../configure.ac
|
||||
sed -i.bak -e '/^####nolibtool_start##/,/^####nolibtool_end##/s,^##,,g' \
|
||||
-e '/^##libtool_start##/,/^##libtool_end##/s,^,##,g' ../../src/Makefile.am
|
||||
cp nolib.spec ../../haveged.spec
|
||||
;;
|
||||
lib)
|
||||
sed -i.bak -e '/^####libtool_start##/,/^####libtool_end##/s,^##,,g' ../../configure.ac
|
||||
sed -i.bak -e '/^##nolibtool_start##/,/^##nolibtool_end##/s,^,##,g' \
|
||||
-e '/^####libtool_start##/,/^####libtool_end##/s,^##,,g' ../../src/Makefile.am
|
||||
cp lib.spec ../../haveged.spec
|
||||
;;
|
||||
new)
|
||||
cd ../..
|
||||
make distclean
|
||||
rm -rf autom4te.cache
|
||||
libtoolize --force --install
|
||||
autoreconf --force
|
||||
./configure
|
||||
;;
|
||||
sample)
|
||||
echo "gcc -o havege_sample -DUSE_SOURCE -I../../src -Wall havege_sample.c ../../src/.libs/libhavege.a"
|
||||
gcc -o havege_sample -DUSE_SOURCE -I../../src -Wall havege_sample.c ../../src/.libs/libhavege.a
|
||||
echo "./havege_sample > /dev/null"
|
||||
./havege_sample > /dev/null
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "usage: build [new|nolib|lib|sample]";
|
||||
;;
|
||||
esac
|
||||
|
97
contrib/build/havege_sample.c
Normal file
97
contrib/build/havege_sample.c
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
Simple test of build - writes 1k of RNG runs to stdout
|
||||
|
||||
gcc -o havege_sample -DUSE_SOURCE -I../../src -Wall havege_sample.c ../../src/.libs/libhavege.a
|
||||
./havege_sample > /dev/null
|
||||
|
||||
After package is installed into test RAM disk /dev/shm/1
|
||||
gcc -Wall -o havege_sample -I/dev/shm/1/include -L/dev/shm/1/lib havege_sample.c -lhavege
|
||||
LD_LIBRARY_PATH=/dev/shm/1/lib ./havege_sample > /dev/shm/havege_random
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef USE_SOURCE
|
||||
#include "havege.h"
|
||||
#else
|
||||
#include <haveged/havege.h>
|
||||
#endif
|
||||
|
||||
int my_status_dump ( H_PTR h, char *buf, size_t buflen) {
|
||||
H_SD_TOPIC topics[4] = {H_SD_TOPIC_BUILD, H_SD_TOPIC_TUNE, H_SD_TOPIC_TEST, H_SD_TOPIC_SUM};
|
||||
int ret=0, i;
|
||||
|
||||
for(i=0;i<4 && ret<(buflen-2);i++) {
|
||||
ret += havege_status_dump(h, topics[i], buf + ret, buflen-ret);
|
||||
if (ret>(buflen-2))
|
||||
break;
|
||||
buf[ret++] = '\n';
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
* RNG output is written to stdout
|
||||
*/
|
||||
int main(void) {
|
||||
int rc;
|
||||
H_UINT* buf;
|
||||
H_PARAMS havege_parameters={0};
|
||||
H_PTR havege_state = NULL;
|
||||
const int status_buf_size = 8192;
|
||||
char status_buf[status_buf_size];
|
||||
int i, size;
|
||||
|
||||
//havege_parameters.msg_out = print_msg;
|
||||
fprintf(stderr, "library version is %s\n", havege_version(NULL));
|
||||
havege_state = havege_create(&havege_parameters);
|
||||
|
||||
rc = havege_state==NULL? H_NOHANDLE : havege_state->error;
|
||||
if (H_NOERR==rc) {
|
||||
buf = havege_state->io_buf;
|
||||
size = havege_state->i_readSz /sizeof(H_UINT);
|
||||
fprintf(stderr, "havege_create: buffer size is %d\n", havege_state->i_readSz);
|
||||
}
|
||||
else {
|
||||
if (H_NOTESTSPEC==rc)
|
||||
fprintf(stderr, "ERROR: havege_create: unrecognized test setup: %s", havege_parameters.testSpec);
|
||||
else fprintf(stderr, "ERROR: havege_create has returned %d\n",rc);
|
||||
if (H_NOHANDLE!=rc)
|
||||
havege_destroy(havage_state);
|
||||
return 1;
|
||||
}
|
||||
rc = havege_run(havege_state);
|
||||
if ( rc ) {
|
||||
fprintf(stderr, "ERROR: havege_run has returned %d\n", havege_state->error);
|
||||
havege_destroy(havege_state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ( my_status_dump(havege_state, status_buf, status_buf_size) > 0 )
|
||||
fprintf(stderr,"%s\n", status_buf);
|
||||
for (i=0;i<1024;i++) {
|
||||
|
||||
rc = havege_rng(havege_state, buf, size);
|
||||
if ( rc != (int) size ) {
|
||||
fprintf(stderr, "ERROR: havege_rng has returned %d\n", havege_state->error);
|
||||
havege_destroy(havege_state);
|
||||
return 1;
|
||||
}
|
||||
|
||||
rc = fwrite(buf, 1, size, stdout);
|
||||
if ( rc < size ) {
|
||||
fprintf(stderr, "ERROR: fwrite\n");
|
||||
havege_destroy(havege_state);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( my_status_dump(havege_state, status_buf, status_buf_size) > 0 )
|
||||
fprintf(stderr,"%s\n", status_buf);
|
||||
havege_destroy(havege_state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
76
contrib/build/lib.spec
Normal file
76
contrib/build/lib.spec
Normal file
|
@ -0,0 +1,76 @@
|
|||
#
|
||||
# Sample spec file for haveged and haveged-devel
|
||||
# Copyright (c) 2013-2014
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself.
|
||||
#
|
||||
%define have_systemd 0
|
||||
|
||||
Name: haveged
|
||||
Version: 1.9
|
||||
Release: 0
|
||||
License: GPLv3
|
||||
Group: System Environment/Daemons
|
||||
Summary: Feed entropy into random pool
|
||||
URL: http://www.issihosts.com/haveged/
|
||||
Source0: http://www.issihosts.com/haveged/haveged-%{version}.tar.gz
|
||||
BuildRoot: %{_builddir}/%{name}-root
|
||||
%if 0%{?have_systemd}
|
||||
BuildRequires: systemd
|
||||
%endif
|
||||
|
||||
%description
|
||||
The haveged daemon feeds the linux entropy pool with random
|
||||
numbers generated from hidden processor state.
|
||||
|
||||
%package devel
|
||||
Summary: haveged development files
|
||||
Group: Development/Libraries
|
||||
|
||||
%description devel
|
||||
Headers and shared object symbolic links for the haveged library
|
||||
|
||||
This package contains the haveged implementation of the HAVEGE
|
||||
algorithm and supporting features.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure \
|
||||
--enable-daemon\
|
||||
--enable--init=sysv.redhat
|
||||
make
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%install
|
||||
%makeinstall
|
||||
%{__install} -D -m0755 %{_sysconfdir}/init.d/%{name}
|
||||
%if 0%{?have_systemd}
|
||||
%{__install} -D -m0644 %{S:2} %{buildroot}%{_unitdir}/%{name}.service
|
||||
%endif
|
||||
%{__rm} -f %{buildroot}%{_libdir}/libhavege.*a
|
||||
|
||||
%clean
|
||||
%{?buildroot:%__rm -rf "%{buildroot}"}
|
||||
|
||||
%files
|
||||
%defattr(-, root, root, -)
|
||||
%doc COPYING
|
||||
%{_mandir}/man8/haveged.8*
|
||||
%{_sbindir}/haveged
|
||||
%if 0%{?have_systemd}
|
||||
%{_unitdir}/haveged.service
|
||||
%endif
|
||||
|
||||
%files devel
|
||||
%doc COPYING
|
||||
%defattr(-, root, root, -)
|
||||
%{_mandir}/man3/libhavege.3*
|
||||
%dir %{_includedir}/%{name}
|
||||
%{_includedir}/%{name}/havege*.h
|
||||
%doc contrib/build/havege_sample.c
|
||||
%{_libdir}/*.so*
|
||||
|
40
contrib/build/nolib.spec
Normal file
40
contrib/build/nolib.spec
Normal file
|
@ -0,0 +1,40 @@
|
|||
#
|
||||
# Sample spec file for haveged
|
||||
# Copyright (c) 2013-2014
|
||||
# This file and all modifications and additions to the pristine
|
||||
# package are under the same license as the package itself.
|
||||
#
|
||||
Name: haveged
|
||||
Version: 1.9
|
||||
Release: 1
|
||||
License: GPLv3
|
||||
Group: System Environment/Daemons
|
||||
Summary: Feed entropy into random pool
|
||||
URL: http://www.issihosts.com/haveged/
|
||||
Source0: http://www.issihosts.com/haveged/haveged-%{version}.tar.gz
|
||||
BuildRoot: %{_builddir}/%{name}-root
|
||||
|
||||
%description
|
||||
The haveged daemon feeds the linux entropy pool with random
|
||||
numbers generated from hidden processor state.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
./configure
|
||||
make
|
||||
make check
|
||||
|
||||
%install
|
||||
[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
%clean
|
||||
[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
/usr/local/sbin/haveged
|
||||
/usr/local/share/man/man8/haveged.8
|
||||
/etc/init.d/haveged
|
12
contrib/diags/bins.p
Normal file
12
contrib/diags/bins.p
Normal file
|
@ -0,0 +1,12 @@
|
|||
unset key
|
||||
set ticslevel 0.1
|
||||
set xlabel "Step"
|
||||
set ylabel "Tick"
|
||||
set zlabel "Count"
|
||||
set zlabel rotate
|
||||
set xtic .2
|
||||
set ytic 1
|
||||
set grid x y z
|
||||
set title "Ticks Frequency"
|
||||
splot("run.bins")
|
||||
|
341
contrib/diags/data_prep.c
Normal file
341
contrib/diags/data_prep.c
Normal file
|
@ -0,0 +1,341 @@
|
|||
/**
|
||||
** Data preparation for diagnostic interfaces
|
||||
**
|
||||
** Copyright 2009-2011 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2011 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <math.h>
|
||||
|
||||
/**
|
||||
* Something borrowed......
|
||||
*/
|
||||
#define APP_BUFF_SIZE 1024
|
||||
#define NDSIZECOLLECT 0x1000000
|
||||
|
||||
typedef unsigned int U_INT;
|
||||
|
||||
struct pparams {
|
||||
int cmd; // command to execute
|
||||
int options; // debug options
|
||||
char *outpath; // output file;
|
||||
FILE *input; // input file
|
||||
FILE *output; // output file
|
||||
U_INT limit; // limit delta
|
||||
U_INT repeat; // repeat values
|
||||
U_INT value; // inject value
|
||||
U_INT bsize; // Buffer size
|
||||
double xs; // X scale
|
||||
};
|
||||
/**
|
||||
* For bin output
|
||||
*/
|
||||
#define X_BINS 512
|
||||
#define Y_BINS 2048
|
||||
/**
|
||||
* Divide data into bins
|
||||
*/
|
||||
#define X_FACTOR (1.0 * X_BINS)/(1.0 * p->bsize)
|
||||
#define Y_FACTOR (0.5 * Y_BINS)/(1.0 * 0x7fffffff)
|
||||
/*
|
||||
* Scale bins back to values x = 1M, y=4.0G
|
||||
*/
|
||||
#define X_SCALE (p->xs/X_BINS)
|
||||
#define Y_SCALE (4.0/Y_BINS)
|
||||
|
||||
static int inject_output(struct pparams *p);
|
||||
static void matrix_output(struct pparams *p);
|
||||
static void sequence_output(struct pparams *p);
|
||||
static void usage(int nopts, struct option *long_options, const char **cmds);
|
||||
/**
|
||||
* Data Prep
|
||||
*/
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static const char* cmds[] = {
|
||||
"b", "buffer", "1", "buffer size (k): default 1024",
|
||||
"f", "file", "1", "output file name: default is '-' (stdout)",
|
||||
"i", "inject", "1", "inject 0=2up, 1=1up, 2=raw 1up",
|
||||
"o", "output", "1", "[bin|delta|inject|raw|xor|wrap] data",
|
||||
"r", "repeat", "1", "repeat inject sequence",
|
||||
"s", "start", "1", "start value inject sequence",
|
||||
"u", "upper", "1", "inject sequence upper bound",
|
||||
"v", "verbose", "1", "verbose reporting",
|
||||
"h", "help", "0", "This help"
|
||||
};
|
||||
char *outputs[] = {"bin","delta","inject","raw","xor","wrap",NULL};
|
||||
static int nopts = sizeof(cmds)/(4*sizeof(char *));
|
||||
struct option long_options[nopts+1];
|
||||
char short_options[1+nopts*2];
|
||||
struct pparams params;
|
||||
FILE *f;
|
||||
U_INT i, j, n;
|
||||
int c;
|
||||
char *s;
|
||||
|
||||
for(i=j=0;j<(nopts*4);j+=4) {
|
||||
long_options[i].name = cmds[j+1];
|
||||
long_options[i].has_arg = atoi(cmds[j+2]);
|
||||
long_options[i].flag = NULL;
|
||||
long_options[i].val = cmds[j][0];
|
||||
strcat(short_options,cmds[j]);
|
||||
if (long_options[i].has_arg!=0) strcat(short_options,":");
|
||||
i += 1;
|
||||
}
|
||||
memset(&long_options[i], 0, sizeof(struct option));
|
||||
memset(¶ms, 0, sizeof(struct pparams));
|
||||
params.outpath = "-";
|
||||
params.bsize = NDSIZECOLLECT;
|
||||
params.xs = 1.0;
|
||||
do {
|
||||
c = getopt_long (argc, argv, short_options, long_options, NULL);
|
||||
switch(c) {
|
||||
case 'b':
|
||||
params.bsize = atoi(optarg);
|
||||
params.xs = params.bsize;
|
||||
while(params.xs >= 10.0)
|
||||
params.xs /= 10.0;
|
||||
break;
|
||||
case 'f':
|
||||
params.outpath = optarg;
|
||||
break;
|
||||
case 'i':
|
||||
params.options = atoi(optarg);
|
||||
break;
|
||||
case 'o':
|
||||
n = strlen(optarg);
|
||||
for(i=0;outputs[i]!=NULL;i++)
|
||||
if (!strncmp(optarg, outputs[i], n)) {
|
||||
params.cmd = optarg[0];
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
params.repeat = atoi(optarg);
|
||||
break;
|
||||
case 's':
|
||||
params.value = atoi(optarg);
|
||||
break;
|
||||
case 'u':
|
||||
params.limit = atoi(optarg);
|
||||
break;
|
||||
case 'v':
|
||||
params.cmd = atoi(optarg);
|
||||
break;
|
||||
case '?':
|
||||
case 'h':
|
||||
usage(nopts, long_options, cmds);
|
||||
case -1:
|
||||
break;
|
||||
}
|
||||
} while (c!=-1);
|
||||
|
||||
if (0==params.cmd || optind != (argc-1))
|
||||
usage(nopts, long_options, cmds);
|
||||
if (!strcmp(argv[1],"-"))
|
||||
params.input = stdin;
|
||||
else {
|
||||
params.input = fopen(argv[optind], "rb");
|
||||
if (NULL == params.input) {
|
||||
fprintf(stderr, "Unable to open input %s\n", argv[optind]);
|
||||
exit(2);
|
||||
}
|
||||
}
|
||||
if (!strcmp(params.outpath, "-"))
|
||||
params.output = stdout;
|
||||
else {
|
||||
params.output = fopen(params.outpath, "wb");
|
||||
if (NULL == params.output) {
|
||||
fprintf(stderr, "Unable to open %s\n", params.outpath);
|
||||
exit(3);
|
||||
}
|
||||
fprintf(stdout, "writing to %s\n", params.outpath);
|
||||
}
|
||||
switch(params.cmd) {
|
||||
case 'i':
|
||||
while(inject_output(¶ms)>0)
|
||||
;
|
||||
break;
|
||||
case 'b':
|
||||
matrix_output(¶ms);
|
||||
break;
|
||||
case 'd': case 'r': case 'x': case 'w':
|
||||
sequence_output(¶ms);
|
||||
break;
|
||||
}
|
||||
if (params.output != stdout)
|
||||
fclose(params.output);
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Create injection data - input file is log10 sequence data - can be repeated
|
||||
*/
|
||||
static int inject_output(struct pparams *p)
|
||||
{
|
||||
U_INT buf[APP_BUFF_SIZE];
|
||||
char ibuf[80], *s;
|
||||
U_INT i, j;
|
||||
double n, delta;
|
||||
int rv = 1;
|
||||
|
||||
n = 0;
|
||||
for(i=0;i<APP_BUFF_SIZE && rv==1;i++) {
|
||||
buf[i] = p->value;
|
||||
s = fgets(ibuf, 80, p->input);
|
||||
if (NULL == s && p->repeat != 0) {
|
||||
p->repeat -= 1;
|
||||
rewind(p->input);
|
||||
s = fgets(ibuf, 80, p->input);
|
||||
}
|
||||
if (NULL != s) {
|
||||
if (p->options!=0)
|
||||
delta = strtod(ibuf, NULL);
|
||||
else {
|
||||
n = strtod(ibuf, &s);
|
||||
delta = strtod(s, NULL);
|
||||
}
|
||||
if (p->limit != 0 && delta > p->limit)
|
||||
delta -= p->limit;
|
||||
if (p->options == 2)
|
||||
p->value = (U_INT) delta;
|
||||
else p->value += (U_INT)pow(10.0,delta);
|
||||
}
|
||||
else rv = 0;
|
||||
}
|
||||
if (i != fwrite(buf, sizeof(U_INT), i, p->output)) {
|
||||
printf("Write error\n");
|
||||
rv = -1;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
/**
|
||||
* Create matrix data file
|
||||
*/
|
||||
static void matrix_output(struct pparams *p)
|
||||
{
|
||||
U_INT buf[APP_BUFF_SIZE];
|
||||
U_INT **matrix;
|
||||
FILE *f = p->input;
|
||||
int i, n, sz, x, y;
|
||||
|
||||
matrix = (U_INT **) malloc(sizeof(U_INT **) * X_BINS);
|
||||
if (NULL == matrix) {
|
||||
fprintf(stderr, "Unable to allocate cols\n");
|
||||
return;
|
||||
}
|
||||
sz = sizeof(U_INT *) * Y_BINS;
|
||||
for (i = 0;i< X_BINS;i++) {
|
||||
matrix[i] = (U_INT *)malloc(sz);
|
||||
if (NULL == matrix[i]) {
|
||||
fprintf(stderr, "Unable to allocate row\n");
|
||||
return;
|
||||
}
|
||||
memset(matrix[i], 0, sz);
|
||||
}
|
||||
n = 0;
|
||||
while(1) {
|
||||
sz = fread(buf, sizeof(U_INT), APP_BUFF_SIZE, f);
|
||||
if (sz < 1)
|
||||
break;
|
||||
for(i=0;i<sz;i++) {
|
||||
x = (int)(n * X_FACTOR);
|
||||
y = (int)(buf[i] * Y_FACTOR);
|
||||
matrix[x][y] += 1;
|
||||
n += 1;
|
||||
n %= p->bsize;
|
||||
}
|
||||
}
|
||||
for(x=0;x<X_BINS;x++)
|
||||
for(y=0;y<Y_BINS;y++)
|
||||
if (matrix[x][y]!=0)
|
||||
fprintf(p->output,"%g\t%g\t%u\n", x*X_SCALE, y*Y_SCALE, matrix[x][y]);
|
||||
}
|
||||
/**
|
||||
* Create sequence data file
|
||||
*/
|
||||
static void sequence_output(struct pparams *p)
|
||||
{
|
||||
U_INT buf[APP_BUFF_SIZE];
|
||||
FILE *f = p->input;
|
||||
int i, m, n, sz;
|
||||
U_INT delta, cur, prev;
|
||||
U_INT plus, minus;
|
||||
|
||||
m = p->cmd=='r'? 1 : 0;
|
||||
n = 0;
|
||||
plus = minus = 0;
|
||||
while(1) {
|
||||
sz = fread(buf, sizeof(U_INT), APP_BUFF_SIZE, f);
|
||||
if (sz < 1)
|
||||
break;
|
||||
for(i=0;i<sz;i++) {
|
||||
prev = cur;
|
||||
cur = buf[i];
|
||||
if (m==0) {
|
||||
m = 1;
|
||||
}
|
||||
else switch(p->cmd) {
|
||||
case 'd':
|
||||
if (cur < prev)
|
||||
delta = prev - cur;
|
||||
else delta = cur - prev;
|
||||
fprintf(p->output,"%g\t%g\n", n * 10.0/1024.0, log10(delta));
|
||||
break;
|
||||
case 'x':
|
||||
fprintf(p->output,"%g\t%g\n", n * 10.0/1024.0, log10(cur^prev));
|
||||
break;
|
||||
case 'r':
|
||||
fprintf(p->output,"%g\t%g\n", n * 10.0/1024.0, 1.0 * cur);
|
||||
break;
|
||||
case 'w':
|
||||
if (cur < prev) {
|
||||
if (p->options & 1)
|
||||
fprintf(p->output,"rollover %d\n", n);
|
||||
minus++;
|
||||
}
|
||||
else plus++;
|
||||
break;
|
||||
}
|
||||
n += 1;
|
||||
n %= p->bsize;
|
||||
}
|
||||
}
|
||||
if (p->cmd=='w')
|
||||
fprintf(p->output,"Rollover %u/%u = %g\n", minus, plus, minus*100/(double)(minus+plus));
|
||||
}
|
||||
/**
|
||||
* usage
|
||||
*/
|
||||
static void usage(int nopts, struct option *long_options, const char **cmds)
|
||||
{
|
||||
int i;
|
||||
|
||||
fprintf(stderr, "\nUsage: %s [options] <file>\n\n", "data_prep");
|
||||
fprintf(stderr, "Prepare diagnostic data from <file>\n\n");
|
||||
fprintf(stderr, " Options:\n");
|
||||
for(i=0;long_options[i].val != 0;i++) {
|
||||
fprintf(stderr," --%-10s, -%c %s %s\n",
|
||||
long_options[i].name, long_options[i].val,
|
||||
long_options[i].has_arg? "[]":" ",cmds[4*i+3]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
8
contrib/diags/inc.p
Normal file
8
contrib/diags/inc.p
Normal file
|
@ -0,0 +1,8 @@
|
|||
unset key
|
||||
set xlabel "Step"
|
||||
set ylabel "log10(increment)"
|
||||
set ylabel rotate
|
||||
set xtic auto
|
||||
set ytic auto
|
||||
set title "Ticks Increment"
|
||||
plot("run.inc")
|
6
contrib/diags/lognorm.r
Normal file
6
contrib/diags/lognorm.r
Normal file
|
@ -0,0 +1,6 @@
|
|||
x = rnorm(16*1024*1024, mean=2.005285, sd=0.2162)
|
||||
write(x,file="i7.ln",ncolumns=1)
|
||||
x = rnorm(16*1024*1024, mean=2.744504, sd=0.93767)
|
||||
write(x,file="xeon.ln",ncolumns=1)
|
||||
x = rnorm(16*1024*1024, mean=5.9478, sd=2.4142)
|
||||
write(x,file="celeron.ln",ncolumns=1)
|
13
contrib/diags/lognorm.sh
Executable file
13
contrib/diags/lognorm.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
src/haveged -n 16m -f i7.dat -r 4 -s i7.ln
|
||||
ent/entest -vf i7.dat
|
||||
nist/nist i7.dat
|
||||
mv nist.out i7.out
|
||||
src/haveged -n 16m -f xeon.dat -r 4 -s xeon.ln
|
||||
ent/entest -vf xeon.dat
|
||||
nist/nist xeon.dat
|
||||
mv nist.out xeon.out
|
||||
src/haveged -n 16m -f celeron.dat -r 4 -s celeron.ln
|
||||
ent/entest -vf celeron.dat
|
||||
nist/nist celeron.dat
|
||||
mv nist.out celeron.out
|
22
ent/Makefile.am
Normal file
22
ent/Makefile.am
Normal file
|
@ -0,0 +1,22 @@
|
|||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
if ENABLE_ENT_TEST
|
||||
check_PROGRAMS = entest
|
||||
endif
|
||||
|
||||
AM_CFLAGS=-Wall
|
||||
|
||||
entest_LDADD = -lm
|
||||
|
||||
entest_SOURCES = entest.c iso8859.c randtest.c chisq.c iso8859.h randtest.h
|
||||
|
||||
CLEANFILES = sample
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
if ENABLE_ENT_TEST
|
||||
check-local:
|
||||
./entest -t ${srcdir}/entitle.gif
|
||||
../src/haveged -n 16384k -v 1 $*
|
||||
./entest -vf sample
|
||||
endif
|
577
ent/Makefile.in
Normal file
577
ent/Makefile.in
Normal file
|
@ -0,0 +1,577 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@ENABLE_ENT_TEST_TRUE@check_PROGRAMS = entest$(EXEEXT)
|
||||
subdir = ent
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am_entest_OBJECTS = entest.$(OBJEXT) iso8859.$(OBJEXT) \
|
||||
randtest.$(OBJEXT) chisq.$(OBJEXT)
|
||||
entest_OBJECTS = $(am_entest_OBJECTS)
|
||||
entest_DEPENDENCIES =
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(entest_SOURCES)
|
||||
DIST_SOURCES = $(entest_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@
|
||||
HA_DISTRO = @HA_DISTRO@
|
||||
HA_LDFLAGS = @HA_LDFLAGS@
|
||||
HA_UNITD = @HA_UNITD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CFLAGS = -Wall
|
||||
entest_LDADD = -lm
|
||||
entest_SOURCES = entest.c iso8859.c randtest.c chisq.c iso8859.h randtest.h
|
||||
CLEANFILES = sample
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps ent/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps ent/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
entest$(EXEEXT): $(entest_OBJECTS) $(entest_DEPENDENCIES) $(EXTRA_entest_DEPENDENCIES)
|
||||
@rm -f entest$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(entest_OBJECTS) $(entest_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@ENABLE_ENT_TEST_FALSE@check-local:
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-local
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: check-am install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
|
||||
clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
|
||||
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
@ENABLE_ENT_TEST_TRUE@check-local:
|
||||
@ENABLE_ENT_TEST_TRUE@ ./entest -t ${srcdir}/entitle.gif
|
||||
@ENABLE_ENT_TEST_TRUE@ ../src/haveged -n 16384k -v 1 $*
|
||||
@ENABLE_ENT_TEST_TRUE@ ./entest -vf sample
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
136
ent/chisq.c
Normal file
136
ent/chisq.c
Normal file
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
|
||||
Compute probability of measured Chi Square value.
|
||||
|
||||
This code was developed by Gary Perlman of the Wang
|
||||
Institute (full citation below) and has been minimally
|
||||
modified for use in this program.
|
||||
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/*HEADER
|
||||
Module: z.c
|
||||
Purpose: compute approximations to normal z distribution probabilities
|
||||
Programmer: Gary Perlman
|
||||
Organization: Wang Institute, Tyngsboro, MA 01879
|
||||
Copyright: none
|
||||
Tabstops: 4
|
||||
*/
|
||||
|
||||
#define Z_MAX 6.0 /* maximum meaningful z value */
|
||||
|
||||
/*FUNCTION poz: probability of normal z value */
|
||||
/*ALGORITHM
|
||||
Adapted from a polynomial approximation in:
|
||||
Ibbetson D, Algorithm 209
|
||||
Collected Algorithms of the CACM 1963 p. 616
|
||||
Note:
|
||||
This routine has six digit accuracy, so it is only useful for absolute
|
||||
z values < 6. For z values >= to 6.0, poz() returns 0.0.
|
||||
*/
|
||||
static double /*VAR returns cumulative probability from -oo to z */
|
||||
poz(const double z) /*VAR normal z value */
|
||||
{
|
||||
double y, x, w;
|
||||
|
||||
if (z == 0.0) {
|
||||
x = 0.0;
|
||||
} else {
|
||||
y = 0.5 * fabs(z);
|
||||
if (y >= (Z_MAX * 0.5)) {
|
||||
x = 1.0;
|
||||
} else if (y < 1.0) {
|
||||
w = y * y;
|
||||
x = ((((((((0.000124818987 * w
|
||||
-0.001075204047) * w +0.005198775019) * w
|
||||
-0.019198292004) * w +0.059054035642) * w
|
||||
-0.151968751364) * w +0.319152932694) * w
|
||||
-0.531923007300) * w +0.797884560593) * y * 2.0;
|
||||
} else {
|
||||
y -= 2.0;
|
||||
x = (((((((((((((-0.000045255659 * y
|
||||
+0.000152529290) * y -0.000019538132) * y
|
||||
-0.000676904986) * y +0.001390604284) * y
|
||||
-0.000794620820) * y -0.002034254874) * y
|
||||
+0.006549791214) * y -0.010557625006) * y
|
||||
+0.011630447319) * y -0.009279453341) * y
|
||||
+0.005353579108) * y -0.002141268741) * y
|
||||
+0.000535310849) * y +0.999936657524;
|
||||
}
|
||||
}
|
||||
return (z > 0.0 ? ((x + 1.0) * 0.5) : ((1.0 - x) * 0.5));
|
||||
}
|
||||
|
||||
/*
|
||||
Module: chisq.c
|
||||
Purpose: compute approximations to chisquare distribution probabilities
|
||||
Contents: pochisq()
|
||||
Uses: poz() in z.c (Algorithm 209)
|
||||
Programmer: Gary Perlman
|
||||
Organization: Wang Institute, Tyngsboro, MA 01879
|
||||
Copyright: none
|
||||
Tabstops: 4
|
||||
*/
|
||||
|
||||
#define LOG_SQRT_PI 0.5723649429247000870717135 /* log (sqrt (pi)) */
|
||||
#define I_SQRT_PI 0.5641895835477562869480795 /* 1 / sqrt (pi) */
|
||||
#define BIGX 20.0 /* max value to represent exp (x) */
|
||||
#define ex(x) (((x) < -BIGX) ? 0.0 : exp(x))
|
||||
|
||||
/*FUNCTION pochisq: probability of chi sqaure value */
|
||||
/*ALGORITHM Compute probability of chi square value.
|
||||
Adapted from:
|
||||
Hill, I. D. and Pike, M. C. Algorithm 299
|
||||
Collected Algorithms for the CACM 1967 p. 243
|
||||
Updated for rounding errors based on remark in
|
||||
ACM TOMS June 1985, page 185
|
||||
*/
|
||||
|
||||
double pochisq(
|
||||
const double ax, /* obtained chi-square value */
|
||||
const int df /* degrees of freedom */
|
||||
)
|
||||
{
|
||||
double x = ax;
|
||||
double a, y=0, s;
|
||||
double e, c, z;
|
||||
int even; /* true if df is an even number */
|
||||
|
||||
if (x <= 0.0 || df < 1) {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
a = 0.5 * x;
|
||||
even = (2 * (df / 2)) == df;
|
||||
if (df > 1) {
|
||||
y = ex(-a);
|
||||
}
|
||||
s = (even ? y : (2.0 * poz(-sqrt(x))));
|
||||
if (df > 2) {
|
||||
x = 0.5 * (df - 1.0);
|
||||
z = (even ? 1.0 : 0.5);
|
||||
if (a > BIGX) {
|
||||
e = (even ? 0.0 : LOG_SQRT_PI);
|
||||
c = log(a);
|
||||
while (z <= x) {
|
||||
e = log(z) + e;
|
||||
s += ex(c * z - a - e);
|
||||
z += 1.0;
|
||||
}
|
||||
return (s);
|
||||
} else {
|
||||
e = (even ? 1.0 : (I_SQRT_PI / sqrt(a)));
|
||||
c = 0.0;
|
||||
while (z <= x) {
|
||||
e = e * (a / z);
|
||||
c = c + e;
|
||||
z += 1.0;
|
||||
}
|
||||
return (c * y + s);
|
||||
}
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}
|
270
ent/entest.c
Normal file
270
ent/entest.c
Normal file
|
@ -0,0 +1,270 @@
|
|||
/*
|
||||
ENT -- Entropy calculation and analysis of putative
|
||||
random sequences.
|
||||
|
||||
Designed and implemented by John "Random" Walker in May 1985.
|
||||
|
||||
Multiple analyses of random sequences added in December 1985.
|
||||
|
||||
Bit stream analysis added in September 1997.
|
||||
|
||||
Terse mode output, getopt() command line processing,
|
||||
optional stdin input, and HTML documentation added in
|
||||
October 1998.
|
||||
|
||||
Documentation for the -t (terse output) option added
|
||||
in July 2006.
|
||||
|
||||
Replaced table look-up for chi square to probability
|
||||
conversion with algorithmic computation in January 2008.
|
||||
|
||||
Hacked for haveged test April 2009
|
||||
|
||||
For additional information and the latest version,
|
||||
see http://www.fourmilab.ch/random/
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <math.h>
|
||||
#include "getopt.h"
|
||||
#ifdef _WIN32
|
||||
#include <fcntl.h>
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "iso8859.h"
|
||||
#include "randtest.h"
|
||||
|
||||
#define UPDATE "January 28th, 2008"
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#ifdef M_PI
|
||||
#define PI M_PI
|
||||
#else
|
||||
#define PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
extern double pochisq(const double ax, const int df);
|
||||
|
||||
struct pparams {
|
||||
double chisqr;
|
||||
double entropy;
|
||||
double mean;
|
||||
double pi;
|
||||
double seq;
|
||||
double xtreme;
|
||||
};
|
||||
|
||||
static struct pparams defaults = {
|
||||
.chisqr = 1, // bounds - should be >1% and <99%
|
||||
.entropy = 7.5, // minimum - should be close to 8
|
||||
.mean = 127.0, // minimum - should be close to 127.5
|
||||
.pi = 0.5, // maximum - error deviation in percent
|
||||
.seq = 0.8, // minimum - should be close to 1
|
||||
.xtreme = 0.00001 // maximum - result deviation
|
||||
};
|
||||
struct pparams *params = &defaults;
|
||||
|
||||
static int check(long totalc, double ent, double chip, double mean, double montepi, double scc)
|
||||
{
|
||||
char failures[512];
|
||||
int offs=0;
|
||||
double p;
|
||||
double p0 = params->chisqr;
|
||||
double p1 = 100-p0;
|
||||
if (ent<params->entropy) {
|
||||
sprintf(failures+offs,"entropy:%f<%f ",ent,params->entropy);
|
||||
offs=strlen(failures);
|
||||
}
|
||||
chip *= 100;
|
||||
if (chip<p0||chip>p1) {
|
||||
sprintf(failures+offs,"chisqr:%f%% not in %f-%f ",chip,p0,p1);
|
||||
offs=strlen(failures);
|
||||
}
|
||||
if (mean<params->mean) {
|
||||
sprintf(failures+offs,"mean:%f<%f ",mean,params->mean);
|
||||
offs=strlen(failures);
|
||||
}
|
||||
p = 100*(montepi-PI)/PI;
|
||||
if (fabs(p)>params->pi) {
|
||||
sprintf(failures+offs,"pi:%f %f>%f ",montepi,p,params->pi);
|
||||
offs=strlen(failures);
|
||||
}
|
||||
if (scc>params->seq) {
|
||||
sprintf(failures+offs,"sequence:%f>%f ",scc,params->seq);
|
||||
offs=strlen(failures);
|
||||
}
|
||||
if (offs) {
|
||||
printf("Check Fail: %s\n",failures);
|
||||
return -1;
|
||||
}
|
||||
printf("Sample looks good!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Who checks the checker? The ent self-test test the various options by collecting the output
|
||||
* of the various options on a given input in a text and then doing a diff with the expected
|
||||
* output. IMHO the text comparison is pretty cheezy since doubles are involved. We make the
|
||||
* same check but do not require equality on the quantities involved
|
||||
*/
|
||||
|
||||
static int checkSelf(long totalc, double ent, double chisq, double mean, double montepi, double scc)
|
||||
{
|
||||
double ref[6] = {11619,7.787095,6567.223255,110.000258,3.392562,0.098324};
|
||||
double tst[6] = {totalc,ent,chisq,mean,montepi,scc};
|
||||
int i;double f;
|
||||
for(i=0;i<6;i++) {
|
||||
f=fabs(tst[i]-ref[i])/ref[i];
|
||||
if (f > params->xtreme) {
|
||||
printf("Self-test(%d) failed:%f?",i,f);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
printf("Self-test good!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* HELP -- Print information on how to call */
|
||||
|
||||
static void help(void)
|
||||
{
|
||||
printf("entest -- Test the havege RNG.");
|
||||
printf("\n");
|
||||
printf("\n Options: -c<min> Chi Square Threshold");
|
||||
printf("\n -e<min> Min entropy/char");
|
||||
printf("\n -f<file> File");
|
||||
printf("\n -m<min> Min arithmetic mean");
|
||||
printf("\n -p<max> Max error in pi");
|
||||
printf("\n -s<min> Min serial coeficient");
|
||||
printf("\n -t Self test");
|
||||
printf("\n -u Print this message\n");
|
||||
printf("\n -v Verbose - show the stats");
|
||||
printf("\nAdapted from the work of John Walker");
|
||||
printf("\n http://www.fourmilab.ch/\n\n");
|
||||
}
|
||||
|
||||
|
||||
/* Main program */
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int oc, opt;
|
||||
long ccount[256]; /* Bins to count occurrences of values */
|
||||
long totalc = 0; /* Total character count */
|
||||
double montepi, chip,
|
||||
scc, ent, mean, chisq;
|
||||
FILE *fp = stdin;
|
||||
int fold = FALSE, /* Fold upper to lower */
|
||||
binary = FALSE, /* Treat input as a bitstream */
|
||||
stest = FALSE,
|
||||
verbose = FALSE;
|
||||
char *filename="";
|
||||
|
||||
while ((opt = getopt(argc, argv, "?c:e:f:m:p:s:t:v")) != -1) {
|
||||
switch (toISOlower(opt)) {
|
||||
case 'c':
|
||||
params->chisqr = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
params->entropy = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
filename = optarg;
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
params->mean = atof(optarg);
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
params->pi = atof(optarg);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
params->seq = atof(optarg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
filename = optarg;
|
||||
/* filename = "entitle.gif"; */
|
||||
stest = TRUE;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
verbose = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
help();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!strlen(filename)) {
|
||||
printf("Need input file\n");
|
||||
help();
|
||||
return 2;
|
||||
}
|
||||
if ((fp = fopen(filename, "rb")) == NULL) {
|
||||
printf("Cannot open file %s\n", filename);
|
||||
return 2;
|
||||
}
|
||||
memset(ccount, 0, sizeof ccount);
|
||||
|
||||
/* Initialise for calculations */
|
||||
|
||||
rt_init(binary);
|
||||
|
||||
/* Scan input file and count character occurrences */
|
||||
|
||||
while ((oc = fgetc(fp)) != EOF) {
|
||||
unsigned char ocb;
|
||||
|
||||
if (fold && isISOalpha(oc) && isISOupper(oc)) {
|
||||
oc = toISOlower(oc);
|
||||
}
|
||||
ocb = (unsigned char) oc;
|
||||
totalc += binary ? 8 : 1;
|
||||
if (binary) {
|
||||
int b;
|
||||
unsigned char ob = ocb;
|
||||
|
||||
for (b = 0; b < 8; b++) {
|
||||
ccount[ob & 1]++;
|
||||
ob >>= 1;
|
||||
}
|
||||
} else {
|
||||
ccount[ocb]++; /* Update counter for this bin */
|
||||
}
|
||||
rt_add(&ocb, 1);
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
/* Complete calculation and return sequence metrics */
|
||||
|
||||
rt_end(&ent, &chisq, &mean, &montepi, &scc);
|
||||
chip = pochisq(chisq, (binary ? 1 : 255));
|
||||
|
||||
if (verbose)
|
||||
printf("\nTest Results\n"
|
||||
"Sample: %ld bytes\n"
|
||||
"Entropy: %f bits\n"
|
||||
"Chi-Square: %f(%f%%)\n"
|
||||
"Mean: %f\n"
|
||||
"PI: %f(%f%%)\n"
|
||||
"Correlation: %f\n",
|
||||
totalc, ent, chisq, chip*100, mean, montepi,100*(montepi-PI)/PI,scc);
|
||||
|
||||
if (stest)
|
||||
return checkSelf(totalc, ent, chisq, mean, montepi, scc);
|
||||
return check(totalc, ent, chip, mean, montepi, scc);
|
||||
}
|
BIN
ent/entitle.gif
Normal file
BIN
ent/entitle.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
19
ent/iso8859.c
Normal file
19
ent/iso8859.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
/* ISO 8859/1 Latin-1 alphabetic and upper and lower case bit vector tables. */
|
||||
|
||||
/* LINTLIBRARY */
|
||||
|
||||
unsigned char isoalpha[32] = {
|
||||
0,0,0,0,0,0,0,0,127,255,255,224,127,255,255,224,0,0,0,0,0,0,0,0,255,255,
|
||||
254,255,255,255,254,255
|
||||
};
|
||||
|
||||
unsigned char isoupper[32] = {
|
||||
0,0,0,0,0,0,0,0,127,255,255,224,0,0,0,0,0,0,0,0,0,0,0,0,255,255,254,254,
|
||||
0,0,0,0
|
||||
};
|
||||
|
||||
unsigned char isolower[32] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,127,255,255,224,0,0,0,0,0,0,0,0,0,0,0,1,255,255,
|
||||
254,255
|
||||
};
|
17
ent/iso8859.h
Normal file
17
ent/iso8859.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
/* ISO 8859/1 Latin-1 "ctype" macro replacements. */
|
||||
|
||||
extern unsigned char isoalpha[32], isoupper[32], isolower[32];
|
||||
|
||||
#define isISOspace(x) ((isascii(((unsigned char) (x))) && isspace(((unsigned char) (x)))) || ((x) == 0xA0))
|
||||
#define isISOalpha(x) ((isoalpha[(((unsigned char) (x))) / 8] & (0x80 >> ((((unsigned char) (x))) % 8))) != 0)
|
||||
#define isISOupper(x) ((isoupper[(((unsigned char) (x))) / 8] & (0x80 >> ((((unsigned char) (x))) % 8))) != 0)
|
||||
#define isISOlower(x) ((isolower[(((unsigned char) (x))) / 8] & (0x80 >> ((((unsigned char) (x))) % 8))) != 0)
|
||||
#define isISOprint(x) ((((x) >= ' ') && ((x) <= '~')) || ((x) >= 0xA0))
|
||||
#define toISOupper(x) (isISOlower(x) ? (isascii(((unsigned char) (x))) ? \
|
||||
toupper(x) : (((((unsigned char) (x)) != 0xDF) && \
|
||||
(((unsigned char) (x)) != 0xFF)) ? \
|
||||
(((unsigned char) (x)) - 0x20) : (x))) : (x))
|
||||
#define toISOlower(x) (isISOupper(x) ? (isascii(((unsigned char) (x))) ? \
|
||||
tolower(x) : (((unsigned char) (x)) + 0x20)) \
|
||||
: (x))
|
183
ent/randtest.c
Normal file
183
ent/randtest.c
Normal file
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
|
||||
Apply various randomness tests to a stream of bytes
|
||||
|
||||
by John Walker -- September 1996
|
||||
http://www.fourmilab.ch/
|
||||
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
|
||||
#define log2of10 3.32192809488736234787
|
||||
|
||||
static int binary = FALSE; /* Treat input as a bitstream */
|
||||
|
||||
static long ccount[256], /* Bins to count occurrences of values */
|
||||
totalc = 0; /* Total bytes counted */
|
||||
static double prob[256]; /* Probabilities per bin for entropy */
|
||||
|
||||
/* RT_LOG2 -- Calculate log to the base 2 */
|
||||
|
||||
static double rt_log2(double x)
|
||||
{
|
||||
return log2of10 * log10(x);
|
||||
}
|
||||
|
||||
#define MONTEN 6 /* Bytes used as Monte Carlo
|
||||
co-ordinates. This should be no more
|
||||
bits than the mantissa of your
|
||||
"double" floating point type. */
|
||||
|
||||
static int mp, sccfirst;
|
||||
static unsigned int monte[MONTEN];
|
||||
static long inmont, mcount;
|
||||
static double cexp, incirc, montex, montey, montepi,
|
||||
scc, sccun, sccu0, scclast, scct1, scct2, scct3,
|
||||
ent, chisq, datasum;
|
||||
|
||||
/* RT_INIT -- Initialise random test counters. */
|
||||
|
||||
void rt_init(int binmode)
|
||||
{
|
||||
int i;
|
||||
|
||||
binary = binmode; /* Set binary / byte mode */
|
||||
|
||||
/* Initialise for calculations */
|
||||
|
||||
ent = 0.0; /* Clear entropy accumulator */
|
||||
chisq = 0.0; /* Clear Chi-Square */
|
||||
datasum = 0.0; /* Clear sum of bytes for arithmetic mean */
|
||||
|
||||
mp = 0; /* Reset Monte Carlo accumulator pointer */
|
||||
mcount = 0; /* Clear Monte Carlo tries */
|
||||
inmont = 0; /* Clear Monte Carlo inside count */
|
||||
incirc = 65535.0 * 65535.0;/* In-circle distance for Monte Carlo */
|
||||
|
||||
sccfirst = TRUE; /* Mark first time for serial correlation */
|
||||
scct1 = scct2 = scct3 = 0.0; /* Clear serial correlation terms */
|
||||
|
||||
incirc = pow(pow(256.0, (double) (MONTEN / 2)) - 1, 2.0);
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
ccount[i] = 0;
|
||||
}
|
||||
totalc = 0;
|
||||
}
|
||||
|
||||
/* RT_ADD -- Add one or more bytes to accumulation. */
|
||||
|
||||
void rt_add(void *buf, int bufl)
|
||||
{
|
||||
unsigned char *bp = buf;
|
||||
int oc, c, bean;
|
||||
|
||||
while (bean = 0, (bufl-- > 0)) {
|
||||
oc = *bp++;
|
||||
|
||||
do {
|
||||
if (binary) {
|
||||
c = !!(oc & 0x80);
|
||||
} else {
|
||||
c = oc;
|
||||
}
|
||||
ccount[c]++; /* Update counter for this bin */
|
||||
totalc++;
|
||||
|
||||
/* Update inside / outside circle counts for Monte Carlo
|
||||
computation of PI */
|
||||
|
||||
if (bean == 0) {
|
||||
monte[mp++] = oc; /* Save character for Monte Carlo */
|
||||
if (mp >= MONTEN) { /* Calculate every MONTEN character */
|
||||
int mj;
|
||||
|
||||
mp = 0;
|
||||
mcount++;
|
||||
montex = montey = 0;
|
||||
for (mj = 0; mj < MONTEN / 2; mj++) {
|
||||
montex = (montex * 256.0) + monte[mj];
|
||||
montey = (montey * 256.0) + monte[(MONTEN / 2) + mj];
|
||||
}
|
||||
if ((montex * montex + montey * montey) <= incirc) {
|
||||
inmont++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Update calculation of serial correlation coefficient */
|
||||
|
||||
sccun = c;
|
||||
if (sccfirst) {
|
||||
sccfirst = FALSE;
|
||||
scclast = 0;
|
||||
sccu0 = sccun;
|
||||
} else {
|
||||
scct1 = scct1 + scclast * sccun;
|
||||
}
|
||||
scct2 = scct2 + sccun;
|
||||
scct3 = scct3 + (sccun * sccun);
|
||||
scclast = sccun;
|
||||
oc <<= 1;
|
||||
} while (binary && (++bean < 8));
|
||||
}
|
||||
}
|
||||
|
||||
/* RT_END -- Complete calculation and return results. */
|
||||
|
||||
void rt_end(double *r_ent, double *r_chisq, double *r_mean,
|
||||
double *r_montepicalc, double *r_scc)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Complete calculation of serial correlation coefficient */
|
||||
|
||||
scct1 = scct1 + scclast * sccu0;
|
||||
scct2 = scct2 * scct2;
|
||||
scc = totalc * scct3 - scct2;
|
||||
if (scc == 0.0) {
|
||||
scc = -100000;
|
||||
} else {
|
||||
scc = (totalc * scct1 - scct2) / scc;
|
||||
}
|
||||
|
||||
/* Scan bins and calculate probability for each bin and
|
||||
Chi-Square distribution. The probability will be reused
|
||||
in the entropy calculation below. While we're at it,
|
||||
we sum of all the data which will be used to compute the
|
||||
mean. */
|
||||
|
||||
cexp = totalc / (binary ? 2.0 : 256.0); /* Expected count per bin */
|
||||
for (i = 0; i < (binary ? 2 : 256); i++) {
|
||||
double a = ccount[i] - cexp;;
|
||||
|
||||
prob[i] = ((double) ccount[i]) / totalc;
|
||||
chisq += (a * a) / cexp;
|
||||
datasum += ((double) i) * ccount[i];
|
||||
}
|
||||
|
||||
/* Calculate entropy */
|
||||
|
||||
for (i = 0; i < (binary ? 2 : 256); i++) {
|
||||
if (prob[i] > 0.0) {
|
||||
ent += prob[i] * rt_log2(1 / prob[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate Monte Carlo value for PI from percentage of hits
|
||||
within the circle */
|
||||
|
||||
montepi = 4.0 * (((double) inmont) / mcount);
|
||||
|
||||
/* Return results through arguments */
|
||||
|
||||
*r_ent = ent;
|
||||
*r_chisq = chisq;
|
||||
*r_mean = datasum / totalc;
|
||||
*r_montepicalc = montepi;
|
||||
*r_scc = scc;
|
||||
}
|
7
ent/randtest.h
Normal file
7
ent/randtest.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
|
||||
/* Random test function prototypes */
|
||||
|
||||
extern void rt_init(int binmode);
|
||||
extern void rt_add(void *buf, int bufl);
|
||||
extern void rt_end(double *r_ent, double *r_chisq, double *r_mean,
|
||||
double *r_montepicalc, double *r_scc);
|
45
init.d/Makefile.am
Normal file
45
init.d/Makefile.am
Normal file
|
@ -0,0 +1,45 @@
|
|||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
EXTRA_DIST = service.fedora service.forking service.redhat service.suse sysv.lsb sysv.redhat
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
CLEANFILES = haveged haveged.service
|
||||
|
||||
do_subst = sed -e 's,[@]SBIN_DIR[@],$(sbindir),g'
|
||||
src_tmpl = @HA_DISTRO@
|
||||
unit_dir = @HA_UNITD@
|
||||
|
||||
if ENABLE_NOINIT
|
||||
## user will install manually.
|
||||
install-exec-hook:
|
||||
@echo "no init script installed";
|
||||
endif
|
||||
|
||||
if ENABLE_SYSV
|
||||
## legacy init script - installation via automake defaults
|
||||
|
||||
initdir = $(sysconfdir)/init.d
|
||||
init_SCRIPTS = haveged
|
||||
|
||||
haveged: $(src_tmpl) Makefile
|
||||
$(do_subst) < $(srcdir)/$(src_tmpl) > haveged;
|
||||
|
||||
endif
|
||||
|
||||
if ENABLE_SYSTEMD
|
||||
## systemd script - lookup unitdir if not specified
|
||||
|
||||
install-exec-hook:
|
||||
$(do_subst) < $(srcdir)/$(src_tmpl) > haveged.service;
|
||||
|
||||
install-data-hook: install-exec-hook
|
||||
if ENABLE_SYSTEMD_LOOKUP
|
||||
install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
|
||||
else
|
||||
install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
|
||||
endif
|
||||
## Defer systemd call to for cross-compile case
|
||||
## systemctl enable haveged.service;
|
||||
|
||||
endif
|
532
init.d/Makefile.in
Normal file
532
init.d/Makefile.in
Normal file
|
@ -0,0 +1,532 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = init.d
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
am__installdirs = "$(DESTDIR)$(initdir)"
|
||||
SCRIPTS = $(init_SCRIPTS)
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@
|
||||
HA_DISTRO = @HA_DISTRO@
|
||||
HA_LDFLAGS = @HA_LDFLAGS@
|
||||
HA_UNITD = @HA_UNITD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
EXTRA_DIST = service.fedora service.forking service.redhat service.suse sysv.lsb sysv.redhat
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
CLEANFILES = haveged haveged.service
|
||||
do_subst = sed -e 's,[@]SBIN_DIR[@],$(sbindir),g'
|
||||
src_tmpl = @HA_DISTRO@
|
||||
unit_dir = @HA_UNITD@
|
||||
@ENABLE_SYSV_TRUE@initdir = $(sysconfdir)/init.d
|
||||
@ENABLE_SYSV_TRUE@init_SCRIPTS = haveged
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps init.d/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps init.d/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-initSCRIPTS: $(init_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(init_SCRIPTS)'; test -n "$(initdir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(initdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(initdir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n' \
|
||||
-e 'h;s|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
|
||||
if (++n[d] == $(am__install_max)) { \
|
||||
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
|
||||
else { print "f", d "/" $$4, $$1 } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(initdir)$$dir'"; \
|
||||
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(initdir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-initSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(init_SCRIPTS)'; test -n "$(initdir)" || exit 0; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 's,.*/,,;$(transform)'`; \
|
||||
dir='$(DESTDIR)$(initdir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(initdir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
@ENABLE_NOINIT_FALSE@@ENABLE_SYSTEMD_FALSE@install-exec-hook:
|
||||
@ENABLE_SYSTEMD_FALSE@install-data-hook:
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-initSCRIPTS
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
@$(NORMAL_INSTALL)
|
||||
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-initSCRIPTS
|
||||
|
||||
.MAKE: install-am install-data-am install-exec-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
cscopelist-am ctags-am distclean distclean-generic \
|
||||
distclean-libtool distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am \
|
||||
install-data-hook install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-exec-hook install-html install-html-am \
|
||||
install-info install-info-am install-initSCRIPTS install-man \
|
||||
install-pdf install-pdf-am install-ps install-ps-am \
|
||||
install-strip installcheck installcheck-am installdirs \
|
||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags-am uninstall uninstall-am uninstall-initSCRIPTS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
@ENABLE_NOINIT_TRUE@install-exec-hook:
|
||||
@ENABLE_NOINIT_TRUE@ @echo "no init script installed";
|
||||
|
||||
@ENABLE_SYSV_TRUE@haveged: $(src_tmpl) Makefile
|
||||
@ENABLE_SYSV_TRUE@ $(do_subst) < $(srcdir)/$(src_tmpl) > haveged;
|
||||
|
||||
@ENABLE_SYSTEMD_TRUE@install-exec-hook:
|
||||
@ENABLE_SYSTEMD_TRUE@ $(do_subst) < $(srcdir)/$(src_tmpl) > haveged.service;
|
||||
|
||||
@ENABLE_SYSTEMD_TRUE@install-data-hook: install-exec-hook
|
||||
@ENABLE_SYSTEMD_LOOKUP_TRUE@@ENABLE_SYSTEMD_TRUE@ install -p -D -m644 haveged.service $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`/haveged.service;
|
||||
@ENABLE_SYSTEMD_LOOKUP_FALSE@@ENABLE_SYSTEMD_TRUE@ install -p -D -m644 haveged.service $(DESTDIR)$(unit_dir)/haveged.service;
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
35
init.d/service.fedora
Normal file
35
init.d/service.fedora
Normal file
|
@ -0,0 +1,35 @@
|
|||
[Unit]
|
||||
Description=Entropy Daemon based on the HAVEGE algorithm
|
||||
Documentation=man:haveged(8) http://www.issihosts.com/haveged/
|
||||
DefaultDependencies=no
|
||||
After=systemd-tmpfiles-setup-dev.service
|
||||
Before=sysinit.target shutdown.target systemd-journald.service
|
||||
|
||||
[Service]
|
||||
ExecStart=@SBIN_DIR@/haveged -w 1024 -v 1 --Foreground
|
||||
Restart=always
|
||||
SuccessExitStatus=137 143
|
||||
|
||||
SecureBits=noroot-locked
|
||||
CapabilityBoundingSet=CAP_SYS_ADMIN
|
||||
# We can *not* set PrivateTmp=true as it can cause an ordering cycle.
|
||||
PrivateTmp=false
|
||||
PrivateDevices=true
|
||||
PrivateNetwork=true
|
||||
ProtectSystem=full
|
||||
ProtectHome=true
|
||||
ProtectHostname=true
|
||||
ProtectKernelLogs=true
|
||||
ProtectKernelModules=true
|
||||
RestrictNamespaces=true
|
||||
RestrictRealtime=true
|
||||
|
||||
LockPersonality=true
|
||||
MemoryDenyWriteExecute=true
|
||||
SystemCallArchitectures=native
|
||||
SystemCallFilter=@system-service
|
||||
SystemCallFilter=~@mount
|
||||
SystemCallErrorNumber=EPERM
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
11
init.d/service.forking
Normal file
11
init.d/service.forking
Normal file
|
@ -0,0 +1,11 @@
|
|||
[Unit]
|
||||
Description=Entropy Daemon based on the HAVEGE algorithm
|
||||
Documentation=man:haveged(8) http://www.issihosts.com/haveged/
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/run/haveged.pid
|
||||
ExecStart=@SBIN_DIR@/haveged -w 1024 -v 1 -p /run/haveged.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
10
init.d/service.redhat
Normal file
10
init.d/service.redhat
Normal file
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Entropy Daemon based on the HAVEGE algorithm
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
PIDFile=/run/haveged.pid
|
||||
ExecStart=@SBIN_DIR@/haveged -w 1024 -v 1
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
19
init.d/service.suse
Normal file
19
init.d/service.suse
Normal file
|
@ -0,0 +1,19 @@
|
|||
[Unit]
|
||||
Description=Entropy Daemon based on the HAVEGE algorithm
|
||||
Documentation=man:haveged(8) http://www.issihosts.com/haveged/
|
||||
DefaultDependencies=no
|
||||
ConditionVirtualization=!container
|
||||
#Conflicts=shutdown.target
|
||||
# Don't wait for systemd-random-seed.service, leads to deadlock with fips=1
|
||||
#After=systemd-random-seed.service
|
||||
Before=sysinit.target shutdown.target systemd-journald.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/haveged -w 1024 -v 0 -F
|
||||
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_SYS_CHROOT
|
||||
PrivateNetwork=yes
|
||||
Restart=always
|
||||
SuccessExitStatus=137 143
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
75
init.d/sysv.lsb
Normal file
75
init.d/sysv.lsb
Normal file
|
@ -0,0 +1,75 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2011-2012 Jirka Hladky hladky_dot_jiri_at_gmail_com
|
||||
# Copyright 2011-2012 Gary Wuertz gary@issiweb.com
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# haveged: Starts the haveged entropy daemon
|
||||
#
|
||||
# chkconfig: - 75 25
|
||||
# description: havege entropy daemon
|
||||
# processname: haveged
|
||||
#
|
||||
# source function library
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
prog="haveged"
|
||||
|
||||
HAVEGED_BIN=/usr/local/sbin/haveged
|
||||
LOCKFILE=/var/lock/$prog
|
||||
RETVAL=0
|
||||
|
||||
test -x ${HAVEGED_BIN} || { echo "Cannot find haveged executable ${HAVEGED_BIN}" 1>&2 ; exit 5 ; }
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n $"Starting $prog: "
|
||||
${HAVEGED_BIN} -w 1024 -v 1 && log_success_msg || log_failure_msg
|
||||
RETVAL=$?
|
||||
[ "$RETVAL" = 0 ] && touch ${LOCKFILE}
|
||||
echo
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo -n $"Stopping $prog: "
|
||||
if [ -e /var/run/$prog.pid ]; then
|
||||
kill `cat /var/run/$prog.pid` && log_success_msg || log_failure_msg
|
||||
else
|
||||
log_failure_msg
|
||||
fi
|
||||
RETVAL=$?
|
||||
[ "$RETVAL" = 0 ] && rm -f ${LOCKFILE}
|
||||
echo
|
||||
;;
|
||||
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
condrestart)
|
||||
[ -f $LOCKFILE ] && $0 restart
|
||||
;;
|
||||
|
||||
status)
|
||||
status $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $prog {start|stop|status|reload|restart|condrestart}"
|
||||
esac
|
||||
exit $RETVAL
|
74
init.d/sysv.redhat
Normal file
74
init.d/sysv.redhat
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2011-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
# Copyright 2011-2012 Gary Wuertz gary@issiweb.com
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# haveged: Starts the haveged entropy daemon
|
||||
#
|
||||
# chkconfig: - 75 25
|
||||
# description: havege entropy daemon
|
||||
# processname: haveged
|
||||
#
|
||||
# source function library
|
||||
. /etc/init.d/functions
|
||||
|
||||
HAVEGED_BIN=@SBIN_DIR@/haveged
|
||||
|
||||
RETVAL=0
|
||||
prog="haveged"
|
||||
LOCKFILE=/var/lock/subsys/$prog
|
||||
|
||||
test -x ${HAVEGED_BIN} || { echo "Cannot find haveged executable ${HAVEGED_BIN}" 1>&2 ; exit 5 ; }
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo -n $"Starting $prog: "
|
||||
${HAVEGED_BIN} -w 1024 -v 1 && success || failure
|
||||
RETVAL=$?
|
||||
[ "$RETVAL" = 0 ] && touch ${LOCKFILE}
|
||||
echo
|
||||
;;
|
||||
|
||||
stop)
|
||||
echo -n $"Stopping $prog: "
|
||||
if [ -e /var/run/$prog.pid ]; then
|
||||
kill `cat /var/run/$prog.pid` && success || failure
|
||||
else
|
||||
failure
|
||||
fi
|
||||
RETVAL=$?
|
||||
[ "$RETVAL" = 0 ] && rm -f ${LOCKFILE}
|
||||
echo
|
||||
;;
|
||||
|
||||
restart|reload)
|
||||
$0 stop
|
||||
$0 start
|
||||
;;
|
||||
|
||||
condrestart)
|
||||
[ -f $LOCKFILE ] && $0 restart
|
||||
;;
|
||||
|
||||
status)
|
||||
status $prog
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $prog {start|stop|status|reload|restart|condrestart}"
|
||||
esac
|
||||
exit $RETVAL
|
7
man/Makefile.am
Normal file
7
man/Makefile.am
Normal file
|
@ -0,0 +1,7 @@
|
|||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
man_MANS = haveged.8 libhavege.3
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
564
man/Makefile.in
Normal file
564
man/Makefile.in
Normal file
|
@ -0,0 +1,564 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
subdir = man
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
man3dir = $(mandir)/man3
|
||||
am__installdirs = "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man8dir)"
|
||||
man8dir = $(mandir)/man8
|
||||
NROFF = nroff
|
||||
MANS = $(man_MANS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@
|
||||
HA_DISTRO = @HA_DISTRO@
|
||||
HA_LDFLAGS = @HA_LDFLAGS@
|
||||
HA_UNITD = @HA_UNITD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
man_MANS = haveged.8 libhavege.3
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps man/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps man/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-man3: $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list1=''; \
|
||||
list2='$(man_MANS)'; \
|
||||
test -n "$(man3dir)" \
|
||||
&& test -n "`echo $$list1$$list2`" \
|
||||
|| exit 0; \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
|
||||
{ for i in $$list1; do echo "$$i"; done; \
|
||||
if test -n "$$list2"; then \
|
||||
for i in $$list2; do echo "$$i"; done \
|
||||
| sed -n '/\.3[a-z]*$$/p'; \
|
||||
fi; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man3:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man3dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.3[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
|
||||
install-man8: $(man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list1=''; \
|
||||
list2='$(man_MANS)'; \
|
||||
test -n "$(man8dir)" \
|
||||
&& test -n "`echo $$list1$$list2`" \
|
||||
|| exit 0; \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(man8dir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(man8dir)" || exit 1; \
|
||||
{ for i in $$list1; do echo "$$i"; done; \
|
||||
if test -n "$$list2"; then \
|
||||
for i in $$list2; do echo "$$i"; done \
|
||||
| sed -n '/\.8[a-z]*$$/p'; \
|
||||
fi; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man8:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man8dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.8[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
|
||||
tags TAGS:
|
||||
|
||||
ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man8dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man3 install-man8
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man3 uninstall-man8
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
cscopelist-am ctags-am distclean distclean-generic \
|
||||
distclean-libtool distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-man3 install-man8 install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic \
|
||||
mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
|
||||
uninstall-am uninstall-man uninstall-man3 uninstall-man8
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
342
man/haveged.8
Normal file
342
man/haveged.8
Normal file
|
@ -0,0 +1,342 @@
|
|||
.TH haveged 8 "February 10, 2014" "version 1.9" "SYSTEM ADMINISTRATION COMMANDS"
|
||||
.SH NAME
|
||||
haveged \- Generate random numbers and feed Linux's random device.
|
||||
.SH SYNOPSIS
|
||||
.B haveged [options]
|
||||
.SH DESCRIPTION
|
||||
.B haveged
|
||||
generates an unpredictable stream of random numbers harvested from the indirect
|
||||
effects of hardware events on hidden processor state (caches, branch predictors,
|
||||
memory translation tables, etc) using the HAVEGE (HArdware Volatile Entropy
|
||||
Gathering and Expansion) algorithm. The algorithm operates in user space, no
|
||||
special privilege is required for file system access to the output stream.
|
||||
.P
|
||||
Linux pools randomness for distribution by the /dev/random and /dev/urandom
|
||||
device interfaces. The standard mechanisms of filling the /dev/random pool may
|
||||
not be sufficient to meet demand on systems with high needs or limited user
|
||||
interaction. In those circumstances,
|
||||
.B haveged
|
||||
may be run as a privileged daemon to fill the /dev/random pool whenever the
|
||||
supply of random bits in /dev/random falls below the low water mark of the
|
||||
device.
|
||||
.P
|
||||
.B haveged
|
||||
tunes itself to its environment and provides the same built-in test suite
|
||||
for the output stream as used on certified hardware security devices. See
|
||||
.B NOTES
|
||||
below for further information.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
-b nnn, --buffer=nnn
|
||||
Set collection buffer size to nnn KW. Default is 128KW (or 512KB).
|
||||
.TP
|
||||
-c cmd, --command=cmd
|
||||
Switch to command mode and send a command to an already running
|
||||
.B haveged
|
||||
process or daemon. Currently the only known commands are
|
||||
.I close
|
||||
to close the current communication socket of the running
|
||||
.B haveged
|
||||
process as well as
|
||||
.IR root = <new_root>
|
||||
where
|
||||
.I <new_root>
|
||||
is a place holder for the path of the real new root directory which should
|
||||
provide a haveged installation. The
|
||||
.B haveged
|
||||
process or daemon will perform a
|
||||
.BR chroot (2)
|
||||
system call followed by a
|
||||
.BR execv (3)
|
||||
to become rebased
|
||||
.B within
|
||||
the new root directory.
|
||||
.TP
|
||||
-d nnn, --data=nnn
|
||||
Set data cache size to nnn KB. Default is 16 or as determined dynamically.
|
||||
.TP
|
||||
-f file, --file=file
|
||||
Set output file path for non-daemon use. Default is "sample",
|
||||
use "-" for stdout.
|
||||
.TP
|
||||
-F , --Foreground
|
||||
Run daemon in foreground. Do not fork and detach.
|
||||
.TP
|
||||
-i nnn, --inst=nnn
|
||||
Set instruction cache size to nnn KB. Default is 16 or as determined dynamically.
|
||||
.TP
|
||||
-n nnn, --number=nnn
|
||||
Set number of bytes written to the output file. The value may be specified using one
|
||||
of the suffixes k, m, g, or t. The upper bound of this value is "16t" (2^44 Bytes = 16TB).
|
||||
A value of 0 indicates unbounded output and forces output to stdout. This argument is
|
||||
required if the daemon interface is not present. If the daemon interface is present, this
|
||||
setting takes precedence over any --run value.
|
||||
.TP
|
||||
-o <spec>, --onlinetest=<spec>
|
||||
Specify online tests to run. The <spec> consists of optional "t"ot and
|
||||
"c"ontinuous groups, each group indicates the procedures to be run, using "a<n>"
|
||||
to indicate a AIS-31 procedure A variant, and "b" to indicate AIS procedure B.
|
||||
The specifications are order independent (procedure B always runs first in each
|
||||
group) and case insensitive. The a<n> variations exist to mitigate the a slow
|
||||
autocorrelation test (test5). Normally all procedure A tests, except the first
|
||||
are iterated 257 times. An a<n> option indicates test5 should only be executed
|
||||
every modulo <n> times during the procedure's 257 repetitions. The effect is so
|
||||
noticeable that A8 is the usual choice.
|
||||
|
||||
The "tot" tests run only at initialization - there are no negative performance
|
||||
consequences except for a slight increase in the time required to initialize.
|
||||
The "tot" tests guarantee haveged has initialized properly. The use of both test
|
||||
procedures in the "tot" test is highly recommended because the two test emphasize
|
||||
different aspects of RNG quality.
|
||||
|
||||
In continuous testing, the test sequence is cycled repeatedly. For example, the
|
||||
string "tbca8b" (suitable for an AIS NTG.1 device) would run procedure B for the
|
||||
"tot" test, then cycle between procedure A8 and procedure B continuously for all
|
||||
further output. Continuous testing does not come for free, impacting both
|
||||
throughput and resource consumption. Continual testing also opens up the possibility
|
||||
of a test failure. A strict retry procedure recovers from spurious failure in all but
|
||||
the most extreme circumstances. When the retry fails, operation will terminate unless
|
||||
a "w" has been appended to the test token to make the test advisory only. In our
|
||||
example above, the string "tbca8wbw" would make all continuous tests advisory. For
|
||||
more detailed information on AIS retries see
|
||||
.B NOTES
|
||||
below.
|
||||
|
||||
Complete control over the test configuration is provided for flexibility. The
|
||||
defaults (ta8bcb" if run as a daemon and "ta8b" otherwise) are suitable for most
|
||||
circumstances.
|
||||
|
||||
.TP
|
||||
-p file, --pidfile=file
|
||||
Set file path for the daemon pid file. Default is "/var/run/haveged.pid",
|
||||
.TP
|
||||
-r n, --run=n
|
||||
Set run level for daemon interface:
|
||||
|
||||
n = 0 Run as daemon - must be root. Fills /dev/random when the supply of random bits
|
||||
falls below the low water mark of the device.
|
||||
|
||||
n = 1 Display configuration info and terminate.
|
||||
|
||||
n > 1 Write <n> kb of output. Deprecated (use --number instead), only provided for backward
|
||||
compatibility.
|
||||
|
||||
If --number is specified, values other than 0,1 are ignored. Default is 0.
|
||||
.TP
|
||||
-v n, --verbose=n
|
||||
Set diagnostic bitmap as sum of following options:
|
||||
|
||||
1=Show build/tuning summary on termination, summary for online test retries.
|
||||
|
||||
2=Show online test retry details
|
||||
|
||||
4=Show timing for collections
|
||||
|
||||
8=Show collection loop layout
|
||||
|
||||
16=Show collection loop code offsets
|
||||
|
||||
32=Show all online test completion detail
|
||||
|
||||
Default is 0. Use -1 for all diagnostics.
|
||||
.TP
|
||||
-w nnn, --write=nnn
|
||||
Set write_wakeup_threshold of daemon interface to nnn bits. Applies only to run level 0.
|
||||
.TP
|
||||
-?, --help
|
||||
This summary of program options.
|
||||
|
||||
.SH NOTES
|
||||
.P
|
||||
haveged tunes the HAVEGE algorithm for maximum effectiveness using a hierarchy
|
||||
of defaults, command line options, virtual file system information, and cpuid
|
||||
information where available. Under most circumstances, user input is not
|
||||
required for excellent results.
|
||||
.P
|
||||
Run-time testing provides assurance of correct haveged operation. The run-time
|
||||
test suite is modeled upon the AIS-31 specification of the German Common
|
||||
Criteria body, BIS. This specification is typically applied to hardware devices,
|
||||
requiring formal certification and mandated start-up and continuous operational
|
||||
testing. Because haveged runs on many different hardware platforms, certification
|
||||
cannot be a goal, but the AIS-31 test suite provides the means to assess haveged
|
||||
output with the same operational tests applied to certified hardware devices.
|
||||
.P
|
||||
AIS test procedure A performs 6 tests to check for statistically inconspicuous
|
||||
behavior. AIS test procedure B performs more theoretical tests such as checking
|
||||
multi-step transition probabilities and making an empirical entropy estimate.
|
||||
Procedure A is the much more resource and compute intensive of the two but is
|
||||
still recommended for the haveged start-up tests. Procedure B is well suited to
|
||||
use of haveged as a daemon because the test entropy estimate confirms the
|
||||
entropy estimate haveged uses when adding entropy to the /dev/random device.
|
||||
.P
|
||||
No test is perfect. There is a 10e-4 probability that a perfect generator will
|
||||
fail either of the test procedures. AIS-31 mandates a strict retry policy to
|
||||
filter out false alarms and haveged always logs test procedure failures. Retries
|
||||
are expected but rarely observed except when large data sets are generated with
|
||||
continuous testing. See the
|
||||
.B libhavege(3)
|
||||
notes for more detailed information.
|
||||
|
||||
.SH FILES
|
||||
|
||||
If running as a daemon, access to the following files is required
|
||||
.RS
|
||||
.P
|
||||
.I /dev/random
|
||||
.P
|
||||
.I /proc/sys/kernel/osrelease
|
||||
.P
|
||||
.I /proc/sys/kernel/random/poolsize
|
||||
.P
|
||||
.I /proc/sys/kernel/random/write_wakeup_threshold
|
||||
.RE
|
||||
|
||||
.SH DIAGNOSTICS
|
||||
Haveged returns 0 for success and non-zero for failure. The failure return code is 1
|
||||
"general failure" unless execution is terminated by signal <n>, in which case
|
||||
the return code will be 128 + <n>. The following diagnostics are issued to stderr
|
||||
upon non-zero termination:
|
||||
|
||||
Cannot fork into the background
|
||||
.RS
|
||||
Call to daemon(3) failed.
|
||||
|
||||
.RE
|
||||
Cannot open file <s> for writing.
|
||||
.RS
|
||||
Could not open sample file <s> for writing.
|
||||
|
||||
.RE
|
||||
Cannot write data in file:
|
||||
.RS
|
||||
Could not write data to the sample file.
|
||||
|
||||
.RE
|
||||
Couldn't get pool size.
|
||||
.RS
|
||||
Unable to read /proc/sys/kernel/random/poolsize
|
||||
|
||||
.RE
|
||||
Couldn't initialize HAVEGE rng
|
||||
.RS
|
||||
Invalid data or instruction cache size.
|
||||
|
||||
.RE
|
||||
Couldn't open PID file <s> for writing
|
||||
.RS
|
||||
Unable to write daemon PID
|
||||
|
||||
.RE
|
||||
Couldn't open random device
|
||||
.RS
|
||||
Could not open /dev/random for read-write.
|
||||
|
||||
.RE
|
||||
Couldn't query entropy-level from kernel: error
|
||||
.RS
|
||||
Call to ioctl(2) failed.
|
||||
|
||||
.RE
|
||||
Couldn't open PID file <path> for writing
|
||||
.RS
|
||||
Error writing /var/run/haveged.pid
|
||||
|
||||
.RE
|
||||
Fail:set_watermark()
|
||||
.RS
|
||||
Unable to write to /proc/sys/kernel/random/write_wakeup_threshold
|
||||
|
||||
.RE
|
||||
RNDADDENTROPY failed!
|
||||
.RS
|
||||
Call to ioctl(2) to add entropy failed
|
||||
|
||||
.RE
|
||||
RNG failed
|
||||
.RS
|
||||
The random number generator failed self-test or encountered a fatal error.
|
||||
|
||||
.RE
|
||||
Select error
|
||||
.RS
|
||||
Call to select(2) failed.
|
||||
|
||||
.RE
|
||||
Stopping due to signal <n>
|
||||
.RS
|
||||
Signal <n> caught.
|
||||
|
||||
.RE
|
||||
Unable to setup online tests
|
||||
.RS
|
||||
Memory unavailable for online test resources.
|
||||
|
||||
|
||||
.SH EXAMPLES
|
||||
.TP
|
||||
Write 1.5MB of random data to the file /tmp/random
|
||||
haveged -n 1.5M -f /tmp/random
|
||||
.TP
|
||||
Generate a /tmp/keyfile for disk encryption with LUKS
|
||||
haveged -n 2048 -f /tmp/keyfile
|
||||
.TP
|
||||
Overwrite partition /dev/sda1 with random data. Be careful, all data on the partition will be lost!
|
||||
haveged -n 0 | dd of=/dev/sda1
|
||||
.TP
|
||||
Generate random ASCII passwords of the length 16 characters
|
||||
(haveged -n 1000 -f - 2>/dev/null | tr -cd '[:graph:]' | fold -w 16 && echo ) | head
|
||||
.TP
|
||||
Write endless stream of random bytes to the pipe. Utility pv measures the speed by which data are written to the pipe.
|
||||
haveged -n 0 | pv > /dev/null
|
||||
.TP
|
||||
Evaluate speed of haveged to generate 1GB of random data
|
||||
haveged -n 1g -f - | dd of=/dev/null
|
||||
.TP
|
||||
Create a random key file containing 65 random keys for the encryption program aespipe.
|
||||
haveged -n 3705 -f - 2>/dev/null | uuencode -m - | head -n 66 | tail -n 65
|
||||
.TP
|
||||
Test the randomness of the generated data with dieharder test suite
|
||||
haveged -n 0 | dieharder -g 200 -a
|
||||
.TP
|
||||
Generate 16k of data, testing with procedure A and B with detailed test results. No c result seen because a single buffer fill did not contain enough data to complete the test.
|
||||
haveged -n 16k -o tba8ca8 -v 33
|
||||
.TP
|
||||
Generate 16k of data as above with larger buffer. The c test now completes - enough data now generated to complete the test.
|
||||
haveged -n 16k -o tba8ca8 -v 33 -b 512
|
||||
.TP
|
||||
Generate 16m of data as above, observe many c test completions with default buffer size.
|
||||
haveged -n 16m -o tba8ca8 -v 33
|
||||
.TP
|
||||
Generate large amounts of data - in this case 16TB. Enable initialization test but made continuous tests advisory only to avoid a possible situation that program will terminate because of procedureB failing two times in a row. The probability of procedureB to fail two times in a row can be estimated as <TB to generate>/3000 which yields 0.5% for 16TB.
|
||||
haveged -n 16T -o tba8cbw -f - | pv > /dev/null
|
||||
.TP
|
||||
Generate large amounts of data (16TB). Disable continuous tests for the maximum throughput but run the online tests at the startup to make sure that generator for properly initialized:
|
||||
haveged -n 16T -o tba8c -f - | pv > /dev/null
|
||||
|
||||
.SH SEE ALSO
|
||||
.TP
|
||||
.BR libhavege(3),
|
||||
.BR cryptsetup(8),
|
||||
.BR aespipe(1),
|
||||
.BR pv(1),
|
||||
.BR openssl(1),
|
||||
.BR uuencode(1)
|
||||
|
||||
.SH REFERENCES
|
||||
|
||||
.I HArdware Volatile Entropy Gathering and Expansion: generating unpredictable random numbers at user level
|
||||
by A. Seznec, N. Sendrier, INRIA Research Report, RR-4592, October 2002
|
||||
|
||||
.I A proposal for: Functionality classes for random number generators
|
||||
by W. Killmann and W. Schindler, version 2.0, Bundesamt fur Sicherheit in der
|
||||
Informationstechnik (BSI), September, 2011
|
||||
|
||||
.I A Statistical Test Suite for the Validation of Random NUmber Generators and Pseudorandom Number Generators for Cryptographic Applications,
|
||||
special publication SP800-22, National Institute of Standards and Technology, revised April, 2010
|
||||
|
||||
Additional information can also be found at
|
||||
.B http://www.issihosts.com/haveged/
|
||||
|
||||
.SH AUTHORS
|
||||
Gary Wuertz <gary@issiweb.com> and Jirka Hladky <hladky jiri AT gmail DOT com>
|
414
man/libhavege.3
Normal file
414
man/libhavege.3
Normal file
|
@ -0,0 +1,414 @@
|
|||
.TH libhavege 3 "February 10, 2014" "version 1.1" "LIBRARY FUNCTIONS"
|
||||
.SH NAME
|
||||
libhavege, havege_create, havege_run, havege_rng, havege_destroy, havege_status, havege_status_dump, havege_version \- haveged RNG
|
||||
.SH SYNOPSIS
|
||||
.HP
|
||||
.P
|
||||
.nf
|
||||
#include <haveged/havege.h>
|
||||
H_PARAMS params = {0};
|
||||
h_status status;
|
||||
char status_buf[512];
|
||||
|
||||
if (NULL==havege_version(HAVEGE_PREP_VERSION)) exit(1);
|
||||
H_PTR handle = havege_create(¶ms);
|
||||
havege_status(handle, &status);
|
||||
havege_run(handle);
|
||||
rc = havege_rng(handle, handle->io_buf, handle->i_readSz/sizeof(H_UINT));
|
||||
havege_status_dump(handle, H_SD_TOPIC_BUILD, status_buf, sizeof(status_buf));
|
||||
havege_destroy(handle);
|
||||
.fi
|
||||
|
||||
.SH DESCRIPTION
|
||||
.P
|
||||
The libhavege library provides the haveged random number generator and it's
|
||||
associated tuning and testing facilities in a development sub-package. All
|
||||
haveged conditional build features are preserved and all haveged options not
|
||||
directly related to it's daemon or file system interfaces are available. This
|
||||
means that the same haveged tuning and testing components are present in the
|
||||
library with the equivalent controls provided by the haveged command line.
|
||||
|
||||
|
||||
.SH API METHODS
|
||||
.P
|
||||
The libhavege library uses the opaque handle technique to manage it's required
|
||||
resources. Errors are returned in the "error" member of the handle. The
|
||||
havege_destroy() method should be called to dispose of any resources
|
||||
claimed by havege_create().
|
||||
.P
|
||||
.BI "H_PTR havege_create(H_PARAMS " *params ");"
|
||||
|
||||
Create an anchor. Most members of the H_PARAMS input to this call correspond
|
||||
closely to haveged command line options (see
|
||||
.B haveged(8)
|
||||
for details). The caller
|
||||
should check for a non-null return value with a error value of H_NOERR. Any
|
||||
non-null return should be disposed of by a call to havege_destroy() to free any
|
||||
resources. Possible error values: H_NOERR, H_NOTESTSPEC, H_NOBUF, H_NOTESTMEM,
|
||||
H_NOINIT
|
||||
|
||||
.P
|
||||
.BI "void havege_destroy(H_PTR " hptr ");"
|
||||
|
||||
Free all allocated anchor resources. If the multi-core option is used, this
|
||||
method should be called from a signal handler to prevent zombie processes. If
|
||||
called by the process that called haveged_create(), hptr will be freed when all
|
||||
child processes (if any) have terminated. If called by a child process, H_EXIT
|
||||
will be set and all children awakened to exit.
|
||||
|
||||
.P
|
||||
.BI "int havege_rng(H_PTR " hptr ", H_UINT " *buf ", H_UINT " sz ");"
|
||||
|
||||
Read random bytes from an active anchor. The RNG must have been previously
|
||||
readied by a call to havege_run(). The read must take place within the allocated
|
||||
buffer, hptr->io_buf. The range specified is the number of H_UINT to read. If
|
||||
the multi-core option is used, this buffer is memory mapped between collectors.
|
||||
Possible error values: H_NOERR, H_NOTESRUN, H_NOPOST, H_NODONE, H_NORQST,
|
||||
H_NOCOMP, H_EXIT
|
||||
|
||||
.P
|
||||
.BI "int havege_run(H_PTR " hptr ");"
|
||||
|
||||
Warm up the RNG and run the start-up tests. The operation succeeded if the error
|
||||
member of the handle is H_NOERR. A failed handle should be disposed of by a call
|
||||
to havege_destroy(). Possible error values: H_NOERR, H_NOCOLLECT, H_NOWALK,
|
||||
H_NOTESTMEM, H_NOTASK, H_NOTESTTOT, H_NOWAIT, H_NOTIMER, and any havege_rng()
|
||||
error.
|
||||
|
||||
.P
|
||||
.BI "void havege_status(H_PTR " hptr ", H_STATUS " hsts ");"
|
||||
|
||||
Fills in the h_status structure with read-only information collected from the
|
||||
package build, run-time tuning, and test components.
|
||||
|
||||
.P
|
||||
.BI "int havege_status_dump(H_PTR " hptr ", H_SD_TOPIC " topic ", char " *buf ", size_t " len ");"
|
||||
|
||||
Calls havege_status() and formats standard presentations of havege status in the
|
||||
supplied buffer. The standard formats are:
|
||||
|
||||
.RS
|
||||
H_SD_TOPIC_BUILD
|
||||
|
||||
ver: %s; arch: %s; vend: %s; build: (%s); collect: %dK
|
||||
|
||||
H_SD_TOPIC_TUNE
|
||||
|
||||
cpu: (%s); data: %dK (%s); inst: %dK (%s); idx: %d/%d; sz: %d/%d
|
||||
|
||||
H_SD_TOPIC_TEST
|
||||
|
||||
[tot tests(%s): A:%d/%d B: %d/%d;][continuous tests(%s): A:%d/%d B: %d/%d;][last entropy estimate %g]
|
||||
|
||||
H_SD_TOPIC_SUM
|
||||
|
||||
fills: %d, generated: %.4g %c bytes
|
||||
.RE
|
||||
|
||||
.BI "const char *havege_version(const char *" version ");"
|
||||
|
||||
Return/check library prep version. The prep version is the package version used
|
||||
to build the library. A null argument returns the prep version unconditionally.
|
||||
Using the definition of the prep string in havege.h as input returns the
|
||||
prep version if the header file is compatible with the library, or NULL if
|
||||
it is not. Intended to be called before attempting any initialization.
|
||||
|
||||
.SH NOTES
|
||||
.P
|
||||
|
||||
The sizes of the processor level 1 instruction and data caches are used to tune
|
||||
the HAVEGE algorithm for maximum sensitivity. If these sizes not specified,
|
||||
haveged will attempt to determine the sizes dynamically from the Linux sysfs
|
||||
and/or cpuid instruction with a fallback to a compiled default if no better
|
||||
information is not available.
|
||||
|
||||
The haveged RNG includes a run time test facility based upon the test suite
|
||||
defined in the AIS-31 specification from the The German Federal Office for
|
||||
Information Security (Bundesamt für Sicherheit in der Informationstechnik). The
|
||||
test suite consists of 11 statistical tests packaged into two test suites ("A"
|
||||
and "B"). The tests can be run at initialization (a.k.a. a "tot" test), or
|
||||
continuously to monitor all output. Failure of a suite will abort operation
|
||||
unless the behavior is explicitly waived in the test setup options.
|
||||
.P
|
||||
|
||||
Procedure A contains 6 test procedures designed to ensure statistically
|
||||
inconspicuous behavior. The first test, "test0", checks the disjointedness of
|
||||
65k six-bit strings. The remainder of the procedure consists of 257 repetitions
|
||||
of the FIPS140-1 tests, "test1" through "test4", and an auto-correlation test,
|
||||
"test5". The fixed size of the Procedure A input makes it ideal for continuous
|
||||
use, but the procedure is slow and resource intensive. In particular, test5 is
|
||||
several orders of magnitude slower than any other individual AIS test. As an
|
||||
alternative for those who cannot tolerate this load, procedure A variants A<n>
|
||||
are provided that execute all included tests but execute test5 only every 2^n
|
||||
repetitions. Even with this accommodation, procedure A is much slower than
|
||||
procedure B.
|
||||
|
||||
.P
|
||||
|
||||
Procedure B contains 5 tests, "test6a", "test6b', "test7a", "test7b", and
|
||||
"test8". The first 4 tests verify the expected frequencies for samples 100,000
|
||||
one-step, two-step, three-step, and four-step bit transitions. The last test
|
||||
provides an empirical entropy estimate of the input. The input required to
|
||||
complete these tests is variable, resulting in an ever-shifting bit alignment
|
||||
that guards against buffering artifacts.
|
||||
|
||||
.P
|
||||
|
||||
Each test procedure requires more than 1MB of data. Test input is managed by a
|
||||
bit index into the collection buffer. An independent index manages where integer
|
||||
output is taken from the same buffer. A buffer fill is triggered when the output
|
||||
index indicates all data has been extracted from the buffer. Online testing
|
||||
takes place after the buffer has been refilled but before the output index
|
||||
update allows output to resume. If any online test fails while processing the
|
||||
buffer, the buffer will be refilled and reprocessed until any retry is complete
|
||||
and the buffer contains no failed online tests or the online test procedure has
|
||||
failed and the RNG is considered broken.
|
||||
|
||||
.P
|
||||
|
||||
It is recommend to run both AIS test procedures at start-up to ensure the RNG
|
||||
is properly initialized. If resources are in short supply, omitting procedure A
|
||||
will save memory and time, with little risk in circumstances where output is
|
||||
mixed with other sources in /dev/random or other csprng. Continuous testing is
|
||||
also recommended where the throughput penalty is acceptable. One recent
|
||||
assessment of testing throughput costs is shown below.
|
||||
|
||||
.RS
|
||||
.TP 40
|
||||
haveged -n0 -oc | pv > /dev/null
|
||||
400MiB/s
|
||||
.TP
|
||||
haveged -n0 -ocb | pv > /dev/null
|
||||
70MiB/s
|
||||
.TP
|
||||
haveged -n0 -oca8b | pv > /dev/null
|
||||
13MiB/s
|
||||
.TP
|
||||
haveged -n0 -oca8 | pv > /dev/null
|
||||
8MiB/s
|
||||
.TP
|
||||
haveged -n0 -oca | pv > /dev/null
|
||||
100kiB/s
|
||||
.RE
|
||||
.P
|
||||
|
||||
Continuous testing also exposes another possible pitfall. Even an ideal RNG has
|
||||
a 10e-4 chance of failing either test procedure. The strict retry policy of
|
||||
AIS-31 is designed to guarantee an ideal RNG will "almost never" fail a test
|
||||
procedure. A single retry is mandated only to recover from a previous attempt
|
||||
that experienced a single individual test failure. The haveged implementation
|
||||
logs all retries and terminates on test procedure failures unless the procedure
|
||||
has been flagged as advisory by the "w" argument (see --onlinetest in
|
||||
.B haveged(8)
|
||||
). Little evidence of the retry mechanism is seen unless large data sets are
|
||||
processed. Procedure A is too slow to be practical in these situations, so
|
||||
procedure B has been the best studied. Retries are observed at the approximate
|
||||
rate of 0.7-0.8 failures/GB, mostly in the test7 multi-step transition checks.
|
||||
.P
|
||||
The probability that procedureB will fail two times in a row (in which case the
|
||||
program will be terminated unless w option was specified) is 4e-7 which is
|
||||
expected to happen at an approximate rate of once per 3,000 TB. When producing
|
||||
large amounts of data in order of TBs it's recommended to use -w option to make
|
||||
sure that program will not prematurely terminate because of a failed retry
|
||||
and carefully examine the stderr output for any problems.
|
||||
|
||||
.P
|
||||
|
||||
.SH FILES
|
||||
|
||||
Tuning information may be extracted from the following virtual file paths if
|
||||
tuning is required and the path exists.
|
||||
.P
|
||||
.RS
|
||||
.I /proc/cpuinfo
|
||||
.P
|
||||
.I /proc/self/status
|
||||
.P
|
||||
.I /sys/devices/system/cpu/online
|
||||
.P
|
||||
.I /sys/devices/system/cpu/cpu%d/cache/index%d/level
|
||||
.RE
|
||||
|
||||
.SH DIAGNOSTICS
|
||||
|
||||
To enable diagnostic output, supply a msg_out callback when creating the handle. All
|
||||
possible errors are enumerated in havege.h and reproduced here for reference.
|
||||
.P
|
||||
.RE
|
||||
.B 01 H_NOHANDLE
|
||||
.RS
|
||||
No memory for handle
|
||||
.P
|
||||
.RE
|
||||
.B 02 H_NOBUF
|
||||
.RS
|
||||
Output buffer allocation failed
|
||||
.P
|
||||
.RE
|
||||
.B 03 H_NOINIT
|
||||
.RS
|
||||
Semaphore init failed
|
||||
.P
|
||||
.RE
|
||||
.B 04 H_NOCOLLECT
|
||||
.RS
|
||||
Collector allocation failed
|
||||
.P
|
||||
.RE
|
||||
.B 05 H_NOWALK
|
||||
.RS
|
||||
Walk buffer allocation failed
|
||||
.P
|
||||
.RE
|
||||
.B 06 H_NOTESTSPEC
|
||||
.RS
|
||||
Invalid test specification
|
||||
.P
|
||||
.RE
|
||||
.B 07 H_NOTESTINIT
|
||||
.RS
|
||||
Test setup failed
|
||||
.P
|
||||
.RE
|
||||
.B 08 H_NOTESTMEM
|
||||
.RS
|
||||
Unable to allocate test memory
|
||||
.P
|
||||
.RE
|
||||
.B 09 H_NOTESTTOT
|
||||
.RS
|
||||
Power on (i.e. 'tot') test failed
|
||||
.P
|
||||
.RE
|
||||
.B 10 H_NOTESTRUN
|
||||
.RS
|
||||
Continuous test failed
|
||||
.P
|
||||
.RE
|
||||
.B 11 H_NOCORES
|
||||
.RS
|
||||
Too many cores specified
|
||||
.P
|
||||
.RE
|
||||
.B 12 H_NOTASK
|
||||
.RS
|
||||
Unable to create child task
|
||||
.P
|
||||
.RE
|
||||
.B 13 H_NOWAIT
|
||||
.RS
|
||||
sem_wait failed
|
||||
.P
|
||||
.RE
|
||||
.B 14 H_NOPOST
|
||||
.RS
|
||||
sem_post failed
|
||||
.P
|
||||
.RE
|
||||
.B 15 H_NODONE
|
||||
.RS
|
||||
sem_post done failed
|
||||
.P
|
||||
.RE
|
||||
.B 16 H_NORQST
|
||||
.RS
|
||||
sem_post request failed
|
||||
.P
|
||||
.RE
|
||||
.B 17 H_NOCOMP
|
||||
.RS
|
||||
wait for completion failed
|
||||
.P
|
||||
.RE
|
||||
.B 18 H_EXIT
|
||||
.RS
|
||||
Exit signal
|
||||
.P
|
||||
.RE
|
||||
.B 19 H_NOTIMER
|
||||
.RS
|
||||
Timer failed
|
||||
.P
|
||||
.RE
|
||||
.RE
|
||||
.SH EXAMPLE
|
||||
|
||||
The following minimal program writes the contents of 16 collection buffers
|
||||
of random data to stdout with continuous testing.
|
||||
|
||||
.nf
|
||||
#include <stdio.h>
|
||||
#include <haveged/havege.h>
|
||||
int main(void)
|
||||
{
|
||||
H_PTR havege_state;
|
||||
H_PARAMS havege_parameters = {0};
|
||||
int i, rc;
|
||||
|
||||
if (NULL==havege_version(HAVEGE_PREP_VERSION)) {
|
||||
fprintf(stderr, "Incompatible library %s\\n", havege_version(NULL));
|
||||
return 1;
|
||||
}
|
||||
havege_parameters.testSpec="ta8bcb";
|
||||
havege_state = havege_create(&havege_parameters);
|
||||
rc = havege_state==NULL? H_NOHANDLE : havege_state->error;
|
||||
if (H_NOERR==rc) {
|
||||
if (0==havege_run(havege_state)) {
|
||||
H_UINT *buf = havege_state->io_buf;
|
||||
int size = havege_state->i_readSz /sizeof(H_UINT);
|
||||
char info[256];
|
||||
|
||||
for(i=0;i<16;i++) {
|
||||
rc = havege_rng(havege_state, buf, size);
|
||||
if (rc != size) {
|
||||
fprintf(stderr, "RNG read failed %d\\n", havege_state->error);
|
||||
break;
|
||||
}
|
||||
rc = fwrite(buf, 1, size*sizeof(H_UINT), stdout);
|
||||
if ( rc < size ) {
|
||||
fprintf(stderr, "Write failed\\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
i = havege_status_dump(havege_state, H_SD_TOPIC_TEST, info, sizeof(info));
|
||||
info[i++] = '\\n';
|
||||
havege_status_dump(havege_state, H_SD_TOPIC_SUM, info+i, sizeof(info)-i);
|
||||
fprintf(stderr, "%s\\n", info);
|
||||
}
|
||||
else fprintf(stderr, "Initialize failed %d\\n", havege_state->error);
|
||||
havege_destroy(havege_state);
|
||||
}
|
||||
else fprintf(stderr, "Create failed %d\\n", rc);
|
||||
return rc;
|
||||
}
|
||||
.fi
|
||||
|
||||
Defaults are provided for all inputs to havege_create() as documented in havege.h. In this
|
||||
case for example, (16*4kb=65kb) will be written to stdout because the default size for
|
||||
i_readsz in 4kb.
|
||||
|
||||
.SH SEE ALSO
|
||||
.TP
|
||||
.BR haveged(8)
|
||||
|
||||
.SH REFERENCES
|
||||
|
||||
.B haveged(8)
|
||||
references provides a basic reading list. The following links are suggested as sources for
|
||||
further exploration.
|
||||
.TP
|
||||
The origins of the HAVEGE concept can be found at:
|
||||
http://www.irisa.fr/caps/projects/hipsor/
|
||||
.TP
|
||||
Tuning concepts inspired by (the complexity) at:
|
||||
http://www.open-mpi.org/projects/hwloc/
|
||||
.TP
|
||||
Reference documentation for the AIS-31 test suite can be found at:
|
||||
https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Zertifizierung/Interpretationen/AIS_31_Functionality_classes_for_random_number_generators_e.pdf?__blob=publicationFile
|
||||
.TP
|
||||
Implementation and design information available at:
|
||||
http://www.issihosts.com/haveged/
|
||||
|
||||
|
||||
.SH AUTHORS
|
||||
Gary Wuertz <gary@issiweb.com> and Jirka Hladky <hladky jiri AT gmail DOT com>
|
22
nist/Makefile.am
Normal file
22
nist/Makefile.am
Normal file
|
@ -0,0 +1,22 @@
|
|||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
|
||||
if ENABLE_NIST_TEST
|
||||
check_PROGRAMS = nist
|
||||
endif
|
||||
|
||||
AM_CFLAGS=-Wall
|
||||
|
||||
nist_LDADD = -lm
|
||||
|
||||
nist_SOURCES = cephes.c dfft.c matrix.c nist.c packtest.c special-functions.c cephes-protos.h matrix.h mconf.h special-functions.h nist.h
|
||||
|
||||
CLEANFILES = sample nist.out
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
if ENABLE_NIST_TEST
|
||||
check-local:
|
||||
../src/haveged -n 16M $*
|
||||
./nist sample ${srcdir}
|
||||
endif
|
576
nist/Makefile.in
Normal file
576
nist/Makefile.in
Normal file
|
@ -0,0 +1,576 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@ENABLE_NIST_TEST_TRUE@check_PROGRAMS = nist$(EXEEXT)
|
||||
subdir = nist
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am_nist_OBJECTS = cephes.$(OBJEXT) dfft.$(OBJEXT) matrix.$(OBJEXT) \
|
||||
nist.$(OBJEXT) packtest.$(OBJEXT) special-functions.$(OBJEXT)
|
||||
nist_OBJECTS = $(am_nist_OBJECTS)
|
||||
nist_DEPENDENCIES =
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(nist_SOURCES)
|
||||
DIST_SOURCES = $(nist_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@
|
||||
HA_DISTRO = @HA_DISTRO@
|
||||
HA_LDFLAGS = @HA_LDFLAGS@
|
||||
HA_UNITD = @HA_UNITD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CFLAGS = -Wall
|
||||
nist_LDADD = -lm
|
||||
nist_SOURCES = cephes.c dfft.c matrix.c nist.c packtest.c special-functions.c cephes-protos.h matrix.h mconf.h special-functions.h nist.h
|
||||
CLEANFILES = sample nist.out
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps nist/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps nist/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
clean-checkPROGRAMS:
|
||||
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
nist$(EXEEXT): $(nist_OBJECTS) $(nist_DEPENDENCIES) $(EXTRA_nist_DEPENDENCIES)
|
||||
@rm -f nist$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(nist_OBJECTS) $(nist_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@ENABLE_NIST_TEST_FALSE@check-local:
|
||||
check-am: all-am
|
||||
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
|
||||
$(MAKE) $(AM_MAKEFLAGS) check-local
|
||||
check: check-am
|
||||
all-am: Makefile
|
||||
installdirs:
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
|
||||
mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: check-am install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am check-local clean \
|
||||
clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
|
||||
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
@ENABLE_NIST_TEST_TRUE@check-local:
|
||||
@ENABLE_NIST_TEST_TRUE@ ../src/haveged -n 16M $*
|
||||
@ENABLE_NIST_TEST_TRUE@ ./nist sample ${srcdir}
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
180
nist/cephes-protos.h
Normal file
180
nist/cephes-protos.h
Normal file
|
@ -0,0 +1,180 @@
|
|||
/*
|
||||
* This file was automatically generated by version 1.7 of cextract.
|
||||
* Manual editing not recommended.
|
||||
*
|
||||
* Created: Fri Mar 31 19:17:33 1995
|
||||
*/
|
||||
extern double acosh ( double x );
|
||||
extern int airy ( double x, double *ai, double *aip, double *bi, double *bip );
|
||||
extern double asin ( double x );
|
||||
extern double acos ( double x );
|
||||
extern double asinh ( double x );
|
||||
extern double atan ( double x );
|
||||
extern double atan2 ( double y, double x );
|
||||
extern double atanh ( double x );
|
||||
extern double bdtrc ( int k, int n, double p );
|
||||
extern double bdtr ( int k, int n, double p );
|
||||
extern double bdtri ( int k, int n, double y );
|
||||
extern double beta ( double a, double b );
|
||||
extern double lbeta ( double a, double b );
|
||||
extern double btdtr ( double a, double b, double x );
|
||||
extern double cbrt ( double x );
|
||||
extern double chbevl ( double x, void *P, int n );
|
||||
extern double chdtrc ( double df, double x );
|
||||
extern double chdtr ( double df, double x );
|
||||
extern double chdtri ( double df, double y );
|
||||
// extern void clog ( cmplx *z, cmplx *w );
|
||||
extern void _cexp ( cmplx *z, cmplx *w );
|
||||
extern void _csin ( cmplx *z, cmplx *w );
|
||||
extern void _ccos ( cmplx *z, cmplx *w );
|
||||
extern void _ctan ( cmplx *z, cmplx *w );
|
||||
extern void _ccot ( cmplx *z, cmplx *w );
|
||||
extern void _casin ( cmplx *z, cmplx *w );
|
||||
extern void _cacos ( cmplx *z, cmplx *w );
|
||||
extern void _catan ( cmplx *z, cmplx *w );
|
||||
extern void cadd ( cmplx *a, cmplx *b, cmplx *c );
|
||||
extern void csub ( cmplx *a, cmplx *b, cmplx *c );
|
||||
extern void cmul ( cmplx *a, cmplx *b, cmplx *c );
|
||||
extern void cdiv ( cmplx *a, cmplx *b, cmplx *c );
|
||||
extern void cmov ( void *a, void *b );
|
||||
extern void cneg ( cmplx *a );
|
||||
//extern double _cabs ( cmplx *z );
|
||||
extern void _csqrt ( cmplx *z, cmplx *w );
|
||||
extern double hypot ( double x, double y );
|
||||
extern double cosh ( double x );
|
||||
extern double dawsn ( double xx );
|
||||
extern void eigens ( double A[], double RR[], double E[], int N );
|
||||
extern double ellie ( double phi, double m );
|
||||
extern double ellik ( double phi, double m );
|
||||
extern double ellpe ( double x );
|
||||
extern int ellpj ( double u, double m, double *sn, double *cn, double *dn, double *ph );
|
||||
extern double ellpk ( double x );
|
||||
extern double exp ( double x );
|
||||
extern double exp10 ( double x );
|
||||
extern double exp1m ( double x );
|
||||
extern double exp2 ( double x );
|
||||
extern double expn ( int n, double x );
|
||||
extern double fabs ( double x );
|
||||
extern double fac ( int i );
|
||||
extern double fdtrc ( int ia, int ib, double x );
|
||||
extern double fdtr ( int ia, int ib, double x );
|
||||
extern double fdtri ( int ia, int ib, double y );
|
||||
extern int fftr ( double x[], int m0, double sine[] );
|
||||
extern double ceil ( double x );
|
||||
extern double floor ( double x );
|
||||
extern double frexp ( double x, int *pw2 );
|
||||
extern double ldexp ( double x, int pw2 );
|
||||
extern int _signbit ( double x );
|
||||
/* extern int isnan ( double x ); */
|
||||
/*extern int isfinite ( double x );*/
|
||||
extern int fresnl ( double xxa, double *ssa, double *cca );
|
||||
extern double gamma ( double x );
|
||||
extern double lgam ( double x );
|
||||
extern double gdtr ( double a, double b, double x );
|
||||
extern double gdtrc ( double a, double b, double x );
|
||||
extern int gels ( double A[], double R[], int M, double EPS, double AUX[] );
|
||||
extern double hyp2f1 ( double a, double b, double c, double x );
|
||||
extern double hyperg ( double a, double b, double x );
|
||||
extern double hyp2f0 ( double a, double b, double x, int type, double *err );
|
||||
extern double i0 ( double x );
|
||||
extern double i0e ( double x );
|
||||
extern double i1 ( double x );
|
||||
extern double i1e ( double x );
|
||||
extern double igamc ( double a, double x );
|
||||
extern double igam ( double a, double x );
|
||||
extern double igami ( double a, double y0 );
|
||||
extern double incbet ( double aa, double bb, double xx );
|
||||
extern double incbi ( double aa, double bb, double yy0 );
|
||||
extern double iv ( double v, double x );
|
||||
extern double j0 ( double x );
|
||||
extern double y0 ( double x );
|
||||
extern double j1 ( double x );
|
||||
extern double y1 ( double x );
|
||||
extern double jn ( int n, double x );
|
||||
extern double jv ( double n, double x );
|
||||
extern double k0 ( double x );
|
||||
extern double k0e ( double x );
|
||||
extern double k1 ( double x );
|
||||
extern double k1e ( double x );
|
||||
extern double kn ( int nn, double x );
|
||||
extern int levnsn ( int n, double r[], double a[], double e[], double refl[] );
|
||||
extern double log ( double x );
|
||||
extern double log10 ( double x );
|
||||
extern double _log2 ( double x );
|
||||
extern long lrand ( void );
|
||||
extern long lsqrt ( long x );
|
||||
extern int minv ( double A[], double X[], int n, double B[], int IPS[] );
|
||||
extern int mmmpy ( int r, int c, double *A, double *B, double *Y );
|
||||
extern int mtherr ( char *name, int code );
|
||||
/*extern double polevl ( double x, void *P, int N );
|
||||
extern double p1evl ( double x, void *P, int N );*/
|
||||
extern int mtransp ( int n, double *A, double *T );
|
||||
extern int mvmpy ( int r, int c, double *A, double *V, double *Y );
|
||||
extern double nbdtrc ( int k, int n, double p );
|
||||
extern double nbdtr ( int k, int n, double p );
|
||||
extern double nbdtri ( int k, int n, double p );
|
||||
extern double ndtr ( double a );
|
||||
extern double erfc ( double a );
|
||||
extern double erf ( double x );
|
||||
extern double ndtri ( double y0 );
|
||||
extern double pdtrc ( int k, double m );
|
||||
extern double pdtr ( int k, double m );
|
||||
extern double pdtri ( int k, double y );
|
||||
extern double pow ( double x, double y );
|
||||
extern double powi ( double x, int nn );
|
||||
extern double psi ( double x );
|
||||
extern void revers ( double y[], double x[], int n );
|
||||
extern double rgamma ( double x );
|
||||
extern double round ( double x );
|
||||
extern int sprec ( void );
|
||||
extern int dprec ( void );
|
||||
extern int ldprec ( void );
|
||||
extern int shichi ( double x, double *si, double *ci );
|
||||
extern int sici ( double x, double *si, double *ci );
|
||||
extern double simpsn ( double f[], double delta );
|
||||
extern int simq ( double A[], double B[], double X[], int n, int flag, int IPS[] );
|
||||
extern double sin ( double x );
|
||||
extern double cos ( double x );
|
||||
extern double radian ( double d, double m, double s );
|
||||
/*
|
||||
extern int sincos ( double x, double *s, double *c, int flg );
|
||||
*/
|
||||
extern double sindg ( double x );
|
||||
extern double cosdg ( double x );
|
||||
extern double sinh ( double x );
|
||||
extern double spence ( double x );
|
||||
extern double sqrt ( double x );
|
||||
extern double stdtr ( int k, double t );
|
||||
extern double stdtri ( int k, double p );
|
||||
extern double onef2 ( double a, double b, double c, double x, double *err );
|
||||
extern double threef0 ( double a, double b, double c, double x, double *err );
|
||||
extern double struve ( double v, double x );
|
||||
extern double tan ( double x );
|
||||
extern double cot ( double x );
|
||||
extern double tandg ( double x );
|
||||
extern double cotdg ( double x );
|
||||
extern double tanh ( double x );
|
||||
extern double log1p ( double x );
|
||||
extern double expm1 ( double x );
|
||||
extern double cosm1 ( double x );
|
||||
extern double yn ( int n, double x );
|
||||
extern double zeta ( double x, double q );
|
||||
extern double zetac ( double x );
|
||||
extern int drand ( double *a );
|
||||
|
||||
/* polyn.c */
|
||||
extern void polini ( int maxdeg );
|
||||
extern void polprt ( double a[], int na, int d );
|
||||
extern void polclr ( double *a, int n );
|
||||
extern void polmov ( double *a, int na, double *b );
|
||||
extern void polmul ( double a[], int na, double b[], int nb, double c[] );
|
||||
extern void poladd ( double a[], int na, double b[], int nb, double c[] );
|
||||
extern void polsub ( double a[], int na, double b[], int nb, double c[] );
|
||||
extern int poldiv ( double a[], int na, double b[], int nb, double c[] );
|
||||
extern void polsbt ( double a[], int na, double b[], int nb, double c[] );
|
||||
extern double poleva ( double a[], int na, double x );
|
||||
/* polmisc.c */
|
||||
extern void polatn ( double num[], double den[], double ans[], int nn );
|
||||
extern void polsqt ( double pol[], double ans[], int nn );
|
||||
extern void polsin ( double x[], double y[], int nn );
|
||||
extern void polcos ( double x[], double y[], int nn );
|
1327
nist/cephes.c
Normal file
1327
nist/cephes.c
Normal file
File diff suppressed because it is too large
Load diff
1381
nist/dfft.c
Normal file
1381
nist/dfft.c
Normal file
File diff suppressed because it is too large
Load diff
168
nist/matrix.c
Normal file
168
nist/matrix.c
Normal file
|
@ -0,0 +1,168 @@
|
|||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
/*#include "defs.h"
|
||||
#include "proto.h"*/
|
||||
#define MIN(x,y) ((x) > (y) ? (y) : (x))
|
||||
|
||||
#include "matrix.h"
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
R A N K A L G O R I T H M R O U T I N E S
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
int computeRank(int M, int Q, BitField** matrix)
|
||||
{
|
||||
int i;
|
||||
int rank;
|
||||
int m = MIN(M,Q);
|
||||
|
||||
/* FORWARD APPLICATION OF ELEMENTARY ROW OPERATIONS */
|
||||
|
||||
for(i = 0; i < m-1; i++) {
|
||||
if (matrix[i][i].b == 1)
|
||||
perform_elementary_row_operations(0, i, M, Q, matrix);
|
||||
else { /* matrix[i][i] = 0 */
|
||||
if (find_unit_element_and_swap(0, i, M, Q, matrix) == 1)
|
||||
perform_elementary_row_operations(0, i, M, Q, matrix);
|
||||
}
|
||||
}
|
||||
|
||||
/* BACKWARD APPLICATION OF ELEMENTARY ROW OPERATIONS */
|
||||
for(i = m-1; i > 0; i--) {
|
||||
if (matrix[i][i].b == 1)
|
||||
perform_elementary_row_operations(1, i, M, Q, matrix);
|
||||
else { /* matrix[i][i] = 0 */
|
||||
if (find_unit_element_and_swap(1, i, M, Q, matrix) == 1)
|
||||
perform_elementary_row_operations(1, i, M, Q, matrix);
|
||||
}
|
||||
}
|
||||
rank = determine_rank(m,M,Q,matrix);
|
||||
|
||||
return rank;
|
||||
}
|
||||
|
||||
void perform_elementary_row_operations(int flag, int i, int M, int Q,
|
||||
BitField** A)
|
||||
{
|
||||
int j,k;
|
||||
|
||||
switch(flag)
|
||||
{
|
||||
case 0: for(j = i+1; j < M; j++)
|
||||
if (A[j][i].b == 1)
|
||||
for(k = i; k < Q; k++)
|
||||
A[j][k].b = (A[j][k].b + A[i][k].b) % 2;
|
||||
break;
|
||||
|
||||
case 1: for(j = i-1; j >= 0; j--)
|
||||
if (A[j][i].b == 1)
|
||||
for(k = 0; k < Q; k++)
|
||||
A[j][k].b = (A[j][k].b + A[i][k].b) % 2;
|
||||
break;
|
||||
default: fprintf(stderr,"ERROR IN CALL TO perform_elementary_row_operations\n");
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int find_unit_element_and_swap(int flag, int i, int M, int Q, BitField** A)
|
||||
{
|
||||
int index;
|
||||
int row_op = 0;
|
||||
|
||||
switch(flag)
|
||||
{
|
||||
case 0: index = i+1;
|
||||
while ((index < M) && (A[index][i].b == 0))
|
||||
index++;
|
||||
if (index < M)
|
||||
row_op = swap_rows(i,index,Q,A);
|
||||
break;
|
||||
case 1:
|
||||
index = i-1;
|
||||
while ((index >= 0) && (A[index][i].b == 0))
|
||||
index--;
|
||||
if (index >= 0)
|
||||
row_op = swap_rows(i,index,Q,A);
|
||||
break;
|
||||
default: fprintf(stderr,"ERROW IN CALL TO find_unit_element_and_swap\n");
|
||||
break;
|
||||
}
|
||||
return row_op;
|
||||
}
|
||||
|
||||
int swap_rows(int i, int index, int Q, BitField** A)
|
||||
{
|
||||
int p;
|
||||
BitField temp;
|
||||
|
||||
for(p = 0; p < Q; p++) {
|
||||
temp.b = A[i][p].b;
|
||||
A[i][p].b = A[index][p].b;
|
||||
A[index][p].b = temp.b;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int determine_rank(int m, int M, int Q, BitField** A)
|
||||
{
|
||||
int i, j, rank, allZeroes;
|
||||
|
||||
/* DETERMINE RANK, THAT IS, COUNT THE NUMBER OF NONZERO ROWS */
|
||||
|
||||
rank = m;
|
||||
for(i = 0; i < M; i++) {
|
||||
allZeroes = 1;
|
||||
for(j=0; j < Q; j++) {
|
||||
if (A[i][j].b == 1) {
|
||||
allZeroes = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allZeroes == 1) rank--;
|
||||
}
|
||||
return rank;
|
||||
}
|
||||
|
||||
|
||||
void display_matrix(int M, int Q, BitField** m)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
for (i = 0; i < M; i++) {
|
||||
for (j = 0; j < Q; j++)
|
||||
fprintf(stderr,"%d ", m[i][j].b);
|
||||
fprintf(stderr,"\n");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void def_matrix(int M, int Q, BitField** m,int k, int *pt, int *PT, int*DATA, int *ARRAY)
|
||||
{
|
||||
int i,j;
|
||||
for (i = 0; i < M; i++)
|
||||
for (j = 0; j < Q; j++) {
|
||||
m[i][j].b = *DATA & 1;
|
||||
(*PT)++;
|
||||
if ((*PT) == 32)
|
||||
{
|
||||
*PT = 0;
|
||||
(*pt)++;
|
||||
*DATA = ARRAY[*pt];
|
||||
}
|
||||
else
|
||||
*DATA = (*DATA) >> 1;
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void delete_matrix(int M, BitField** matrix)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < M; i++)
|
||||
free(matrix[i]);
|
||||
free(matrix);
|
||||
}
|
19
nist/matrix.h
Normal file
19
nist/matrix.h
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
R A N K A L G O R I T H M F U N C T I O N P R O T O T Y P E S
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
struct bit {
|
||||
unsigned char b:1;
|
||||
};
|
||||
typedef struct bit BitField;
|
||||
|
||||
|
||||
void perform_elementary_row_operations(int,int,int,int,BitField**);
|
||||
int find_unit_element_and_swap(int,int,int,int, BitField**);
|
||||
int swap_rows(int, int, int, BitField**);
|
||||
int determine_rank(int, int, int, BitField**);
|
||||
int computeRank(int,int,BitField**);
|
||||
void define_matrix(int,int,int,BitField**);
|
||||
BitField** create_matrix(int, int);
|
||||
void display_matrix(int, int, BitField**);
|
||||
void def_matrix(int M, int Q, BitField** m,int k, int *pt, int *PT, int*DATA, int *ARRAY);
|
||||
void delete_matrix(int, BitField**);
|
169
nist/mconf.h
Normal file
169
nist/mconf.h
Normal file
|
@ -0,0 +1,169 @@
|
|||
/* mconf.h
|
||||
*
|
||||
* Common include file for math routines
|
||||
*
|
||||
*
|
||||
*
|
||||
* SYNOPSIS:
|
||||
*
|
||||
* #include "mconf.h"
|
||||
*
|
||||
*
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This file contains definitions for error codes that are
|
||||
* passed to the common error handling routine mtherr()
|
||||
* (which see).
|
||||
*
|
||||
* The file also includes a conditional assembly definition
|
||||
* for the type of computer arithmetic (IEEE, DEC, Motorola
|
||||
* IEEE, or UNKnown).
|
||||
*
|
||||
* For Digital Equipment PDP-11 and VAX computers, certain
|
||||
* IBM systems, and others that use numbers with a 56-bit
|
||||
* significand, the symbol DEC should be defined. In this
|
||||
* mode, most floating point constants are given as arrays
|
||||
* of octal integers to eliminate decimal to binary conversion
|
||||
* errors that might be introduced by the compiler.
|
||||
*
|
||||
* For little-endian computers, such as IBM PC, that follow the
|
||||
* IEEE Standard for Binary Floating Point Arithmetic (ANSI/IEEE
|
||||
* Std 754-1985), the symbol IBMPC should be defined. These
|
||||
* numbers have 53-bit significands. In this mode, constants
|
||||
* are provided as arrays of hexadecimal 16 bit integers.
|
||||
*
|
||||
* Big-endian IEEE format is denoted MIEEE. On some RISC
|
||||
* systems such as Sun SPARC, double precision constants
|
||||
* must be stored on 8-byte address boundaries. Since integer
|
||||
* arrays may be aligned differently, the MIEEE configuration
|
||||
* may fail on such machines.
|
||||
*
|
||||
* To accommodate other types of computer arithmetic, all
|
||||
* constants are also provided in a normal decimal radix
|
||||
* which one can hope are correctly converted to a suitable
|
||||
* format by the available C language compiler. To invoke
|
||||
* this mode, define the symbol UNK.
|
||||
*
|
||||
* An important difference among these modes is a predefined
|
||||
* set of machine arithmetic constants for each. The numbers
|
||||
* MACHEP (the machine roundoff error), MAXNUM (largest number
|
||||
* represented), and several other parameters are preset by
|
||||
* the configuration symbol. Check the file const.c to
|
||||
* ensure that these values are correct for your computer.
|
||||
*
|
||||
* Configurations NANS, INFINITIES, MINUSZERO, and DENORMAL
|
||||
* may fail on many systems. Verify that they are supposed
|
||||
* to work on your computer.
|
||||
*/
|
||||
|
||||
/*
|
||||
Cephes Math Library Release 2.3: June, 1995
|
||||
Copyright 1984, 1987, 1989, 1995 by Stephen L. Moshier
|
||||
*/
|
||||
|
||||
|
||||
/* Constant definitions for math error conditions
|
||||
*/
|
||||
#ifndef DOMAIN
|
||||
#define DOMAIN 1 /* argument domain error */
|
||||
#define SING 2 /* argument singularity */
|
||||
#define OVERFLOW 3 /* overflow range error */
|
||||
#define UNDERFLOW 4 /* underflow range error */
|
||||
#define TLOSS 5 /* total loss of precision */
|
||||
#define PLOSS 6 /* partial loss of precision */
|
||||
|
||||
#define EDOM 33
|
||||
#define ERANGE 34
|
||||
#endif
|
||||
|
||||
/* Complex numeral. */
|
||||
typedef struct
|
||||
{
|
||||
double r;
|
||||
double i;
|
||||
} cmplx;
|
||||
|
||||
/* Long double complex numeral. */
|
||||
/*
|
||||
typedef struct
|
||||
{
|
||||
long double r;
|
||||
long double i;
|
||||
} cmplxl;
|
||||
*/
|
||||
|
||||
/* Type of computer arithmetic */
|
||||
|
||||
/* PDP-11, Pro350, VAX:
|
||||
*/
|
||||
/* #define DEC 1 */
|
||||
|
||||
/* Intel IEEE, low order words come first:
|
||||
*/
|
||||
/*#define IBMPC 1 */
|
||||
|
||||
/* Motorola IEEE, high order words come first
|
||||
* (Sun 680x0 workstation):
|
||||
*/
|
||||
/* #define MIEEE 1 */
|
||||
|
||||
/* UNKnown arithmetic, invokes coefficients given in
|
||||
* normal decimal format. Beware of range boundary
|
||||
* problems (MACHEP, MAXLOG, etc. in const.c) and
|
||||
* roundoff problems in pow.c:
|
||||
* (Sun SPARCstation)
|
||||
*/
|
||||
#define UNK 1
|
||||
|
||||
/* If you define UNK, then be sure to set BIGENDIAN properly. */
|
||||
#define BIGENDIAN 0
|
||||
|
||||
/* Define this `volatile' if your compiler thinks
|
||||
* that floating point arithmetic obeys the associative
|
||||
* and distributive laws. It will defeat some optimizations
|
||||
* (but probably not enough of them).
|
||||
*
|
||||
* #define VOLATILE volatile
|
||||
*/
|
||||
#define VOLATILE
|
||||
|
||||
/* For 12-byte long doubles on an i386, pad a 16-bit short 0
|
||||
* to the end of real constants initialized by integer arrays.
|
||||
*
|
||||
* #define XPD 0,
|
||||
*
|
||||
* Otherwise, the type is 10 bytes long and XPD should be
|
||||
* defined blank (e.g., Microsoft C).
|
||||
*
|
||||
* #define XPD
|
||||
*/
|
||||
#define XPD 0,
|
||||
|
||||
/* Define to support tiny denormal numbers, else undefine. */
|
||||
#define DENORMAL 1
|
||||
|
||||
/* Define to ask for infinity support, else undefine. */
|
||||
/* #define INFINITIES 1 */
|
||||
|
||||
/* Define to ask for support of numbers that are Not-a-Number,
|
||||
else undefine. This may automatically define INFINITIES in some files. */
|
||||
/* #define NANS 1 */
|
||||
|
||||
/* Define to distinguish between -0.0 and +0.0. */
|
||||
/* #define MINUSZERO 1 */
|
||||
|
||||
/* Define 1 for ANSI C atan2() function
|
||||
See atan.c and clog.c. */
|
||||
#define ANSIC 1
|
||||
|
||||
/* Get ANSI function prototypes, if you want them. */
|
||||
#ifdef __STDC__
|
||||
#define ANSIPROT
|
||||
#include "cephes-protos.h"
|
||||
#else
|
||||
int mtherr();
|
||||
#endif
|
||||
|
||||
/* Variable for error reporting. See mtherr.c. */
|
||||
extern int merror;
|
57
nist/nist.c
Normal file
57
nist/nist.c
Normal file
|
@ -0,0 +1,57 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "nist.h"
|
||||
|
||||
#define _32MB (32 * 1024 * 1024)
|
||||
#define _08MB (8 * 1024 * 1024)
|
||||
#define _04MB (4 * 1024 * 1024)
|
||||
#define _02MB (2 * 1024 * 1024)
|
||||
|
||||
|
||||
static int random_pool1 [_32MB];
|
||||
char basedirname[FILENAME_MAX+1];
|
||||
|
||||
char *GetBaseDir(void)
|
||||
{
|
||||
return basedirname;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *filename = "";
|
||||
FILE *fp = stdin;
|
||||
long result=0;
|
||||
|
||||
if (argc<2 || argc>3) {
|
||||
printf("Usage sts <file> [<template directory>]\n");
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* get optional directory name
|
||||
*/
|
||||
basedirname[0] = 0;
|
||||
if (argc>2) {
|
||||
strcat(basedirname, argv[2]);
|
||||
strcat(basedirname, "/");
|
||||
}
|
||||
|
||||
filename = argv[1];
|
||||
if ((fp = fopen(filename, "rb")) == NULL) {
|
||||
printf("Cannot open file %s\n", filename);
|
||||
return 2;
|
||||
}
|
||||
result = fread(random_pool1,sizeof(int),_04MB,fp);
|
||||
fclose(fp);
|
||||
if (result!=_04MB) {
|
||||
printf("16MB sample required %ld != %d\n",result, _04MB);
|
||||
return 3;
|
||||
}
|
||||
if (PackTestF (random_pool1, _04MB, "nist.out") < 8) {
|
||||
if (PackTestL (random_pool1, _04MB, "nist.out") < 8)
|
||||
return 0;
|
||||
return 5;
|
||||
}
|
||||
return 4;
|
||||
}
|
33
nist/nist.h
Normal file
33
nist/nist.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Supply function prototypes for the test suite.
|
||||
*/
|
||||
int PackTestF (int *ARRAY, int ArraySize, char *C);
|
||||
int PackTestL (int *ARRAY, int ArraySize, char *C);
|
||||
|
||||
int ApproximateEntropy (int mmin, int mmax, int n, int *ARRAY);
|
||||
int BlockFrequency (int ArraySize, int m, int *ARRAY);
|
||||
int CumulativeSums (int n, int *ARRAY);
|
||||
int DiscreteFourierTransform (int N, int *ARRAY);
|
||||
int Frequency (int n, int *ARRAY);
|
||||
int LempelZivCompression (int n, int *ARRAY, int *DATA, int *pt, int *PT);
|
||||
int LinearComplexity (int M, int N, int *ARRAY, int PT);
|
||||
int LongestRunOfOnes (int n, int *ARRAY);
|
||||
int NonOverlappingTemplateMatchings (int m, int n, int *ARRAY);
|
||||
int OverlappingTemplateMatchings (int m, int n, int *ARRAY);
|
||||
int RandomExcursions (int n, int *ARRAY);
|
||||
int RandomExcursionsVariant (int n, int *ARRAY);
|
||||
int Rank (int n, int *ARRAY);
|
||||
int Runs (int n, int *ARRAY);
|
||||
int Serial (int m, int n, int *ARRAY, int PT);
|
||||
int UNIVERSAL (int n, int *ARRAY);
|
||||
int Universal (int n, int *ARRAY);
|
||||
|
||||
double psi2 (int m, int n, int *ARRAY, int PT);
|
||||
/**
|
||||
* From dfft.c
|
||||
*/
|
||||
void __ogg_fdrffti(int n, double *wsave, int *ifac);
|
||||
void __ogg_fdrfftf(int n,double *r,double *wsave,int *ifac);
|
||||
|
||||
char *GetBaseDir(void);
|
||||
|
2252
nist/packtest.c
Normal file
2252
nist/packtest.c
Normal file
File diff suppressed because it is too large
Load diff
32
nist/special-functions.c
Normal file
32
nist/special-functions.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
S P E C I A L F U N C T I O N S
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
#define LinuxorUnix
|
||||
#ifdef WIN
|
||||
#ifndef CYGWIN
|
||||
#undef LinuxorUnix
|
||||
/* same libraries are available*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LinuxorUnix
|
||||
double normal(double x)
|
||||
{
|
||||
double arg, result, sqrt2=1.414213562373095048801688724209698078569672;
|
||||
|
||||
if (x > 0) {
|
||||
arg = x/sqrt2;
|
||||
result = 0.5 * ( 1 + erf(arg) );
|
||||
}
|
||||
else {
|
||||
arg = -x/sqrt2;
|
||||
result = 0.5 * ( 1 - erf(arg) );
|
||||
}
|
||||
return( result);
|
||||
}
|
||||
|
||||
double normal2(double a)
|
||||
{ return (1.0-0.5*erfc(a/sqrt(2.0))); }
|
||||
#endif
|
14
nist/special-functions.h
Normal file
14
nist/special-functions.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
S P E C I A L F U N C T I O N P R O T O T Y P E S
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
double derf_(); /* ERROR FUNCTION */
|
||||
double derfc(); /* COMPLEMENTARY ERROR */
|
||||
double normal(double); /* NORMAL DISTRIBUTION */
|
||||
double normal2(double); /* NORMAL DISTRIBUTION */
|
||||
/*
|
||||
double gser(double,double,double,double);
|
||||
double gcf(double,double,double,double);
|
||||
double gammln(double); LOG GAMMA FUNCTION
|
||||
double gammq(double,double); INCOMPLETE GAMMA FUNCTION
|
||||
*/
|
148
nist/template9
Normal file
148
nist/template9
Normal file
|
@ -0,0 +1,148 @@
|
|||
0 0 0 0 0 0 0 0 1
|
||||
0 0 0 0 0 0 0 1 1
|
||||
0 0 0 0 0 0 1 0 1
|
||||
0 0 0 0 0 0 1 1 1
|
||||
0 0 0 0 0 1 0 0 1
|
||||
0 0 0 0 0 1 0 1 1
|
||||
0 0 0 0 0 1 1 0 1
|
||||
0 0 0 0 0 1 1 1 1
|
||||
0 0 0 0 1 0 0 0 1
|
||||
0 0 0 0 1 0 0 1 1
|
||||
0 0 0 0 1 0 1 0 1
|
||||
0 0 0 0 1 0 1 1 1
|
||||
0 0 0 0 1 1 0 0 1
|
||||
0 0 0 0 1 1 0 1 1
|
||||
0 0 0 0 1 1 1 0 1
|
||||
0 0 0 0 1 1 1 1 1
|
||||
0 0 0 1 0 0 0 1 1
|
||||
0 0 0 1 0 0 1 0 1
|
||||
0 0 0 1 0 0 1 1 1
|
||||
0 0 0 1 0 1 0 0 1
|
||||
0 0 0 1 0 1 0 1 1
|
||||
0 0 0 1 0 1 1 0 1
|
||||
0 0 0 1 0 1 1 1 1
|
||||
0 0 0 1 1 0 0 1 1
|
||||
0 0 0 1 1 0 1 0 1
|
||||
0 0 0 1 1 0 1 1 1
|
||||
0 0 0 1 1 1 0 0 1
|
||||
0 0 0 1 1 1 0 1 1
|
||||
0 0 0 1 1 1 1 0 1
|
||||
0 0 0 1 1 1 1 1 1
|
||||
0 0 1 0 0 0 0 1 1
|
||||
0 0 1 0 0 0 1 0 1
|
||||
0 0 1 0 0 0 1 1 1
|
||||
0 0 1 0 0 1 0 1 1
|
||||
0 0 1 0 0 1 1 0 1
|
||||
0 0 1 0 0 1 1 1 1
|
||||
0 0 1 0 1 0 0 1 1
|
||||
0 0 1 0 1 0 1 0 1
|
||||
0 0 1 0 1 0 1 1 1
|
||||
0 0 1 0 1 1 0 1 1
|
||||
0 0 1 0 1 1 1 0 1
|
||||
0 0 1 0 1 1 1 1 1
|
||||
0 0 1 1 0 0 1 0 1
|
||||
0 0 1 1 0 0 1 1 1
|
||||
0 0 1 1 0 1 0 1 1
|
||||
0 0 1 1 0 1 1 0 1
|
||||
0 0 1 1 0 1 1 1 1
|
||||
0 0 1 1 1 0 1 0 1
|
||||
0 0 1 1 1 0 1 1 1
|
||||
0 0 1 1 1 1 0 1 1
|
||||
0 0 1 1 1 1 1 0 1
|
||||
0 0 1 1 1 1 1 1 1
|
||||
0 1 0 0 0 0 0 1 1
|
||||
0 1 0 0 0 0 1 1 1
|
||||
0 1 0 0 0 1 0 1 1
|
||||
0 1 0 0 0 1 1 1 1
|
||||
0 1 0 0 1 0 0 1 1
|
||||
0 1 0 0 1 0 1 1 1
|
||||
0 1 0 0 1 1 0 1 1
|
||||
0 1 0 0 1 1 1 1 1
|
||||
0 1 0 1 0 0 0 1 1
|
||||
0 1 0 1 0 0 1 1 1
|
||||
0 1 0 1 0 1 0 1 1
|
||||
0 1 0 1 0 1 1 1 1
|
||||
0 1 0 1 1 0 0 1 1
|
||||
0 1 0 1 1 0 1 1 1
|
||||
0 1 0 1 1 1 0 1 1
|
||||
0 1 0 1 1 1 1 1 1
|
||||
0 1 1 0 0 0 1 1 1
|
||||
0 1 1 0 0 1 1 1 1
|
||||
0 1 1 0 1 0 1 1 1
|
||||
0 1 1 0 1 1 1 1 1
|
||||
0 1 1 1 0 1 1 1 1
|
||||
0 1 1 1 1 1 1 1 1
|
||||
1 0 0 0 0 0 0 0 0
|
||||
1 0 0 0 1 0 0 0 0
|
||||
1 0 0 1 0 0 0 0 0
|
||||
1 0 0 1 0 1 0 0 0
|
||||
1 0 0 1 1 0 0 0 0
|
||||
1 0 0 1 1 1 0 0 0
|
||||
1 0 1 0 0 0 0 0 0
|
||||
1 0 1 0 0 0 1 0 0
|
||||
1 0 1 0 0 1 0 0 0
|
||||
1 0 1 0 0 1 1 0 0
|
||||
1 0 1 0 1 0 0 0 0
|
||||
1 0 1 0 1 0 1 0 0
|
||||
1 0 1 0 1 1 0 0 0
|
||||
1 0 1 0 1 1 1 0 0
|
||||
1 0 1 1 0 0 0 0 0
|
||||
1 0 1 1 0 0 1 0 0
|
||||
1 0 1 1 0 1 0 0 0
|
||||
1 0 1 1 0 1 1 0 0
|
||||
1 0 1 1 1 0 0 0 0
|
||||
1 0 1 1 1 0 1 0 0
|
||||
1 0 1 1 1 1 0 0 0
|
||||
1 0 1 1 1 1 1 0 0
|
||||
1 1 0 0 0 0 0 0 0
|
||||
1 1 0 0 0 0 0 1 0
|
||||
1 1 0 0 0 0 1 0 0
|
||||
1 1 0 0 0 1 0 0 0
|
||||
1 1 0 0 0 1 0 1 0
|
||||
1 1 0 0 1 0 0 0 0
|
||||
1 1 0 0 1 0 0 1 0
|
||||
1 1 0 0 1 0 1 0 0
|
||||
1 1 0 0 1 1 0 0 0
|
||||
1 1 0 0 1 1 0 1 0
|
||||
1 1 0 1 0 0 0 0 0
|
||||
1 1 0 1 0 0 0 1 0
|
||||
1 1 0 1 0 0 1 0 0
|
||||
1 1 0 1 0 1 0 0 0
|
||||
1 1 0 1 0 1 0 1 0
|
||||
1 1 0 1 0 1 1 0 0
|
||||
1 1 0 1 1 0 0 0 0
|
||||
1 1 0 1 1 0 0 1 0
|
||||
1 1 0 1 1 0 1 0 0
|
||||
1 1 0 1 1 1 0 0 0
|
||||
1 1 0 1 1 1 0 1 0
|
||||
1 1 0 1 1 1 1 0 0
|
||||
1 1 1 0 0 0 0 0 0
|
||||
1 1 1 0 0 0 0 1 0
|
||||
1 1 1 0 0 0 1 0 0
|
||||
1 1 1 0 0 0 1 1 0
|
||||
1 1 1 0 0 1 0 0 0
|
||||
1 1 1 0 0 1 0 1 0
|
||||
1 1 1 0 0 1 1 0 0
|
||||
1 1 1 0 1 0 0 0 0
|
||||
1 1 1 0 1 0 0 1 0
|
||||
1 1 1 0 1 0 1 0 0
|
||||
1 1 1 0 1 0 1 1 0
|
||||
1 1 1 0 1 1 0 0 0
|
||||
1 1 1 0 1 1 0 1 0
|
||||
1 1 1 0 1 1 1 0 0
|
||||
1 1 1 1 0 0 0 0 0
|
||||
1 1 1 1 0 0 0 1 0
|
||||
1 1 1 1 0 0 1 0 0
|
||||
1 1 1 1 0 0 1 1 0
|
||||
1 1 1 1 0 1 0 0 0
|
||||
1 1 1 1 0 1 0 1 0
|
||||
1 1 1 1 0 1 1 0 0
|
||||
1 1 1 1 0 1 1 1 0
|
||||
1 1 1 1 1 0 0 0 0
|
||||
1 1 1 1 1 0 0 1 0
|
||||
1 1 1 1 1 0 1 0 0
|
||||
1 1 1 1 1 0 1 1 0
|
||||
1 1 1 1 1 1 0 0 0
|
||||
1 1 1 1 1 1 0 1 0
|
||||
1 1 1 1 1 1 1 0 0
|
||||
1 1 1 1 1 1 1 1 0
|
34
src/Makefile.am
Normal file
34
src/Makefile.am
Normal file
|
@ -0,0 +1,34 @@
|
|||
## Process this file with automake to produce Makefile.in.
|
||||
|
||||
if ENABLE_BIN
|
||||
bin_PROGRAMS = haveged
|
||||
else
|
||||
sbin_PROGRAMS = haveged
|
||||
endif
|
||||
|
||||
AM_CFLAGS=-Wall -Wextra -Wpedantic -I..
|
||||
|
||||
####nolibtool_start##
|
||||
##haveged_SOURCES = haveged.c havege.c havegetune.c havegecollect.c havegetest.c havegecmd.c \
|
||||
## cpuid-43.h haveged.h havege.h havegetune.h havegecollect.h havegetest.h oneiteration.h \
|
||||
## havegecmd.h
|
||||
##
|
||||
##haveged_LDADD = @HA_LDFLAGS@
|
||||
####nolibtool_end##
|
||||
##libtool_start##
|
||||
lib_LTLIBRARIES = libhavege.la
|
||||
libhavege_la_CPPFLAGS =
|
||||
libhavege_la_LDFLAGS = -version-number @HAVEGE_LT_VERSION@
|
||||
libhavege_la_LIBADD = @HA_LDFLAGS@
|
||||
|
||||
libhavege_la_SOURCES = havege.c havegetune.c havegecollect.c havegetest.c \
|
||||
cpuid-43.h havege.h havegetune.h havegecollect.h havegetest.h oneiteration.h
|
||||
|
||||
pkginclude_HEADERS = havege.h
|
||||
|
||||
haveged_SOURCES = haveged.c haveged.h havegecmd.c havegecmd.h
|
||||
|
||||
haveged_LDADD = @HA_LDFLAGS@ libhavege.la
|
||||
##libtool_end##
|
||||
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
794
src/Makefile.in
Normal file
794
src/Makefile.in
Normal file
|
@ -0,0 +1,794 @@
|
|||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
|
||||
|
||||
VPATH = @srcdir@
|
||||
am__is_gnu_make = { \
|
||||
if test -z '$(MAKELEVEL)'; then \
|
||||
false; \
|
||||
elif test -n '$(MAKE_HOST)'; then \
|
||||
true; \
|
||||
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||
true; \
|
||||
else \
|
||||
false; \
|
||||
fi; \
|
||||
}
|
||||
am__make_running_with_option = \
|
||||
case $${target_option-} in \
|
||||
?) ;; \
|
||||
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||
"target option '$${target_option-}' specified" >&2; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
has_opt=no; \
|
||||
sane_makeflags=$$MAKEFLAGS; \
|
||||
if $(am__is_gnu_make); then \
|
||||
sane_makeflags=$$MFLAGS; \
|
||||
else \
|
||||
case $$MAKEFLAGS in \
|
||||
*\\[\ \ ]*) \
|
||||
bs=\\; \
|
||||
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||
esac; \
|
||||
fi; \
|
||||
skip_next=no; \
|
||||
strip_trailopt () \
|
||||
{ \
|
||||
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||
}; \
|
||||
for flg in $$sane_makeflags; do \
|
||||
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||
case $$flg in \
|
||||
*=*|--*) continue;; \
|
||||
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||
-*I?*) strip_trailopt 'I';; \
|
||||
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||
-*O?*) strip_trailopt 'O';; \
|
||||
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||
-*l?*) strip_trailopt 'l';; \
|
||||
-[dEDm]) skip_next=yes;; \
|
||||
-[JT]) skip_next=yes;; \
|
||||
esac; \
|
||||
case $$flg in \
|
||||
*$$target_option*) has_opt=yes; break;; \
|
||||
esac; \
|
||||
done; \
|
||||
test $$has_opt = yes
|
||||
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
@ENABLE_BIN_TRUE@bin_PROGRAMS = haveged$(EXEEXT)
|
||||
@ENABLE_BIN_FALSE@sbin_PROGRAMS = haveged$(EXEEXT)
|
||||
subdir = src
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(pkginclude_HEADERS) \
|
||||
$(am__DIST_COMMON)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
|
||||
"$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"
|
||||
PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__uninstall_files_from_dir = { \
|
||||
test -z "$$files" \
|
||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||
}
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libhavege_la_DEPENDENCIES =
|
||||
am_libhavege_la_OBJECTS = libhavege_la-havege.lo \
|
||||
libhavege_la-havegetune.lo libhavege_la-havegecollect.lo \
|
||||
libhavege_la-havegetest.lo
|
||||
libhavege_la_OBJECTS = $(am_libhavege_la_OBJECTS)
|
||||
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||
am__v_lt_0 = --silent
|
||||
am__v_lt_1 =
|
||||
libhavege_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(libhavege_la_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am_haveged_OBJECTS = haveged.$(OBJEXT) havegecmd.$(OBJEXT)
|
||||
haveged_OBJECTS = $(am_haveged_OBJECTS)
|
||||
haveged_DEPENDENCIES = libhavege.la
|
||||
AM_V_P = $(am__v_P_@AM_V@)
|
||||
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||
am__v_P_0 = false
|
||||
am__v_P_1 = :
|
||||
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
am__v_GEN_1 =
|
||||
AM_V_at = $(am__v_at_@AM_V@)
|
||||
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||
am__v_at_0 = @
|
||||
am__v_at_1 =
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp =
|
||||
am__maybe_remake_depfiles =
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||
$(AM_CFLAGS) $(CFLAGS)
|
||||
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||
am__v_CC_0 = @echo " CC " $@;
|
||||
am__v_CC_1 =
|
||||
CCLD = $(CC)
|
||||
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||
am__v_CCLD_1 =
|
||||
SOURCES = $(libhavege_la_SOURCES) $(haveged_SOURCES)
|
||||
DIST_SOURCES = $(libhavege_la_SOURCES) $(haveged_SOURCES)
|
||||
am__can_run_installinfo = \
|
||||
case $$AM_UPDATE_INFO_DIR in \
|
||||
n|no|NO) false;; \
|
||||
*) (install-info --version) >/dev/null 2>&1;; \
|
||||
esac
|
||||
HEADERS = $(pkginclude_HEADERS)
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
am__uniquify_input = $(AWK) '\
|
||||
BEGIN { nonempty = 0; } \
|
||||
{ items[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in items) print i; }; } \
|
||||
'
|
||||
# Make sure the list of sources is unique. This is necessary because,
|
||||
# e.g., the same source file might be shared among _SOURCES variables
|
||||
# for different programs/libraries.
|
||||
am__define_uniq_tagged_files = \
|
||||
list='$(am__tagged_files)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
GREP = @GREP@
|
||||
HAVEGE_LT_VERSION = @HAVEGE_LT_VERSION@
|
||||
HA_DISTRO = @HA_DISTRO@
|
||||
HA_LDFLAGS = @HA_LDFLAGS@
|
||||
HA_UNITD = @HA_UNITD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_AR = @ac_ct_AR@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CFLAGS = -Wall -Wextra -Wpedantic -I..
|
||||
|
||||
####nolibtool_start##
|
||||
####nolibtool_end##
|
||||
lib_LTLIBRARIES = libhavege.la
|
||||
libhavege_la_CPPFLAGS =
|
||||
libhavege_la_LDFLAGS = -version-number @HAVEGE_LT_VERSION@
|
||||
libhavege_la_LIBADD = @HA_LDFLAGS@
|
||||
libhavege_la_SOURCES = havege.c havegetune.c havegecollect.c havegetest.c \
|
||||
cpuid-43.h havege.h havegetune.h havegecollect.h havegetest.h oneiteration.h
|
||||
|
||||
pkginclude_HEADERS = havege.h
|
||||
haveged_SOURCES = haveged.c haveged.h havegecmd.c havegecmd.h
|
||||
haveged_LDADD = @HA_LDFLAGS@ libhavege.la
|
||||
MAINTAINERCLEANFILES = Makefile.in
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .c .lo .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu --ignore-deps src/Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' \
|
||||
-e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' \
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
install-sbinPROGRAMS: $(sbin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p \
|
||||
|| test -f $$p1 \
|
||||
; then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' \
|
||||
-e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-sbinPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' \
|
||||
`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(sbindir)" && rm -f $$files
|
||||
|
||||
clean-sbinPROGRAMS:
|
||||
@list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list || exit $$?; \
|
||||
test -n "$(EXEEXT)" || exit 0; \
|
||||
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||
echo " rm -f" $$list; \
|
||||
rm -f $$list
|
||||
|
||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
list2=; for p in $$list; do \
|
||||
if test -f $$p; then \
|
||||
list2="$$list2 $$p"; \
|
||||
else :; fi; \
|
||||
done; \
|
||||
test -z "$$list2" || { \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
||||
}
|
||||
|
||||
uninstall-libLTLIBRARIES:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
||||
for p in $$list; do \
|
||||
$(am__strip_dir) \
|
||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
||||
done
|
||||
|
||||
clean-libLTLIBRARIES:
|
||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
||||
@list='$(lib_LTLIBRARIES)'; \
|
||||
locs=`for p in $$list; do echo $$p; done | \
|
||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
||||
sort -u`; \
|
||||
test -z "$$locs" || { \
|
||||
echo rm -f $${locs}; \
|
||||
rm -f $${locs}; \
|
||||
}
|
||||
|
||||
libhavege.la: $(libhavege_la_OBJECTS) $(libhavege_la_DEPENDENCIES) $(EXTRA_libhavege_la_DEPENDENCIES)
|
||||
$(AM_V_CCLD)$(libhavege_la_LINK) -rpath $(libdir) $(libhavege_la_OBJECTS) $(libhavege_la_LIBADD) $(LIBS)
|
||||
|
||||
haveged$(EXEEXT): $(haveged_OBJECTS) $(haveged_DEPENDENCIES) $(EXTRA_haveged_DEPENDENCIES)
|
||||
@rm -f haveged$(EXEEXT)
|
||||
$(AM_V_CCLD)$(LINK) $(haveged_OBJECTS) $(haveged_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
.c.o:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ $<
|
||||
|
||||
.c.obj:
|
||||
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
.c.lo:
|
||||
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
|
||||
|
||||
libhavege_la-havege.lo: havege.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhavege_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhavege_la-havege.lo `test -f 'havege.c' || echo '$(srcdir)/'`havege.c
|
||||
|
||||
libhavege_la-havegetune.lo: havegetune.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhavege_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhavege_la-havegetune.lo `test -f 'havegetune.c' || echo '$(srcdir)/'`havegetune.c
|
||||
|
||||
libhavege_la-havegecollect.lo: havegecollect.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhavege_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhavege_la-havegecollect.lo `test -f 'havegecollect.c' || echo '$(srcdir)/'`havegecollect.c
|
||||
|
||||
libhavege_la-havegetest.lo: havegetest.c
|
||||
$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libhavege_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libhavege_la-havegetest.lo `test -f 'havegetest.c' || echo '$(srcdir)/'`havegetest.c
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
|
||||
@$(NORMAL_INSTALL)
|
||||
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||
if test -n "$$list"; then \
|
||||
echo " $(MKDIR_P) '$(DESTDIR)$(pkgincludedir)'"; \
|
||||
$(MKDIR_P) "$(DESTDIR)$(pkgincludedir)" || exit 1; \
|
||||
fi; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; \
|
||||
done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
|
||||
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
|
||||
done
|
||||
|
||||
uninstall-pkgincludeHEADERS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
|
||||
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
|
||||
dir='$(DESTDIR)$(pkgincludedir)'; $(am__uninstall_files_from_dir)
|
||||
|
||||
ID: $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||
tags: tags-am
|
||||
TAGS: tags
|
||||
|
||||
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
$(am__define_uniq_tagged_files); \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: ctags-am
|
||||
|
||||
CTAGS: ctags
|
||||
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||
$(am__define_uniq_tagged_files); \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
cscopelist: cscopelist-am
|
||||
|
||||
cscopelist-am: $(am__tagged_files)
|
||||
list='$(am__tagged_files)'; \
|
||||
case "$(srcdir)" in \
|
||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||
esac; \
|
||||
for i in $$list; do \
|
||||
if test -f "$$i"; then \
|
||||
echo "$(subdir)/$$i"; \
|
||||
else \
|
||||
echo "$$sdir/$$i"; \
|
||||
fi; \
|
||||
done >> $(top_builddir)/cscope.files
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
distdir-am: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS)
|
||||
install-binPROGRAMS: install-libLTLIBRARIES
|
||||
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
if test -z '$(STRIP)'; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
install; \
|
||||
else \
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||
fi
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
|
||||
clean-libtool clean-sbinPROGRAMS mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-pkgincludeHEADERS
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS install-libLTLIBRARIES \
|
||||
install-sbinPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
||||
mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES \
|
||||
uninstall-pkgincludeHEADERS uninstall-sbinPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
|
||||
clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
|
||||
clean-libtool clean-sbinPROGRAMS cscopelist-am ctags ctags-am \
|
||||
distclean distclean-compile distclean-generic \
|
||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-libLTLIBRARIES \
|
||||
install-man install-pdf install-pdf-am \
|
||||
install-pkgincludeHEADERS install-ps install-ps-am \
|
||||
install-sbinPROGRAMS install-strip installcheck \
|
||||
installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \
|
||||
uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS \
|
||||
uninstall-sbinPROGRAMS
|
||||
|
||||
.PRECIOUS: Makefile
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
181
src/cpuid-43.h
Normal file
181
src/cpuid-43.h
Normal file
|
@ -0,0 +1,181 @@
|
|||
/*
|
||||
* Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 3, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* Under Section 7 of GPL version 3, you are granted additional
|
||||
* permissions described in the GCC Runtime Library Exception, version
|
||||
* 3.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License and
|
||||
* a copy of the GCC Runtime Library Exception along with this program;
|
||||
* see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* %ecx */
|
||||
#define bit_SSE3 (1 << 0)
|
||||
#define bit_PCLMUL (1 << 1)
|
||||
#define bit_SSSE3 (1 << 9)
|
||||
#define bit_FMA (1 << 12)
|
||||
#define bit_CMPXCHG16B (1 << 13)
|
||||
#define bit_SSE4_1 (1 << 19)
|
||||
#define bit_SSE4_2 (1 << 20)
|
||||
#define bit_MOVBE (1 << 22)
|
||||
#define bit_POPCNT (1 << 23)
|
||||
#define bit_AES (1 << 25)
|
||||
#define bit_XSAVE (1 << 26)
|
||||
#define bit_OSXSAVE (1 << 27)
|
||||
#define bit_AVX (1 << 28)
|
||||
|
||||
/* %edx */
|
||||
#define bit_CMPXCHG8B (1 << 8)
|
||||
#define bit_CMOV (1 << 15)
|
||||
#define bit_MMX (1 << 23)
|
||||
#define bit_FXSAVE (1 << 24)
|
||||
#define bit_SSE (1 << 25)
|
||||
#define bit_SSE2 (1 << 26)
|
||||
|
||||
/* Extended Features */
|
||||
/* %ecx */
|
||||
#define bit_LAHF_LM (1 << 0)
|
||||
#define bit_ABM (1 << 5)
|
||||
#define bit_SSE4a (1 << 6)
|
||||
#define bit_XOP (1 << 11)
|
||||
#define bit_LWP (1 << 15)
|
||||
#define bit_FMA4 (1 << 16)
|
||||
|
||||
/* %edx */
|
||||
#define bit_LM (1 << 29)
|
||||
#define bit_3DNOWP (1 << 30)
|
||||
#define bit_3DNOW (1 << 31)
|
||||
|
||||
|
||||
#if defined(__i386__) && defined(__PIC__)
|
||||
/* %ebx may be the PIC register. */
|
||||
#if __GNUC__ >= 3
|
||||
#define __cpuid(level, a, b, c, d) \
|
||||
__asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
|
||||
"cpuid\n\t" \
|
||||
"xchg{l}\t{%%}ebx, %1\n\t" \
|
||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level))
|
||||
|
||||
#define __cpuid_count(level, count, a, b, c, d) \
|
||||
__asm__ ("xchg{l}\t{%%}ebx, %1\n\t" \
|
||||
"cpuid\n\t" \
|
||||
"xchg{l}\t{%%}ebx, %1\n\t" \
|
||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level), "2" (count))
|
||||
#else
|
||||
/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
|
||||
nor alternatives in i386 code. */
|
||||
#define __cpuid(level, a, b, c, d) \
|
||||
__asm__ ("xchgl\t%%ebx, %1\n\t" \
|
||||
"cpuid\n\t" \
|
||||
"xchgl\t%%ebx, %1\n\t" \
|
||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level))
|
||||
|
||||
#define __cpuid_count(level, count, a, b, c, d) \
|
||||
__asm__ ("xchgl\t%%ebx, %1\n\t" \
|
||||
"cpuid\n\t" \
|
||||
"xchgl\t%%ebx, %1\n\t" \
|
||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level), "2" (count))
|
||||
#endif
|
||||
#else
|
||||
#define __cpuid(level, a, b, c, d) \
|
||||
__asm__ ("cpuid\n\t" \
|
||||
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level))
|
||||
|
||||
#define __cpuid_count(level, count, a, b, c, d) \
|
||||
__asm__ ("cpuid\n\t" \
|
||||
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
|
||||
: "0" (level), "2" (count))
|
||||
#endif
|
||||
|
||||
/* Return highest supported input value for cpuid instruction. ext can
|
||||
be either 0x0 or 0x8000000 to return highest supported value for
|
||||
basic or extended cpuid information. Function returns 0 if cpuid
|
||||
is not supported or whatever cpuid returns in eax register. If sig
|
||||
pointer is non-null, then first four bytes of the signature
|
||||
(as found in ebx register) are returned in location pointed by sig. */
|
||||
|
||||
static __inline unsigned int
|
||||
__get_cpuid_max (unsigned int __ext, unsigned int *__sig)
|
||||
{
|
||||
unsigned int __eax, __ebx, __ecx, __edx;
|
||||
|
||||
#ifndef __x86_64__
|
||||
/* See if we can use cpuid. On AMD64 we always can. */
|
||||
#if __GNUC__ >= 3
|
||||
__asm__ ("pushf{l|d}\n\t"
|
||||
"pushf{l|d}\n\t"
|
||||
"pop{l}\t%0\n\t"
|
||||
"mov{l}\t{%0, %1|%1, %0}\n\t"
|
||||
"xor{l}\t{%2, %0|%0, %2}\n\t"
|
||||
"push{l}\t%0\n\t"
|
||||
"popf{l|d}\n\t"
|
||||
"pushf{l|d}\n\t"
|
||||
"pop{l}\t%0\n\t"
|
||||
"popf{l|d}\n\t"
|
||||
: "=&r" (__eax), "=&r" (__ebx)
|
||||
: "i" (0x00200000));
|
||||
#else
|
||||
/* Host GCCs older than 3.0 weren't supporting Intel asm syntax
|
||||
nor alternatives in i386 code. */
|
||||
__asm__ ("pushfl\n\t"
|
||||
"pushfl\n\t"
|
||||
"popl\t%0\n\t"
|
||||
"movl\t%0, %1\n\t"
|
||||
"xorl\t%2, %0\n\t"
|
||||
"pushl\t%0\n\t"
|
||||
"popfl\n\t"
|
||||
"pushfl\n\t"
|
||||
"popl\t%0\n\t"
|
||||
"popfl\n\t"
|
||||
: "=&r" (__eax), "=&r" (__ebx)
|
||||
: "i" (0x00200000));
|
||||
#endif
|
||||
|
||||
if (!((__eax ^ __ebx) & 0x00200000))
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
/* Host supports cpuid. Return highest supported cpuid input value. */
|
||||
__cpuid (__ext, __eax, __ebx, __ecx, __edx);
|
||||
|
||||
if (__sig)
|
||||
*__sig = __ebx;
|
||||
|
||||
return __eax;
|
||||
}
|
||||
|
||||
/* Return cpuid data for requested cpuid level, as found in returned
|
||||
eax, ebx, ecx and edx registers. The function checks if cpuid is
|
||||
supported and returns 1 for valid cpuid information or 0 for
|
||||
unsupported cpuid level. All pointers are required to be non-null. */
|
||||
|
||||
static __inline int
|
||||
__get_cpuid (unsigned int __level,
|
||||
unsigned int *__eax, unsigned int *__ebx,
|
||||
unsigned int *__ecx, unsigned int *__edx)
|
||||
{
|
||||
unsigned int __ext = __level & 0x80000000;
|
||||
|
||||
if (__get_cpuid_max (__ext, 0) < __level)
|
||||
return 0;
|
||||
|
||||
__cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
|
||||
return 1;
|
||||
}
|
785
src/havege.c
Normal file
785
src/havege.c
Normal file
|
@ -0,0 +1,785 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*/
|
||||
/**
|
||||
* This compile unit implements the havege algorithm as an inteface to
|
||||
* either a single collector in the calling process or an interface to
|
||||
* multiple collector processes (experimental).
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include "havegetest.h"
|
||||
#include "havegetune.h"
|
||||
/**
|
||||
* The library version interface results in a pair of version definitions
|
||||
* which must agree yet must also be string literals. No foolproof build
|
||||
* mechanism could be devised to ensure this, so a run-time check was added
|
||||
* instead - if the two definitions do not agree, the interface is diabled.
|
||||
*/
|
||||
#define INTERFACE_DISABLED() strcmp(PACKAGE_VERSION,HAVEGE_PREP_VERSION)
|
||||
|
||||
#if NUMBER_CORES>1
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/wait.h>
|
||||
#include <semaphore.h>
|
||||
#include <sched.h>
|
||||
/**
|
||||
* Collection thread directory
|
||||
*/
|
||||
typedef struct {
|
||||
pid_t main; /* the main thread */
|
||||
H_UINT exit_ct; /* shutdown counter */
|
||||
H_UINT count; /* associated count */
|
||||
H_UINT last; /* last output */
|
||||
H_UINT *out; /* buffer pointer */
|
||||
H_UINT fatal; /* fatal error in last */
|
||||
sem_t flags[1]; /* thread signals */
|
||||
} H_THREAD;
|
||||
/**
|
||||
* Local prototypes
|
||||
*/
|
||||
static int havege_exit(H_PTR h_ptr);
|
||||
static void havege_ipc(H_PTR h_ptr, H_UINT n, H_UINT sz);
|
||||
static int havege_rngChild(H_PTR h_ptr, H_UINT cNumber);
|
||||
static void havege_unipc(H_PTR h_ptr);
|
||||
#endif
|
||||
/**
|
||||
* Main allocation
|
||||
*/
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
typedef struct {
|
||||
struct h_anchor info; /* Application anchor */
|
||||
HOST_CFG cfg; /* Runtime environment */
|
||||
procShared std; /* Shared test data */
|
||||
} H_SETUP;
|
||||
|
||||
static int testsConfigure(H_UINT *tot, H_UINT *run, char *options);
|
||||
static void testsStatus(procShared *tps, char *tot, char *prod);
|
||||
|
||||
static void testReport(H_COLLECT * h_ctxt, H_UINT action, H_UINT prod, H_UINT state, H_UINT ct);
|
||||
static void testReportA(H_PTR h, procA *context);
|
||||
static void testReportB(H_PTR h, procB *context);
|
||||
|
||||
#else
|
||||
typedef struct {
|
||||
struct h_anchor info; /* Application anchor */
|
||||
HOST_CFG cfg; /* Runtime environment */
|
||||
} H_SETUP;
|
||||
|
||||
#endif
|
||||
/**
|
||||
* Local prototypes
|
||||
*/
|
||||
static void havege_mute(const char *format, ...);
|
||||
/**
|
||||
* Initialize the environment based upon the tuning survey. This includes,
|
||||
* allocation the output buffer (in shared memory if mult-threaded) and
|
||||
* fitting the collection code to the tuning inputs.
|
||||
*/
|
||||
H_PTR havege_create( /* RETURN: app state */
|
||||
H_PARAMS *params) /* IN: input params */
|
||||
{
|
||||
H_SETUP *anchor;
|
||||
HOST_CFG *env;
|
||||
H_PTR h = 0;
|
||||
H_UINT n = params->nCores;
|
||||
H_UINT sz = params->ioSz;
|
||||
|
||||
if (INTERFACE_DISABLED())
|
||||
return NULL;
|
||||
if (0 == n)
|
||||
n = 1;
|
||||
if (0 == sz)
|
||||
sz = DEFAULT_BUFSZ;
|
||||
anchor = (H_SETUP *)calloc(sizeof(H_SETUP),1);
|
||||
if (NULL==anchor)
|
||||
return h;
|
||||
h = &anchor->info;
|
||||
h->print_msg = params->msg_out==0? havege_mute : params->msg_out;
|
||||
h->metering = params->metering;
|
||||
env = &anchor->cfg;
|
||||
havege_tune(env, params);
|
||||
h->error = H_NOERR;
|
||||
h->arch = ARCH;
|
||||
h->inject = params->injection;
|
||||
h->n_cores = n;
|
||||
h->havege_opts = params->options;
|
||||
h->i_collectSz = params->collectSize==0? NDSIZECOLLECT : params->collectSize;
|
||||
h->i_readSz = sz;
|
||||
h->tuneData = env;
|
||||
h->cpu = &env->cpus[env->a_cpu];
|
||||
h->instCache = &env->caches[env->i_tune];
|
||||
h->dataCache = &env->caches[env->d_tune];
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
{
|
||||
static const H_UINT tests[5] = {B_RUN, A_RUN};
|
||||
|
||||
H_UINT tot=0,run=0;
|
||||
H_UINT i, j;
|
||||
|
||||
procShared *tps = (procShared *)&anchor->std;
|
||||
if (testsConfigure(&tot, &run, params->testSpec)) {
|
||||
h->error = H_NOTESTSPEC;
|
||||
return h;
|
||||
}
|
||||
for(i=j=0;i<2;i++)
|
||||
if (0!=(tot & tests[i])) {
|
||||
tps->testsUsed |= tests[i];
|
||||
tps->totTests[j].action = tests[i];
|
||||
tps->totTests[j++].options = tot;
|
||||
}
|
||||
for(i=j=0;i<2;i++)
|
||||
if (0!=(run & tests[i])) {
|
||||
tps->testsUsed |= tests[i];
|
||||
tps->runTests[j].action = tests[i];
|
||||
tps->runTests[j++].options = run;
|
||||
}
|
||||
testsStatus(tps, tps->totText, tps->prodText);
|
||||
tps->report = testReport;
|
||||
h->testData = tps;
|
||||
if (havege_test(tps, params)) {
|
||||
h->error = H_NOTESTMEM;
|
||||
return h;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if NUMBER_CORES>1
|
||||
havege_ipc(h, n, sz);
|
||||
#else
|
||||
h->io_buf = malloc(sz);
|
||||
h->threads = NULL;
|
||||
#endif
|
||||
if (NULL==h->io_buf) {
|
||||
h->error = H_NOBUF;
|
||||
return h;
|
||||
}
|
||||
havege_ndsetup(h);
|
||||
return h;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
void havege_reparent(
|
||||
H_PTR hptr)
|
||||
{
|
||||
#if NUMBER_CORES>1
|
||||
H_THREAD *t = (H_THREAD *)hptr->threads;
|
||||
if (0 == t)
|
||||
return; /* single-threaded */
|
||||
|
||||
t->main = getpid();
|
||||
#endif
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/**
|
||||
* Destructor. In a multi-collector build, this method should be called from a signal handler
|
||||
* to avoid creating processes.
|
||||
*/
|
||||
void havege_destroy( /* RETURN: none */
|
||||
H_PTR hptr) /* IN-OUT: app anchor */
|
||||
{
|
||||
if (NULL != hptr) {
|
||||
H_COLLECT *htemp;
|
||||
void *temp;
|
||||
#if NUMBER_CORES>1
|
||||
if (!havege_exit(hptr))
|
||||
return; /* only main thread continues */
|
||||
#endif
|
||||
if (0 != (temp=hptr->io_buf)) {
|
||||
hptr->io_buf = 0;
|
||||
free(temp);
|
||||
}
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
if (0 != (temp=hptr->testData)) {
|
||||
double *g = ((procShared *)temp)->G;
|
||||
hptr->testData = 0;
|
||||
if (0 != g)
|
||||
free(g);
|
||||
}
|
||||
#endif
|
||||
if (0 != (htemp=hptr->collector)) {
|
||||
hptr->collector = 0;
|
||||
havege_nddestroy(htemp);
|
||||
}
|
||||
free(hptr);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read random words. In the single-collector case, input is read by the calling
|
||||
* the collection method directly. In the multi-collector case, the request info is
|
||||
* signaled to the collector last read and the caller waits for a completion signal.
|
||||
*/
|
||||
int havege_rng( /* RETURN: number words read */
|
||||
H_PTR h, /* IN-OUT: app state */
|
||||
H_UINT *buffer, /* OUT: read buffer */
|
||||
H_UINT sz) /* IN: number words to read */
|
||||
{
|
||||
#if NUMBER_CORES>1
|
||||
H_THREAD *t = (H_THREAD *) h->threads;
|
||||
|
||||
t->count = sz;
|
||||
t->out = buffer;
|
||||
if (0!=sem_post(&t->flags[t->last]))
|
||||
h->error = H_NORQST;
|
||||
else if (0!=sem_wait(&t->flags[h->n_cores]))
|
||||
h->error = H_NOCOMP;
|
||||
else if (H_NOERR != t->fatal)
|
||||
h->error = t->fatal;
|
||||
#else
|
||||
H_UINT i;
|
||||
|
||||
for(i=0;i<sz;i++)
|
||||
buffer[i] = havege_ndread((H_COLLECT *)h->collector);
|
||||
h->error = ((H_COLLECT *)h->collector)->havege_err;
|
||||
#endif
|
||||
return h->error==(H_UINT)H_NOERR? (int) sz : -1;
|
||||
}
|
||||
/**
|
||||
* Start the entropy collector.
|
||||
*/
|
||||
int havege_run( /* RETURN: NZ on failure */
|
||||
H_PTR h) /* IN-OUT: app anchor */
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
#if NUMBER_CORES>1
|
||||
for(i = 0; i < h->n_cores;i++)
|
||||
if (0 == havege_rngChild(h, i))
|
||||
return 1;
|
||||
#else
|
||||
if (NULL==(h->collector = havege_ndcreate(h, i)))
|
||||
return 1;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Report concealed setup data
|
||||
*/
|
||||
void havege_status( /* RETURN: none */
|
||||
H_PTR h_ptr, /* IN: app state */
|
||||
H_STATUS h_sts) /* OUT: app state */
|
||||
{
|
||||
if (0 != h_sts) {
|
||||
HOST_CFG *en = (HOST_CFG *) (h_ptr->tuneData);
|
||||
CACHE_INST *cd = (CACHE_INST *)(h_ptr->dataCache);
|
||||
CACHE_INST *ci = (CACHE_INST *)(h_ptr->instCache);
|
||||
CPU_INST *cp = (CPU_INST *) (h_ptr->cpu);
|
||||
procShared *ps = (procShared *)(h_ptr->testData);
|
||||
|
||||
h_sts->version = HAVEGE_PREP_VERSION;
|
||||
h_sts->buildOptions = en->buildOpts;
|
||||
h_sts->cpuSources = en->cpuOpts;
|
||||
h_sts->i_cacheSources = en->icacheOpts;
|
||||
h_sts->d_cacheSources = en->dcacheOpts;
|
||||
h_sts->vendor = cp->vendor;
|
||||
h_sts->d_cache = cd->size;
|
||||
h_sts->i_cache = ci->size;
|
||||
h_sts->tot_tests = (0 != ps)? ps->totText :"";
|
||||
h_sts->prod_tests = (0 != ps)? ps->prodText :"";
|
||||
if (0 != ps) {
|
||||
memcpy(h_sts->n_tests, ps->meters, (H_OLT_PROD_B_P+1) * sizeof(H_UINT));
|
||||
h_sts->last_test8 = ps->lastCoron;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Standard status presetations
|
||||
*/
|
||||
int havege_status_dump( /* RETURN: output length */
|
||||
H_PTR hptr, /* IN: app state */
|
||||
H_SD_TOPIC topic, /* IN: presentation topic */
|
||||
char *buf, /* OUT: output area */
|
||||
size_t len) /* IN: size of buf */
|
||||
{
|
||||
struct h_status status;
|
||||
int n = 0;
|
||||
|
||||
if (buf != 0) {
|
||||
*buf = 0;
|
||||
len -= 1;
|
||||
havege_status(hptr, &status);
|
||||
switch(topic) {
|
||||
case H_SD_TOPIC_BUILD:
|
||||
n += snprintf(buf, len, "ver: %s; arch: %s; vend: %s; build: (%s); collect: %uK",
|
||||
status.version,
|
||||
hptr->arch,
|
||||
status.vendor,
|
||||
status.buildOptions,
|
||||
hptr->i_collectSz/1024
|
||||
);
|
||||
break;
|
||||
case H_SD_TOPIC_TUNE:
|
||||
n += snprintf(buf, len, "cpu: (%s); data: %uK (%s); inst: %uK (%s); idx: %u/%u; sz: %u/%u",
|
||||
status.cpuSources,
|
||||
status.d_cache,
|
||||
status.d_cacheSources,
|
||||
status.i_cache,
|
||||
status.i_cacheSources,
|
||||
hptr->i_maxidx - hptr->i_idx, hptr->i_maxidx,
|
||||
hptr->i_sz, hptr->i_maxsz
|
||||
);
|
||||
break;
|
||||
case H_SD_TOPIC_TEST:
|
||||
{
|
||||
H_UINT m;
|
||||
|
||||
if (strlen(status.tot_tests)>0) {
|
||||
n += snprintf(buf+n, len-n, "tot tests(%s): ", status.tot_tests);
|
||||
if ((m = status.n_tests[ H_OLT_TOT_A_P] + status.n_tests[ H_OLT_TOT_A_F])>0)
|
||||
n += snprintf(buf+n, len-n, "A:%u/%u ", status.n_tests[ H_OLT_TOT_A_P], m);
|
||||
if ((m = status.n_tests[ H_OLT_TOT_B_P] + status.n_tests[ H_OLT_TOT_B_F])>0)
|
||||
n += snprintf(buf+n, len, "B:%u/%u ", status.n_tests[ H_OLT_TOT_B_P], m);
|
||||
}
|
||||
if (strlen(status.prod_tests)>0) {
|
||||
n += snprintf(buf+n, len-n, "continuous tests(%s): ", status.prod_tests);
|
||||
if ((m = status.n_tests[ H_OLT_PROD_A_P] + status.n_tests[ H_OLT_PROD_A_F])>0)
|
||||
n += snprintf(buf+n, len-n, "A:%u/%u ", status.n_tests[ H_OLT_PROD_A_P], m);
|
||||
if ((m = status.n_tests[ H_OLT_PROD_B_P] + status.n_tests[ H_OLT_PROD_B_F])>0)
|
||||
n += snprintf(buf+n, len, "B:%u/%u ", status.n_tests[ H_OLT_PROD_B_P], m);
|
||||
}
|
||||
if (n>0)
|
||||
n += snprintf(buf+n, len-n, " last entropy estimate %g", status.last_test8);
|
||||
}
|
||||
break;
|
||||
case H_SD_TOPIC_SUM:
|
||||
{
|
||||
char units[] = {'T', 'G', 'M', 'K', 0};
|
||||
double factor = 1024.0 * 1024.0 * 1024.0 * 1024.0;
|
||||
double sz = ((double)hptr->n_fills * hptr->i_collectSz) * sizeof(H_UINT);
|
||||
int i;
|
||||
|
||||
for (i=0;0 != units[i];i++) {
|
||||
if (sz >= factor)
|
||||
break;
|
||||
factor /= 1024.0;
|
||||
}
|
||||
n = snprintf(buf, len, "fills: %u, generated: %.4g %c bytes",
|
||||
hptr->n_fills,
|
||||
sz / factor,
|
||||
units[i]
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
/**
|
||||
* Return-check library prep version. Calling havege_version() with a NULL version
|
||||
* returns the definition of HAVEGE_PREP_VERSION used to build the library. Calling
|
||||
* with HAVEGE_PREP_VERSION as the version checks if this headers definition is
|
||||
* compatible with that of the library, returning NULL if the input is incompatible
|
||||
* with the library.
|
||||
*/
|
||||
const char *havege_version(const char *version)
|
||||
{
|
||||
if (INTERFACE_DISABLED())
|
||||
return NULL;
|
||||
/**
|
||||
* Version check academic at the moment, but initial idea is to do a table
|
||||
* lookup on the library version to get a pattern to match against the
|
||||
* input version.
|
||||
*/
|
||||
if (version) {
|
||||
H_UINT l_interface=0, l_revision=0, l_age=0;
|
||||
H_UINT p, p_interface, p_revision, p_patch;
|
||||
|
||||
#ifdef HAVEGE_LIB_VERSION
|
||||
sscanf(HAVEGE_LIB_VERSION, "%u:%u:%u", &l_interface, &l_revision, &l_age);
|
||||
#endif
|
||||
(void)l_interface;(void)l_revision;(void)l_age;(void)p_patch; /* No check for now */
|
||||
|
||||
p = sscanf(version, "%u.%u.%u", &p_interface, &p_revision, &p_patch);
|
||||
if (p!=3 || p_interface != 1 || p_revision != 9)
|
||||
return NULL;
|
||||
}
|
||||
return HAVEGE_PREP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* Place holder if output display not provided
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
static void havege_mute( /* RETURN: none */
|
||||
const char *format, /* IN: printf format */
|
||||
...) /* IN: args */
|
||||
{
|
||||
;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
#if NUMBER_CORES > 1
|
||||
/**
|
||||
* Cleanup collector(s). In a multi-collector environment, need to kill
|
||||
* children to avoid zombies.
|
||||
*/
|
||||
static int havege_exit( /* RETURN: NZ if child */
|
||||
H_PTR h_ptr) /* IN: app state */
|
||||
{
|
||||
H_THREAD *t = (H_THREAD *)h_ptr->threads;
|
||||
pid_t p;
|
||||
H_UINT i;
|
||||
|
||||
if (0 == t)
|
||||
return 0; /* Must be main thread */
|
||||
t->fatal = H_EXIT;
|
||||
for(i=0;i<t->exit_ct;i++)
|
||||
(void)sem_post(&t->flags[i]);
|
||||
if (getpid() != t->main)
|
||||
return 1;
|
||||
do { /* Wait for children */
|
||||
p = wait(NULL);
|
||||
} while(p != -1 && errno != ECHILD);
|
||||
for(i=0;i<t->exit_ct;i++)
|
||||
(void)sem_destroy(&t->flags[i]);
|
||||
if (i==h_ptr->n_cores)
|
||||
(void)sem_destroy(&t->flags[i]);
|
||||
havege_unipc(h_ptr); /* unmap memory */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize IPC mechanism. This consists of setting up a shared memory area
|
||||
* containing the output buffer and the collection thread directory.
|
||||
*/
|
||||
static void havege_ipc( /* RETURN: None */
|
||||
H_PTR h, /* IN: app state */
|
||||
H_UINT n, /* IN: number of threads */
|
||||
H_UINT sz) /* IN: size of buffer */
|
||||
{
|
||||
void *m;
|
||||
H_THREAD *t;
|
||||
H_UINT m_sz;
|
||||
int i;
|
||||
|
||||
if (n > NUMBER_CORES) {
|
||||
h->error = H_NOCORES;
|
||||
return;
|
||||
}
|
||||
m = mmap(NULL,
|
||||
m_sz = sz + sizeof(H_THREAD) + n * sizeof(sem_t),
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED | MAP_ANONYMOUS,
|
||||
0,
|
||||
0);
|
||||
if (m != MAP_FAILED) {
|
||||
h->io_buf = m;
|
||||
h->m_sz = m_sz;
|
||||
t = (H_THREAD *)((char *) m + sz);
|
||||
memset(t, 0, sizeof(H_THREAD));
|
||||
t->main = getpid();
|
||||
h->threads = t;
|
||||
for(i=0;i<=n;i++)
|
||||
if(sem_init(&t->flags[i],1,0) < 0) {
|
||||
h->error = H_NOINIT;
|
||||
break;
|
||||
}
|
||||
t->exit_ct = i;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Child harvester task. If task fails to start H_PTR::error will be set to reason.
|
||||
* If task fails after start, H_THREAD::fatal will be set to the reason and a completion
|
||||
* will be posted to prevent the main thread from hanging waiting for a response.
|
||||
*/
|
||||
static int havege_rngChild(/* RETURN: none */
|
||||
H_PTR h_ptr, /* IN: app state */
|
||||
H_UINT cNumber) /* IN: collector index */
|
||||
{
|
||||
H_COLLECT *h_ctxt = 0;
|
||||
H_THREAD *thds = (H_THREAD *) h_ptr->threads;
|
||||
H_UINT cNext, i, r;
|
||||
int pid;
|
||||
|
||||
switch(pid=fork()) {
|
||||
case 0:
|
||||
h_ctxt = havege_ndcreate(h_ptr, cNumber);
|
||||
if (NULL != h_ctxt) {
|
||||
cNext = (cNumber + 1) % h_ptr->n_cores;
|
||||
while(1) {
|
||||
if (0!=sem_wait(&thds->flags[cNumber])) {
|
||||
thds->fatal = H_NOWAIT;
|
||||
break;
|
||||
}
|
||||
if (H_NOERR != thds->fatal) {
|
||||
havege_nddestroy(h_ctxt);
|
||||
exit(0);
|
||||
}
|
||||
thds->last = cNumber;
|
||||
r = h_ctxt->havege_szFill - h_ctxt->havege_nptr;
|
||||
if (thds->count < r)
|
||||
r = thds->count;
|
||||
for(i=0;i<r;i++)
|
||||
thds->out[i] = havege_ndread(h_ctxt);
|
||||
thds->fatal = h_ctxt->havege_err;
|
||||
if (0==(thds->count -= i)) {
|
||||
if (0!=sem_post(&thds->flags[h_ptr->n_cores])) {
|
||||
thds->fatal = H_NODONE;
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
thds->out += i;
|
||||
if (0!=sem_post(&thds->flags[cNext])) {
|
||||
thds->fatal = H_NOPOST;
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_SCHED_YIELD
|
||||
(void)sched_yield();
|
||||
#endif
|
||||
(void)havege_ndread(h_ctxt);
|
||||
h_ctxt->havege_nptr = 0;
|
||||
}
|
||||
havege_nddestroy(h_ctxt);
|
||||
}
|
||||
else thds->fatal = h_ptr->error; /* h_ptr is a copy!! */
|
||||
(void)sem_post(&thds->flags[h_ptr->n_cores]); /* announce death! */
|
||||
break;
|
||||
case -1:
|
||||
h_ptr->error = H_NOTASK;
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
/**
|
||||
* Unmap memory
|
||||
*/
|
||||
static void havege_unipc( /* RETURN: none */
|
||||
H_PTR h_ptr) /* IN: app state */
|
||||
{
|
||||
if (0 != h_ptr->m_sz) {
|
||||
munmap(h_ptr->io_buf, h_ptr->m_sz);
|
||||
h_ptr->io_buf = 0;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
/**
|
||||
* Interpret options string as settings. The option string consists of terms
|
||||
* like "[t|c][a[1-8][w]|b[w]]".
|
||||
*/
|
||||
static int testsConfigure( /* RETURN: non-zero on error */
|
||||
H_UINT *tot, /* OUT: tot test options */
|
||||
H_UINT *run, /* OUT: run test options */
|
||||
char *options) /* IN: option string */
|
||||
{
|
||||
H_UINT section=0;
|
||||
int c;
|
||||
|
||||
if (options==0)
|
||||
options = DEFAULT_TEST_OPTIONS;
|
||||
while(0 != (c = *options++)) {
|
||||
switch(c) {
|
||||
case 'T': case 't': /* tot test */
|
||||
section = 't';
|
||||
*tot = 0;
|
||||
break;
|
||||
case 'C': case 'c': /* production test */
|
||||
section = 'c';
|
||||
*run = 0;
|
||||
break;
|
||||
case 'A': case 'a':
|
||||
if (!section) return 1;
|
||||
c = atoi(options);
|
||||
if (c >= 1 && c < 9) {
|
||||
c = 1<<c;
|
||||
options +=1;
|
||||
}
|
||||
else c = 0;
|
||||
c |= A_RUN;
|
||||
if (*options=='W' || *options=='w') {
|
||||
c |= A_WARN;
|
||||
options++;
|
||||
}
|
||||
if (section=='t')
|
||||
*tot |= c;
|
||||
else *run |= c;
|
||||
break;
|
||||
case 'B': case 'b':
|
||||
if (!section) return 1;
|
||||
c = B_RUN;
|
||||
if (*options=='W' || *options=='w') {
|
||||
c |= B_WARN;
|
||||
options++;
|
||||
}
|
||||
if (section=='t')
|
||||
*tot |= c;
|
||||
else *run |= c;
|
||||
break;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Show test setup. Output strings are [A[N]][B]..
|
||||
*/
|
||||
static void testsStatus( /* RETURN: test config */
|
||||
procShared *tps, /* IN: shared data */
|
||||
char *tot, /* OUT: tot tests */
|
||||
char *prod) /* OUT: production tests */
|
||||
{
|
||||
procInst *p;
|
||||
char *dst = tot;
|
||||
H_UINT i, j, k, m;
|
||||
|
||||
*dst = *tot = 0;
|
||||
p = tps->totTests;
|
||||
for(i=0;i<2;i++,p = tps->runTests, dst = prod) {
|
||||
for(j=0;j<2;j++,p++) {
|
||||
switch(p->action) {
|
||||
case A_RUN:
|
||||
*dst++ = 'A';
|
||||
if (0!=(m = p->options & A_CYCLE)) {
|
||||
for(k=0;m>>=1 != 0;k++);
|
||||
*dst++ = '0' + k;
|
||||
}
|
||||
if (0 != (p->options & A_WARN))
|
||||
*dst++ = 'w';
|
||||
break;
|
||||
case B_RUN:
|
||||
*dst++ = 'B';
|
||||
if (0 != (p->options & B_WARN))
|
||||
*dst++ = 'w';
|
||||
break;
|
||||
}
|
||||
*dst = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reporting unit for tests
|
||||
*/
|
||||
static void testReport(
|
||||
H_COLLECT * h_ctxt, /* IN-OUT: collector context */
|
||||
H_UINT action, /* IN: A_RUN or B_RUN */
|
||||
H_UINT prod, /* IN: 0==tot, else continuous */
|
||||
H_UINT state, /* IN: state variable */
|
||||
H_UINT ct) /* IN: bytes consumed */
|
||||
{
|
||||
H_PTR h_ptr = (H_PTR)(h_ctxt->havege_app);
|
||||
onlineTests *context = (onlineTests *) h_ctxt->havege_tests;
|
||||
char *result;
|
||||
|
||||
switch(state) {
|
||||
case TEST_DONE: result = "success"; break;
|
||||
case TEST_RETRY: result = "retry"; break;
|
||||
case TEST_IGNORE: result = "warning"; break;
|
||||
default: result = "failure";
|
||||
}
|
||||
h_ptr->print_msg("AIS-31 %s procedure %s: %s %d bytes fill %d\n",
|
||||
prod==0? "tot" : "continuous", action==A_RUN? "A":"B", result, ct, h_ptr->n_fills);
|
||||
if (0 != (h_ptr->havege_opts & (H_DEBUG_OLTR|H_DEBUG_OLT)))
|
||||
switch(action){
|
||||
case A_RUN:
|
||||
testReportA(h_ptr, context->pA);
|
||||
break;
|
||||
case B_RUN:
|
||||
testReportB(h_ptr, context->pB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reporting unit for procedure A. Results are 0-257*(1-[4 or 5])
|
||||
*/
|
||||
static void testReportA( /* RETURN: nothing */
|
||||
H_PTR h_ptr, /* IN: application instance */
|
||||
procA *p) /* IN: proc instance */
|
||||
{
|
||||
static const char * pa_tests[6] = {"test0","test1","test2","test3","test4","test5"};
|
||||
|
||||
H_UINT ran[6],sum[6];
|
||||
H_UINT ct, i, j, k;
|
||||
|
||||
for (i=0;i<6;i++)
|
||||
ran[i] = sum[i] = 0;
|
||||
for(i=0;i<p->testRun;i++){
|
||||
ct = p->results[i].testResult;
|
||||
j = ct>>8;
|
||||
ran[j] += 1;
|
||||
if (0==(ct & 0xff))
|
||||
sum[j] += 1;
|
||||
}
|
||||
h_ptr->print_msg("procedure A: %s:%d/%d, %s:%d/%d, %s:%d/%d, %s:%d/%d, %s:%d/%d, %s:%d/%d\n",
|
||||
pa_tests[0], sum[0], ran[0],
|
||||
pa_tests[1], sum[1], ran[1],
|
||||
pa_tests[2], sum[2], ran[2],
|
||||
pa_tests[3], sum[3], ran[3],
|
||||
pa_tests[4], sum[4], ran[4],
|
||||
pa_tests[5], sum[5], ran[5]
|
||||
);
|
||||
for(i=k=0;i<p->testRun;i++){
|
||||
ct = p->results[i].testResult;
|
||||
j = ct>>8;
|
||||
if (j==1)
|
||||
k+=1;
|
||||
if (0!=(ct & 0xff))
|
||||
h_ptr->print_msg(" %s[%d] failed with %d\n", pa_tests[j%6],k,p->results[i].finalValue);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Reporting unit for procedure B. Results are 6a-6b-7a[0]-7a[1]-7b[0]-7b[1]-7b[2]-7b[3]-8
|
||||
*/
|
||||
static void testReportB( /* RETURN: nothing */
|
||||
H_PTR h_ptr, /* IN: application instance */
|
||||
procB *p) /* IN: proc instance */
|
||||
{
|
||||
static const char * pb_tests[5] = {"test6a","test6b","test7a","test7b","test8"};
|
||||
|
||||
H_UINT ct, i, j, ran[5],sum[5];
|
||||
|
||||
for (i=0;i<5;i++) {
|
||||
ran[i] = sum[i] = 0;
|
||||
}
|
||||
for(i=0;i<p->testNbr;i++){
|
||||
ct = p->results[i].testResult;
|
||||
j = ct>>8;
|
||||
ran[j] += 1;
|
||||
if (0==(ct & 0xff))
|
||||
sum[j] += 1;
|
||||
}
|
||||
h_ptr->print_msg("procedure B: %s:%d/%d, %s:%d/%d, %s:%d/%d, %s:%d/%d, %s:%d/%d\n",
|
||||
pb_tests[0], sum[0], ran[0],
|
||||
pb_tests[1], sum[1], ran[1],
|
||||
pb_tests[2], sum[2], ran[2],
|
||||
pb_tests[3], sum[3], ran[3],
|
||||
pb_tests[4], sum[4], ran[4]
|
||||
);
|
||||
for(i=0;i<5;i++)
|
||||
ran[i] = p->testNbr;
|
||||
for(i=0;i<p->testNbr;i++){
|
||||
ct = p->results[i].testResult;
|
||||
j = ct>>8;
|
||||
if (i < ran[j]) ran[j] = i;
|
||||
if (0!=(ct & 0xff))
|
||||
h_ptr->print_msg(" %s[%d] failed with %g\n", pb_tests[j],i-ran[j],p->results[i].finalValue);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
308
src/havege.h
Normal file
308
src/havege.h
Normal file
|
@ -0,0 +1,308 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HAVEGE_H
|
||||
#define HAVEGE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/**
|
||||
* header/package version as a numeric major, minor, patch triple. See havege_version()
|
||||
* below for usage.
|
||||
*/
|
||||
#define HAVEGE_PREP_VERSION "1.9.14"
|
||||
/**
|
||||
* Basic types
|
||||
*/
|
||||
#define H_UINT uint32_t
|
||||
#define H_UINT8 uint8_t
|
||||
/**
|
||||
* Optional metering call-back. Called with event=0 at start of collection buffer fill.
|
||||
* Called with event=1 at end of collection buffer fill. The nCollect parameter indicates
|
||||
* the calling process if multiple collection processes are enabled. Use a value of 0
|
||||
* to disable metering.
|
||||
*/
|
||||
typedef void (*pMeter)(H_UINT nCollect, H_UINT event);
|
||||
/**
|
||||
* Optional message display call-back. This printf style method is used for all diagnostic
|
||||
* output including havege_status(). Use a value of 0 to disable output.
|
||||
*/
|
||||
typedef void (*pMsg)(const char *format, ...);
|
||||
/**
|
||||
* Injection call-back for RAW diagnostics. Use a value of 0 to disable diagnostic. Ignored
|
||||
* except for diaqnotic builds.
|
||||
*/
|
||||
typedef int (*pRawIn)(volatile H_UINT *pData, H_UINT szData);
|
||||
/**
|
||||
* options for H_PARAMS below. Lower byte transferred from verbose settings
|
||||
* upper byte set by diagnositic run options
|
||||
*/
|
||||
#define H_VERBOSE 0x001 /* deprecated from ver 1.7 */
|
||||
#define H_DEBUG_INFO 0x001 /* Show config info, retries */
|
||||
#define H_DEBUG_OLTR 0x002 /* Show detailed test retry info */
|
||||
#define H_DEBUG_TIME 0x004 /* Show collection times */
|
||||
#define H_DEBUG_LOOP 0x008 /* Show loop parameters */
|
||||
#define H_DEBUG_COMPILE 0x010 /* Show assembly info */
|
||||
#define H_DEBUG_OLT 0x020 /* Show all test info */
|
||||
|
||||
#define H_DEBUG_RAW_OUT 0x100 /* diagnostic output */
|
||||
#define H_DEBUG_RAW_IN 0x200 /* diagnostic input */
|
||||
#define H_DEBUG_TEST_IN 0x400 /* input test data */
|
||||
/**
|
||||
* Initialization parameters. Use non-zero values to override default values.
|
||||
* Notes:
|
||||
*
|
||||
* 1) Correspondence between provided value and value of H_PTR members are:
|
||||
* ioSz <==> i_readSz, collectSize <==> i_collectSz, nCores <==> n_cores,
|
||||
* options <==> havege_opts
|
||||
* 2) ioSz is specified in bytes. collectSize sizes is specified as number
|
||||
* of H_UINT. The default for ioSz is 1024*sizeof(H_UINT). The default
|
||||
* for collecSize is 128K * sizeof(H_UINT).
|
||||
* 3) The icacheSize and dcacheSize override cache sizes. Both are specified in KB.
|
||||
* Either may be specified to override the tuning value. If both are provided,
|
||||
* tuning code is bypassed. The fallback tuning values can be overridden
|
||||
* by defining GENERIC_DCACHE and GENERIC_ICACHE (16 will be used if not
|
||||
* otherwise defined)
|
||||
* 4) null callback values suppress the function.
|
||||
* 5) sysFs default is '/sys', procFs default is '/proc'.
|
||||
* 6) testSpec same as haveged option "[t<x>][c<x>] x=[a[n][w]][b[w]]". If
|
||||
* not specified (NULL) the default is "ta8b" - i.e. run the tot tests
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT ioSz; /* size of write buffer */
|
||||
H_UINT collectSize; /* size of collection buffer */
|
||||
H_UINT icacheSize; /* Instruction cache size */
|
||||
H_UINT dcacheSize; /* Data cache size */
|
||||
H_UINT options; /* Other options */
|
||||
H_UINT nCores; /* If multi-core */
|
||||
pMeter metering; /* meterming method */
|
||||
pMsg msg_out; /* output display method */
|
||||
pRawIn injection; /* injection method */
|
||||
char *procFs; /* proc mount point override */
|
||||
char *sysFs; /* sys mount point override */
|
||||
char *testSpec; /* test specification */
|
||||
} H_PARAMS;
|
||||
/**
|
||||
* Status codes used in the error member of h_anchor
|
||||
*/
|
||||
typedef enum {
|
||||
H_NOERR, /* 00 No error */
|
||||
H_NOHANDLE, /* 01 No memory for handle */
|
||||
H_NOBUF, /* 02 Output buffer allocation failed */
|
||||
H_NOINIT, /* 03 semaphore init failed */
|
||||
H_NOCOLLECT, /* 04 H_COLLECT allocation failed */
|
||||
H_NOWALK, /* 05 Walk buffer allocation failed */
|
||||
H_NOTESTSPEC, /* 06 invalid test specification */
|
||||
H_NOTESTINIT, /* 07 test setup failed */
|
||||
H_NOTESTMEM, /* 08 Unable to allocate test memory */
|
||||
H_NOTESTTOT, /* 09 tot test failed */
|
||||
H_NOTESTRUN, /* 10 production test failed */
|
||||
H_NOCORES, /* 11 too many cores specified */
|
||||
H_NOTASK, /* 12 Unable to create child task */
|
||||
H_NOWAIT, /* 13 sem_wait failed */
|
||||
H_NOPOST, /* 14 sem_post failed */
|
||||
H_NODONE, /* 15 sem_post done failed */
|
||||
H_NORQST, /* 16 sem_post request failed */
|
||||
H_NOCOMP, /* 17 wait for completion failed */
|
||||
H_EXIT, /* 18 Exit signal */
|
||||
H_NOTIMER /* 19 timer failed */
|
||||
} H_ERR;
|
||||
/**
|
||||
* Keep compiler honest
|
||||
*/
|
||||
typedef volatile void *H_VOL;
|
||||
/**
|
||||
* Anchor for the RNG. Should be read only at devel level and above.
|
||||
*/
|
||||
typedef struct h_anchor {
|
||||
H_UINT *io_buf; /* output buffer */
|
||||
char *arch; /* "x86","sparc","ppc","ia64",etc */
|
||||
void *cpu; /* information on the cpu */
|
||||
void *instCache; /* instruction cache info */
|
||||
void *dataCache; /* data cache info */
|
||||
pMsg print_msg; /* output display method */
|
||||
pMeter metering; /* metering method */
|
||||
pRawIn inject; /* Injection diagnostic only */
|
||||
H_VOL collector; /* single thread collector */
|
||||
H_VOL threads; /* multi thread collectors */
|
||||
void *testData; /* online test data */
|
||||
void *tuneData; /* tuning data */
|
||||
H_UINT error; /* H_ERR enum for status */
|
||||
H_UINT havege_opts; /* option flags */
|
||||
H_UINT i_maxidx; /* maximum instruction loop index */
|
||||
H_UINT i_maxsz; /* maximum code size */
|
||||
H_UINT i_idx; /* code index used */
|
||||
H_UINT i_sz; /* code size used */
|
||||
H_UINT i_collectSz; /* size of collection buffer */
|
||||
H_UINT i_readSz; /* size of read buffer (bytes) */
|
||||
H_UINT m_sz; /* size of thread ipc area (bytes) */
|
||||
H_UINT n_cores; /* number of cores */
|
||||
H_UINT n_fills; /* number of buffer fills */
|
||||
} *H_PTR;
|
||||
/**
|
||||
* Fail/Success counters for tot and production tests.
|
||||
*/
|
||||
typedef enum {
|
||||
H_OLT_TOT_A_F, /* tot Procedure A failed */
|
||||
H_OLT_TOT_A_P, /* tot Procedure A passed */
|
||||
H_OLT_TOT_B_F, /* tot Procedure B failed */
|
||||
H_OLT_TOT_B_P, /* tot Procedure B passed */
|
||||
H_OLT_PROD_A_F, /* prod Procedure A failed */
|
||||
H_OLT_PROD_A_P, /* prod Procedure A passed */
|
||||
H_OLT_PROD_B_F, /* prod Procedure B failed */
|
||||
H_OLT_PROD_B_P /* prod Procedure B passed */
|
||||
} H_OLT_METERS;
|
||||
/**
|
||||
* Structure used to query RNG anchor settings for information not exposed by
|
||||
* H_PTR. List formats are strings with one or more tokens separated by space.
|
||||
* Sources lists show how tuning parameters are derived. D is a build default,
|
||||
* P is a run time override, items V* come from linux virtual file system,
|
||||
* other items trace various cpuid sources. Tuning is skipped if both cache
|
||||
* sizes have 'P' sources.
|
||||
*
|
||||
* Notes:
|
||||
*
|
||||
* 1) Build: package version of source
|
||||
* 2) Build options: compiler version followed by build configuration encoded
|
||||
* as string of: [C][I][M][T][V] where C=clock_gettime, I=tune with cpuid,
|
||||
* M=multi-core, T=online-test, V=tune with vfs
|
||||
* 3) Tuning source lists: D=default, P=parameter, C=cpuid present,
|
||||
* H=hyperthreading, A=AMD cpuid, A5=AMD fn5, A6=AMD fn6, A8=AMD fn8
|
||||
* L2=Intel has leaf2, L4=Intel has leaf4, B=Intel leaf b,
|
||||
* 4=intel leaf4, V=virtual file system available
|
||||
* VS=/sys/devices/system/cpu/cpu%d/cache/index<n>/level,
|
||||
* VO=/sys/devices/system/cpu/online, VI=/proc/cpuinfo
|
||||
* VC=/sys/devices/system/cpu
|
||||
* 4) test spec [A[1..8]][B], see H_PARAMS above.
|
||||
* 5) zero unless tests are enabled
|
||||
* 6) Last Coron's entropy estimate from Procedure B, test 8
|
||||
*/
|
||||
typedef struct h_status {
|
||||
const char *version; /* Package version [1] */
|
||||
const char *buildOptions; /* Options [2] */
|
||||
const char *vendor; /* cpuid machines only */
|
||||
const char *cpuSources; /* Tuning sources list [3] */
|
||||
const char *i_cacheSources; /* Tuning sources list [3] */
|
||||
const char *d_cacheSources; /* Tuning sources list [3] */
|
||||
const char *tot_tests; /* tot test spec [4] */
|
||||
const char *prod_tests; /* prod test spec [4] */
|
||||
H_UINT i_cache; /* size of L1 instruction cache KB */
|
||||
H_UINT d_cache; /* size of L1 data cache KB */
|
||||
H_UINT n_tests[H_OLT_PROD_B_P+1]; /* test statistics [5] */
|
||||
double last_test8; /* last test8 result [6] */
|
||||
} *H_STATUS;
|
||||
/**
|
||||
* Standard presentation formats for havege_status_dump.
|
||||
*/
|
||||
typedef enum {
|
||||
H_SD_TOPIC_BUILD,
|
||||
/* ver: %s; arch: %s; vend: %s; build: (%s); collect: %dK */
|
||||
H_SD_TOPIC_TUNE,
|
||||
/* cpu: (%s); data: %dK (%s); inst: %dK (%s); idx: %d/%d; sz: %d/%d */
|
||||
H_SD_TOPIC_TEST,
|
||||
/* [tot tests (%s): A:%d/%d B: %d/%d;][continuous tests (%s): A:%d/%d B: %d/%d;][last entropy estimate %g] */
|
||||
H_SD_TOPIC_SUM,
|
||||
/* fills: %d, generated: %.4g %c bytes */
|
||||
} H_SD_TOPIC;
|
||||
/**
|
||||
* Public prototypes. Library users note that "havege_*" is reserved for library
|
||||
* public functions. Note that the multi-core option is experimental and must
|
||||
* enabled in the build.
|
||||
*/
|
||||
/**
|
||||
* Create an anchor. The caller should check for a non-null return value with
|
||||
* a error value of H_NOERR. Any non-null return should be disposed of by a
|
||||
* call to havege_destroy() to free all allocated resources.
|
||||
*
|
||||
* Possible error values: H_NOERR, H_NOTESTSPEC, H_NOBUF, H_NOTESTMEM,
|
||||
* H_NOINIT
|
||||
*/
|
||||
H_PTR havege_create(H_PARAMS *params);
|
||||
|
||||
/**
|
||||
* haveger_create() remembers parent pid and uses it to identify deallocating thread.
|
||||
* daemonize() forks parent and effectively loses parent thread.
|
||||
* havege_reparent(void) allows recovering new parent pid before havege_run() is started.
|
||||
*/
|
||||
void havege_reparent(H_PTR hptr);
|
||||
|
||||
/**
|
||||
* Frees all allocated anchor resources. If the multi-core option is used, this
|
||||
* method should be called from a signal handler to prevent zombie processes.
|
||||
* If called by the process that called haveged_create(), hptr will be freed
|
||||
* when all child processes (if any) have terminated. If called by a child
|
||||
* process, H_EXIT will be set and all children awakened to exit.
|
||||
*/
|
||||
void havege_destroy(H_PTR hptr);
|
||||
/**
|
||||
* Read random words from an active anchor. The RNG must have been readied
|
||||
* by a previous call to havege_run(). The read must take place within the
|
||||
* allocated buffer, hptr->io_buf, and the range is specified in number of
|
||||
* H_UINT to read. If the multi-core option is used, this buffer is
|
||||
* memory-mapped between collectors.
|
||||
*
|
||||
* Returns the number of H_UINT read.
|
||||
*
|
||||
* Possible error values: H_NOERR, H_NOTESRUN, H_NOPOST, H_NODONE,
|
||||
* H_NORQST, H_NOCOMP, H_EXIT
|
||||
*/
|
||||
int havege_rng(H_PTR hptr, H_UINT *buf, H_UINT sz);
|
||||
/**
|
||||
* Warm up the RNG and run the start-up tests. The operation suceeded if the
|
||||
* error member of the handle is H_NOERR. A failed handle should be disposed
|
||||
* of by a call to havege_destroy().
|
||||
*
|
||||
* Returns non-zero on failure.
|
||||
*
|
||||
* Possible error values: H_NOERR, H_NOCOLLECT, H_NOWALK, H_NOTESTMEM,
|
||||
* H_NOTASK, H_NOTESTTOT, H_NOWAIT,
|
||||
* any havege_rng error
|
||||
*/
|
||||
int havege_run(H_PTR hptr);
|
||||
/**
|
||||
* Fill in the h_status structure with read-only information collected from
|
||||
* the package build, run-time tuning, and test components.
|
||||
*/
|
||||
void havege_status(H_PTR hptr, H_STATUS hsts);
|
||||
/**
|
||||
* Call havege_status() and generate a standard presentation of H_STATUS content.
|
||||
* See the H_SD_TOPIC enum above for the formats.
|
||||
*
|
||||
* Returns the number of bytes placed in buf.
|
||||
*/
|
||||
int havege_status_dump(H_PTR hptr, H_SD_TOPIC topic, char *buf, size_t len);
|
||||
/**
|
||||
* Return/check library prep version. Calling havege_version() with a NULL version
|
||||
* returns the definition of HAVEGE_PREP_VERSION used to build the library. Calling
|
||||
* with HAVEGE_PREP_VERSION as the version checks if this headers definition is
|
||||
* compatible with that of the library, returning NULL if the input is incompatible
|
||||
* with the library.
|
||||
*/
|
||||
const char *havege_version(const char *version);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
460
src/havegecmd.c
Normal file
460
src/havegecmd.c
Normal file
|
@ -0,0 +1,460 @@
|
|||
/**
|
||||
** Provide HAVEGE socket communication API
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2018 Werner Fink <werner@suse.de>
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef NO_COMMAND_MODE
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/un.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef HAVE_STRUCT_UCRED
|
||||
struct ucred
|
||||
{
|
||||
pid_t pid; /* PID of sending process. */
|
||||
uid_t uid; /* UID of sending process. */
|
||||
gid_t gid; /* GID of sending process. */
|
||||
};
|
||||
#endif
|
||||
|
||||
#include "havegecmd.h"
|
||||
|
||||
int first_byte;
|
||||
int socket_fd;
|
||||
static char errmsg[1024];
|
||||
|
||||
static int new_root( /* RETURN: status */
|
||||
const char *root, /* IN: path of the new root file system */
|
||||
const volatile char *path, /* IN: path of the haveged executable */
|
||||
char *const argv[], /* IN: arguments for the haveged process */
|
||||
struct pparams *params) /* IN: input params */
|
||||
{
|
||||
int ret;
|
||||
struct stat st;
|
||||
const char *realtive = (const char*)&path[0];
|
||||
|
||||
ret = chdir(root);
|
||||
if (ret < 0) {
|
||||
snprintf(&errmsg[0], sizeof(errmsg)-1,
|
||||
"can't change to working directory %s: %s\n",
|
||||
root, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
if (path[0] == '/')
|
||||
realtive++;
|
||||
ret = fstatat(AT_FDCWD, realtive, &st, 0);
|
||||
if (ret < 0) {
|
||||
snprintf(&errmsg[0], sizeof(errmsg)-1,
|
||||
"can't restart %s: %s\n",
|
||||
path, strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
ret = chroot(".");
|
||||
if (ret < 0) {
|
||||
snprintf(&errmsg[0], sizeof(errmsg)-1,
|
||||
"can't change root directory %s\n",
|
||||
strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
ret = chdir("/");
|
||||
if (ret < 0) {
|
||||
snprintf(&errmsg[0], sizeof(errmsg)-1,
|
||||
"can't change to working directory / : %s\n",
|
||||
strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
ret = execv((const char *)path, argv);
|
||||
if (ret < 0) {
|
||||
snprintf(&errmsg[0], sizeof(errmsg)-1,
|
||||
"can't restart %s: %s\n",
|
||||
path, strerror(errno));
|
||||
}
|
||||
err:
|
||||
if (ret < 0)
|
||||
print_msg("%s", errmsg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open and listen on a UNIX socket to get command from there
|
||||
*/
|
||||
int cmd_listen( /* RETURN: UNIX socket file descriptor */
|
||||
struct pparams *params) /* IN: input params */
|
||||
{
|
||||
struct sockaddr_un su = { /* The abstract UNIX socket of haveged */
|
||||
.sun_family = AF_UNIX,
|
||||
.sun_path = HAVEGED_SOCKET_PATH,
|
||||
};
|
||||
const int one = 1;
|
||||
int fd, ret;
|
||||
|
||||
fd = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
|
||||
if (fd < 0) {
|
||||
print_msg("%s: can not open UNIX socket\n", params->daemon);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, (socklen_t)sizeof(one));
|
||||
if (ret < 0) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
print_msg("%s: can not set option for UNIX socket\n", params->daemon);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = bind(fd, (struct sockaddr *)&su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
|
||||
if (ret < 0) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
if (errno != EADDRINUSE)
|
||||
print_msg("%s: can not bind a name to UNIX socket\n", params->daemon);
|
||||
else
|
||||
fd = -2;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = listen(fd, SOMAXCONN);
|
||||
if (ret < 0) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
print_msg("%s: can not listen on UNIX socket\n", params->daemon);
|
||||
goto err;
|
||||
}
|
||||
err:
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open and connect on a UNIX socket to send command over this
|
||||
*/
|
||||
int cmd_connect( /* RETURN: UNIX socket file descriptor */
|
||||
struct pparams *params) /* IN: input params */
|
||||
{
|
||||
struct sockaddr_un su = { /* The abstract UNIX socket of haveged */
|
||||
.sun_family = AF_UNIX,
|
||||
.sun_path = HAVEGED_SOCKET_PATH,
|
||||
};
|
||||
const int one = 1;
|
||||
int fd, ret;
|
||||
|
||||
fd = socket(PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
|
||||
if (fd < 0) {
|
||||
print_msg("%s: can not open UNIX socket\n", params->daemon);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &one, (socklen_t)sizeof(one));
|
||||
if (ret < 0) {
|
||||
print_msg("%s: can not set option for UNIX socket\n", params->daemon);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = connect(fd, (struct sockaddr *)&su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
|
||||
if (ret < 0) {
|
||||
if (errno != ECONNREFUSED)
|
||||
print_msg("%s: can not connect on UNIX socket\n", params->daemon);
|
||||
close(fd);
|
||||
fd = -1;
|
||||
goto err;
|
||||
}
|
||||
err:
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle arguments in command mode
|
||||
*/
|
||||
int getcmd( /* RETURN: success or error */
|
||||
char *arg) /* handle current known commands */
|
||||
{
|
||||
static const struct {
|
||||
const char* cmd;
|
||||
const int req;
|
||||
const int arg;
|
||||
const char* opt;
|
||||
} cmds[] = {
|
||||
{ "root=", MAGIC_CHROOT, 1, NULL }, /* New root */
|
||||
{ "close", MAGIC_CLOSE, 0, NULL }, /* Close socket */
|
||||
{0}
|
||||
}, *cmd = cmds;
|
||||
int ret = -1;
|
||||
|
||||
if (!arg || !*arg)
|
||||
goto err;
|
||||
|
||||
optarg = NULL;
|
||||
for (; cmd->cmd; cmd++)
|
||||
if (cmd->arg) {
|
||||
if (strncmp(cmd->cmd, arg, strlen(cmd->cmd)) == 0) {
|
||||
optarg = strchr(arg, '=');
|
||||
optarg++;
|
||||
ret = cmd->req;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (strcmp(cmd->cmd, arg) == 0) {
|
||||
ret = cmd->req;
|
||||
break;
|
||||
}
|
||||
}
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle incomming messages from socket
|
||||
*/
|
||||
int socket_handler( /* RETURN: closed file descriptor */
|
||||
int fd, /* IN: connected socket file descriptor */
|
||||
const volatile char *path, /* IN: path of the haveged executable */
|
||||
char *const argv[], /* IN: arguments for the haveged process */
|
||||
struct pparams *params) /* IN: input params */
|
||||
{
|
||||
struct ucred cred = {0};
|
||||
unsigned char magic[2], *ptr;
|
||||
char *enqry;
|
||||
char *optarg = NULL;
|
||||
socklen_t clen;
|
||||
int ret = -1, len;
|
||||
|
||||
if (fd < 0) {
|
||||
print_msg("%s: no connection jet\n", params->daemon);
|
||||
}
|
||||
|
||||
ptr = &magic[0];
|
||||
len = sizeof(magic);
|
||||
ret = safein(fd, ptr, len);
|
||||
if (ret < 0) {
|
||||
print_msg("%s: can not read from UNIX socket\n", params->daemon);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (magic[1] == '\002') { /* ASCII start of text: read argument provided */
|
||||
uint32_t alen;
|
||||
|
||||
ret = receive_uinteger(fd, &alen);
|
||||
if (ret < 0) {
|
||||
print_msg("%s: can not read from UNIX socket\n", params->daemon);
|
||||
goto out;
|
||||
}
|
||||
|
||||
optarg = calloc(alen, sizeof(char));
|
||||
if (!optarg) {
|
||||
print_msg("can not allocate memory for message from UNIX socket");
|
||||
goto out;
|
||||
}
|
||||
ptr = (unsigned char*)optarg;
|
||||
|
||||
ret = safein(fd, ptr, alen);
|
||||
if (ret < 0) {
|
||||
print_msg("%s: can not read from UNIX socket\n", params->daemon);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
clen = sizeof(struct ucred);
|
||||
ret = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cred, &clen);
|
||||
if (ret < 0) {
|
||||
print_msg("%s: can not get credentials from UNIX socket part1\n", params->daemon);
|
||||
goto out;
|
||||
}
|
||||
if (clen != sizeof(struct ucred)) {
|
||||
print_msg("%s: can not get credentials from UNIX socket part2\n", params->daemon);
|
||||
goto out;
|
||||
}
|
||||
if (cred.uid != 0) {
|
||||
enqry = ASCII_NAK;
|
||||
|
||||
ptr = (unsigned char *)enqry;
|
||||
len = (int)strlen(enqry)+1;
|
||||
safeout(fd, ptr, len);
|
||||
}
|
||||
|
||||
switch (magic[0]) {
|
||||
case MAGIC_CHROOT:
|
||||
enqry = ASCII_ACK;
|
||||
|
||||
ret = new_root(optarg, path, argv, params);
|
||||
if (ret < 0) {
|
||||
uint32_t size = strlen(errmsg);
|
||||
safeout(fd, ASCII_STX, strlen(ASCII_STX));
|
||||
send_uinteger(fd, size);
|
||||
safeout(fd, errmsg, size+1);
|
||||
break;
|
||||
}
|
||||
|
||||
ptr = (unsigned char *)enqry;
|
||||
len = (int)strlen(enqry);
|
||||
safeout(fd, ptr, len);
|
||||
|
||||
break;
|
||||
case MAGIC_CLOSE:
|
||||
enqry = ASCII_ACK;
|
||||
|
||||
close(socket_fd);
|
||||
socket_fd = -1;
|
||||
|
||||
ptr = (unsigned char *)enqry;
|
||||
len = (int)strlen(enqry);
|
||||
safeout(fd, ptr, len);
|
||||
argv[0][0] = first_byte;
|
||||
|
||||
break;
|
||||
default:
|
||||
enqry = ASCII_NAK;
|
||||
|
||||
ptr = (unsigned char *)enqry;
|
||||
len = (int)strlen(enqry);
|
||||
safeout(fd, ptr, len);
|
||||
break;
|
||||
}
|
||||
out:
|
||||
if (optarg)
|
||||
free(optarg);
|
||||
if (fd > 0) {
|
||||
close(fd);
|
||||
fd = -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive incomming messages from socket
|
||||
*/
|
||||
ssize_t safein( /* RETURN: read bytes */
|
||||
int fd, /* IN: file descriptor */
|
||||
void *ptr, /* OUT: pointer to buffer */
|
||||
size_t len) /* IN: size of buffer */
|
||||
{
|
||||
int saveerr = errno, avail;
|
||||
ssize_t ret = 0;
|
||||
|
||||
if (len > SSIZE_MAX)
|
||||
len = SSIZE_MAX;
|
||||
|
||||
ret = ioctl(fd, FIONREAD, &avail);
|
||||
if (ret < 0 || avail <=0)
|
||||
goto out;
|
||||
|
||||
if (len > (unsigned int) avail)
|
||||
len = avail;
|
||||
|
||||
do {
|
||||
errno = saveerr;
|
||||
ssize_t p = recv(fd, ptr, len, 0 /* MSG_DONTWAIT */);
|
||||
if (p < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
||||
break;
|
||||
print_msg("Unable to read from socket %d: %s", socket_fd, strerror(errno));
|
||||
}
|
||||
ptr = (char *) ptr + p;
|
||||
ret += p;
|
||||
len -= p;
|
||||
}
|
||||
while (len > 0);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send outgoing messages to socket
|
||||
*/
|
||||
void safeout( /* RETURN: nothing */
|
||||
int fd, /* IN: file descriptor */
|
||||
const void *ptr, /* IN: pointer to buffer */
|
||||
size_t len) /* IN: size of buffer */
|
||||
{
|
||||
int saveerr = errno;
|
||||
|
||||
do {
|
||||
ssize_t p = send(fd, ptr, len, MSG_NOSIGNAL);
|
||||
if (p < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
if (errno == EPIPE || errno == EAGAIN || errno == EWOULDBLOCK)
|
||||
break;
|
||||
print_msg("Unable to write to socket %d: %s", fd, strerror(errno));
|
||||
}
|
||||
ptr = (char *) ptr + p;
|
||||
len -= p;
|
||||
}
|
||||
while (len > 0);
|
||||
|
||||
errno = saveerr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send outgoing unsigned integer to socket
|
||||
*/
|
||||
void send_uinteger( /* RETURN: nothing */
|
||||
int fd, /* IN: file descriptor */
|
||||
uint32_t value) /* IN: 32 bit unsigned integer */
|
||||
{
|
||||
uint8_t buffer[4];
|
||||
|
||||
buffer[0] = (uint8_t)((value >> 24) & 0xFF);
|
||||
buffer[1] = (uint8_t)((value >> 16) & 0xFF);
|
||||
buffer[2] = (uint8_t)((value >> 8) & 0xFF);
|
||||
buffer[3] = (uint8_t)((value >> 0) & 0xFF);
|
||||
|
||||
safeout(fd, buffer, 4 * sizeof(uint8_t));
|
||||
}
|
||||
|
||||
/**
|
||||
* Receive incomming unsigned integer from socket
|
||||
*/
|
||||
int receive_uinteger( /* RETURN: status */
|
||||
int fd, /* IN: file descriptor */
|
||||
uint32_t *value) /* OUT: 32 bit unsigned integer */
|
||||
{
|
||||
uint8_t buffer[4];
|
||||
|
||||
if (safein(fd, buffer, 4 * sizeof(uint8_t)) < 0)
|
||||
return -1;
|
||||
|
||||
*value = (((uint32_t)buffer[0]) << 24) |
|
||||
(((uint32_t)buffer[1]) << 16) |
|
||||
(((uint32_t)buffer[2]) << 8) |
|
||||
(((uint32_t)buffer[3]) << 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
103
src/havegecmd.h
Normal file
103
src/havegecmd.h
Normal file
|
@ -0,0 +1,103 @@
|
|||
/**
|
||||
** Provide HAVEGE socket communication API
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2018 Werner Fink <werner@suse.de>
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef HAVEGECMD_H
|
||||
#define HAVEGECMD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "havege.h"
|
||||
#include "haveged.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#define HAVEGED_SOCKET_PATH "\0/sys/entropy/haveged"
|
||||
#define MAGIC_CHROOT 'R'
|
||||
#define MAGIC_CLOSE 'X'
|
||||
#define MAGIC_PATH 'P'
|
||||
|
||||
#define ASCII_ACK "\x6" /* ASCII acknowledge */
|
||||
#define ASCII_NAK "\x15" /* ASCII negative acknowledge */
|
||||
#define ASCII_STX "\x2" /* ASCII start of text */
|
||||
|
||||
#ifndef SOCK_CLOEXEC
|
||||
#define SOCK_CLOEXEC 0
|
||||
#endif
|
||||
|
||||
#ifndef SOCK_NONBLOCK
|
||||
#define SOCK_NONBLOCK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Open and listen on a UNIX socket to get command from there
|
||||
*/
|
||||
int cmd_listen(struct pparams *);
|
||||
|
||||
/**
|
||||
* Open and connect on a UNIX socket to send command over this
|
||||
*/
|
||||
int cmd_connect(struct pparams *);
|
||||
|
||||
/**
|
||||
* Handle arguments in command mode
|
||||
*/
|
||||
int getcmd(char *);
|
||||
|
||||
/**
|
||||
* Handle incomming messages from socket
|
||||
*/
|
||||
int socket_handler(int, const volatile char *, char *const [], struct pparams *);
|
||||
|
||||
/**
|
||||
* Receive incomming messages from socket
|
||||
*/
|
||||
ssize_t safein(int, void *, size_t);
|
||||
|
||||
/**
|
||||
* Send outgoing messages to socket
|
||||
*/
|
||||
void safeout(int, const void *, size_t);
|
||||
|
||||
/**
|
||||
* Send outgoing unsigned integer to socket
|
||||
*/
|
||||
void send_uinteger(int, uint32_t);
|
||||
|
||||
/**
|
||||
* Receive incomming unsigned integer from socket
|
||||
*/
|
||||
int receive_uinteger(int, uint32_t *);
|
||||
|
||||
/**
|
||||
* Socket file descriptor used for communication
|
||||
*/
|
||||
|
||||
extern int socket_fd;
|
||||
extern int first_byte;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
480
src/havegecollect.c
Normal file
480
src/havegecollect.c
Normal file
|
@ -0,0 +1,480 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/**
|
||||
* This compile unit isolates the operation of the HAVEGE algorithm to better
|
||||
* deal with compiler issues. Extensive macro expansion used to deal with
|
||||
* hardware variations.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "havegecollect.h"
|
||||
#include "havegetest.h"
|
||||
#include "havegetune.h"
|
||||
/**
|
||||
* Injection and capture diagnostics
|
||||
*/
|
||||
#if defined(RAW_IN_ENABLE) || defined(RAW_OUT_ENABLE)
|
||||
#define DIAGNOSTICS_ENABLE
|
||||
#endif
|
||||
/**
|
||||
* Option to use clockgettime() as timer source
|
||||
*/
|
||||
#if defined(ENABLE_CLOCK_GETTIME)
|
||||
#include <time.h>
|
||||
|
||||
#undef HARDCLOCK
|
||||
#define HARDCLOCK(x) x = havege_clock()
|
||||
/**
|
||||
* Provide a generic timer fallback
|
||||
*/
|
||||
static H_UINT havege_clock(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return (H_UINT)(ts.tv_nsec + ts.tv_sec * 1000000000LL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Memory allocation sizing
|
||||
*/
|
||||
#define SZH_INIT sizeof(H_COLLECT)+sizeof(char *)*(LOOP_CT + 2)
|
||||
#define SZH_COLLECT(a) sizeof(H_COLLECT)+sizeof(H_UINT)*(a+16384-1)
|
||||
/**
|
||||
* The HAVEGE collector is created by interleaving instructions generated by
|
||||
* oneiteration.h with the LOOP() output to control the sequence. At each
|
||||
* LOOP() point, the following actions are possible.
|
||||
*/
|
||||
typedef enum {
|
||||
LOOP_NEXT, /* Next loop */
|
||||
LOOP_ENTER, /* First loop */
|
||||
LOOP_EXIT /* Last loop */
|
||||
} LOOP_BRANCH;
|
||||
/**
|
||||
* The LOOP macro labels calculation sequences generated by oneiteration.h in
|
||||
* decreasing order from LOOPCT down to 0. During a normal collection, the
|
||||
* loop construct only introduces an extra conditional branch into the instruction
|
||||
* stream. For the exceptional conditions (initialization, end-of-loop, and
|
||||
* raw HARDCLOCK capture), the return from havege_cp() is used to determine
|
||||
* the action to be taken.
|
||||
*/
|
||||
#define LOOP(n,m) loop##n: if (n < h_ctxt->havege_cdidx) { \
|
||||
switch(havege_cp(h_ctxt,i,n,LOOP_PT(n))) { \
|
||||
case LOOP_NEXT: goto loop##m; \
|
||||
case LOOP_ENTER: goto loop_enter; \
|
||||
case LOOP_EXIT: goto loop_exit; \
|
||||
} \
|
||||
}
|
||||
/**
|
||||
* These macros below bind the code contained in oneiteration.h to the H_COLLECT
|
||||
* instance defined above
|
||||
*/
|
||||
#define ANDPT (h_ctxt->havege_andpt)
|
||||
#define PTTEST (h_ctxt->havege_PTtest)
|
||||
#define PT (h_ctxt->havege_PT)
|
||||
#define PT1 (h_ctxt->havege_pt2)
|
||||
#define PT2 (h_ctxt->havege_PT2)
|
||||
#define PWALK (h_ctxt->havege_pwalk)
|
||||
#define RESULT (h_ctxt->havege_bigarray)
|
||||
/**
|
||||
* Previous diagnostic support has been replaced. The new implementation provides
|
||||
* simultaneous access to both the noise source (i.e. the timer tics) and the
|
||||
* output. The tics buffer is also used by the injection diagnostic if enabled
|
||||
*/
|
||||
#ifdef DIAGNOSTICS_ENABLE
|
||||
#define HTICK1 (h_ctxt->havege_tics[i>>3])
|
||||
#define HTICK2 (h_ctxt->havege_tics[i>>3])
|
||||
#define SZ_TICK ((h_ptr->i_collectSz)>>3)
|
||||
#else
|
||||
#define HTICK1 (h_ctxt->havege_tic)
|
||||
#define HTICK2 (h_ctxt->havege_tic)
|
||||
#define SZ_TICK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* If the injection diagnostic is enabled, use a wrapper for the timer source
|
||||
*/
|
||||
#ifdef RAW_IN_ENABLE
|
||||
static H_UINT havege_inject(H_COLLECT *h_ctxt, H_UINT x);
|
||||
|
||||
#define HARDCLOCKR(x) x=havege_inject(h_ctxt, x)
|
||||
#else
|
||||
#define HARDCLOCKR(x) HARDCLOCK(x)
|
||||
#endif
|
||||
/**
|
||||
* inline optimization - left conditional for legacy systems
|
||||
*/
|
||||
#if 0
|
||||
#define ROR32(value,shift) ((value >> (shift)) | (value << (32-shift)))
|
||||
#else
|
||||
inline static H_UINT ror32(const H_UINT value, const H_UINT shift) {
|
||||
return (value >> shift) | (value << (32 - shift));
|
||||
}
|
||||
#define ROR32(value,shift) ror32(value, shift)
|
||||
#endif
|
||||
/**
|
||||
* Local prototypes
|
||||
*/
|
||||
static LOOP_BRANCH havege_cp(H_COLLECT *h_ctxt, H_UINT i, H_UINT n, char *p);
|
||||
/**
|
||||
* Protect the collection mechanism against ever-increasing gcc optimization
|
||||
*/
|
||||
#if defined (GCC_VERSION) && GCC_VERSION >= 40400
|
||||
static int havege_gather(H_COLLECT * h_ctxt) __attribute__((optimize(1)));
|
||||
#else
|
||||
static int havege_gather(H_COLLECT * h_ctxt);
|
||||
#endif
|
||||
static void havege_ndinit(H_PTR h_ptr, struct h_collect *h_ctxt);
|
||||
|
||||
/**
|
||||
* Create a collector
|
||||
*/
|
||||
H_COLLECT *havege_ndcreate(/* RETURN: NULL on failure */
|
||||
H_PTR h_ptr, /* IN-OUT: application instance */
|
||||
H_UINT nCollector) /* IN: The collector instance */
|
||||
{
|
||||
H_UINT i,offs,*p,d_cache;
|
||||
H_UINT szBuffer;
|
||||
H_COLLECT *h_ctxt;
|
||||
|
||||
szBuffer = h_ptr->i_collectSz;
|
||||
d_cache = ((CACHE_INST *)(h_ptr->dataCache))->size;
|
||||
h_ctxt = (H_COLLECT *) calloc(SZH_COLLECT(szBuffer + SZ_TICK),1);
|
||||
if (NULL != h_ctxt) {
|
||||
h_ctxt->havege_app = h_ptr;
|
||||
h_ctxt->havege_idx = nCollector;
|
||||
h_ctxt->havege_raw = h_ptr->havege_opts & 0xff00;
|
||||
h_ctxt->havege_rawInput = h_ptr->inject;
|
||||
h_ctxt->havege_szCollect = szBuffer;
|
||||
h_ctxt->havege_szFill = szBuffer>>3;
|
||||
h_ctxt->havege_cdidx = h_ptr->i_idx;
|
||||
p = (H_UINT *) RESULT;
|
||||
h_ctxt->havege_err = H_NOERR;
|
||||
h_ctxt->havege_tests = 0;
|
||||
h_ctxt->havege_extra = 0;
|
||||
h_ctxt->havege_tics = p+szBuffer;
|
||||
|
||||
/** An intermediate walk table twice the size of the L1 cache is allocated
|
||||
** for use in permuting time stamp readings. The is meant to exercise
|
||||
** processor TLBs.
|
||||
*/
|
||||
ANDPT = ((2*d_cache*1024)/sizeof(H_UINT))-1;
|
||||
p = (H_UINT *) calloc((ANDPT + 4097)*sizeof(H_UINT),1);
|
||||
if (NULL != p) {
|
||||
h_ctxt->havege_extra = p;
|
||||
offs = (H_UINT)((((unsigned long)&p[4096])&0xfff)/sizeof(H_UINT));
|
||||
PWALK = &p[4096-offs];
|
||||
/**
|
||||
* Warm up the generator, running the startup tests
|
||||
*/
|
||||
#if defined(RAW_IN_ENABLE)
|
||||
if (0 == (h_ctxt->havege_raw & H_DEBUG_TEST_IN))
|
||||
#endif
|
||||
{
|
||||
H_UINT t0=0;
|
||||
|
||||
(void)havege_gather(h_ctxt); /* first sample */
|
||||
t0 = HTICK1;
|
||||
for(i=1;i<MININITRAND;i++)
|
||||
(void)havege_gather(h_ctxt); /* warmup rng */
|
||||
if (HTICK1==t0) { /* timer stuck? */
|
||||
h_ptr->error = H_NOTIMER;
|
||||
havege_nddestroy(h_ctxt);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
{
|
||||
procShared *ps = (procShared *)(h_ptr->testData);
|
||||
while(0!=ps->run(h_ctxt, 0)) { /* run tot tests */
|
||||
(void)havege_gather(h_ctxt);
|
||||
}
|
||||
}
|
||||
if (H_NOERR != (h_ptr->error = h_ctxt->havege_err)) {
|
||||
havege_nddestroy(h_ctxt);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
h_ctxt->havege_nptr = szBuffer;
|
||||
if (0 == (h_ctxt->havege_raw & H_DEBUG_RAW_OUT))
|
||||
h_ctxt->havege_szFill = szBuffer;
|
||||
}
|
||||
else {
|
||||
havege_nddestroy(h_ctxt);
|
||||
h_ptr->error = H_NOWALK;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else h_ptr->error = H_NOCOLLECT;
|
||||
return h_ctxt;
|
||||
}
|
||||
/**
|
||||
* Destruct a collector
|
||||
*/
|
||||
void havege_nddestroy( /* RETURN: none */
|
||||
H_COLLECT *h_ctxt) /* IN: collector context */
|
||||
{
|
||||
if (0 != h_ctxt) {
|
||||
if (h_ctxt->havege_extra!=0) {
|
||||
free(h_ctxt->havege_extra);
|
||||
h_ctxt->havege_extra = 0;
|
||||
}
|
||||
if (h_ctxt->havege_tests!=0) {
|
||||
free(h_ctxt->havege_tests);
|
||||
h_ctxt->havege_tests = 0;
|
||||
}
|
||||
free((void *)h_ctxt);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Read from the collector.
|
||||
*/
|
||||
H_UINT havege_ndread( /* RETURN: data value */
|
||||
H_COLLECT *h_ctxt) /* IN: collector context */
|
||||
{
|
||||
if (h_ctxt->havege_nptr >= h_ctxt->havege_szFill) {
|
||||
H_PTR h_ptr = (H_PTR)(h_ctxt->havege_app);
|
||||
pMeter pm;
|
||||
|
||||
if (0 != (pm = h_ptr->metering))
|
||||
(*pm)(h_ctxt->havege_idx, 0);
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
{
|
||||
procShared *ps = (procShared *)(h_ptr->testData);
|
||||
do {
|
||||
(void) havege_gather(h_ctxt);
|
||||
(void) ps->run(h_ctxt, 1);
|
||||
} while(ps->discard(h_ctxt)>0);
|
||||
}
|
||||
#else
|
||||
(void) havege_gather(h_ctxt);
|
||||
#endif
|
||||
h_ptr->n_fills += 1;
|
||||
if (0 != pm)
|
||||
(*pm)(h_ctxt->havege_idx, 1);
|
||||
h_ctxt->havege_nptr = 0;
|
||||
}
|
||||
#ifdef RAW_OUT_ENABLE
|
||||
if (0!=(h_ctxt->havege_raw & H_DEBUG_RAW_OUT))
|
||||
return h_ctxt->havege_tics[h_ctxt->havege_nptr++];
|
||||
#endif
|
||||
return RESULT[h_ctxt->havege_nptr++];
|
||||
}
|
||||
/**
|
||||
* Setup haveged
|
||||
*/
|
||||
void havege_ndsetup( /* RETURN: None */
|
||||
H_PTR h_ptr) /* IN-OUT: application instance */
|
||||
{
|
||||
char wkspc[SZH_INIT];
|
||||
|
||||
memset(wkspc, 0, SZH_INIT);
|
||||
havege_ndinit(h_ptr, (struct h_collect *) wkspc);
|
||||
}
|
||||
/**
|
||||
* This method is called only for control points NOT part of a normal collection:
|
||||
*
|
||||
* a) For a collection loop after all iterations are performed, this function
|
||||
* determines if the collection buffer is full.
|
||||
* b) For initialization, this method saves the address of the collection point
|
||||
* for analysis at the end of the loop.
|
||||
*/
|
||||
static LOOP_BRANCH havege_cp( /* RETURN: branch to take */
|
||||
H_COLLECT *h_ctxt, /* IN: collection context */
|
||||
H_UINT i, /* IN: collection offset */
|
||||
H_UINT n, /* IN: iteration index */
|
||||
char *p) /* IN: code pointer */
|
||||
{
|
||||
|
||||
if (h_ctxt->havege_cdidx <= LOOP_CT)
|
||||
return i < h_ctxt->havege_szCollect? LOOP_ENTER : LOOP_EXIT;
|
||||
((char **)RESULT)[n] = CODE_PT(p);
|
||||
if (n==0) h_ctxt->havege_cdidx = 0;
|
||||
return LOOP_NEXT;
|
||||
}
|
||||
|
||||
/**
|
||||
* The collection loop is constructed by repetitions of oneinteration.h interleaved
|
||||
* with control points generated by the LOOP macro.
|
||||
*/
|
||||
static int havege_gather( /* RETURN: 1 if initialized */
|
||||
H_COLLECT * h_ctxt) /* IN: collector context */
|
||||
{
|
||||
H_UINT i=0,pt=0,inter=0;
|
||||
H_UINT *Pt0, *Pt1, *Pt2, *Pt3, *Ptinter;
|
||||
|
||||
#if defined(RAW_IN_ENABLE)
|
||||
if (0 != (h_ctxt->havege_raw & H_DEBUG_RAW_IN)) {
|
||||
(*h_ctxt->havege_rawInput)(h_ctxt->havege_tics, h_ctxt->havege_szCollect>>3);
|
||||
h_ctxt->havege_tic = h_ctxt->havege_tics[0];
|
||||
}
|
||||
else if (0 != (h_ctxt->havege_raw & H_DEBUG_TEST_IN)) {
|
||||
(*h_ctxt->havege_rawInput)(RESULT, h_ctxt->havege_szCollect);
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
|
||||
loop_enter:
|
||||
LOOP(40,39)
|
||||
#include "oneiteration.h"
|
||||
LOOP(39,38)
|
||||
#include "oneiteration.h"
|
||||
LOOP(38,37)
|
||||
#include "oneiteration.h"
|
||||
LOOP(37,36)
|
||||
#include "oneiteration.h"
|
||||
LOOP(36,35)
|
||||
#include "oneiteration.h"
|
||||
LOOP(35,34)
|
||||
#include "oneiteration.h"
|
||||
LOOP(34,33)
|
||||
#include "oneiteration.h"
|
||||
LOOP(33,32)
|
||||
#include "oneiteration.h"
|
||||
LOOP(32,31)
|
||||
#include "oneiteration.h"
|
||||
LOOP(31,30)
|
||||
#include "oneiteration.h"
|
||||
LOOP(30,29)
|
||||
#include "oneiteration.h"
|
||||
LOOP(29,28)
|
||||
#include "oneiteration.h"
|
||||
LOOP(28,27)
|
||||
#include "oneiteration.h"
|
||||
LOOP(27,26)
|
||||
#include "oneiteration.h"
|
||||
LOOP(26,25)
|
||||
#include "oneiteration.h"
|
||||
LOOP(25,24)
|
||||
#include "oneiteration.h"
|
||||
LOOP(24,23)
|
||||
#include "oneiteration.h"
|
||||
LOOP(23,22)
|
||||
#include "oneiteration.h"
|
||||
LOOP(22,21)
|
||||
#include "oneiteration.h"
|
||||
LOOP(21,20)
|
||||
#include "oneiteration.h"
|
||||
LOOP(20,19)
|
||||
#include "oneiteration.h"
|
||||
LOOP(19,18)
|
||||
#include "oneiteration.h"
|
||||
LOOP(18,17)
|
||||
#include "oneiteration.h"
|
||||
LOOP(17,16)
|
||||
#include "oneiteration.h"
|
||||
LOOP(16,15)
|
||||
#include "oneiteration.h"
|
||||
LOOP(15,14)
|
||||
#include "oneiteration.h"
|
||||
LOOP(14,13)
|
||||
#include "oneiteration.h"
|
||||
LOOP(13,12)
|
||||
#include "oneiteration.h"
|
||||
LOOP(12,11)
|
||||
#include "oneiteration.h"
|
||||
LOOP(11,10)
|
||||
#include "oneiteration.h"
|
||||
LOOP(10,9)
|
||||
#include "oneiteration.h"
|
||||
LOOP(9,8)
|
||||
#include "oneiteration.h"
|
||||
LOOP(8,7)
|
||||
#include "oneiteration.h"
|
||||
LOOP(7,6)
|
||||
#include "oneiteration.h"
|
||||
LOOP(6,5)
|
||||
#include "oneiteration.h"
|
||||
LOOP(5,4)
|
||||
#include "oneiteration.h"
|
||||
LOOP(4,3)
|
||||
#include "oneiteration.h"
|
||||
LOOP(3,2)
|
||||
#include "oneiteration.h"
|
||||
LOOP(2,1)
|
||||
#include "oneiteration.h"
|
||||
LOOP(1,0)
|
||||
#include "oneiteration.h"
|
||||
LOOP(0,0)
|
||||
(void)havege_cp(h_ctxt, i,0,LOOP_PT(0));
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
loop_exit:
|
||||
return ANDPT==0? 0 : 1;
|
||||
}
|
||||
#ifdef RAW_IN_ENABLE
|
||||
/**
|
||||
* Wrapper for noise injector. When input is injected, the hardclock
|
||||
* call is not made and the contents of the tic buffer are used
|
||||
* unchanged from when the inject call was made at the top of the
|
||||
* loop.
|
||||
*/
|
||||
static H_UINT havege_inject( /* RETURN: clock value */
|
||||
H_COLLECT *h_ctxt, /* IN: workspace */
|
||||
H_UINT x) /* IN: injected value */
|
||||
{
|
||||
if (0==(h_ctxt->havege_raw & H_DEBUG_RAW_IN)) {
|
||||
HARDCLOCK(x);
|
||||
}
|
||||
return x;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Initialize the collection loop
|
||||
*/
|
||||
#if defined (GCC_VERSION) && GCC_VERSION >= 40600
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
#endif
|
||||
|
||||
static void havege_ndinit( /* RETURN: None */
|
||||
H_PTR h_ptr, /* IN-OUT: application instance */
|
||||
struct h_collect *h_ctxt) /* IN: workspace */
|
||||
{
|
||||
char **addr = (char **)(&RESULT[0]);
|
||||
H_UINT sz;
|
||||
int i;
|
||||
|
||||
h_ctxt->havege_cdidx = LOOP_CT + 1;
|
||||
(void)havege_gather(h_ctxt);
|
||||
for (i=0;i<=LOOP_CT;i++) {
|
||||
if (0 != (h_ptr->havege_opts & H_DEBUG_COMPILE)) {
|
||||
h_ptr->print_msg("Address %u=%p\n", i, addr[i]);
|
||||
}
|
||||
RESULT[i] = labs(addr[i] - addr[LOOP_CT]);
|
||||
if (i > 0 && 0 != (h_ptr->havege_opts & H_DEBUG_LOOP)) {
|
||||
h_ptr->print_msg("Loop %u: offset=%u, delta=%u\n", i,RESULT[i],RESULT[i-1]-RESULT[i]);
|
||||
}
|
||||
}
|
||||
h_ptr->i_maxidx = LOOP_CT;
|
||||
h_ptr->i_maxsz = RESULT[1];
|
||||
sz = ((CACHE_INST *)(h_ptr->instCache))->size * 1024;
|
||||
for(i=LOOP_CT;i>0;i--)
|
||||
if (RESULT[i]>sz)
|
||||
break;
|
||||
h_ptr->i_idx = ++i;
|
||||
h_ptr->i_sz = RESULT[i];
|
||||
}
|
215
src/havegecollect.h
Normal file
215
src/havegecollect.h
Normal file
|
@ -0,0 +1,215 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HAVEGECOLLECT_H
|
||||
#define HAVEGECOLLECT_H
|
||||
/**
|
||||
** Definitions needed to build haveged
|
||||
*/
|
||||
#include "havege.h"
|
||||
/**
|
||||
* The collection context
|
||||
*/
|
||||
typedef struct h_collect {
|
||||
void *havege_app; /* Application block */
|
||||
H_UINT havege_idx; /* Identifer */
|
||||
H_UINT havege_szCollect; /* Size of collection buffer */
|
||||
H_UINT havege_raw; /* RAW mode control flags */
|
||||
H_UINT havege_szFill; /* Fill size */
|
||||
H_UINT havege_nptr; /* Input pointer */
|
||||
pRawIn havege_rawInput; /* Injection function */
|
||||
pRawIn havege_testInput; /* Injection function for test */
|
||||
H_UINT havege_cdidx; /* normal mode control flags */
|
||||
H_UINT *havege_pwalk; /* Instance variable */
|
||||
H_UINT havege_andpt; /* Instance variable */
|
||||
H_UINT havege_PT; /* Instance variable */
|
||||
H_UINT havege_PT2; /* Instance variable */
|
||||
H_UINT havege_pt2; /* Instance variable */
|
||||
H_UINT havege_PTtest; /* Instance variable */
|
||||
H_UINT havege_tic; /* Instance variable */
|
||||
H_UINT *havege_tics; /* loop timer noise buffer */
|
||||
H_UINT havege_err; /* H_ERR enum for status */
|
||||
void *havege_tests; /* opague test context */
|
||||
void *havege_extra; /* other allocations */
|
||||
H_UINT havege_bigarray[1]; /* collection buffer */
|
||||
} volatile H_COLLECT;
|
||||
/**
|
||||
** Compiler intrinsics are used to make the build more portable and stable
|
||||
** with fall-backs provided where the intrisics cannot be used.
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
/* ################################################################################# */
|
||||
|
||||
/**
|
||||
** For the GNU compiler, the use of a cpuid intrinsic is somewhat garbled by the
|
||||
** fact that some distributions (Centos 5.x) carry an empty cpuid.h (in order
|
||||
** to back patch glicb?). AFAIK cpuid did not appear in gcc until version 4.3
|
||||
** although it was in existence before. If we do not have a valid cpuid.h,
|
||||
** we provide our own copy of the file (from gcc 4.3)
|
||||
**
|
||||
** Also, gcc 4.4 and later provide an optimize attribute which remedies the
|
||||
** effect ever increasing optimization on the collection loop
|
||||
*/
|
||||
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||
|
||||
#define ASM __asm__ volatile
|
||||
/**
|
||||
** For the intel world...
|
||||
*/
|
||||
#ifdef HAVE_ISA_X86
|
||||
#define ARCH "x86"
|
||||
|
||||
#if GCC_VERSION<40300
|
||||
#undef HAVE_CPUID_H
|
||||
#endif
|
||||
#ifdef HAVE_CPUID_H
|
||||
#include <cpuid.h>
|
||||
#else
|
||||
#include "cpuid-43.h"
|
||||
#endif
|
||||
/**
|
||||
** Compatibility wrappers
|
||||
*/
|
||||
#define CPUID(level,p)\
|
||||
{\
|
||||
register int ecx asm ("ecx") = p[2];\
|
||||
__cpuid(level,p[0],p[1],p[2],p[3]);\
|
||||
(void) ecx;\
|
||||
}
|
||||
#define HASCPUID(p) __get_cpuid_max(0, p)
|
||||
/**
|
||||
** The rdtsc intrinsic is called in by x86intrin.h - also a recent gcc innovation
|
||||
** There have been some discussions of the code in 4.5 and 4.6, so you may opt
|
||||
** to use the inline alternative based on GCC_VERSION
|
||||
*/
|
||||
#ifdef HAVE_X86INTRIN_H
|
||||
#include <x86intrin.h>
|
||||
#endif
|
||||
#ifdef HAVE___RDTSC
|
||||
#define HARDCLOCK(x) x=__rdtsc()
|
||||
#else
|
||||
#define HARDCLOCK(x) ASM("rdtsc;movl %%eax,%0":"=m"(x)::"ax","dx")
|
||||
#endif
|
||||
#else
|
||||
/**
|
||||
* Outside the x86 family
|
||||
*/
|
||||
#ifdef HAVE_ISA_GENERIC
|
||||
#define ARCH "generic"
|
||||
#define ENABLE_CLOCKGETTIME 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISA_IA64
|
||||
#define ARCH "ia64"
|
||||
#define HARDCLOCK(x) ASM("mov %0=ar.itc" : "=r"(x))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISA_SPARC
|
||||
#define ARCH "sparc"
|
||||
#define HARDCLOCK(x) ASM("rd %%tick, %0":"=r"(x):"r"(x))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISA_SPARCLITE
|
||||
#define ARCH "sparclite"
|
||||
#define HARDCLOCK(x) ASM(".byte 0x83, 0x41, 0x00, 0x00");\
|
||||
ASM("mov %%g1, %0" : "=r"(x))
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISA_PPC
|
||||
#define ARCH "ppc"
|
||||
#define HARDCLOCK(x) ASM("mftb %0":"=r"(x)) /* eq. to mftb %0, 268 */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ISA_S390
|
||||
#define ARCH "s390"
|
||||
#define HARDCLOCK(x) { unsigned long long tsc; ASM("stck %0":"=Q"(tsc)::"cc"); x = (unsigned int)tsc; }
|
||||
#endif
|
||||
/**
|
||||
* /Outside the x86 family
|
||||
*/
|
||||
#endif
|
||||
/**
|
||||
* Use the "&&" extension to calculate the LOOP_PT
|
||||
*/
|
||||
#define CODE_PT(a) a
|
||||
#define LOOP_PT(a) &&loop##a
|
||||
|
||||
/* ################################################################################# */
|
||||
#endif
|
||||
/**
|
||||
* For the MSVC world
|
||||
*/
|
||||
#if _MSVC_VERS
|
||||
/* ################################################################################# */
|
||||
#define ARCH "x86"
|
||||
/**
|
||||
* For the MSVC compilers V8 and above
|
||||
*/
|
||||
#include <intrin.h>
|
||||
/**
|
||||
* Read the processor timestamp counter
|
||||
*/
|
||||
#define HARDCLOCK(x) x=__rdtsc()
|
||||
/**
|
||||
* Normalize to the gcc interface
|
||||
*/
|
||||
#define CPUID(level,p) return __cpuidx(p, level, p[2])
|
||||
#define HASCPUID(p) \
|
||||
{ \
|
||||
CPUID(0,a,b,c,d) \
|
||||
}
|
||||
/**
|
||||
* Use the __ReturnAddress intrinsic to calculate the LOOP_PT
|
||||
*/
|
||||
#define CODE_PT(a) __ReturnAddress()
|
||||
#define LOOP_PT(a) 0
|
||||
#endif
|
||||
/* ################################################################################# */
|
||||
/**
|
||||
* Configuration defaults - allow override at compile
|
||||
*/
|
||||
#ifndef COLLECT_BUFSIZE
|
||||
#define COLLECT_BUFSIZE 128 /* collection buffer size in KW */
|
||||
#endif
|
||||
#ifndef GENERIC_DCACHE
|
||||
#define GENERIC_DCACHE 16 /* size of L1 data cache */
|
||||
#endif
|
||||
#ifndef GENERIC_ICACHE
|
||||
#define GENERIC_ICACHE 16 /* size of L1 instruction cache */
|
||||
#endif
|
||||
#ifndef LOOP_CT
|
||||
#define LOOP_CT 40 /* Max interations per collection loop */
|
||||
#endif
|
||||
/**
|
||||
* Other useful definitions
|
||||
*/
|
||||
#define BITS_PER_H_UINT (8*sizeof(H_UINT)) /* Bit packing constant */
|
||||
#define DEFAULT_BUFSZ 1024*sizeof(H_UINT) /* Default for ioSz */
|
||||
#define MININITRAND 32 /* Number of initial fills to prime RNG */
|
||||
#define NDSIZECOLLECT (COLLECT_BUFSIZE*1024) /* Collection size: 128K*H_UINT = .5M byte */
|
||||
/**
|
||||
** The public collection interface
|
||||
*/
|
||||
H_COLLECT *havege_ndcreate(H_PTR hptr, H_UINT nCollector);
|
||||
void havege_nddestroy(H_COLLECT *rdr);
|
||||
H_UINT havege_ndread(H_COLLECT *rdr);
|
||||
void havege_ndsetup(H_PTR hptr);
|
||||
|
||||
#endif
|
1008
src/haveged.c
Normal file
1008
src/haveged.c
Normal file
File diff suppressed because it is too large
Load diff
100
src/haveged.h
Normal file
100
src/haveged.h
Normal file
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HAVEGED_H
|
||||
#define HAVEGED_H
|
||||
|
||||
#include "havege.h"
|
||||
/**
|
||||
* Settings - default values declared in haveged.c
|
||||
*/
|
||||
struct pparams {
|
||||
char *daemon; /* Daemon name - default is "haveged" */
|
||||
H_UINT exit_code; /* Exit code */
|
||||
H_UINT setup; /* setup options */
|
||||
H_UINT ncores; /* number of cores to use */
|
||||
H_UINT buffersz; /* size of collection buffer (kb) */
|
||||
H_UINT detached; /* non-zero if daemonized */
|
||||
H_UINT foreground; /* non-zero if running in foreground */
|
||||
H_UINT run_level; /* type of run 0=daemon,1=setup,2=pip,sample kb */
|
||||
H_UINT d_cache; /* size of data cache (kb) */
|
||||
H_UINT i_cache; /* size of instruction cache (kb) */
|
||||
H_UINT low_water; /* write threshold to set - 0 for none */
|
||||
char *tests_config; /* online test configuration */
|
||||
char *os_rel; /* path to operating system release */
|
||||
char *pid_file; /* name of pid file */
|
||||
char *poolsize; /* path to poolsize */
|
||||
char *random_device; /* path to random device */
|
||||
char *sample_in; /* input path for injection diagnostic */
|
||||
char *sample_out; /* path to sample file */
|
||||
H_UINT verbose; /* Output level for log or stdout */
|
||||
char *version; /* Our version */
|
||||
char *watermark; /* path to write_wakeup_threshold */
|
||||
char *command; /* command which will be send/received */
|
||||
};
|
||||
/**
|
||||
* Buffer size used when not running as daemon
|
||||
*/
|
||||
#define APP_BUFF_SIZE 1024
|
||||
#define INPUT_DEFAULT "data"
|
||||
#define OUTPUT_DEFAULT "sample"
|
||||
#define PID_DEFAULT "/var/run/haveged.pid"
|
||||
/**
|
||||
* Setup options (for app)
|
||||
*/
|
||||
#define RUN_AS_APP 0x001
|
||||
#define RANGE_SPEC 0x002
|
||||
#define USE_STDOUT 0x004
|
||||
#define CAPTURE 0x008
|
||||
#define INJECT 0x010
|
||||
#define RUN_IN_FG 0x020
|
||||
#define SET_LWM 0x040
|
||||
#define MULTI_CORE 0x080
|
||||
#define CMD_MODE 0x100
|
||||
/**
|
||||
* Default tests settings
|
||||
*/
|
||||
#define TESTS_DEFAULT_APP "ta8b" /* startup tests */
|
||||
#define TESTS_DEFAULT_RUN "ta8bcb" /* startup + continuous B */
|
||||
/**
|
||||
* Run levels for diagnostic build
|
||||
*/
|
||||
#define DIAG_RUN_CAPTURE 2 /* output clock ticks */
|
||||
#define DIAG_RUN_INJECT 4 /* inject clock ticks */
|
||||
#define DIAG_RUN_TEST 8 /* inject test data */
|
||||
/**
|
||||
* Status/monitoring information
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT n_fill; /* number times filled */
|
||||
double etime; /* milliseconds for last collection */
|
||||
double estart; /* start time for calculation */
|
||||
} H_METER;
|
||||
|
||||
/**
|
||||
* Bail....
|
||||
*/
|
||||
void error_exit(const char *, ...);
|
||||
|
||||
/**
|
||||
* Execution notices - to stderr or syslog
|
||||
*/
|
||||
void print_msg(const char *, ...);
|
||||
|
||||
#endif
|
1030
src/havegetest.c
Normal file
1030
src/havegetest.c
Normal file
File diff suppressed because it is too large
Load diff
225
src/havegetest.h
Normal file
225
src/havegetest.h
Normal file
|
@ -0,0 +1,225 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2012-2014 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2012 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HAVEGETEST_H
|
||||
#define HAVEGETEST_H
|
||||
/**
|
||||
* The haveged test suite is built from the 8 tests specified in AIS-31
|
||||
* organized into test procedure A and test procedure B and structured
|
||||
* as state machines capable of processing segmented input streams.
|
||||
*/
|
||||
#include "havegecollect.h"
|
||||
/**
|
||||
* All individual tests and the test procedures use the following
|
||||
* simple state machine to manage input.
|
||||
*/
|
||||
typedef enum {
|
||||
TEST_INIT, /* initialize test (internal) */
|
||||
TEST_INPUT, /* test input needed */
|
||||
TEST_EVAL, /* evaluating results (internal) */
|
||||
TEST_DONE, /* test complete */
|
||||
TEST_RETRY, /* retry the test */
|
||||
TEST_IGNORE, /* ignore failure and continue */
|
||||
TEST_FAIL /* Test has failed */
|
||||
} TEST_STATE;
|
||||
/**
|
||||
* AIS-31 procedure A uses the FIPS140-1 as test1 thru test4. A disjointedness test is
|
||||
* used as test0 and a autocorrelation test is used as test5. test0 is executed only
|
||||
* once, the other tests are repeated in sequence 257 times.
|
||||
*/
|
||||
#define AIS_A_REPS 257 /* reps for test1 through test 5 */
|
||||
/**
|
||||
* Constants for the fips tests. Note AIS-31 v1 uses the unamended FIPS test limits
|
||||
*/
|
||||
#define FIPS_USED 20000
|
||||
#ifndef USE_AMENDED_FIPS
|
||||
#define FIPS_MAX_RUN 34
|
||||
#define FIPS_ONES_LOW 9654
|
||||
#define FIPS_ONES_HIGH 10346
|
||||
#define FIPS_POKER_LOW 1562822 /* 1.03 */
|
||||
#define FIPS_POKER_HIGH 1580438 /* 57.4 */
|
||||
#define FIPS_RUNS_LOW 2267,1079,502,223,90,90
|
||||
#define FIPS_RUNS_HIGH 2733,1421,748,402,223,223
|
||||
#else
|
||||
#define FIPS_MAX_RUN 25
|
||||
#define FIPS_ONES_LOW 9725
|
||||
#define FIPS_ONES_HIGH 10275
|
||||
#define FIPS_POKER_LOW 1576928 /* 2.16 */
|
||||
#define FIPS_POKER_HIGH 1576928 /* 46.17 */
|
||||
#define FIPS_RUNS_LOW 2315,1114,525,240,103,103
|
||||
#define FIPS_RUNS_HIGH 2685,1386,723,384,209,209
|
||||
#endif
|
||||
/**
|
||||
* test 0 consumes 64k * 48 bits
|
||||
*/
|
||||
#define TEST0_LENGTH 65536
|
||||
#define TEST0_USED (TEST0_LENGTH * 48)
|
||||
#define TEST5_LENGTH 5000
|
||||
/**
|
||||
* Fixed size input for procedure A
|
||||
*/
|
||||
#define AIS_A_SIZE (TEST0_USED+(2500*257))
|
||||
/**
|
||||
* AIS-31 procedure A results
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT testResult; /* id 8 bits, pass/fail 8bits */
|
||||
H_UINT finalValue; /* end result */
|
||||
} resultA;
|
||||
/**
|
||||
* AIS-31 procedure A context. Options are defined in haveged.h
|
||||
* This puppy weighs in at ~3 MB.
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT8 *data; /* input for test */
|
||||
H_UINT range; /* number of bits of input */
|
||||
H_UINT procState; /* procedure state */
|
||||
H_UINT procRetry; /* retry indication */
|
||||
H_UINT testId; /* test selector 0-5 */
|
||||
H_UINT testRun; /* test index 1 - 1285 */
|
||||
H_UINT testState; /* FSM state of current test */
|
||||
H_UINT bridge; /* index for data bridge */
|
||||
H_UINT bytesUsed; /* number of bytes used */
|
||||
H_UINT options; /* duty cycle for test5 */
|
||||
H_UINT8 aux[TEST0_USED]; /* extra work space */
|
||||
resultA results[1286]; /* test results */
|
||||
} procA;
|
||||
/**
|
||||
* AIS-31 procedure B is a set of multinomial distribution tests
|
||||
* and an entropy estimate (Coron' test). The distribution tests,
|
||||
* test6 and test7, require at least AIS_LENGTH sequences of 1, 2
|
||||
* 4, and 8 bits.
|
||||
*/
|
||||
/*
|
||||
* Bit range of AIS-31 procedure B distribution tests
|
||||
*/
|
||||
#define AIS_LENGTH 100000
|
||||
/**
|
||||
* AIS-31 test8 constants (Coron's test)
|
||||
*/
|
||||
#define Q 2560
|
||||
#define K 256000
|
||||
#define LN2 0.69314718055994530941
|
||||
/**
|
||||
* AIS-31 procedure B results
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT testResult; /* id 8 bits, pass/fail 8bits */
|
||||
double finalValue; /* final value */
|
||||
} resultB;
|
||||
/**
|
||||
* AIS-31 procedure B context, a svelt 1.25 KB
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT *noise; /* input for test */
|
||||
H_UINT range; /* number of bits of input */
|
||||
H_UINT procState; /* procedure state */
|
||||
H_UINT procRetry; /* retry indication */
|
||||
H_UINT testId; /* test selector 6-8 */
|
||||
H_UINT testNbr; /* current test number */
|
||||
H_UINT testState; /* FSM state of current test */
|
||||
H_UINT seq; /* aisSeq() sequence needed */
|
||||
H_UINT bitsUsed; /* bits used by procedure */
|
||||
H_UINT bridge; /* data bridge test6,7 */
|
||||
H_UINT counter[8]; /* sequence lengths */
|
||||
H_UINT einsen[8]; /* sequence counts (ones) */
|
||||
H_UINT full; /* sequence flags */
|
||||
H_UINT lastpos[256]; /* counters for test 8 */
|
||||
H_UINT options; /* RFU */
|
||||
resultB results[9]; /* test results */
|
||||
} procB;
|
||||
/**
|
||||
* Testing options
|
||||
*/
|
||||
#define A_CYCLE 0x000001ff /* test5 duty cycle */
|
||||
#define A_WARN 0x00000200 /* Only warn of A fails */
|
||||
#define A_RUN 0x00000400 /* Run procedure A */
|
||||
#define A_OPTIONS 0x000003ff
|
||||
#define B_WARN 0x00001000 /* Only warn of B fails */
|
||||
#define B_RUN 0x00002000 /* Run proceure B */
|
||||
#define B_OPTIONS 0x00001000
|
||||
#define X_OPTIONS 0x000f0000 /* isolated test index */
|
||||
#define X_RUN 0x00100000 /* diagnostic isolated test */
|
||||
/**
|
||||
* A test procedure run consists of an indicator and options
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT action; /* action code A_RUN, B_RUN */
|
||||
H_UINT options; /* WARN and other options */
|
||||
} procInst;
|
||||
|
||||
/**
|
||||
* Services provided
|
||||
*/
|
||||
typedef int (*ptrDiscard)(H_COLLECT *rdr);
|
||||
typedef void (*ptrReport)(H_COLLECT * h_ctxt, H_UINT action, H_UINT prod, H_UINT state, H_UINT ct);
|
||||
typedef int (*ptrRun)(H_COLLECT *rdr, H_UINT prod);
|
||||
|
||||
/**
|
||||
* A test procedure is associated with a collection buffer. Some
|
||||
* resources are shared by all collection buffers. This includes
|
||||
* roll-your-own vtable used to avoid polluting the RNG name space
|
||||
* This structure ends up in hptr->testData
|
||||
*/
|
||||
typedef struct {
|
||||
ptrDiscard discard; /* release test resources */
|
||||
ptrRun run; /* run test suite */
|
||||
ptrReport report; /* report test results */
|
||||
H_UINT options; /* verbosity, etc. */
|
||||
H_UINT testsUsed; /* tests used */
|
||||
procInst totTests[2]; /* tot tests to run */
|
||||
procInst runTests[2]; /* production tests to run */
|
||||
H_UINT procReps; /* Number of A repetitions */
|
||||
H_UINT fips_low[6]; /* low runs thresholds */
|
||||
H_UINT fips_high[6]; /* high runs thresholds */
|
||||
char totText[8]; /* tot test text rep */
|
||||
char prodText[8]; /* production test text rep */
|
||||
H_UINT meters[H_OLT_PROD_B_P+1]; /* test counters */
|
||||
double lastCoron; /* last test8 result */
|
||||
double *G; /* test8 lookup table */
|
||||
} procShared;
|
||||
/**
|
||||
* How to get test context and shared data from H_COLLECT
|
||||
*/
|
||||
#define TESTS_CONTEXT(c) (onlineTests *)(c->havege_tests)
|
||||
#define TESTS_SHARED(c) (procShared *)(((H_PTR)(c->havege_app))->testData)
|
||||
/**
|
||||
* Online testing context - one per collector. Note szTotal is for diagnostic
|
||||
* use only, no effort is made to account for overflow.
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT result; /* nz if failed */
|
||||
H_UINT totIdx; /* tot test idx */
|
||||
H_UINT runIdx; /* run test idx */
|
||||
H_UINT szCarry; /* bits carried in next proc */
|
||||
H_UINT szTotal; /* total bits processed */
|
||||
procA *pA; /* procedure A instance */
|
||||
procB *pB; /* procedure B instance */
|
||||
} onlineTests;
|
||||
/**
|
||||
* Default options are to run the tot tests.
|
||||
*/
|
||||
#define DEFAULT_TEST_OPTIONS "ta8b"
|
||||
/**
|
||||
* Public interface
|
||||
*/
|
||||
int havege_test(procShared *tps, H_PARAMS *params);
|
||||
|
||||
#endif
|
926
src/havegetune.c
Normal file
926
src/havegetune.c
Normal file
|
@ -0,0 +1,926 @@
|
|||
/**
|
||||
** Determine HAVEGE environment
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
** Copyright 2011-2012 BenEleventh Consulting manolson@beneleventh.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*/
|
||||
/**
|
||||
* This compile unit implements automatic tuning for the havege algorithm. Two
|
||||
* general methods are used CPUID (intel specific) and VFS (Linux specific). The
|
||||
* best result of the available methods is returned.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "havegetune.h"
|
||||
/**
|
||||
* Text representations of build options
|
||||
*/
|
||||
#define BUILD_CLOCK 'C'
|
||||
#define BUILD_DIAGS 'D'
|
||||
#define BUILD_CPUID 'I'
|
||||
#define BUILD_THREADS 'M'
|
||||
#define BUILD_OLT 'T'
|
||||
#define BUILD_VFS 'V'
|
||||
/**
|
||||
* Text representations of TOPO_MAP sources
|
||||
*/
|
||||
static const char *topoReps[] = {
|
||||
"D", /* SRC_DEFAULT 0x00001 */
|
||||
"P", /* SRC_PARAM 0x00002 */
|
||||
"A6", /* SRC_CPUID_AMD6 0x00004 */
|
||||
"A5", /* SRC_CPUID_AMD5 0x00008 */
|
||||
"L2", /* SRC_CPUID_INTEL2 0x00010 */
|
||||
"L4", /* SRC_CPUID_INTEL4 0x00020 */
|
||||
"V", /* SRC_VFS_INDEX 0x00040 */
|
||||
"", /* not used 0x00080 */
|
||||
"C", /* SRC_CPUID_PRESENT 0x00100 */
|
||||
"H", /* SRC_CPUID_HT 0x00200 */
|
||||
"A", /* SRC_CPUID_AMD 0x00400 */
|
||||
"A8", /* SRC_CPUID_AMD8 0x00800 */
|
||||
"B", /* SRC_CPUID_LEAFB 0x01000 */
|
||||
"4", /* SRC_CPUID_LEAF4 0x02000 */
|
||||
"VS", /* SRC_VFS_STATUS 0x04000 */
|
||||
"VO" /* SRC_VFS_ONLINE 0x08000 */
|
||||
"VI", /* SRC_VFS_CPUINFO 0x10000 */
|
||||
"VC", /* SRC_VFS_CPUDIR 0x20000 */
|
||||
0
|
||||
};
|
||||
/**
|
||||
* Local debugging
|
||||
*/
|
||||
#if 0
|
||||
#define TUNE_DEBUG(...) fprintf(stderr,__VA_ARGS__)
|
||||
#define TUNE_DUMP 1
|
||||
static void cfg_dump(HOST_CFG *anchor);
|
||||
#else
|
||||
#define TUNE_DEBUG(...)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Local prototypes
|
||||
*/
|
||||
#ifdef TUNING_VFS_ENABLE
|
||||
static void cfg_bitClear(TOPO_MAP *m);
|
||||
static int cfg_bitCount(TOPO_MAP *m);
|
||||
#endif
|
||||
static void cfg_bitDecode(char *dest, const char **reps, H_UINT value, H_UINT size);
|
||||
#if 0
|
||||
static void cfg_bitDisplay(TOPO_MAP *m);
|
||||
#endif
|
||||
static int cfg_bitIntersect(TOPO_MAP *m, TOPO_MAP *t);
|
||||
static void cfg_bitMerge(TOPO_MAP *m,TOPO_MAP *t);
|
||||
static int cfg_bitNext(TOPO_MAP *m, int n);
|
||||
static void cfg_bitSet(TOPO_MAP *m, int n);
|
||||
static void cfg_cacheAdd(HOST_CFG *anchor, H_UINT src, H_UINT cpu,
|
||||
H_UINT level, H_UINT type, H_UINT kb);
|
||||
static void cfg_cpuAdd(HOST_CFG *anchor, H_UINT src, CPU_INST *INST);
|
||||
/**
|
||||
* If cpuid not present, no need to generate the code
|
||||
*/
|
||||
#ifndef CPUID
|
||||
#undef TUNING_CPUID_ENABLE
|
||||
#endif
|
||||
|
||||
#ifdef TUNING_CPUID_ENABLE
|
||||
/************************* CPUID support ***************************************/
|
||||
/**
|
||||
* Register names
|
||||
*/
|
||||
typedef enum {
|
||||
EAX, EBX, ECX, EDX
|
||||
} CPUID_REGNAMES;
|
||||
|
||||
#define CPUID_CONFIG(a) cpuid_config(a)
|
||||
#define CPUID_VENDOR(r) *((H_UINT *)s) = regs[r];s+= sizeof(H_UINT)
|
||||
/**
|
||||
* Local CPUID prototypes
|
||||
*/
|
||||
#if defined (GCC_VERSION) && GCC_VERSION >= 40400
|
||||
static void cpuid(int fn, int sfn, H_UINT *regs) __attribute__((optimize(0)));
|
||||
#else
|
||||
static void cpuid(int fn, int sfn, H_UINT *regs);
|
||||
#endif
|
||||
static void cpuid_config(HOST_CFG *anchor);
|
||||
static void cpuid_configAmd(HOST_CFG *anchor, CPU_INST *w);
|
||||
static void cpuid_configIntel(HOST_CFG *anchor, CPU_INST *w);
|
||||
static void cpuid_configIntel2(HOST_CFG *anchor, CPU_INST *w, H_UINT *regs);
|
||||
static void cpuid_configIntel4(HOST_CFG *anchor, CPU_INST *w, H_UINT *regs);
|
||||
#else
|
||||
#define CPUID_CONFIG(a)
|
||||
#endif
|
||||
/************************ /CPUID support ***************************************/
|
||||
/************************ VFS support ***************************************/
|
||||
#ifdef TUNING_VFS_ENABLE
|
||||
|
||||
#define VFS_LINESIZE 256
|
||||
/**
|
||||
* Filter function used by configuration
|
||||
*/
|
||||
typedef int (*pFilter)(HOST_CFG *pAnchor, char *input);
|
||||
typedef int (*pDirFilter)(HOST_CFG *pAnchor, char *input, H_UINT *pArg);
|
||||
/**
|
||||
* Definitions
|
||||
*/
|
||||
#define VFS_CONFIG(a) vfs_config(a)
|
||||
/**
|
||||
* Local filesystem prototypes
|
||||
*/
|
||||
static void vfs_config(HOST_CFG *anchor);
|
||||
static int vfs_configCpuDir(HOST_CFG *anchor, char *input, H_UINT *pArg);
|
||||
static int vfs_configCpuInfo(HOST_CFG *anchor, char *input);
|
||||
static int vfs_configDir(HOST_CFG *pAnchor, char *path, pDirFilter filter, H_UINT *pArg);
|
||||
static int vfs_configFile(HOST_CFG *anchor, char *path, pFilter filter);
|
||||
static int vfs_configInfoCache(HOST_CFG *pAnchor, char *input, H_UINT *pArg);
|
||||
static int vfs_configOnline(HOST_CFG *anchor, char *input);
|
||||
static int vfs_configInt(HOST_CFG *anchor, char *input);
|
||||
static int vfs_configStatus(HOST_CFG *anchor, char *input);
|
||||
static int vfs_configType(HOST_CFG *anchor, char *input);
|
||||
|
||||
static void vfs_parseList(TOPO_MAP *map, char *input);
|
||||
static void vfs_parseMask(TOPO_MAP *map, char *input);
|
||||
#else
|
||||
#define VFS_CONFIG(a)
|
||||
#endif
|
||||
/************************* /VFS support ***************************************/
|
||||
|
||||
/**
|
||||
* Get tuning values for collector
|
||||
*/
|
||||
void havege_tune( /* RETURN: none */
|
||||
HOST_CFG *anchor, /* OUT: tuning info */
|
||||
H_PARAMS *param) /* IN: config parameters */
|
||||
{
|
||||
char *bp = anchor->buildOpts;
|
||||
int i;
|
||||
|
||||
/**
|
||||
* Capture build options
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
bp += snprintf(bp, 24, "gcc %d.%d.%d ", __GNUC__ ,__GNUC_MINOR__ , __GNUC_PATCHLEVEL__);
|
||||
#endif
|
||||
#if defined(ENABLE_CLOCK_GETTIME)
|
||||
*bp++ = BUILD_CLOCK;
|
||||
#endif
|
||||
#if defined(RAW_IN_ENABLE) || defined(RAW_OUT_ENABLE)
|
||||
*bp++ = BUILD_DIAGS;
|
||||
#endif
|
||||
#ifdef TUNING_CPUID_ENABLE
|
||||
*bp++ = BUILD_CPUID;
|
||||
#endif
|
||||
#if NUMBER_CORES>1
|
||||
*bp++ = BUILD_THREADS;
|
||||
#endif
|
||||
#ifdef ONLINE_TESTS_ENABLE
|
||||
*bp++ = BUILD_OLT;
|
||||
#endif
|
||||
#ifdef TUNING_VFS_ENABLE
|
||||
*bp++ = BUILD_VFS;
|
||||
#endif
|
||||
*bp = 0;
|
||||
/**
|
||||
* Virtual file system setup
|
||||
*/
|
||||
anchor->procfs = param->procFs==NULL? "/proc" : param->procFs;
|
||||
anchor->sysfs = param->sysFs==NULL? "/sys" : param->sysFs;
|
||||
/**
|
||||
* The order determines preference
|
||||
*/
|
||||
if (param->icacheSize != 0)
|
||||
cfg_cacheAdd(anchor, SRC_PARAM, -1, 1, 'I', param->icacheSize);
|
||||
if (param->dcacheSize != 0)
|
||||
cfg_cacheAdd(anchor, SRC_PARAM, -1, 1, 'D', param->dcacheSize);
|
||||
/**
|
||||
* Bypass configuration if entirely specified
|
||||
*/
|
||||
if (param->icacheSize == 0 || param->dcacheSize == 0) {
|
||||
CPUID_CONFIG(anchor);
|
||||
VFS_CONFIG(anchor);
|
||||
cfg_cacheAdd(anchor, SRC_DEFAULT, -1, 1, 'I', GENERIC_ICACHE);
|
||||
cfg_cacheAdd(anchor, SRC_DEFAULT, -1, 1, 'D', GENERIC_DCACHE);
|
||||
}
|
||||
/**
|
||||
* Make sure there is at least 1 cpu instance. cpus configuration is considered
|
||||
* homogeneous so only the first will be reported/used.
|
||||
*/
|
||||
if (0 == anchor->ctCpu)
|
||||
cfg_cpuAdd(anchor, 0, NULL);
|
||||
cfg_bitDecode(anchor->cpuOpts, topoReps, anchor->cpus[0].cpuMap.source, SZ_CPUREP);
|
||||
#ifdef TUNE_DUMP
|
||||
cfg_dump(anchor);
|
||||
#endif
|
||||
anchor->d_tune = anchor->i_tune = MAX_CACHES+2;
|
||||
for (i=0;i<anchor->ctCache;i++) {
|
||||
if (anchor->caches[i].level==1) {
|
||||
switch(anchor->caches[i].type) {
|
||||
case 'I': case 'T':
|
||||
if (i < (int)anchor->i_tune)
|
||||
anchor->i_tune = i;
|
||||
break;
|
||||
case 'D':
|
||||
if (i < (int)anchor->d_tune)
|
||||
anchor->d_tune = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
cfg_bitDecode(anchor->icacheOpts, topoReps,
|
||||
anchor->caches[anchor->i_tune].cpuMap.source, SZ_CACHEREP);
|
||||
cfg_bitDecode(anchor->dcacheOpts, topoReps,
|
||||
anchor->caches[anchor->d_tune].cpuMap.source, SZ_CACHEREP);
|
||||
TUNE_DEBUG("havege_tune %d/%d\n", anchor->i_tune, anchor->d_tune);
|
||||
}
|
||||
#ifdef TUNING_VFS_ENABLE
|
||||
/**
|
||||
* Return number of bits set in map
|
||||
*/
|
||||
static void cfg_bitClear( /* RETURN : None */
|
||||
TOPO_MAP *m) /* IN: bitmap */
|
||||
{
|
||||
memset(&m->bits[0], 0, MAX_BIT_IDX * sizeof(H_UINT));
|
||||
}
|
||||
/**
|
||||
* Return number of bits set in map
|
||||
*/
|
||||
static int cfg_bitCount( /* RETURN : None */
|
||||
TOPO_MAP *m) /* IN: bitmap */
|
||||
{
|
||||
int n, ct=0;
|
||||
|
||||
for(n=-1;(n=cfg_bitNext(m,n))!=-1;ct++) ;
|
||||
return ct;
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* decode bit representation
|
||||
*/
|
||||
static void cfg_bitDecode( /* RETURN: None */
|
||||
char *dest, /* OUT: target */
|
||||
const char **reps, /* IN: codes */
|
||||
H_UINT value, /* IN: value to decode */
|
||||
H_UINT size) /* IN: max range */
|
||||
{
|
||||
H_UINT i=0;
|
||||
const char *s;
|
||||
|
||||
size -= 1;
|
||||
while(value!= 0 && *reps != 0) {
|
||||
s = *reps++;
|
||||
if ((value & 1) != 0) {
|
||||
if (i>0 && i < size)
|
||||
dest[i++] = ' ';
|
||||
while(*s != 0 && i < size)
|
||||
dest[i++] = *s++;
|
||||
}
|
||||
value >>= 1;
|
||||
}
|
||||
dest[i] = 0;
|
||||
}
|
||||
#if 0
|
||||
/**
|
||||
* Display topo bit map - cpuset(7) convention is big-endian
|
||||
*/
|
||||
static void cfg_bitDisplay( /* RETURN : None */
|
||||
TOPO_MAP *m) /* IN: bitmap */
|
||||
{
|
||||
int n;
|
||||
|
||||
for(n=m->msw;n>=0 && n < (int)MAX_BIT_IDX;n--)
|
||||
printf(" %08x", m->bits[n]);
|
||||
}
|
||||
#endif
|
||||
/**
|
||||
* Test if maps intersect
|
||||
*/
|
||||
static int cfg_bitIntersect( /* RETURN: None */
|
||||
TOPO_MAP *m, /* OUT: bitmap */
|
||||
TOPO_MAP *t) /* IN: bit to set */
|
||||
{
|
||||
H_UINT i;
|
||||
|
||||
for (i=0;i < MAX_BIT_IDX;i++)
|
||||
if (0!=(m->bits[i] & t->bits[i]))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Merge two maps
|
||||
*/
|
||||
static void cfg_bitMerge( /* RETURN: None */
|
||||
TOPO_MAP *m, /* OUT: bitmap */
|
||||
TOPO_MAP *t) /* IN: bits to set */
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i=0;i<(int)MAX_BIT_IDX;i++) {
|
||||
m->bits[i] |= t->bits[i];
|
||||
if (0 != m->bits[i] && i > m->msw)
|
||||
m->msw = i;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Find next bit in topo bit map
|
||||
*/
|
||||
static int cfg_bitNext ( /* RETURN: index of next bit or -1 */
|
||||
TOPO_MAP *m, /* IN: bitmap */
|
||||
int n) /* IN: prev bit use -1 for first */
|
||||
{
|
||||
int bit, word;
|
||||
|
||||
bit = (n+1) % BITS_PER_H_UINT;
|
||||
for(word = (n+1) / BITS_PER_H_UINT;word <= m->msw && word < (int)MAX_BIT_IDX;word++) {
|
||||
for(;bit<(int)BITS_PER_H_UINT; bit++)
|
||||
if (m->bits[word] & 1<< bit)
|
||||
return word * BITS_PER_H_UINT + bit;
|
||||
bit = 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* Set a bit in the topo bit map
|
||||
*/
|
||||
static void cfg_bitSet( /* RETURN: None */
|
||||
TOPO_MAP *m, /* OUT: bitmap */
|
||||
int n) /* IN: bit to set */
|
||||
{
|
||||
int word;
|
||||
|
||||
word = n / BITS_PER_H_UINT;
|
||||
if (word < (int)MAX_BIT_IDX) {
|
||||
if (word > m->msw)
|
||||
m->msw = word;
|
||||
m->bits[word] |= 1 << (n % BITS_PER_H_UINT);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Add cache description to configuration
|
||||
*/
|
||||
static void cfg_cacheAdd( /* RETURN: None */
|
||||
HOST_CFG *anchor, /* IN-OUT: configuration */
|
||||
H_UINT src, /* IN: source */
|
||||
H_UINT cpu, /* IN: use -1 for all */
|
||||
H_UINT level, /* IN: cache level */
|
||||
H_UINT type, /* IN: cache type */
|
||||
H_UINT kb) /* IN: cache size in kb */
|
||||
{
|
||||
int i;
|
||||
|
||||
TUNE_DEBUG("cacheAdd(%x, %d,%d,%d,%c)\n", src, cpu, level, kb, type);
|
||||
if (3 < level || 0 ==kb) return;
|
||||
for(i = 0;i < anchor->ctCache;i++)
|
||||
if (anchor->caches[i].level == level &&
|
||||
anchor->caches[i].type == type &&
|
||||
anchor->caches[i].size == kb)
|
||||
break;
|
||||
if (i >= MAX_CACHES) return;
|
||||
if (-1 == (int)cpu)
|
||||
cfg_bitMerge(&anchor->caches[i].cpuMap, &anchor->pCacheInfo);
|
||||
else cfg_bitSet(&anchor->caches[i].cpuMap, cpu);
|
||||
anchor->caches[i].cpuMap.source |= src;
|
||||
if (i < anchor->ctCache) return;
|
||||
anchor->caches[i].level = level;
|
||||
anchor->caches[i].type = type;
|
||||
anchor->caches[i].size = kb;
|
||||
anchor->ctCache += 1;
|
||||
}
|
||||
/**
|
||||
* Add cpu description to configuration
|
||||
*/
|
||||
static void cfg_cpuAdd( /* RETURN: None */
|
||||
HOST_CFG *anchor, /* IN-OUT: configuration */
|
||||
H_UINT src, /* IN: source */
|
||||
CPU_INST *inst) /* IN: instance */
|
||||
{
|
||||
int i=0;
|
||||
|
||||
TUNE_DEBUG("cpuAdd(%x)\n", src);
|
||||
if (NULL==inst) {
|
||||
cfg_bitSet(&anchor->cpus[i].cpuMap, 0);
|
||||
anchor->ctCpu = 1;
|
||||
return;
|
||||
}
|
||||
for(i=0;i < anchor->ctCpu;i++)
|
||||
if (0 != cfg_bitIntersect(&anchor->cpus[i].cpuMap, &inst->cpuMap)) {
|
||||
cfg_bitMerge(&anchor->cpus[i].cpuMap, &inst->cpuMap);
|
||||
anchor->cpus[i].cpuMap.source |= src;
|
||||
return;
|
||||
}
|
||||
if (i >= MAX_CPUS) return;
|
||||
memcpy(&anchor->cpus[i], inst, sizeof(CPU_INST));
|
||||
anchor->cpus[i].cpuMap.source = src;
|
||||
anchor->ctCpu += 1;
|
||||
}
|
||||
#ifdef TUNE_DUMP
|
||||
/**
|
||||
* Diagnostic dump
|
||||
*/
|
||||
static void cfg_dump( /* RETURN: None */
|
||||
HOST_CFG *anchor) /* IN: configuration */
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0;i < anchor->ctCpu;i++)
|
||||
printf("Cpu: %08x\n",
|
||||
anchor->caches[i].cpuMap.source
|
||||
);
|
||||
for(i = 0;i < anchor->ctCache;i++)
|
||||
printf("Cache: %08x %d, %c, %d\n",
|
||||
anchor->caches[i].cpuMap.source,
|
||||
anchor->caches[i].level,
|
||||
anchor->caches[i].type,
|
||||
anchor->caches[i].size
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TUNING_CPUID_ENABLE
|
||||
/************************* CPUID support ***************************************/
|
||||
/**
|
||||
* Wrapper around the cpuid macro to assist in debugging
|
||||
*/
|
||||
static void cpuid( /* RETURN: none */
|
||||
int fn, /* IN: function code */
|
||||
int sfn, /* IN: subfunction */
|
||||
H_UINT *regs) /* IN-OUT: Workspace */
|
||||
{
|
||||
regs[2] = sfn;
|
||||
CPUID(fn, regs);
|
||||
}
|
||||
/**
|
||||
* Get configuration
|
||||
*/
|
||||
static void cpuid_config( /* RETURN: none */
|
||||
HOST_CFG *anchor) /* IN-OUT: result */
|
||||
{
|
||||
CPU_INST wsp;
|
||||
H_UINT regs[4];
|
||||
char *s;
|
||||
|
||||
if (HASCPUID(regs)) {
|
||||
memset(&wsp, 0, sizeof(CPU_INST));
|
||||
wsp.flags |= SRC_CPUID_PRESENT;
|
||||
cpuid(0x00,0,regs);
|
||||
wsp.maxFn = regs[EAX];
|
||||
s = wsp.vendor;
|
||||
CPUID_VENDOR(EBX);
|
||||
CPUID_VENDOR(EDX);
|
||||
CPUID_VENDOR(ECX);
|
||||
if (regs[EBX] == 0x68747541)
|
||||
wsp.flags |= SRC_CPUID_AMD;
|
||||
(void)cpuid(0x80000000,0,regs);
|
||||
wsp.maxFnx = regs[EAX];
|
||||
(void)cpuid(0x01,0,regs);
|
||||
wsp.signature = regs[EAX];
|
||||
if ((regs[EDX] & (1<<28)) != 0)
|
||||
wsp.flags |= SRC_CPUID_HT;
|
||||
TUNE_DEBUG("cpuid_config %s fn=%d fnx=%x flags=%x\n", (char *)wsp.vendor,
|
||||
wsp.maxFn, wsp.maxFnx, wsp.flags);
|
||||
if (0!=(wsp.flags & SRC_CPUID_AMD))
|
||||
cpuid_configAmd(anchor, &wsp);
|
||||
else cpuid_configIntel(anchor, &wsp);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* AMD cpuid Configuration. Reference: Publication 25481, Revision 2.34, Sept 2010
|
||||
*/
|
||||
static void cpuid_configAmd(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
CPU_INST *w) /* IN-OUT: Workspace */
|
||||
{
|
||||
H_UINT regs[4];
|
||||
int i, n;
|
||||
|
||||
switch((w->maxFnx&15)) {
|
||||
case 8:
|
||||
cpuid(0x80000008,0,regs);
|
||||
n = 1 + (regs[ECX] & 0xff);
|
||||
for(i=0;i<n;i++)
|
||||
cfg_bitSet(&w->cpuMap, i);
|
||||
cfg_cpuAdd(anchor, SRC_CPUID_AMD8, w);
|
||||
/* fallthrough */
|
||||
case 6:
|
||||
cpuid(0x80000006,0,regs);
|
||||
cfg_cacheAdd(anchor, SRC_CPUID_AMD6, -1, 2, 'U', (regs[ECX]>>16) & 0xffff);
|
||||
cfg_cacheAdd(anchor, SRC_CPUID_AMD6, -1, 3, 'U', ((regs[EDX]>>18) & 0x3fff)<<9);
|
||||
/* fallthrough */
|
||||
case 5:
|
||||
cpuid(0x80000005,0,regs);
|
||||
cfg_cacheAdd(anchor, SRC_CPUID_AMD5, -1, 1, 'D', (regs[ECX]>>24) & 0xff);
|
||||
cfg_cacheAdd(anchor, SRC_CPUID_AMD5, -1, 1, 'I', (regs[EDX]>>24) & 0xff);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Intel cpuid configuration. Reference: Publication 241618
|
||||
* Processor Identification and CPUID Instruction
|
||||
* Application node 485, Jan 2011
|
||||
*/
|
||||
static void cpuid_configIntel(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
CPU_INST *w) /* IN-OUT: Workspace */
|
||||
{
|
||||
H_UINT regs[4];
|
||||
|
||||
if (w->maxFn >=0x0b) {
|
||||
regs[ECX] = 0;
|
||||
cpuid(0x0b,0,regs);
|
||||
if (regs[EBX]!=0)
|
||||
w->flags |= SRC_CPUID_LEAFB;
|
||||
}
|
||||
#if 0
|
||||
if (w->flags & SRC_CPUID_HT)
|
||||
;
|
||||
else
|
||||
;
|
||||
#endif
|
||||
if (w->maxFn >=4)
|
||||
cpuid_configIntel4(anchor, w, regs);
|
||||
if (w->maxFn >= 2)
|
||||
cpuid_configIntel2(anchor, w, regs);
|
||||
}
|
||||
/**
|
||||
* Configure caches using cpuid leaf 2. This is a legacy method that only determines
|
||||
* level 1 cache. Still needed because trace cache is not reported elsewhere.
|
||||
*/
|
||||
static void cpuid_configIntel2(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
CPU_INST *w, /* IN-OUT: Workspace */
|
||||
H_UINT *regs) /* IN-OUT: registers */
|
||||
{
|
||||
/* L1 and Trace as per Intel application note 485, May 2012 */
|
||||
static const H_UINT defs[] = {
|
||||
0x06, 'I', 8 , /* 4-way set assoc, 32 byte line size */
|
||||
0x08, 'I', 16 , /* 4-way set assoc, 32 byte line size */
|
||||
0x09, 'I', 32 , /* 4-way set assoc, 64 byte line size + */
|
||||
0x0a, 'D', 8 , /* 2 way set assoc, 32 byte line size */
|
||||
0x0c, 'D', 16 , /* 4-way set assoc, 32 byte line size */
|
||||
0x0d, 'D', 16 , /* 4-way set assoc, 64 byte line size + */
|
||||
0x0e, 'D', 24 , /* 6-way set assoc, 64 byte line size */
|
||||
0x10, 'D', 16 , /* 4-way set assoc, 64 byte line size */
|
||||
0x15, 'I', 16 , /* 4-way set assoc, 64 byte line size */
|
||||
0x2c, 'D', 32 , /* 8-way set assoc, 64 byte line size */
|
||||
0x30, 'I', 32 , /* 8-way set assoc, 64 byte line size */
|
||||
0x60, 'D', 16 , /* 8-way set assoc, sectored cache, 64 byte line size */
|
||||
0x66, 'D', 8 , /* 4-way set assoc, sectored cache, 64 byte line size */
|
||||
0x67, 'D', 16 , /* 4-way set assoc, sectored cache, 64 byte line size */
|
||||
0x68, 'D', 32 , /* 4-way set assoc, sectored cache, 64 byte line size */
|
||||
0x70, 'T', 12 , /* 8-way set assoc, trace cache */
|
||||
0x71, 'T', 16 , /* 8-way set assoc, trace cache */
|
||||
0x72, 'T', 32 , /* 8-way set assoc, trace cache */
|
||||
0x73, 'T', 64 , /* 8-way set assoc, trace cache */
|
||||
0x00, 0, 0 /* sentinel */
|
||||
};
|
||||
H_UINT i, j, n, m;
|
||||
|
||||
cpuid(0x02,0,regs);
|
||||
n = regs[EAX]&0xff;
|
||||
while(n--) {
|
||||
for (i=0;i<4;i++) {
|
||||
if (0==(regs[i] & 0x80000000)) {
|
||||
while(0 != regs[i]) {
|
||||
m = regs[i] & 0xff;
|
||||
if (m==0xff)
|
||||
w->flags |= SRC_CPUID_LEAF4;
|
||||
else for (j=0;0 != defs[j];j += 3)
|
||||
if (defs[j]==m) {
|
||||
cfg_cacheAdd(anchor, SRC_CPUID_INTEL2, -1, 1, defs[j+1], defs[j+2]);
|
||||
break;
|
||||
}
|
||||
regs[i]>>=8;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (n) cpuid(0x02,0,regs);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Configure caches using cpuid leaf 4
|
||||
*/
|
||||
static void cpuid_configIntel4(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
CPU_INST *w, /* IN-OUT: Workspace */
|
||||
H_UINT *regs) /* IN-OUT: registers */
|
||||
{
|
||||
H_UINT level, type;
|
||||
H_UINT i, j, lineSz, nParts, nWays, sz;
|
||||
|
||||
for(i=0;i<MAX_CACHES;i++) {
|
||||
cpuid(0x04,i,regs);
|
||||
if (0==i) {
|
||||
H_UINT n = 1 + (regs[EAX]>>26);
|
||||
for(j=0;j<n;j++)
|
||||
cfg_bitSet(&w->cpuMap, j);
|
||||
cfg_cpuAdd(anchor, SRC_CPUID_INTEL4, w);
|
||||
}
|
||||
switch(regs[EAX] & 31) {
|
||||
case 0: type = 0 ; break;
|
||||
case 1: type = 'D'; break;
|
||||
case 2: type = 'I'; break;
|
||||
case 3: type = 'U'; break;
|
||||
default: type = '?'; break;
|
||||
}
|
||||
if (0==type) break;
|
||||
regs[EAX] >>= 5;
|
||||
level = (H_UINT)(regs[EAX] & 7);
|
||||
lineSz = 1 + (regs[EBX] & 0xfff);
|
||||
regs[EBX] >>= 12;
|
||||
nParts = 1 + (regs[EBX] & 0x3ff);
|
||||
regs[EBX] >>= 10;
|
||||
nWays = 1 + regs[EBX];
|
||||
sz = (nWays * nParts * lineSz * (regs[ECX]+1)) / 1024;
|
||||
cfg_cacheAdd(anchor, SRC_CPUID_INTEL4, -1, level, type, sz);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/************************* CPUID support ***************************************/
|
||||
/************************* VFS support ***************************************/
|
||||
#ifdef TUNING_VFS_ENABLE
|
||||
/**
|
||||
* Get configuration
|
||||
*/
|
||||
static void vfs_config(
|
||||
HOST_CFG *anchor) /* IN-OUT: result */
|
||||
{
|
||||
char path[FILENAME_MAX];
|
||||
CPU_INST inst;
|
||||
H_UINT args[2];
|
||||
int n;
|
||||
|
||||
args[0] = args[1] = 0;
|
||||
snprintf(path, FILENAME_MAX, "%s/self/status", anchor->procfs);
|
||||
if (-1 != vfs_configFile(anchor, path, vfs_configStatus))
|
||||
args[0] |= SRC_VFS_STATUS;
|
||||
snprintf(path, FILENAME_MAX, "%s/devices/system/cpu/online", anchor->sysfs);
|
||||
if (-1 != vfs_configFile(anchor, path, vfs_configOnline))
|
||||
args[0] |= SRC_VFS_ONLINE;
|
||||
snprintf(path, FILENAME_MAX, "%s/cpuinfo", anchor->procfs);
|
||||
if (-1 != vfs_configFile(anchor, path, vfs_configCpuInfo))
|
||||
args[0] |= SRC_VFS_CPUINFO;
|
||||
snprintf(path, FILENAME_MAX, "%s/devices/system/cpu", anchor->sysfs);
|
||||
if (-1 != vfs_configDir(anchor, path, vfs_configCpuDir, args)) {
|
||||
memset(&inst, 0, sizeof(CPU_INST));
|
||||
args[0] |= SRC_VFS_CPUDIR;
|
||||
for(n=-1;(n=cfg_bitNext(&anchor->pCpuInfo,n))!=-1;)
|
||||
cfg_bitSet(&inst.cpuMap, n);
|
||||
if (cfg_bitCount(&inst.cpuMap)>0)
|
||||
cfg_cpuAdd(anchor, SRC_VFS_CPUINFO, &inst);
|
||||
}
|
||||
for(n=-1;(n=cfg_bitNext(&anchor->pCacheInfo,n))!=-1;) {
|
||||
snprintf(path, FILENAME_MAX, "%s/devices/system/cpu/cpu%d/cache", anchor->sysfs, n);
|
||||
args[1] = n;
|
||||
vfs_configDir(anchor, path, vfs_configInfoCache, args);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Call back to get cpus and from cpu subdirectories
|
||||
*/
|
||||
static int vfs_configCpuDir(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
char *input, /* filename */
|
||||
H_UINT *pArg) /* parameter */
|
||||
{
|
||||
|
||||
(void)pArg;
|
||||
if (strlen(input)> 3) {
|
||||
char term[32];
|
||||
int cpu;
|
||||
|
||||
cpu = atoi(input+3);
|
||||
(void)snprintf(term, 32, "cpu%d", cpu);
|
||||
if (!strcmp(term, input))
|
||||
cfg_bitSet(&anchor->pCacheInfo, cpu);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Call back to get cpus from cpuinfo
|
||||
*/
|
||||
static int vfs_configCpuInfo(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
char *input) /* input text */
|
||||
{
|
||||
char *s = strchr(input, ':');
|
||||
|
||||
if (NULL != s) {
|
||||
char key[32], value[32];
|
||||
*s++ = '\0';
|
||||
if (1==sscanf(input, "%31s", key) && 1==sscanf(s, "%31s", value)) {
|
||||
if (!strcmp("processor",key))
|
||||
cfg_bitSet(&anchor->pCpuInfo, atoi(value));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Process a configuration directory
|
||||
*/
|
||||
static int vfs_configDir(
|
||||
HOST_CFG *pAnchor, /* IN-OUT: result */
|
||||
char *path, /* IN: directory path */
|
||||
pDirFilter filter, /* IN: entry filter */
|
||||
H_UINT *pArg) /* IN: filter arg */
|
||||
{
|
||||
DIR *d;
|
||||
int rv=-1;
|
||||
|
||||
if (NULL != (d = opendir(path))) {
|
||||
struct dirent *ent;
|
||||
|
||||
while (NULL!=(ent = readdir(d))) {
|
||||
if (0!=(rv = (*filter)(pAnchor, ent->d_name, pArg)))
|
||||
break;
|
||||
}
|
||||
(void)closedir(d);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
/**
|
||||
* Process a configuration file
|
||||
*/
|
||||
static int vfs_configFile(
|
||||
HOST_CFG *pAnchor, /* IN-OUT: result */
|
||||
char *path, /* IN: file path */
|
||||
pFilter filter) /* IN: input filter */
|
||||
{
|
||||
FILE *f;
|
||||
int rv=-1;
|
||||
|
||||
if (NULL != (f = fopen(path, "rb"))) {
|
||||
char buf[VFS_LINESIZE];
|
||||
|
||||
while(fgets(buf, VFS_LINESIZE, f))
|
||||
if (0!=(rv = (*filter)(pAnchor, buf)))
|
||||
break;
|
||||
fclose(f);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
/**
|
||||
* Call back to get cache details
|
||||
*/
|
||||
static int vfs_configInfoCache(
|
||||
HOST_CFG *pAnchor, /* IN-OUT: result */
|
||||
char *input, /* IN: path name */
|
||||
H_UINT *pArgs)
|
||||
{
|
||||
if (strlen(input)> 5) {
|
||||
char path[FILENAME_MAX];
|
||||
int idx;
|
||||
|
||||
idx = atoi(input+5);
|
||||
(void)snprintf(path, 32, "index%d", idx);
|
||||
if (!strcmp(path, input)) {
|
||||
int plen, ctype, level, size;
|
||||
|
||||
plen = snprintf(path, FILENAME_MAX, "%s/devices/system/cpu/cpu%d/cache/index%d/level",
|
||||
pAnchor->sysfs, pArgs[1], idx) - 5;
|
||||
level = vfs_configFile(pAnchor, path, vfs_configInt);
|
||||
strcpy(path+plen, "type");
|
||||
ctype = vfs_configFile(pAnchor, path, vfs_configType);
|
||||
strcpy(path+plen, "size");
|
||||
size = vfs_configFile(pAnchor, path, vfs_configInt);
|
||||
if (size == -1)
|
||||
size = ctype == 'I' ? GENERIC_ICACHE : GENERIC_DCACHE;
|
||||
cfg_cacheAdd(pAnchor, SRC_VFS_INDEX, pArgs[1], level, ctype, size);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Call back to get cpus from online file
|
||||
*/
|
||||
static int vfs_configOnline(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
char *input) /* IN: input text */
|
||||
{
|
||||
vfs_parseList(&anchor->pOnline, input);
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* Call back to return a single integer input
|
||||
*/
|
||||
static int vfs_configInt(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
char *input) /* IN: input text */
|
||||
{
|
||||
(void)anchor;
|
||||
return atoi(input);
|
||||
}
|
||||
/**
|
||||
* Call back to get cpus and memory from status file
|
||||
*/
|
||||
static int vfs_configStatus(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
char *input) /* IN: input text */
|
||||
{
|
||||
char *s = strchr(input, ':');
|
||||
|
||||
if (NULL != s) {
|
||||
char key[32], value[VFS_LINESIZE-32];
|
||||
|
||||
*s++ = '\0';
|
||||
if (1==sscanf(input, "%31s", key) && 1==sscanf(s, "%223s", value)) {
|
||||
if (!strcmp("Cpus_allowed", key))
|
||||
vfs_parseMask(&anchor->pAllowed, value);
|
||||
else if (!strcmp("Mems_allowed", key))
|
||||
vfs_parseMask(&anchor->mAllowed, value);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Call back to return the first byte of input
|
||||
*/
|
||||
int vfs_configType(
|
||||
HOST_CFG *anchor, /* IN-OUT: result */
|
||||
char *input) /* IN: input text */
|
||||
{
|
||||
(void) anchor;
|
||||
return input[0];
|
||||
}
|
||||
/**
|
||||
* Parse the List format described in cpuset(7)
|
||||
*/
|
||||
static void vfs_parseList( /* RETURN: None */
|
||||
TOPO_MAP *map, /* OUT: bit map */
|
||||
char *input) /* IN: list text */
|
||||
{
|
||||
char *term, c;
|
||||
int bounds[2], n;
|
||||
|
||||
cfg_bitClear(map);
|
||||
for(term = strtok(input, ",");term != NULL;term = strtok(NULL, ",")) {
|
||||
n = bounds[0] = bounds[1] = 0;
|
||||
while(0 != (int)(c = *term++))
|
||||
switch(c) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
bounds[n] = bounds[n] * 10 + (int)(c - '0');
|
||||
break;
|
||||
case '-':
|
||||
n = 1;
|
||||
}
|
||||
cfg_bitSet(map, bounds[0]);
|
||||
if (0 != n)
|
||||
while(++bounds[0] <= bounds[1])
|
||||
cfg_bitSet(map, bounds[0]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Parse the Mask format described in cpuset(7)
|
||||
*/
|
||||
static void vfs_parseMask( /* RETURN: None */
|
||||
TOPO_MAP *map, /* OUT: bit map */
|
||||
char *input) /* IN: list text */
|
||||
{
|
||||
char *term, c;
|
||||
int m, n;
|
||||
|
||||
cfg_bitClear(map);
|
||||
for(term = strtok(input, ",");term != NULL;term = strtok(NULL, ",")) {
|
||||
m = 0;
|
||||
while(0 != (int)(c = *term++))
|
||||
switch(c) {
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
m = m * 16 + (int)(c - '0');
|
||||
break;
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
m = m * 16 + (int)(c - 'A') + 10;
|
||||
break;
|
||||
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
|
||||
m = m * 16 + (int)(c - 'a') + 10;
|
||||
}
|
||||
for(n=map->msw;n>=0;n--)
|
||||
map->bits[n+1] = map->bits[n];
|
||||
if (0 != map->bits[map->msw+1])
|
||||
map->msw++;
|
||||
map->bits[0] = 0;
|
||||
for(n=0;n<32;n++)
|
||||
if (m & (1<<n))
|
||||
cfg_bitSet(map, n);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/************************* VFS support ***************************************/
|
||||
|
121
src/havegetune.h
Normal file
121
src/havegetune.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2014 Gary Wuertz gary@issiweb.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef HAVEGETUNE_H
|
||||
#define HAVEGETUNE_H
|
||||
|
||||
#include "havegecollect.h"
|
||||
/**
|
||||
* Some systems supply a maximum
|
||||
*/
|
||||
#ifndef FILENAME_MAX
|
||||
#define FILENAME_MAX 256 /* Max path length */
|
||||
#endif
|
||||
/**
|
||||
* Limits
|
||||
*/
|
||||
#define MAX_BIT_IDX (256/BITS_PER_H_UINT) /* Size of resource bitmaps */
|
||||
#define MAX_CACHES 8 /* Max cache types */
|
||||
#define MAX_CPUS 8 /* Max cpu types */
|
||||
/**
|
||||
* Object used to represent a set of objects
|
||||
*/
|
||||
typedef struct {
|
||||
H_UINT bits[MAX_BIT_IDX];
|
||||
int msw;
|
||||
H_UINT source;
|
||||
} TOPO_MAP;
|
||||
/**
|
||||
* Cache instance
|
||||
*/
|
||||
typedef struct {
|
||||
TOPO_MAP cpuMap; /* what cpus have this cache */
|
||||
H_UINT type; /* 'I'nstruction, 'D'ata, 'U'nified, 'T'race */
|
||||
H_UINT level; /* 0-15................ */
|
||||
H_UINT size; /* size in KB */
|
||||
} CACHE_INST;
|
||||
/**
|
||||
* Sources for CACHE_INST TOPO_MAP
|
||||
*/
|
||||
#define SRC_DEFAULT 0x00001
|
||||
#define SRC_PARAM 0x00002
|
||||
#define SRC_CPUID_AMD6 0x00004
|
||||
#define SRC_CPUID_AMD5 0x00008
|
||||
#define SRC_CPUID_INTEL2 0x00010
|
||||
#define SRC_CPUID_INTEL4 0x00020
|
||||
#define SRC_VFS_INDEX 0x00040
|
||||
/**
|
||||
* CPU instance
|
||||
*/
|
||||
typedef struct {
|
||||
TOPO_MAP cpuMap; /* what cpus have this config */
|
||||
H_UINT signature; /* processor signature */
|
||||
H_UINT flags;
|
||||
H_UINT maxFn;
|
||||
H_UINT maxFnx;
|
||||
char vendor[16];
|
||||
} CPU_INST;
|
||||
/**
|
||||
* Sources for CPU_INST TOPO_MAP
|
||||
*/
|
||||
#define SRC_CPUID_PRESENT 0x00100
|
||||
#define SRC_CPUID_HT 0x00200
|
||||
#define SRC_CPUID_AMD 0x00400
|
||||
#define SRC_CPUID_AMD8 0x00800
|
||||
#define SRC_CPUID_LEAFB 0x01000
|
||||
#define SRC_CPUID_LEAF4 0x02000
|
||||
#define SRC_VFS_STATUS 0x04000
|
||||
#define SRC_VFS_ONLINE 0x08000
|
||||
#define SRC_VFS_CPUINFO 0x10000
|
||||
#define SRC_VFS_CPUDIR 0x20000
|
||||
/**
|
||||
* Size of representation fields
|
||||
*/
|
||||
#define SZ_BUILDREP 32
|
||||
#define SZ_CPUREP 64
|
||||
#define SZ_CACHEREP 32
|
||||
/**
|
||||
* The result of tuning
|
||||
*/
|
||||
typedef struct {
|
||||
char *procfs; /* where proc is mounted */
|
||||
char *sysfs; /* where sys is mounted */
|
||||
char buildOpts[SZ_BUILDREP]; /* build options */
|
||||
char cpuOpts[SZ_CPUREP]; /* cpu options */
|
||||
char icacheOpts[SZ_CACHEREP]; /* icache options */
|
||||
char dcacheOpts[SZ_CACHEREP]; /* dcache options */
|
||||
TOPO_MAP pAllowed; /* allowed processors */
|
||||
TOPO_MAP pOnline; /* processors online */
|
||||
TOPO_MAP pCpuInfo; /* processors with info */
|
||||
TOPO_MAP pCacheInfo; /* processors with cache info */
|
||||
TOPO_MAP mAllowed; /* allowed memory */
|
||||
H_UINT a_cpu; /* suggested cpu */
|
||||
H_UINT i_tune; /* suggested i cache value */
|
||||
H_UINT d_tune; /* suggested d cache value */
|
||||
int ctCpu; /* number of cpu types */
|
||||
int ctCache; /* number of cache items */
|
||||
CPU_INST cpus[MAX_CPUS]; /* cpu instances */
|
||||
CACHE_INST caches[MAX_CACHES+2]; /* cache instances */
|
||||
} HOST_CFG;
|
||||
/**
|
||||
* Tuning interface
|
||||
*/
|
||||
void havege_tune(HOST_CFG *env, H_PARAMS *params);
|
||||
|
||||
#endif
|
201
src/oneiteration.h
Normal file
201
src/oneiteration.h
Normal file
|
@ -0,0 +1,201 @@
|
|||
/**
|
||||
** Simple entropy harvester based upon the havege RNG
|
||||
**
|
||||
** Copyright 2018-2021 Jirka Hladky hladky DOT jiri AT gmail DOT com
|
||||
** Copyright 2009-2013 Gary Wuertz gary@issiweb.com
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
** This source is an adaptation of work released as
|
||||
**
|
||||
** Copyright (C) 2006 - André Seznec - Olivier Rochecouste
|
||||
**
|
||||
** under version 2.1 of the GNU Lesser General Public License
|
||||
**
|
||||
** The original form is retained with minor variable renames for
|
||||
** more consistent macro itilization. See havegecollect.c for
|
||||
** details.
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* On average, one iteration accesses two 8-word blocks in the PWALK
|
||||
* table, and generates 16 words in the RESULT array.
|
||||
*
|
||||
* The data read in the Walk table are updated and permuted after each use.
|
||||
* The result of the hardware clock counter read is used for this update.
|
||||
*
|
||||
* 21 conditional tests are present. The conditional tests are grouped in
|
||||
* two nested groups of 10 conditional tests and 1 test that controls the
|
||||
* permutation.
|
||||
*
|
||||
* In average, there should be 4 tests executed and, in average, 2 of them
|
||||
* should be mispredicted.
|
||||
* ------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
PTTEST = PT >> 20;
|
||||
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PTTEST = PTTEST >> 1;
|
||||
pt = (PT >> 18) & 7;
|
||||
|
||||
PT = PT & ANDPT;
|
||||
|
||||
HARDCLOCKR(HTICK1);
|
||||
|
||||
Pt0 = &PWALK[PT];
|
||||
Pt1 = &PWALK[PT2];
|
||||
Pt2 = &PWALK[PT ^ 1];
|
||||
Pt3 = &PWALK[PT2 ^ 4];
|
||||
|
||||
RESULT[i++] ^= *Pt0;
|
||||
RESULT[i++] ^= *Pt1;
|
||||
RESULT[i++] ^= *Pt2;
|
||||
RESULT[i++] ^= *Pt3;
|
||||
|
||||
inter = ROR32(*Pt0,1) ^ HTICK1;
|
||||
*Pt0 = ROR32(*Pt1,2) ^ HTICK1;
|
||||
*Pt1 = inter;
|
||||
*Pt2 = ROR32(*Pt2, 3) ^ HTICK1;
|
||||
*Pt3 = ROR32(*Pt3, 4) ^ HTICK1;
|
||||
|
||||
Pt0 = &PWALK[PT ^ 2];
|
||||
Pt1 = &PWALK[PT2 ^ 2];
|
||||
Pt2 = &PWALK[PT ^ 3];
|
||||
Pt3 = &PWALK[PT2 ^ 6];
|
||||
|
||||
RESULT[i++] ^= *Pt0;
|
||||
RESULT[i++] ^= *Pt1;
|
||||
RESULT[i++] ^= *Pt2;
|
||||
RESULT[i++] ^= *Pt3;
|
||||
|
||||
if (PTTEST & 1) {
|
||||
Ptinter = Pt0;
|
||||
Pt2 = Pt0;
|
||||
Pt0 = Ptinter;
|
||||
}
|
||||
|
||||
PTTEST = (PT2 >> 18);
|
||||
inter = ROR32(*Pt0, 5) ^ HTICK1;
|
||||
*Pt0 = ROR32(*Pt1, 6) ^ HTICK1;
|
||||
*Pt1 = inter;
|
||||
|
||||
HARDCLOCKR(HTICK2);
|
||||
|
||||
*Pt2 = ROR32(*Pt2, 7) ^ HTICK2;
|
||||
*Pt3 = ROR32(*Pt3, 8) ^ HTICK2;
|
||||
|
||||
Pt0 = &PWALK[PT ^ 4];
|
||||
Pt1 = &PWALK[PT2 ^ 1];
|
||||
|
||||
PT2 = (RESULT[(i - 8) ^ PT1] ^ PWALK[PT2 ^ PT1 ^ 7]);
|
||||
PT2 = ((PT2 & ANDPT) & (0xfffffff7)) ^ ((PT ^ 8) & 0x8);
|
||||
|
||||
/* avoid PT and PT2 to point on the same cache block */
|
||||
PT1 = ((PT2 >> 28) & 7);
|
||||
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
if (PTTEST & 1) {
|
||||
PTTEST ^= 3; PTTEST = PTTEST >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Pt2 = &PWALK[PT ^ 5];
|
||||
Pt3 = &PWALK[PT2 ^ 5];
|
||||
|
||||
RESULT[i++] ^= *Pt0;
|
||||
RESULT[i++] ^= *Pt1;
|
||||
RESULT[i++] ^= *Pt2;
|
||||
RESULT[i++] ^= *Pt3;
|
||||
|
||||
inter = ROR32(*Pt0 , 9) ^ HTICK2;
|
||||
*Pt0 = ROR32(*Pt1 , 10) ^ HTICK2;
|
||||
*Pt1 = inter;
|
||||
*Pt2 = ROR32(*Pt2, 11) ^ HTICK2;
|
||||
*Pt3 = ROR32(*Pt3, 12) ^ HTICK2;
|
||||
|
||||
Pt0 = &PWALK[PT ^ 6];
|
||||
Pt1 = &PWALK[PT2 ^ 3];
|
||||
Pt2 = &PWALK[PT ^ 7];
|
||||
Pt3 = &PWALK[PT2 ^ 7];
|
||||
|
||||
RESULT[i++] ^= *Pt0;
|
||||
RESULT[i++] ^= *Pt1;
|
||||
RESULT[i++] ^= *Pt2;
|
||||
RESULT[i++] ^= *Pt3;
|
||||
|
||||
inter = ROR32(*Pt0, 13) ^ HTICK2;
|
||||
*Pt0 = ROR32(*Pt1, 14) ^ HTICK2;
|
||||
*Pt1 = inter;
|
||||
*Pt2 = ROR32(*Pt2, 15) ^ HTICK2;
|
||||
*Pt3 = ROR32(*Pt3, 16) ^ HTICK2;
|
||||
|
||||
/* avoid PT and PT2 to point on the same cache block */
|
||||
PT = (((RESULT[(i - 8) ^ pt] ^ PWALK[PT ^ pt ^ 7])) &
|
||||
(0xffffffef)) ^ ((PT2 ^ 0x10) & 0x10);
|
Loading…
Add table
Reference in a new issue