Initial commit – mój build oscama z Advanced fake DCW detection
This commit is contained in:
commit
67e44f7f8e
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
# generated binaries
|
||||
Distribution/oscam-*
|
||||
Distribution/list_smargo-*
|
||||
|
||||
# backup/swap file for vi
|
||||
*~
|
||||
*.swp
|
||||
|
||||
# IDE resources
|
||||
.vscode
|
||||
|
||||
# build directories
|
||||
/build/
|
||||
|
||||
# Currently enabled config items
|
||||
webif/is_defined.txt
|
||||
|
||||
# Testing program
|
||||
tests.bin
|
||||
tests.bin.debug
|
||||
|
||||
# Patch files
|
||||
*.patch
|
||||
*.diff
|
||||
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[submodule "wiki"]
|
||||
path = wiki
|
||||
url = https://git.streamboard.tv/common/oscam.wiki.git
|
||||
branch = main
|
||||
shallow = true
|
||||
depends = WEBIF_WIKI
|
||||
1045
CMakeLists.txt
Normal file
1045
CMakeLists.txt
Normal file
File diff suppressed because it is too large
Load Diff
59
CODING.RULES.txt
Normal file
59
CODING.RULES.txt
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/* CODING RULES */
|
||||
|
||||
//single line comment
|
||||
|
||||
/* #####
|
||||
* multi
|
||||
* line
|
||||
* comment
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/* use tab == (4 spaces)
|
||||
* or 2tab == (8 spaces)
|
||||
* for increment
|
||||
* and each level
|
||||
*/
|
||||
|
||||
//remove spaces at the end of lines
|
||||
|
||||
//one empty line between functions
|
||||
const char *idea_options(void){
|
||||
<------>if (sizeof(short) != sizeof(IDEA_INT)) // please do not use shortenings
|
||||
<------>{
|
||||
<------><-->return ("idea(int)");
|
||||
<------>} else {
|
||||
<------><-->return ("idea(short)");
|
||||
<------>}
|
||||
}
|
||||
|
||||
//alternative usual notation
|
||||
<------>if (sizeof(short) != sizeof(IDEA_INT)) { // please do not use shortenings
|
||||
<------><-->return ("idea(int)");
|
||||
<------>} else {
|
||||
<------><-->return ("idea(short)");
|
||||
<------>}
|
||||
}
|
||||
|
||||
/* ##########################
|
||||
* each function or procedure
|
||||
* begins & ends with a brace
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
<------>printf("hello, world\n");
|
||||
<------>for (count=1; count < 11; count = count + 1)
|
||||
<------>{
|
||||
<------><-->printf(" %d\n", count);
|
||||
<------>}
|
||||
|
||||
<------>//one empty line between codeblocks
|
||||
<------>while(i < x)
|
||||
<------>{
|
||||
<------><-->printf(" %d\n", i);
|
||||
<------><-->i++;
|
||||
<------>}
|
||||
<------>exit(0);
|
||||
}
|
||||
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>.
|
||||
10
Distribution/doc/example/oscam.ac
Normal file
10
Distribution/doc/example/oscam.ac
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# anti-cascading table
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# <CAID>:<provider ID>=<seconds>
|
||||
#
|
||||
|
||||
0500:000000=10
|
||||
*=7
|
||||
12
Distribution/doc/example/oscam.cacheex
Normal file
12
Distribution/doc/example/oscam.cacheex
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#
|
||||
# ECM length matching table
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# matching:
|
||||
# m:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1][,ECM length 2]...=
|
||||
# [CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1][,ECM length 2]...
|
||||
#
|
||||
|
||||
m:1234:::::93=5678:::::93 # matching CAID 1234 and CAID 5678 with
|
||||
# ECM length 93
|
||||
9
Distribution/doc/example/oscam.cert
Normal file
9
Distribution/doc/example/oscam.cert
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# Issuer Public Keys (IPK)
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# CAID:reserved:KEY
|
||||
#
|
||||
|
||||
0100:00000000:000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F
|
||||
71
Distribution/doc/example/oscam.conf
Normal file
71
Distribution/doc/example/oscam.conf
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#
|
||||
# main configuration
|
||||
#
|
||||
|
||||
[global]
|
||||
nice = -1
|
||||
WaitForCards = 1
|
||||
|
||||
# logging
|
||||
|
||||
logfile = /var/log/oscam/oscam.log
|
||||
usrfile = /var/log/oscam/oscamuser.log
|
||||
cwlogdir = /var/log/oscam/cw
|
||||
|
||||
# monitor
|
||||
|
||||
[monitor]
|
||||
port = 988
|
||||
aulow = 120
|
||||
monlevel = 1
|
||||
|
||||
# web interface
|
||||
|
||||
[webif]
|
||||
httpport = 8888
|
||||
httpuser = myusername
|
||||
httppwd = mypassword
|
||||
httpallowed = 127.0.0.1,192.168.0.0-192.168.255.255,::1
|
||||
|
||||
# anti-cascading
|
||||
|
||||
[anticasc]
|
||||
enabled = 1
|
||||
numusers = 1
|
||||
sampletime = 2
|
||||
samples = 5
|
||||
penalty = 1
|
||||
aclogfile = /var/log/oscam/aclog.log
|
||||
denysamples = 9
|
||||
|
||||
# protocols
|
||||
|
||||
[newcamd]
|
||||
key = 000102030405060708090A0B0C0D
|
||||
port = 10000@0100:FFFFFF;10001@0200:FFF000,FFFF00;10002@0300:FFFFFF
|
||||
|
||||
[radegast]
|
||||
port = 20000
|
||||
user = user1
|
||||
allowed = 192.168.0.0-192.168.255.255
|
||||
|
||||
[cs378x]
|
||||
port = 30000@0100:FFFFFF;30001@0200:FFF000,FFFF00;30002@0300:FFFFFF
|
||||
|
||||
[cccam]
|
||||
port = 40000
|
||||
version = 1.2.3
|
||||
build = 1234
|
||||
reshare = 2
|
||||
|
||||
[gbox]
|
||||
hostname = host.example.com
|
||||
port = 50000
|
||||
my_password = AB1122C1
|
||||
|
||||
[serial]
|
||||
device = user2@/dev/ttyS0?delay=1&timeout=300;user3@192.160.0.10,2006?delay=1&timeout=5000
|
||||
|
||||
[dvbapi]
|
||||
enabled = 1
|
||||
user = user1
|
||||
41
Distribution/doc/example/oscam.dvbapi
Normal file
41
Distribution/doc/example/oscam.dvbapi
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#
|
||||
# dvbapi configuration
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# priority:
|
||||
# P: CAID[:][provider ID][:][service ID][:][ECM PID] [continue]
|
||||
#
|
||||
# ignore:
|
||||
# I: CAID[:][provider ID][:][service ID][:][ECM PID]
|
||||
#
|
||||
# wait:
|
||||
# D: CAID[:][provider ID][:][service ID][:][ECM PID] delay
|
||||
#
|
||||
# map:
|
||||
# M: CAID[:][provider ID][:][service ID][:][ECM PID] target CAID[:][target provider ID]
|
||||
#
|
||||
# length:
|
||||
# L: CAID[:][provider ID][:][service ID][:][ECM PID] length
|
||||
#
|
||||
|
||||
P: 0100:123456 # prioritise CAID 0100 with provider 123456
|
||||
|
||||
P: :1234 # prioritise ECM with provider ID 1234 on
|
||||
# on any CAID and service
|
||||
|
||||
P: 0200 # prioritise CAID 0200
|
||||
|
||||
P: 0300::9ABC # prioritise CAID 0300 on service 9ABC only
|
||||
|
||||
M: 0400 0500:123456 # map CAID 0400 to provider ID 123456 with
|
||||
# CAID 0500
|
||||
|
||||
D: 0600 200 # wait 200 ms before writing CW for CAID 0600
|
||||
|
||||
I: :654321 # ignore provider ID 654321 for every CAID and
|
||||
# service
|
||||
|
||||
I: 0 # ignore every CAID that was not handled before
|
||||
|
||||
L: 0700 8e # ECM length for CAID 0700 to 8e (hexadecimal)
|
||||
9
Distribution/doc/example/oscam.guess
Normal file
9
Distribution/doc/example/oscam.guess
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# CAID guessing table
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# <len>:<caid>
|
||||
#
|
||||
|
||||
12:3456
|
||||
10
Distribution/doc/example/oscam.ird
Normal file
10
Distribution/doc/example/oscam.ird
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# Irdeto guessing table
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# <byte3>:<byte4-7>:<CAID>:<SID>
|
||||
#
|
||||
|
||||
12:0000000A:12AB:CD01
|
||||
|
||||
14
Distribution/doc/example/oscam.provid
Normal file
14
Distribution/doc/example/oscam.provid
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#
|
||||
# provider table
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# <caid>:<provid>|<provider>|<satellite>|<language>
|
||||
#
|
||||
|
||||
0100:012345|MyPay-TV1|Astra 19.2E|German
|
||||
0200:543210|MyPay-TV2|Hot Bird 13.0E|English
|
||||
0300:112233|MyPay-TV3|Hot Bird 13.0E|Italian
|
||||
0400:223344|MyPay-TV4|Atra 28.2E|English
|
||||
|
||||
|
||||
169
Distribution/doc/example/oscam.server
Normal file
169
Distribution/doc/example/oscam.server
Normal file
|
|
@ -0,0 +1,169 @@
|
|||
#
|
||||
# reader configuration
|
||||
#
|
||||
|
||||
# serial reader
|
||||
|
||||
[reader]
|
||||
label = reader1
|
||||
protocol = mouse
|
||||
detect = CD
|
||||
device = /dev/ttyS0
|
||||
group = 1
|
||||
emmcache = 1,3,2
|
||||
services = services1
|
||||
caid = 0100
|
||||
|
||||
# USB serial reader
|
||||
|
||||
[reader]
|
||||
label = reader2
|
||||
protocol = mouse
|
||||
detect = CD
|
||||
device = /dev/ttyUSB0
|
||||
aeskey = 000102030405060708090A0B0C0D0E0F
|
||||
group = 2
|
||||
emmcache = 1,3,2
|
||||
services = services2
|
||||
caid = 0200
|
||||
|
||||
# remote newcamd reader with fallback for group 1
|
||||
|
||||
[reader]
|
||||
label = remote1
|
||||
protocol = newcamd
|
||||
key = 0102030405060708091011121314
|
||||
device = 192.168.0.2,66666
|
||||
user = user1
|
||||
password = password1
|
||||
group = 1
|
||||
fallback = 1
|
||||
|
||||
# remote camd 3.78x reader with fallback for group 2
|
||||
|
||||
[reader]
|
||||
label = remote2
|
||||
protocol = cs378x
|
||||
device = 192.168.0.3,23456
|
||||
user = user2
|
||||
password = password2
|
||||
group = 2
|
||||
fallback = 1
|
||||
|
||||
# remote gbox reader
|
||||
|
||||
[reader]
|
||||
label = remote3
|
||||
protocol = gbox
|
||||
device = 192.168.0.5,45678
|
||||
password = AF1BC100
|
||||
user = gbox_client
|
||||
group = 3
|
||||
services = services1
|
||||
|
||||
# remote CCcam reader
|
||||
|
||||
[reader]
|
||||
label = remote4
|
||||
protocol = cccam
|
||||
device = 192.168.0.5,45678
|
||||
user = user4
|
||||
password = password4
|
||||
group = 4
|
||||
caid = 0400
|
||||
cccversion = 1.2.34
|
||||
cccbuild = 5678
|
||||
|
||||
# remote radegast reader
|
||||
|
||||
[reader]
|
||||
label = remote5
|
||||
protocol = radegast
|
||||
device = 192.168.0.6,56789
|
||||
group = 5
|
||||
caid = 0500
|
||||
|
||||
# PCSC reader
|
||||
|
||||
[reader]
|
||||
label = mypcscreader
|
||||
protocol = pcsc
|
||||
device = 0
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 6
|
||||
caid = 0600
|
||||
|
||||
# Smargo Smartreader+ (Tripple Reader as well) using kernel drivers (recommended)
|
||||
|
||||
[reader]
|
||||
label = mysmargo
|
||||
protocol = smargo
|
||||
device = /dev/ttyUSB1
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 7
|
||||
caid = 0700
|
||||
|
||||
# Smargo Smartreader+ using libusb
|
||||
|
||||
[reader]
|
||||
label = mysmartreader
|
||||
protocol = smartreader
|
||||
device = 001:002
|
||||
group = 8
|
||||
caid = 0800
|
||||
|
||||
# internal reader
|
||||
|
||||
[reader]
|
||||
label = myinternalreader
|
||||
protocol = internal
|
||||
device = /dev/sci0
|
||||
group = 9
|
||||
caid = 0900
|
||||
|
||||
# AD-Teknik AB Multiprogrammer 3.5 serial
|
||||
|
||||
[reader]
|
||||
label = reader9
|
||||
protocol = mp35
|
||||
detect = CD
|
||||
device = /dev/ttyS1
|
||||
group = 10
|
||||
emmcache = 1,3,2
|
||||
services = services9
|
||||
caid = 1000
|
||||
|
||||
# AD-Teknik AB Multiprogrammer 3.6 USB
|
||||
|
||||
[reader]
|
||||
label = reader10
|
||||
protocol = mp35
|
||||
detect = CD
|
||||
device = /dev/ttyUSB1
|
||||
group = 11
|
||||
emmcache = 1,3,2
|
||||
services = services10
|
||||
caid = 1100
|
||||
|
||||
# AD-Teknik AB USB Phoenix at 6.00 mhz
|
||||
|
||||
[reader]
|
||||
label = reader12
|
||||
protocol = mp35
|
||||
detect = CD
|
||||
device = /dev/ttyUSB2
|
||||
mhz = 600
|
||||
group = 12
|
||||
emmcache = 1,3,2
|
||||
services = services11
|
||||
caid = 1200
|
||||
|
||||
# sc8in1 reader
|
||||
|
||||
[reader]
|
||||
label = reader12
|
||||
protocol = sc8in1
|
||||
device = /dev/ttyUSB3:1
|
||||
group = 13
|
||||
emmcache = 1,3,2
|
||||
caid = 1300
|
||||
19
Distribution/doc/example/oscam.services
Normal file
19
Distribution/doc/example/oscam.services
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#
|
||||
# definition of services
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# [name]
|
||||
# caid=CAID[,CAID]...
|
||||
# provid = provider ID[,provider ID]...
|
||||
# srvid = service ID[,service ID]...
|
||||
#
|
||||
|
||||
[services1]
|
||||
caid=0100
|
||||
provid=000001,ABCDEF
|
||||
srvid=0001,0002,000A,000B
|
||||
|
||||
[services2]
|
||||
caid=0200
|
||||
srvid=0003,0004,000C,000D
|
||||
6
Distribution/doc/example/oscam.srvid
Normal file
6
Distribution/doc/example/oscam.srvid
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#
|
||||
# service ID configuration file for web interface and monitor
|
||||
#
|
||||
|
||||
1111,2222:000A|provider A|Name C|TV|package E
|
||||
3333,4444,5555:000B|provider B|Name D|Radio|package F
|
||||
7
Distribution/doc/example/oscam.tiers
Normal file
7
Distribution/doc/example/oscam.tiers
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#
|
||||
# TIERS
|
||||
#
|
||||
|
||||
0001,0002,0003:000a|my TIER 1
|
||||
0004:000b|my TIER 2
|
||||
0005:000b|my TIER 3
|
||||
71
Distribution/doc/example/oscam.user
Normal file
71
Distribution/doc/example/oscam.user
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#
|
||||
# user configuration
|
||||
#
|
||||
|
||||
# user for group 1 with Betacrypt tunnel, no monitoring, only one connection possible, AU enabled
|
||||
|
||||
[account]
|
||||
user = user1
|
||||
pwd = password1
|
||||
monlevel = 0
|
||||
uniq = 1
|
||||
group = 1
|
||||
au = reader1
|
||||
services = services1
|
||||
betatunnel = 0300.FFFF:0100,0400.FFFF:0100
|
||||
ident = 0100:000000
|
||||
caid = 0100
|
||||
|
||||
# user for group 2 with monitor access, AU enabled
|
||||
|
||||
[account]
|
||||
user = user2
|
||||
pwd = password2
|
||||
monlevel = 1
|
||||
uniq = 0
|
||||
group = 2
|
||||
au = reader2
|
||||
services = services2
|
||||
ident = 0200:000000
|
||||
caid = 0200
|
||||
|
||||
# user for group 2 without monitor access, AU disabled, account disabled
|
||||
|
||||
[account]
|
||||
user = user3
|
||||
pwd = password3
|
||||
disabled = 1
|
||||
group = 2
|
||||
services = services2
|
||||
ident = 0200:000000
|
||||
caid = 0200
|
||||
|
||||
# user for group 3 without monitor access, only one connection possible, AU disabled, multiple idents
|
||||
|
||||
[account]
|
||||
user = user4
|
||||
pwd = password4
|
||||
monlevel = 0
|
||||
uniq = 1
|
||||
group = 3
|
||||
ident = 0300:000000,FFFFFF;0400:FFFFFF
|
||||
caid = 0300
|
||||
|
||||
# user for group 5 with anti-cascading, only 1 logging allowed, send fake CWs as penalty
|
||||
|
||||
[account]
|
||||
user = user5
|
||||
pwd = password5
|
||||
group = 5
|
||||
services = services5
|
||||
ident = 0500:000000
|
||||
caid = 0500
|
||||
numusers = 1
|
||||
penalty = 1
|
||||
|
||||
# user for gbox reader
|
||||
|
||||
[account]
|
||||
user = gbox_client
|
||||
pwd =
|
||||
group = 3
|
||||
26
Distribution/doc/example/oscam.whitelist
Normal file
26
Distribution/doc/example/oscam.whitelist
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#
|
||||
# whitelist table
|
||||
#
|
||||
# format:
|
||||
#
|
||||
# whitelist:
|
||||
# w:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1][,ECM length 2]...
|
||||
#
|
||||
# whitelist, not proceed with any other ECM length whitelisting when matching:
|
||||
# l:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1][,ECM length 2]...
|
||||
#
|
||||
# ignore:
|
||||
# i:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1][,ECM length 2]...
|
||||
#
|
||||
|
||||
w:0100 # whitelisting for CAID 0100
|
||||
|
||||
i:0200:1234 # ignore CAID 0200 with service ID 1234
|
||||
|
||||
i:::::2345 # ignore CHID 2345
|
||||
|
||||
w: # allow all others (blacklist)
|
||||
|
||||
l:0300 # whitelisting for CAID 0300 not proceeding
|
||||
# if matching
|
||||
|
||||
36
Distribution/doc/html/list_smargo.1.html
Normal file
36
Distribution/doc/html/list_smargo.1.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of list_smargo</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>list_smargo</H1>
|
||||
Section: User Commands (1)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>list_smargo</B> - list all connected Smartreader+
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
list_smargo
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
The list_smargo software lists all connected Smartreader+ with bus number and device address.
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
243
Distribution/doc/html/oscam.1.html
Normal file
243
Distribution/doc/html/oscam.1.html
Normal file
|
|
@ -0,0 +1,243 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam</H1>
|
||||
Section: User Commands (1)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>OSCam</B> - SC server
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
The OSCam software is an <I>open source</I> multi-protocol/multi-platform SC server.
|
||||
<P>
|
||||
<I>Please check the compile options for included features in the binary.</I>
|
||||
<P>
|
||||
OSCam supports the following protocols:
|
||||
<DL COMPACT>
|
||||
<DT>•<DD>
|
||||
newcamd with cascading/remote server ECM support
|
||||
<DT>•<DD>
|
||||
camd 3.3x TCP
|
||||
<DT>•<DD>
|
||||
camd camd 3.5x / 3.57x UDP with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
<DT>•<DD>
|
||||
camd 3.78x TCP with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
<DT>•<DD>
|
||||
CCcam with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
<DT>•<DD>
|
||||
DVB API with multi tuner and PIP support
|
||||
<DT>•<DD>
|
||||
gbox with cascading/remote server ECM support
|
||||
<DT>•<DD>
|
||||
serial (HSIC, SSSP, BOMBA, DSR 9500)
|
||||
<DT>•<DD>
|
||||
radegast
|
||||
<DT>OSCam works on the following platforms:<DD>
|
||||
<DT>•<DD>
|
||||
Linux (Tuxbox, ARM, MIPS, MIPSel, SH-4, PowerPC, ...)
|
||||
<DT>•<DD>
|
||||
Windows (based on cygwin1.dll)
|
||||
<DT>•<DD>
|
||||
Mac OS X
|
||||
</DL>
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>OPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-a</B>|<B>--crash-dump</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
write oscam.crash on segfault (needs installed GDB and OSCam compiled with debug infos -ggdb)
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-b</B>|<B>--daemon</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
starts in background, writing oscam.version with starttime and version info in temporary directory
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-B</B>|<B>--pidfile</B> <filename>
|
||||
<DL COMPACT><DT><DD>
|
||||
set PID file, overrides pidfile of <B>oscam.conf</B>, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-c</B>|<B>--config-dir</B> <directory>
|
||||
<DL COMPACT><DT><DD>
|
||||
read configuration from <directory>, default:see CS_CONFDIR in <B>globals.h</B>,
|
||||
while starting OSCam prints warnings on invalid keywords, comment lines start with <B>#</B> character.
|
||||
<P>
|
||||
Autodiscover of the following directories will be done:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT>•<DD>
|
||||
/etc/tuxbox/config
|
||||
<DT>•<DD>
|
||||
/etc/tuxbox/config/oscam
|
||||
<DT>•<DD>
|
||||
/config/oscam
|
||||
<DT>•<DD>
|
||||
/usr/keys
|
||||
<DT>•<DD>
|
||||
/var/etc
|
||||
<DT>•<DD>
|
||||
/var/etc/oscam
|
||||
<DT>•<DD>
|
||||
/var/keys
|
||||
<DT>•<DD>
|
||||
/var/oscam
|
||||
<DT>•<DD>
|
||||
/var/tuxbox/config
|
||||
<P>
|
||||
</DL>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-d</B>|<B>--debug</B> <level>
|
||||
<DL COMPACT><DT><DD>
|
||||
debug level mask:
|
||||
<P>
|
||||
<BR> <B>0</B> = no debugging (default)
|
||||
<BR> <B>2</B> = ATR parsing info, ECM dumps, CW dumps
|
||||
<BR> <B>4</B> = traffic from/to the reader
|
||||
<BR> <B>8</B> = traffic from/to the clients
|
||||
<BR> <B>16</B> = traffic to the reader-device on IFD layer
|
||||
<BR> <B>32</B> = traffic to the reader-device on I/O layer
|
||||
<BR> <B>64</B> = EMM logging
|
||||
<BR> <B>128</B> = DVBAPI logging
|
||||
<BR> <B>256</B> = load balancing logging
|
||||
<BR> <B>512</B> = cache exchange logging
|
||||
<BR> <B>1024</B> = client ECM logging
|
||||
<BR> <B>2048</B> = CSP logging
|
||||
<BR> <B>4096</B> = CWC logging
|
||||
<BR> <B>8192</B> = CW Cache logging
|
||||
<BR> <B>65535</B> = debug all
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-g</B>|<B>--gcollect</B> <mode>
|
||||
<DL COMPACT><DT><DD>
|
||||
garbage collector debug mode, default:none:
|
||||
<P>
|
||||
<BR> <B>1</B> = immediate free
|
||||
<BR> <B>2</B> = check for double frees
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-h</B>|<B>--help</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
usage
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-I</B>|<B>--syslog-ident</B> <ident>
|
||||
<DL COMPACT><DT><DD>
|
||||
set syslog ident, default:oscam
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-p</B>|<B>--pending-ecm</B> <number>
|
||||
<DL COMPACT><DT><DD>
|
||||
maximum number of pending ECM packets, default:32, maximum:255
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-r</B>|<B>--restart</B> <level>
|
||||
<DL COMPACT><DT><DD>
|
||||
restart level:
|
||||
<P>
|
||||
<BR> <B>0</B> = disabled, restart request sets exit status to 99
|
||||
<BR> <B>1</B> = restart activated, web interface can restart oscam (default)
|
||||
<BR> <B>2</B> = like 1, but also restart on segmentation faults
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-S</B>|<B>--show-sensitive</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
do not filter sensitive info (card serial numbers) in the logs
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-s</B>|<B>--capture-segfaults</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
capture segmentation faults
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-t</B>|<B>--temp-dir</B> <directory>
|
||||
<DL COMPACT><DT><DD>
|
||||
use <directory> for temporary data, default:temporary directory of OS
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-V</B>|<B>--build-info</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
show OSCam version info
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>-w</B>|<B>--wait</B> <seconds>
|
||||
<DL COMPACT><DT><DD>
|
||||
time waiting for system time to be set correctly
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>SIGNALS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>SIGHUP</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
reinit user db, readers, TIERs, services, clients and anti-cascading, for newcamd connections: after reloading the ident, please restart newcamd client
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>SIGUSR1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
shift debug level to next level (see debug level mask above)
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>SIGUSR2</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
get reader SC info
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAD">OPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">SIGNALS</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
54
Distribution/doc/html/oscam.ac.5.html
Normal file
54
Distribution/doc/html/oscam.ac.5.html
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.ac</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.ac</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.ac</B> - anti-cascading table for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
anti-cascading table
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B><CAID></B>:<B><provider ID></B>=<B><seconds></B>
|
||||
<DL COMPACT><DT><DD>
|
||||
define time cycles between CWs changes relating to CAID and provider ID
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>*</B>=<B><seconds></B>
|
||||
<DL COMPACT><DT><DD>
|
||||
default time cycles between CWs changes <I>required</I>
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 0100:000000=10
|
||||
<BR> *=7
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
53
Distribution/doc/html/oscam.cacheex.5.html
Normal file
53
Distribution/doc/html/oscam.cacheex.5.html
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.cacheex</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.cacheex</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam..cacheex</B> - global ECM length matching configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
ECM length matching
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>m</B>:<B>[CAID]</B>[:]<B>[provider ID]</B>[:]<B>[service ID]</B>[:]<B>[ECM PID]</B>[:]<B>[CHID]</B>[:]<B>[ECM length 1[,ECM length 2]...]]</B>=<B>[CAID]</B>[:]<B>[provider ID]</B>[:]<B>[service ID]</B>[:]<B>[ECM PID]</B>[:]<B>[CHID]</B>[:]<B>[ECM length 1[,ECM length 2]...]]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> ECM length matching from remote cache exchange partner to local
|
||||
<BR> cache, <I>for cache exchange pull mode (cacheex = 1) only</I>
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>ANNONTATIONS</H2>
|
||||
|
||||
<I>Please use Unix text file format only.</I>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> m:1234:::::93=5678:::::93 # matching CAID 1234 and CAID 5678 with
|
||||
<BR> # ECM length 93
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B>oscam.srvid </B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5),<B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">ANNONTATIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
46
Distribution/doc/html/oscam.cert.5.html
Normal file
46
Distribution/doc/html/oscam.cert.5.html
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.cert</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.cert</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.cert</B> - Issuer Public Keys (IPK) for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
Issuer Public Keys (IPK)
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>CAID</B>:<B>reserved</B>:<B>IPK</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
mapping between CAID and IPK/sessions keys in hex, currently for Cryptoworks only
|
||||
</DL>
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 0100:00000000:0102030405060708090A0B0C0D0E0F
|
||||
|
||||
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
1985
Distribution/doc/html/oscam.conf.5.html
Normal file
1985
Distribution/doc/html/oscam.conf.5.html
Normal file
File diff suppressed because it is too large
Load Diff
142
Distribution/doc/html/oscam.dvbapi.5.html
Normal file
142
Distribution/doc/html/oscam.dvbapi.5.html
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.dvbapi</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.dvbapi</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.dvbapi</B> - DVB API configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
DVBAPI settings, first match - first used
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>P</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B>:<B>[CHID]</B> <B>[force]</B>:<B>[PIDx]</B> <B>priority</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set priority, <B>continue</B> = <B>1</B>: proceed with priority, recommended for
|
||||
<BR> pay-per-view services / EMMs <I>(use carefully)</I>, <I>although local SCs
|
||||
<BR> will be prioritised higher</I>, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>I</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B>:<B>[CHID]</B> <B>[PIDx]</B> <B>ignore</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set ignore
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>J</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B> <B>joined CAID</B>:<B>joined provider ID</B>:<B>joined ECM PID</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> join to another ECM PID
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>A</B>: ::<B>service ID</B>:<B>[PMT PID] </B>:<B>[provider ID]</B>[:]<B>[ECM PID]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set a dummy ECM request with CAID FFFF for services with a constant CW shown as unencrypted service
|
||||
<I>(for STBs with PMT PID support only)</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>A</B>: ::<B>service ID</B>:<B>[video PID] </B>:<B>[provider ID]</B>[:]<B>[ECM PID]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set a dummy ECM request with CAID FFFF for services with a constant CW shown as unencrypted service
|
||||
<I>(for STBs without PMT PID support only)</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>X</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> add decoding on an extra demux index on the same CA device (Multi ECM) <I>(not support on all STBs)</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>D</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B> <B>delay</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set delay in milli-seconds writing CWs
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>M</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B> <B>target CAID</B>[:]<B>[target provider ID]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> mapping
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>S</B>: <B>[device]</B> <B>[PMT file name]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set DVB API device name and PMT file name <I>(valid for STAPI only)</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>L</B>: <B>[CAID]</B>:<B>[provider ID]</B>:<B>[service ID]</B>:<B>[ECM PID]</B> <B>length</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> set ECM length in hexadecimal
|
||||
</DL>
|
||||
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>ANNONTATIONS</H2>
|
||||
|
||||
<I>Please use Unix text file format only.</I>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> P: 0100:123456 # prioritise CAID 0100 with provider 123456
|
||||
<P>
|
||||
<BR> P: :1234 # prioritise ECM with provider ID 1234 on
|
||||
<BR> # on any CAID and service
|
||||
<P>
|
||||
<BR> P: 0200 # prioritise CAID 0200
|
||||
<P>
|
||||
<BR> P: 0300::9ABC # prioritise CAID 0300 on service 9ABC only
|
||||
<P>
|
||||
<BR> P: 0400 1 # prioritise CAID 0400 for pay-per-view services
|
||||
<BR>
|
||||
<BR> P: : 1 # prioritise for EMMs
|
||||
<P>
|
||||
<BR> M: 0500 0600:123456 # map CAID 0500 to provider ID 123456 with
|
||||
<BR> # CAID 0600
|
||||
<P>
|
||||
<BR> D: 0700 200 # wait 200 ms before writing CW for CAID 0700
|
||||
<P>
|
||||
<BR> I: :654321 # ignore provider ID 654321 for every CAID and
|
||||
<BR> # service
|
||||
<P>
|
||||
<BR> I: 0 # ignore every CAID that was not handled before
|
||||
<P>
|
||||
<BR> L: 0800 8e # ECM length for CAID 0800 to 8e (hexadecimal)
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">ANNONTATIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
45
Distribution/doc/html/oscam.guess.5.html
Normal file
45
Distribution/doc/html/oscam.guess.5.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.guess</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.guess</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.guess</B> - CAID guessing table for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
CAID guessing table
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B><length of ECM></B>:<B><CAID></B>
|
||||
<DL COMPACT><DT><DD>
|
||||
CAID guessing table by len in hex, only needed for protocols (at the moment BOMBA protocol only) that does not pass CAIDs
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 12:3456
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
46
Distribution/doc/html/oscam.ird.5.html
Normal file
46
Distribution/doc/html/oscam.ird.5.html
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.ird</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.ird</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.ird</B> - Irdeto guessing table for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
Irdeto guessing table
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B><byte3></B>:<B><byte4-7></B>:<B><CAID></B>:<B><SID></B>
|
||||
<DL COMPACT><DT><DD>
|
||||
Irdeto guessing table by signature
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 12:0000000a:12ab:cd01
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
46
Distribution/doc/html/oscam.provid.5.html
Normal file
46
Distribution/doc/html/oscam.provid.5.html
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.provid</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.provid</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.provid</B> - provider table for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
provider table
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B><caid></B>:<B><provid></B>|<B><provider></B>|<B><satellite></B>|<B><language></B>
|
||||
<DL COMPACT><DT><DD>
|
||||
provider table
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 0100:012345|MyPay-TV|Astra 19E|German
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
63
Distribution/doc/html/oscam.ratelimit.5.html
Normal file
63
Distribution/doc/html/oscam.ratelimit.5.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.ratelimit</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.ratelimit</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.ratelimit</B> - ECMs ratelimit for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
limit rate of ECMs allowed for an interval
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>CAID</B>:<B>provider ID</B>:<B>service ID</B>:<B>ChID</B>:<B>ratelimitecm</B>:<B>ratelimitseconds</B>:<B>srvidholdseconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<P>
|
||||
<B>ratelimitecm</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
number of different SIDs in ECMs allowed for an interval
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
<B>ratelimitseconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
interval in seconds for ratelimit
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
<B>srvidholdseconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
extra time in seconds this service ID is kept in a slot before another service ID can take its place
|
||||
</DL>
|
||||
|
||||
</DL>
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 0100:00002A:3A3A:4A00:0002:0010:0004
|
||||
|
||||
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
1109
Distribution/doc/html/oscam.server.5.html
Normal file
1109
Distribution/doc/html/oscam.server.5.html
Normal file
File diff suppressed because it is too large
Load Diff
72
Distribution/doc/html/oscam.services.5.html
Normal file
72
Distribution/doc/html/oscam.services.5.html
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.services</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.services</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.services</B> - definition of services for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
service definitions
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H3>The [<service name>] section</H3>
|
||||
|
||||
service name section, service name sections are recurring, <I>required</I>, <I>maximum 64 services are allowed</I>
|
||||
<P>
|
||||
|
||||
<B>caid</B> = <B>CAID[,CAID]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
listing of CAIDs in hex
|
||||
</DL>
|
||||
|
||||
|
||||
<P>
|
||||
|
||||
<B>provid</B> = <B>provider ID[,provider ID]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
listing of provider IDs in hex
|
||||
</DL>
|
||||
|
||||
|
||||
<P>
|
||||
|
||||
<B>srvid</B> = <B>service ID[,service ID]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
listing of service IDs in hex
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> [myservice]
|
||||
<BR> CAID=0100,0200,000A
|
||||
<BR> provid=000001,ABCDEF
|
||||
<BR> srvid=0001,0002,000A,000B
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAE">The [<service name>] section</A><DD>
|
||||
</DL>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
58
Distribution/doc/html/oscam.srvid.5.html
Normal file
58
Distribution/doc/html/oscam.srvid.5.html
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.srvid</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.srvid</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.srvid</B> - service ID configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
service ID mappings
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>CAID[,CAID]...</B>:<B>service ID</B>|<B>[provider]</B>|<B>[name]</B>|<B>[type]</B>|<B>[description]</B>
|
||||
<P>
|
||||
<DL COMPACT><DT><DD>
|
||||
mapping between CAID, service ID, provider, name, type and description of service
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>ANNONTATIONS</H2>
|
||||
|
||||
<I>Please use Unix text file format only.</I>
|
||||
<P>
|
||||
You only need the <B>oscam.srvid</B> when using the monitor or the web interface.
|
||||
<I>For saving memory consumption only insert the service IDs you really need.</I> Some
|
||||
external programs use their own <B>oscam.srvid</B> and do not need the <B>oscam.srvid</B> of OSCam.
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 0001,0002,0003:000a|my provider 1|tv name 1|tv|my tv package
|
||||
<BR> 0004,0005,0006:000a|my provider 2|radio name 2|radio|my radio package
|
||||
<BR> 0006:000b|my provider 3|tv name 3|
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">ANNONTATIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
51
Distribution/doc/html/oscam.srvid2.5.html
Normal file
51
Distribution/doc/html/oscam.srvid2.5.html
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.srvid2</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.srvid2</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.srvid2</B> - service ID configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
service ID mappings
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>service ID</B>:<B>CAID</B>[:<B>@provider ID</B>[<B>@provider ID</B>]...][,:<B>CAID</B>[:<B>@provider ID</B>[<B>@provider ID</B>]...]][<B>name</B>]|[<B>type</B>]|[<B>description</B>]|[<B>provider</B>]
|
||||
<P>
|
||||
<DL COMPACT><DT><DD>
|
||||
mapping between service ID, CAID, provider ID, name, type, description and proivder
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>ANNONTATIONS</H2>
|
||||
|
||||
<I>Please use Unix text file format only.</I>
|
||||
<P>
|
||||
You only need the <B>oscam.srvid2</B> when using the monitor or the web interface.
|
||||
<I>For saving memory consumption only insert the service IDs you really need.</I> Some
|
||||
external programs use their own <B>oscam.srvid2</B> and do not need the <B>oscam.srvid2</B> of OSCam.
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">ANNONTATIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
54
Distribution/doc/html/oscam.tiers.5.html
Normal file
54
Distribution/doc/html/oscam.tiers.5.html
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.tiers</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.tiers</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.tiers</B> - TIER configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
TIER mappings
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>CAID[,CAID]...</B>:<B>TIER ID</B>|<B>description</B>
|
||||
<P>
|
||||
<DL COMPACT><DT><DD>
|
||||
mapping between CAID, TIER ID and description of TIER
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>ANNONTATIONS</H2>
|
||||
|
||||
<I>Please use Unix text file format only.</I>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> 0001,0002,0003:000a|my TIER 1
|
||||
<BR> 0004:000b|my TIER 2
|
||||
<BR> 0005:000b|my TIER 3
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">ANNONTATIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
542
Distribution/doc/html/oscam.user.5.html
Normal file
542
Distribution/doc/html/oscam.user.5.html
Normal file
|
|
@ -0,0 +1,542 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.user</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.user</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.user</B> - user configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
The user configuration file for OSCam contains user definitions. [account]
|
||||
sections in <B>oscam.user</B> are <I>recurring</I> (more than one account).
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H3>The [account] section</H3>
|
||||
|
||||
<P>
|
||||
|
||||
<B>user</B> = <B>name</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
account name, <I>required</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>pwd</B> = <B>password</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
password for account, <I>required</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>description</B> = <B>text</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
description of user account
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>disabled</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
1 = account disabled, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>hostname</B> = <B>hostname</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
host from which user connection is allowed
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>expdate</B> = <B><year>-<month>-<day></B>|<B><year>/<month>/<day></B>
|
||||
<DL COMPACT><DT><DD>
|
||||
expiration date for account, default:none
|
||||
<P>
|
||||
<BR> example: expdate = 2001-11-21
|
||||
<BR> expdate = 2002/12/22
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>allowedprotocols</B> = <B>[camd33][,][camd35][,][cs357x][,][cs378x][,][newcamd][,][cccam][,][gbox][,][radegast]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
list of all allowed connection protocols, default:all connection protocols
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>allowedtimeframe</B> = <B>DAY@hh:mm-hh:mm[,hh:mm-hh:mm][,hh:mm-hh:mm][;DAY@hh:mm-hh:mm[,hh:mm-hh:mm][,hh:mm-hh:mm]]</B><BR>
|
||||
|
||||
where <B>DAY</B> is <B>SUN,MON,TUE,WED,THU,FRI,SAT</B> or <B>ALL</B> (for all possible days)</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
account enabled from hh:mm to hh:mm for the specified days, default:none<BR>
|
||||
<BR>
|
||||
comma (,) to separate times and semicolon(; ) to separate the different days.<BR>
|
||||
You can use ALL@ if you want the same time frames for everyday.<BR>
|
||||
<BR>
|
||||
Example:<BR>
|
||||
allowedtimeframe = ALL@10:00-22:00;MON@00:00-02:00,02:45-04:37;FRI@00:00-10:00,22:00-24:00;SAT@00:00-24:00<BR>
|
||||
<BR>
|
||||
If you use: DAY@22:00-05:00 this will be turned into DAY@00:00-05:00,22:00-24:00<BR>
|
||||
<BR>
|
||||
ALL@ is always checked and used, so you can watch TV the whole day on FRIday in this exemple. There is no problem to overlap ALL@ in a day definition, like for SAT@ definition.<BR>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>max_connections</B> = <B>count</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
maximum allowed connections per user when unique level will be adducted, default:1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>uniq</B> = <B>0</B>|<B>1</B>|<B>2</B>|<B>4</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
unique level:
|
||||
<P>
|
||||
<BR> <B>0</B> = disabled (default)
|
||||
<BR> <B>1</B> = only one connection per user is allowed
|
||||
<BR> <B>2</B> = set user to fake if source ip is different
|
||||
<BR> (e.g. for newcamd clients with different CAIDs and ports)
|
||||
<BR> <B>3</B> = only one connection per user, but only the last login
|
||||
<BR> will survive (old MpCS behavior)
|
||||
<BR> <B>4</B> = set user only to fake if source ip is different,
|
||||
<BR> but only the last login will survive
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>numusers</B> = <B>quantity</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
anti-cascading: user per account, 0 = anti-cascading disabled, -1 = global value from oscam.conf, default:-1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>penalty</B> = <B>0</B>|<B>1</B>|<B>2</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
level of penalty:
|
||||
<P>
|
||||
<BR> <B>-1</B> = level of oscam.conf (default)
|
||||
<BR> <B> 0</B> = only logging
|
||||
<BR> <B> 1</B> = send fake CWs
|
||||
<BR> <B> 2</B> = temporary user ban
|
||||
<BR> <B> 3</B> = send delayed CWs
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>fakedelay</B> = <B>0</B>|<B>1</B>|<B>milli-seconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
set fake delay time individually for user:
|
||||
<P>
|
||||
<BR> <B> 0</B> = disable fake delay
|
||||
<BR> <B>-1</B> = fake delay of oscam.conf (default)
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>acosc_max_ecms_per_minute</B> = <B>count</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
maximum ecms per minute, 0 = unlimited, default:0
|
||||
<P>
|
||||
Can be overwritten per user in <B>oscam.user</B>.
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>acosc_max_active_sids</B> = <B>count</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
maximum active SIDs with anti-cascading over SID, 0 = unlimited, -1 = use global setting, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>acosc_zap_limit</B> = <B>count</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
zap limit for anti-cascading over SID, 0 = unlimited, -1 = use global setting, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>acosc_penalty</B> = <B>0</B>|<B>1</B>|<B>2</B>|<B>3</B>|<B>4</B>|<B>-1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
level of penalty with anti-cascading over SID count:
|
||||
<P>
|
||||
<BR> <B>0</B> = only logging (default)
|
||||
<BR> <B>1</B> = send fake CWs
|
||||
<BR> <B>2</B> = temporary user ban
|
||||
<BR> <B>3</B> = send delayed CWs
|
||||
<BR> <B>4</B> = temporary hidecards to the client
|
||||
<BR> <B>-1</B> = use global setting
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>acosc_penalty_duration</B> = <B>seconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
penalty duration for anti-cascading over SID count, -1 = use global setting, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>acosc_delay</B> = <B>milli-seconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
delay for anti-cascading over SID count, -1 = use global setting, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>failban</B> = <B>0</B>|<B>2</B>|<B>4</B>|<B>8</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
mask for IP address based blocking:
|
||||
<P>
|
||||
<BR> <B>0</B> = ignore (default)
|
||||
<BR> <B>2</B> = block IP address of a disabled account on connecting
|
||||
<BR> <B>4</B> = block IP address of a sleeping account while sleeping comes up
|
||||
<BR> <B>8</B> = block duplicate IP address
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>lb_nbest_readers</B> = <B>counts</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
set count of best readers for load balancing, -1 = use global lb_nbest_readers, default:-1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>lb_nfb_readers</B> = <B>counts</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
set count of fallback readers for load balancing, -1 = use global lb_nfb_readers, default:1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>lb_nbest_percaid</B> = <B>CAID1:count1[,CAID2:count2]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
set count of best readers per CAIDs for load balancing, wildcard CAIDs with two-digit CAIDs possible, default:none
|
||||
<P>
|
||||
<BR> example: lb_nbest_percaid = 0100:4,0200:3,03:2,04:1
|
||||
<BR> (wildcard CAIDs 03xx and 04xx)
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>preferlocalcards</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
SC decoding behavior:.
|
||||
<P>
|
||||
<BR> <B>-1</B> = global value from oscam.conf (default)
|
||||
<BR> <B>0</B> = local SCs used like a remote reader
|
||||
<BR> <B>1</B> = prefer cache exchange based SCs
|
||||
<BR> <B>2</B> = prefer local SCs
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cwc_disable</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
1 = disbale CW cycle check, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cacheex</B> = <B>0</B>|<B>1</B>|<B>2</B>|<B>3</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
set cache exchange mode
|
||||
<P>
|
||||
<BR> <B>0</B>: disable cache exchange mode (default)
|
||||
<BR> <B>1</B>: enable cache exchange pull mode
|
||||
<BR> <B>2</B>: enable cache exchange push mode for camd 3.5x / 3.57x and
|
||||
<BR> CCcam protocol
|
||||
<BR> <B>3</B>: enable reverse cache exchange push mode for camd 3.5x / 3.57x
|
||||
<BR> and CCcam protocol
|
||||
<P>
|
||||
<I>Identical cache exchange modes must be set on local OSCam user account and remote OSCam server.</I>
|
||||
<P>
|
||||
<I>Please consider memory consumption.</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cacheex_maxhop</B> = <B>hops</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
define maximum hops for cache exchange, default=10
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>no_wait_time</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
set wait time behaviour:
|
||||
<BR>
|
||||
<BR> <B>0</B>: use <B>wait_time</B> set in <B>oscam.conf</B> (default)
|
||||
<BR> <B>1</B>: do not use <B>wait_time</B> set in <B>oscam.conf</B>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>csp_ecm_filter</B> = <B>[caid][&mask][@provid][$servid],n</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
cache exchange incoming ECM filter setting (mode 3 only) for Cardservproxy, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cacheex_drop_csp</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
1 = drop incoming Cardservproxy cache (mode 3 only), detection is zero ecmd5, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cacheex_allow_request</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
1 = allow incoming ECM request (mode 3 only), default:1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cacheex_allow_filter</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
1= allow cache exchange filter (for cache exchange mode 3 only), default:1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cacheex_block_fakecws</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
1 = enable fake DCWs blocking (for cache exchange mode 3 only), get fake DCWs form <B>oscam.fakecws</B>, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>sleep</B> = <B>minutes</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
time waiting for inactive user, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>sleepsend</B> = <B>0</B>|<B>255</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
255 = <I>OSCam client only</I>: stopping requests until next zap, 255 = <I>camd 3.x only</I>: stopping requests until restart of camd 3.x client, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>suppresscmd08</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
0 = tell camd 3.5x, 3.57x and 3.78x clients not to request again for rejected
|
||||
CAID, service ID and provider ID combination, 1 = disable, default:0
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>keepalive</B> = <B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
0 = disable keepalive between server and client for newcamd or CCcam protocol, default:1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>umaxidle</B> = <B>seconds</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
value for user being idle before disconnect, 0 = idle disconnect disabled, -1 use clientmaxidle in global section, default:-1
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>caid</B> = <B><CAID>[&<mask>][:<target CAID>][,<CAID>[&<mask>][:<target CAID>]]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
limit and mapping of CAIDs, default:all CAIDs with mask FFFF
|
||||
<P>
|
||||
example: caid = 0100
|
||||
<BR> caid = 0200&ffee:0300
|
||||
<BR> caid = 0400&ff00:0500,0600
|
||||
<BR> caid = 0702,0722
|
||||
<BR> caid = 0702&ffdf (shortcut for the example above)
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>au</B> = <B>label of reader[,label of reader]...</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
AU setting, default:none:
|
||||
<P>
|
||||
<BR> <B>label of reader</B> = sending EMMs to specified reader
|
||||
<BR> <I>(security issue: clients can see SC data!)</I>
|
||||
<BR> <B>1</B> = auto AU is sending EMMs to <I>all</I> readers
|
||||
<BR> <I>(security issue: clients can see SC data!)</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>group</B> = <B>1..64[,1..64]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
user assingment to reader groups, default:none, <I>required</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>betatunnel</B> = <B><CAID>.<ServiceID>:<target CAID>[,<CAID>.<ServiceID>:
|
||||
<target CAID>]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
Define Betacrypt tunneling.
|
||||
The ServiceID can also be used for wildcarded CAIDs.
|
||||
<P>
|
||||
<BR> example: betatunnel = 0100.0001:0200,0300.0004:0500
|
||||
<BR> betatunnel = 0600.FFFF:0700
|
||||
<P>
|
||||
<I>Be carefull using abbreviations.</I>
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
<P>
|
||||
|
||||
<B>emmreassembly</B> = <B>0</B>|<B>1</B>||<B>2</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
EMM reassembly, should be set for Viaccess and Cryptoworks readers if the
|
||||
client that you are using to send EMMs is reassembling them instead of
|
||||
just sending them to OSCam for processing.
|
||||
<P>
|
||||
<BR> <B>0</B>: disabled
|
||||
<BR> <B>1</B>: enabled for DVB API
|
||||
<BR> <B>2</B>: enabled (default)
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>services</B> = <B>[!]services[,[!]<services>]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
user [de]assingment to service group, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>ident</B> = <B><CAID>:<provid>[,<provid>,...][;<CAID>:<provid>[,<provid>,...]]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
user assingment to SC specific idents, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>class</B> = <B>[!]class[,[!]class]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
user [de]assingment to SC specific classes, default=none
|
||||
<P>
|
||||
<BR> example: class = 01,02,!03,!04
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>chid</B> = <B><CAID>:<ChID>[,<CAID>:<ChID>]...</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
user assingment to SC specific ChIDs, default:none
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>monlevel</B> = <B>0</B>|<B>1</B>|<B>2</B>|<B>3</B>|<B>4</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
monitor level:
|
||||
<P>
|
||||
<BR> <B>0</B> = no access to monitor (default)
|
||||
<BR> <B>1</B> = only server and own procs
|
||||
<BR> <B>2</B> = all procs, but viewing only
|
||||
<BR> <B>3</B> = all procs, reload of <B>oscam.user</B> possible
|
||||
<BR> <B>4</B> = complete access
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cccmaxhops</B> = <B>hops</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
maximum hops limit for CCcam clients, default:10
|
||||
<P>
|
||||
<BR> <B>-1</B> = CCcam disabled for this user
|
||||
<BR> <B>0</B> = local SCs only
|
||||
<BR> <B>1</B> = local SCs + 1 hop
|
||||
<BR> <B>2</B> = local SCs + 2 hops
|
||||
<BR> and so on
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cccreshare</B> = <B>level</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
reshare level for CCcam clients
|
||||
<P>
|
||||
<BR> <B>-1</B> = use reshare level of <B>oscam.conf</B> (default)
|
||||
<BR> <B>0</B> = resharing for direct peer only
|
||||
<BR> <B>x</B> = resharing for direct peer and share level x
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cccignorereshare</B> = <B>-1</B>|<B>0</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
CCcam ignore reshare setting:
|
||||
<P>
|
||||
<BR> <B>-1</B> = use ignore reshare level of <B>oscam.conf</B> (default)
|
||||
<BR> <B>0</B> = use ignore reshare setting of server
|
||||
<BR> <B>1</B> = use ignore reshare setting of reader or user
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>cccstealth</B> = <B>-1</B>|<B>1</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
CCcam stealth:
|
||||
<P>
|
||||
<BR> <B>-1</B> = use CCcam stealth of <B>oscam.conf</B> (default)
|
||||
<BR> <B>0</B> = use extended OSCam-CCcam protocol
|
||||
<BR> <B>1</B> = behaviour like the original CCcam: no activate partner
|
||||
<BR> detection and extended OSCam-CCcam protocol, prevent
|
||||
<BR> other OSCam to detect the server as OSCam server
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> [account]
|
||||
<BR> user = username
|
||||
<BR> pwd = password
|
||||
<BR> group = 1
|
||||
<BR> au = myserialmousereader
|
||||
<BR> services = myservice
|
||||
<BR> betatunnel = 0100.0001:0101,0100.0002:0101
|
||||
<BR> caid = 0100
|
||||
<BR> ident = 0100:000000
|
||||
<BR> uniq = 1
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.tiers">oscam.tiers</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.whitelist">oscam.whitelist</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAE">The [account] section</A><DD>
|
||||
</DL>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
87
Distribution/doc/html/oscam.whitelist.5.html
Normal file
87
Distribution/doc/html/oscam.whitelist.5.html
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<HTML><HEAD><TITLE>Man page of oscam.whitelist</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>oscam.whitelist</H1>
|
||||
Section: File Formats (5)<BR><A HREF="#index">Index</A>
|
||||
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
<A NAME="lbAB"> </A>
|
||||
<H2>NAME</H2>
|
||||
|
||||
<B>oscam.whitelist</B> - global ECM length whitelisting configuration file for OSCam
|
||||
<A NAME="lbAC"> </A>
|
||||
<H2>SYNOPSIS</H2>
|
||||
|
||||
ECM length whitelisting
|
||||
<A NAME="lbAD"> </A>
|
||||
<H2>DESCRIPTIONS</H2>
|
||||
|
||||
<P>
|
||||
|
||||
<B>w</B>:<B>[CAID]</B>[:]<B>[provider ID]</B>[:]<B>[service ID]</B>[:]<B>[ECM PID]</B>[:]<B>[CHID]</B>[:]<B>[ECM length 1[,ECM length 2]...]]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> ECM length whitelisting
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>l</B>:<B>[CAID]</B>[:]<B>[provider ID]</B>[:]<B>[service ID]</B>[:]<B>[ECM PID]</B>[:]<B>[CHID]</B>[:]<B>[ECM length 1[,ECM length 2]...]]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> ECM length whitelisting, does not proceed with any other ECM length
|
||||
<BR> whitelisting when matching, abbreviation for normal ECM length
|
||||
<BR> whitelisting using w parameter
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>i</B>:<B>[CAID]</B>[:]<B>[provider ID]</B>[:]<B>[service ID]</B>[:]<B>[ECM PID]</B>[:]<B>[CHID]</B>[:]<B>[ECM length 1[,ECM length 2]...]]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> ignore ECM length
|
||||
</DL>
|
||||
|
||||
<P>
|
||||
|
||||
<B>m</B>:<B>[CAID]</B>[:]<B>[provider ID]</B>[:]<B>[service ID]</B>[:]<B>[ECM PID]</B>[:]<B>[CHID]</B>[:]<B>[ECM length 1[,ECM length 2]...]]</B> <B>[new CAID]</B>[:]<B>[new provider ID]</B>
|
||||
<DL COMPACT><DT><DD>
|
||||
<BR> CAID und provider ID mapping, <I>first matching rules</I>, <I>mapping is
|
||||
<BR> preferred over all other whitelistings</I>
|
||||
</DL>
|
||||
|
||||
<A NAME="lbAE"> </A>
|
||||
<H2>ANNONTATIONS</H2>
|
||||
|
||||
<I>Please use Unix text file format only.</I>
|
||||
<A NAME="lbAF"> </A>
|
||||
<H2>EXAMPLES</H2>
|
||||
|
||||
<BR> w:0100 # whitelisting for CAID 0100
|
||||
<P>
|
||||
<BR> i:0200::1234 # ignore CAID 0200 with
|
||||
<BR> # service ID 1234
|
||||
<P>
|
||||
<BR> i:::::2345 # ignore CHID 2345
|
||||
<P>
|
||||
<BR> m:3456:123456::::: 4567:234567 # mapping
|
||||
<P>
|
||||
<BR> w: # allow all others (blacklist)
|
||||
<P>
|
||||
<BR> l:0300 # whitelisting for CAID 0300 not
|
||||
<BR> # proceeding if matching
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>SEE ALSO</H2>
|
||||
|
||||
<B><A HREF="/cgi-bin/man/man2html?1+list_smargo">list_smargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+oscam">oscam</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ac">oscam.ac</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cacheex">oscam.cacheex</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.cert">oscam.cert</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.conf">oscam.conf</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.dvbapi">oscam.dvbapi</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.fakecws">oscam.fakecws</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.guess">oscam.guess</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ird">oscam.ird</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.provid">oscam.provid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.ratelimit">oscam.ratelimit</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.server">oscam.server</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.services">oscam.services</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid">oscam.srvid</A></B>(5), <B><A HREF="/cgi-bin/man/man2html?5+oscam.srvid2">oscam.srvid2</A></B>(5),c<B><A HREF="/cgi-bin/man/man2html?5+oscam.user">oscam.user</A></B>(5)
|
||||
<P>
|
||||
|
||||
<HR>
|
||||
<A NAME="index"> </A><H2>Index</H2>
|
||||
<DL>
|
||||
<DT><A HREF="#lbAB">NAME</A><DD>
|
||||
<DT><A HREF="#lbAC">SYNOPSIS</A><DD>
|
||||
<DT><A HREF="#lbAD">DESCRIPTIONS</A><DD>
|
||||
<DT><A HREF="#lbAE">ANNONTATIONS</A><DD>
|
||||
<DT><A HREF="#lbAF">EXAMPLES</A><DD>
|
||||
<DT><A HREF="#lbAG">SEE ALSO</A><DD>
|
||||
</DL>
|
||||
</BODY>
|
||||
</HTML>
|
||||
10
Distribution/doc/man/list_smargo.1
Normal file
10
Distribution/doc/man/list_smargo.1
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
.TH list_smargo 1
|
||||
.SH NAME
|
||||
\fBlist_smargo\fR - list all connected Smartreader+
|
||||
.SH SYNOPSIS
|
||||
list_smargo
|
||||
.SH DESCRIPTIONS
|
||||
The list_smargo software lists all connected Smartreader+ with bus number and device address.
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
\fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
195
Distribution/doc/man/oscam.1
Normal file
195
Distribution/doc/man/oscam.1
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
.TH oscam 1
|
||||
.SH NAME
|
||||
\fBOSCam\fR - SC server
|
||||
.SH DESCRIPTIONS
|
||||
The OSCam software is an \fIopen source\fR multi-protocol/multi-platform SC server.
|
||||
|
||||
\fIPlease check the compile options for included features in the binary.\fR
|
||||
|
||||
OSCam supports the following protocols:
|
||||
.TP 3n
|
||||
\(bu
|
||||
newcamd with cascading/remote server ECM support
|
||||
.TP 3n
|
||||
\(bu
|
||||
camd 3.3x TCP
|
||||
.TP 3n
|
||||
\(bu
|
||||
camd camd 3.5x / 3.57x UDP with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
.TP 3n
|
||||
\(bu
|
||||
camd 3.78x TCP with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
.TP 3n
|
||||
\(bu
|
||||
CCcam with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
.TP 3n
|
||||
\(bu
|
||||
DVB API with multi tuner and PIP support
|
||||
.TP 3n
|
||||
\(bu
|
||||
gbox with cascading/remote server ECM support
|
||||
.TP 3n
|
||||
\(bu
|
||||
serial (HSIC, SSSP, BOMBA, DSR 9500)
|
||||
.TP 3n
|
||||
\(bu
|
||||
radegast
|
||||
.TP 3n
|
||||
OSCam works on the following platforms:
|
||||
.TP 3n
|
||||
\(bu
|
||||
Linux (Tuxbox, ARM, MIPS, MIPSel, SH-4, PowerPC, ...)
|
||||
.TP 3n
|
||||
\(bu
|
||||
Windows (based on cygwin1.dll)
|
||||
.TP 3n
|
||||
\(bu
|
||||
Mac OS X
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
\fB-a\fP|\fB--crash-dump\fP
|
||||
.RS 3n
|
||||
write oscam.crash on segfault (needs installed GDB and OSCam compiled with debug infos -ggdb)
|
||||
.RE
|
||||
.PP
|
||||
\fB-b\fP|\fB--daemon\fP
|
||||
.RS 3n
|
||||
starts in background, writing oscam.version with starttime and version info in temporary directory
|
||||
.RE
|
||||
.PP
|
||||
\fB-B\fP|\fB--pidfile\fP <filename>
|
||||
.RS 3n
|
||||
set PID file, overrides pidfile of \fBoscam.conf\fR, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fB-c\fP|\fB--config-dir\fP <directory>
|
||||
.RS 3n
|
||||
read configuration from <directory>, default:see CS_CONFDIR in \fBglobals.h\fR,
|
||||
while starting OSCam prints warnings on invalid keywords, comment lines start with \fB#\fP character.
|
||||
|
||||
Autodiscover of the following directories will be done:
|
||||
|
||||
.TP 3n
|
||||
\(bu
|
||||
/etc/tuxbox/config
|
||||
.TP 3n
|
||||
\(bu
|
||||
/etc/tuxbox/config/oscam
|
||||
.TP 3n
|
||||
\(bu
|
||||
/config/oscam
|
||||
.TP 3n
|
||||
\(bu
|
||||
/usr/keys
|
||||
.TP 3n
|
||||
\(bu
|
||||
/var/etc
|
||||
.TP 3n
|
||||
\(bu
|
||||
/var/etc/oscam
|
||||
.TP 3n
|
||||
\(bu
|
||||
/var/keys
|
||||
.TP 3n
|
||||
\(bu
|
||||
/var/oscam
|
||||
.TP 3n
|
||||
\(bu
|
||||
/var/tuxbox/config
|
||||
|
||||
.RE
|
||||
.PP
|
||||
\fB-d\fP|\fB--debug\fP <level>
|
||||
.RS 3n
|
||||
debug level mask:
|
||||
|
||||
\fB0\fP = no debugging (default)
|
||||
\fB2\fP = ATR parsing info, ECM dumps, CW dumps
|
||||
\fB4\fP = traffic from/to the reader
|
||||
\fB8\fP = traffic from/to the clients
|
||||
\fB16\fP = traffic to the reader-device on IFD layer
|
||||
\fB32\fP = traffic to the reader-device on I/O layer
|
||||
\fB64\fP = EMM logging
|
||||
\fB128\fP = DVBAPI logging
|
||||
\fB256\fP = load balancing logging
|
||||
\fB512\fP = cache exchange logging
|
||||
\fB1024\fP = client ECM logging
|
||||
\fB2048\fP = CSP logging
|
||||
\fB4096\fP = CWC logging
|
||||
\fB65535\fP = debug all
|
||||
.RE
|
||||
.PP
|
||||
\fB-g\fP|\fB--gcollect\fP <mode>
|
||||
.RS 3n
|
||||
garbage collector debug mode, default:none:
|
||||
|
||||
\fB1\fP = immediate free
|
||||
\fB2\fP = check for double frees
|
||||
.RE
|
||||
.PP
|
||||
\fB-h\fP|\fB--help\fP
|
||||
.RS 3n
|
||||
usage
|
||||
.RE
|
||||
.PP
|
||||
\fB-I\fP|\fB--syslog-ident\fP <ident>
|
||||
.RS 3n
|
||||
set syslog ident, default:oscam
|
||||
.RE
|
||||
.PP
|
||||
\fB-p\fP|\fB--pending-ecm\fP <number>
|
||||
.RS 3n
|
||||
maximum number of pending ECM packets, default:32, maximum:255
|
||||
.RE
|
||||
.PP
|
||||
\fB-r\fP|\fB--restart\fP <level>
|
||||
.RS 3n
|
||||
restart level:
|
||||
|
||||
\fB0\fP = disabled, restart request sets exit status to 99
|
||||
\fB1\fP = restart activated, web interface can restart oscam (default)
|
||||
\fB2\fP = like 1, but also restart on segmentation faults
|
||||
.RE
|
||||
.PP
|
||||
\fB-S\fP|\fB--show-sensitive\fP
|
||||
.RS 3n
|
||||
do not filter sensitive info (card serial numbers) in the logs
|
||||
.RE
|
||||
.PP
|
||||
\fB-s\fP|\fB--capture-segfaults\fP
|
||||
.RS 3n
|
||||
capture segmentation faults
|
||||
.RE
|
||||
.PP
|
||||
\fB-t\fP|\fB--temp-dir\fP <directory>
|
||||
.RS 3n
|
||||
use <directory> for temporary data, default:temporary directory of OS
|
||||
.RE
|
||||
.PP
|
||||
\fB-V\fP|\fB--build-info\fP
|
||||
.RS 3n
|
||||
show OSCam version info
|
||||
.RE
|
||||
.PP
|
||||
\fB-w\fP|\fB--wait\fP <seconds>
|
||||
.RS 3n
|
||||
time waiting for system time to be set correctly
|
||||
.RE
|
||||
.SH SIGNALS
|
||||
.PP
|
||||
\fBSIGHUP\fP
|
||||
.RS 3n
|
||||
reinit user db, readers, TIERs, services, clients and anti-cascading, for newcamd connections: after reloading the ident, please restart newcamd client
|
||||
.RE
|
||||
.PP
|
||||
\fBSIGUSR1\fP
|
||||
.RS 3n
|
||||
shift debug level to next level (see debug level mask above)
|
||||
.RE
|
||||
.PP
|
||||
\fBSIGUSR2\fP
|
||||
.RS 3n
|
||||
get reader SC info
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
21
Distribution/doc/man/oscam.ac.5
Normal file
21
Distribution/doc/man/oscam.ac.5
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
.TH oscam.ac 5
|
||||
.SH NAME
|
||||
\fBoscam.ac\fR - anti-cascading table for OSCam
|
||||
.SH SYNOPSIS
|
||||
anti-cascading table
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fB<CAID>\fP:\fB<provider ID>\fP=\fB<seconds>\fP
|
||||
.RS 3n
|
||||
define time cycles between CWs changes relating to CAID and provider ID
|
||||
.RE
|
||||
.PP
|
||||
\fB*\fP=\fB<seconds>\fP
|
||||
.RS 3n
|
||||
default time cycles between CWs changes \fIrequired\fR
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
0100:000000=10
|
||||
*=7
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
19
Distribution/doc/man/oscam.cacheex.5
Normal file
19
Distribution/doc/man/oscam.cacheex.5
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
.TH oscam.cacheex 5
|
||||
.SH NAME
|
||||
\fBoscam..cacheex\fR - global ECM length matching configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
ECM length matching
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBm\fP:\fB[CAID]\fP[:]\fB[provider ID]\fP[:]\fB[service ID]\fP[:]\fB[ECM PID]\fP[:]\fB[CHID]\fP[:]\fB[ECM length 1[,ECM length 2]...]]\fP=\fB[CAID]\fP[:]\fB[provider ID]\fP[:]\fB[service ID]\fP[:]\fB[ECM PID]\fP[:]\fB[CHID]\fP[:]\fB[ECM length 1[,ECM length 2]...]]\fP
|
||||
.RS 3n
|
||||
ECM length matching from remote cache exchange partner to local
|
||||
cache, \fIfor cache exchange pull mode (cacheex = 1) only\fR
|
||||
.RE
|
||||
.SH ANNONTATIONS
|
||||
\fIPlease use Unix text file format only.\fR
|
||||
.SH EXAMPLES
|
||||
m:1234:::::93=5678:::::93 # matching CAID 1234 and CAID 5678 with
|
||||
# ECM length 93
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid \fR(5), \fBoscam.srvid2\fR(5),\fBoscam.user\fR(5)
|
||||
16
Distribution/doc/man/oscam.cert.5
Normal file
16
Distribution/doc/man/oscam.cert.5
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
.TH oscam.cert 5
|
||||
.SH NAME
|
||||
\fBoscam.cert\fR - Issuer Public Keys (IPK) for OSCam
|
||||
.SH SYNOPSIS
|
||||
Issuer Public Keys (IPK)
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBCAID\fP:\fBreserved\fP:\fBIPK\fP
|
||||
.RS 3n
|
||||
mapping between CAID and IPK/sessions keys in hex, currently for Cryptoworks only
|
||||
.SH EXAMPLES
|
||||
0100:00000000:0102030405060708090A0B0C0D0E0F
|
||||
.RE
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
1513
Distribution/doc/man/oscam.conf.5
Normal file
1513
Distribution/doc/man/oscam.conf.5
Normal file
File diff suppressed because it is too large
Load Diff
90
Distribution/doc/man/oscam.dvbapi.5
Normal file
90
Distribution/doc/man/oscam.dvbapi.5
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
.TH oscam.dvbapi 5
|
||||
.SH NAME
|
||||
\fBoscam.dvbapi\fR - DVB API configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
DVBAPI settings, first match - first used
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBP\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP:\fB[CHID]\fP \fB[force]\fP:\fB[PIDx]\fP \fBpriority\fP
|
||||
.RS 3n
|
||||
set priority, \fBcontinue\fP = \fB1\fP: proceed with priority, recommended for
|
||||
pay-per-view services / EMMs \fI(use carefully)\fR, \fIalthough local SCs
|
||||
will be prioritised higher\fR, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBI\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP:\fB[CHID]\fP \fB[PIDx]\fP \fBignore\fP
|
||||
.RS 3n
|
||||
set ignore
|
||||
.RE
|
||||
.PP
|
||||
\fBJ\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP \fBjoined CAID\fP:\fBjoined provider ID\fP:\fBjoined ECM PID\fP
|
||||
.RS 3n
|
||||
join to another ECM PID
|
||||
.RE
|
||||
.PP
|
||||
\fBA\fP: ::\fBservice ID\fP:\fB[PMT PID] \fP:\fB[provider ID]\fP[:]\fB[ECM PID]\fP
|
||||
.RS 3n
|
||||
set a dummy ECM request with CAID FFFF for services with a constant CW shown as unencrypted service
|
||||
\fI(for STBs with PMT PID support only)\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBA\fP: ::\fBservice ID\fP:\fB[video PID] \fP:\fB[provider ID]\fP[:]\fB[ECM PID]\fP
|
||||
.RS 3n
|
||||
set a dummy ECM request with CAID FFFF for services with a constant CW shown as unencrypted service
|
||||
\fI(for STBs without PMT PID support only)\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBX\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP
|
||||
.RS 3n
|
||||
add decoding on an extra demux index on the same CA device (Multi ECM) \fI(not support on all STBs)\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBD\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP \fBdelay\fP
|
||||
.RS 3n
|
||||
set delay in milli-seconds writing CWs
|
||||
.RE
|
||||
.PP
|
||||
\fBM\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP \fBtarget CAID\fP[:]\fB[target provider ID]\fP
|
||||
.RS 3n
|
||||
mapping
|
||||
.RE
|
||||
.PP
|
||||
\fBS\fP: \fB[device]\fP \fB[PMT file name]\fP
|
||||
.RS 3n
|
||||
set DVB API device name and PMT file name \fI(valid for STAPI only)\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBL\fP: \fB[CAID]\fP:\fB[provider ID]\fP:\fB[service ID]\fP:\fB[ECM PID]\fP \fBlength\fP
|
||||
.RS 3n
|
||||
set ECM length in hexadecimal
|
||||
.RE
|
||||
.RE
|
||||
.SH ANNONTATIONS
|
||||
\fIPlease use Unix text file format only.\fR
|
||||
.SH EXAMPLES
|
||||
P: 0100:123456 # prioritise CAID 0100 with provider 123456
|
||||
|
||||
P: :1234 # prioritise ECM with provider ID 1234 on
|
||||
# on any CAID and service
|
||||
|
||||
P: 0200 # prioritise CAID 0200
|
||||
|
||||
P: 0300::9ABC # prioritise CAID 0300 on service 9ABC only
|
||||
|
||||
P: 0400 1 # prioritise CAID 0400 for pay-per-view services
|
||||
|
||||
P: : 1 # prioritise for EMMs
|
||||
|
||||
M: 0500 0600:123456 # map CAID 0500 to provider ID 123456 with
|
||||
# CAID 0600
|
||||
|
||||
D: 0700 200 # wait 200 ms before writing CW for CAID 0700
|
||||
|
||||
I: :654321 # ignore provider ID 654321 for every CAID and
|
||||
# service
|
||||
|
||||
I: 0 # ignore every CAID that was not handled before
|
||||
|
||||
L: 0800 8e # ECM length for CAID 0800 to 8e (hexadecimal)
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
15
Distribution/doc/man/oscam.guess.5
Normal file
15
Distribution/doc/man/oscam.guess.5
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
.TH oscam.guess 5
|
||||
.SH NAME
|
||||
\fBoscam.guess\fR - CAID guessing table for OSCam
|
||||
.SH SYNOPSIS
|
||||
CAID guessing table
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fB<length of ECM>\fP:\fB<CAID>\fP
|
||||
.RS 3n
|
||||
CAID guessing table by len in hex, only needed for protocols (at the moment BOMBA protocol only) that does not pass CAIDs
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
12:3456
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
15
Distribution/doc/man/oscam.ird.5
Normal file
15
Distribution/doc/man/oscam.ird.5
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
.TH oscam.ird 5
|
||||
.SH NAME
|
||||
\fBoscam.ird\fR - Irdeto guessing table for OSCam
|
||||
.SH SYNOPSIS
|
||||
Irdeto guessing table
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fB<byte3>\fP:\fB<byte4-7>\fP:\fB<CAID>\fP:\fB<SID>\fP
|
||||
.RS 3n
|
||||
Irdeto guessing table by signature
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
12:0000000a:12ab:cd01
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
15
Distribution/doc/man/oscam.provid.5
Normal file
15
Distribution/doc/man/oscam.provid.5
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
.TH oscam.provid 5
|
||||
.SH NAME
|
||||
\fBoscam.provid\fR - provider table for OSCam
|
||||
.SH SYNOPSIS
|
||||
provider table
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fB<caid>\fP:\fB<provid>\fP|\fB<provider>\fP|\fB<satellite>\fP|\fB<language>\fP
|
||||
.RS 3n
|
||||
provider table
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
0100:012345|MyPay-TV|Astra 19E|German
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
30
Distribution/doc/man/oscam.ratelimit.5
Normal file
30
Distribution/doc/man/oscam.ratelimit.5
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
.TH oscam.ratelimit 5
|
||||
.SH NAME
|
||||
\fBoscam.ratelimit\fR - ECMs ratelimit for OSCam
|
||||
.SH SYNOPSIS
|
||||
limit rate of ECMs allowed for an interval
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBCAID\fP:\fBprovider ID\fP:\fBservice ID\fP:\fBChID\fP:\fBratelimitecm\fP:\fBratelimitseconds\fP:\fBsrvidholdseconds\fP
|
||||
.RS 3n
|
||||
|
||||
\fBratelimitecm\fP
|
||||
.RS 3n
|
||||
number of different SIDs in ECMs allowed for an interval
|
||||
.RE
|
||||
|
||||
\fBratelimitseconds\fP
|
||||
.RS 3n
|
||||
interval in seconds for ratelimit
|
||||
.RE
|
||||
|
||||
\fBsrvidholdseconds\fP
|
||||
.RS 3n
|
||||
extra time in seconds this service ID is kept in a slot before another service ID can take its place
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
0100:00002A:3A3A:4A00:0002:0010:0004
|
||||
.RE
|
||||
.RE
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
887
Distribution/doc/man/oscam.server.5
Normal file
887
Distribution/doc/man/oscam.server.5
Normal file
|
|
@ -0,0 +1,887 @@
|
|||
.TH oscam.server 5
|
||||
.SH NAME
|
||||
\fBoscam.server\fR - reader configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
The server configuration file for OSCam contains reader parameters.
|
||||
sections in \fBoscam.server\fR are \fIrecurring\fR (more than one reader possible).
|
||||
At least one [reader] section is \fIrequired\fR.
|
||||
.SH DESCRIPTIONS
|
||||
.SS "The [reader] section"
|
||||
.PP
|
||||
\fBlabel\fP = \fBname\fP
|
||||
.RS 3n
|
||||
name for reader, \fIrequired\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBenable\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
0 = deactivate reader, default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBdescription\fP = \fBtext\fP
|
||||
.RS 3n
|
||||
description of reader, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBprotocol\fP = \fBreader protocol\fP
|
||||
.RS 3n
|
||||
reader protocol, \fIrequired\fR:
|
||||
|
||||
\fBcamd35\fP|\fBcs357x\fP
|
||||
\fBcccam\fP
|
||||
\fBcs378x\fP
|
||||
\fBconstcw\fP
|
||||
\fBgbox\fP
|
||||
\fBghttp\fP
|
||||
\fBinternal\fP
|
||||
\fBmouse\fP
|
||||
\fBmp35\fP
|
||||
\fBnewcamd\fP|\fBnewcamd525\fP
|
||||
\fBnewcamd524\fP
|
||||
\fBpcsc\fP
|
||||
\fBradegast\fP
|
||||
\fBscam\fP
|
||||
\fBsc8in1\fP
|
||||
\fBserial\fP
|
||||
\fBsmargo\fP
|
||||
\fBsmartreader\fP
|
||||
.RE
|
||||
.PP
|
||||
\fBdevice\fP = \fB[<readertype>;]serial:serialnum|bus:device\fP|
|
||||
\fB<device|device:slot>\fP|
|
||||
\fB<ip|hostname>,<port>[,<lport>]\fP|
|
||||
\fB<ip|hostname>,<gboxpport>\fP|
|
||||
\fB<ip|hostname>,<scamport>\fP|
|
||||
\fBpcsc\fP|
|
||||
\fB<0|1>\fP>|
|
||||
\fBconstantcw\fP
|
||||
.RS 3n
|
||||
define local or remote reader
|
||||
|
||||
\fBreadertype\fP: set reader type
|
||||
|
||||
\fBSR\fP: Smartreader+ (default)
|
||||
\fBInfinity\fP: Infinity USB
|
||||
\fBTripleP1\fP: Smargo Triple Reader port 1
|
||||
\fBTripleP2\fP: Smargo Triple Reader port 2
|
||||
\fBTripleP3\fP: Smargo Triple Reader port 3
|
||||
|
||||
\fBbus:device\fP: bus name and device name of the Smartreader+ or
|
||||
Infinity USB (get the names with lsusb 'Bus'
|
||||
and 'Device')
|
||||
|
||||
\fBserialnum\fP: serial number of reader of the Smartreader+ or
|
||||
Infinity USB
|
||||
|
||||
\fBdevice\fP: device name
|
||||
|
||||
\fBdevice:slot\fP: device name and slot number sc8in1 [1-8]
|
||||
\fI(only one SC8in1 reader supported)\fR
|
||||
|
||||
\fBip\fP|\fBhostname\fP: IP address or host name
|
||||
|
||||
\fBport\fP: TCP/IP port
|
||||
|
||||
\fBlport\fP: remapping to local TCP/IP port
|
||||
|
||||
\fBgboxpport\fP: UDP port for remote gbox peer
|
||||
|
||||
\fBPCSC\fP: number of PCSC reader, starting with 0
|
||||
|
||||
\fB0|1\fP: for Coolstream HD-1 STB only: select reader 0 or
|
||||
reader 1
|
||||
|
||||
\fBconstantcw\fP: constant CW file name
|
||||
|
||||
constant CW file format:
|
||||
.TP 3n
|
||||
\(bu standard format
|
||||
|
||||
\fPCAID\fB:\fPProvider ID\fB:\fPService ID\fB:\fPPMT ID\fB:\fPECM PID\fI::\fRkey (16 Bytes seperated by spaces)
|
||||
|
||||
example: 1234:123456:1234:2345:3456\fI::\fR00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
.TP 3n
|
||||
\(bu extended OScam format
|
||||
|
||||
\fPCAID\fB:\fPProvider ID\fB:\fPService ID\fB:\fPPMT ID\fB:\fPECM PID\fI:Video PID:\fRkey (16 Bytes seperated by spaces)
|
||||
|
||||
example: 1234:123456:1234:2345:3456\fI:7890:\fR00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
.RE
|
||||
.PP
|
||||
\fBdetect\fP = [\fB!\fP]\fBCD\fP|[\fB!\fP]\fBDSR\fP|[\fB!\fP]\fBCTS\fP|[\fB!\fP]\fBRING\fP|[\fB!\fP]\fBNONE\fP|[\fB!\fP]\fBgpio[1-7]\fP
|
||||
.RS 3n
|
||||
status detect of card, NONE = no detection, ! = inverse, default:CD
|
||||
.RE
|
||||
.PP
|
||||
\fBcardmhz\fP = \fBmhz\fP
|
||||
.RS 3n
|
||||
set standard SC frequency in units of 10 kHz, for Irdeto SC set to 600 mhz,
|
||||
for Dreambox DM800 / DM8000 set to 2700 mhz, for Dreambox DM7025 set to
|
||||
8300 mhz, for older PowerPC Dreambox STBs set to 3150 mhz, refer to
|
||||
OVERCLOCKING, default:357
|
||||
.RE
|
||||
.PP
|
||||
\fBmhz\fP = \fBfrequency\fP
|
||||
.RS 3n
|
||||
set reader frequency in units of 10 kHz, if \fBmhz\fP > \fBcardmhz\fP you
|
||||
are in overclocking mode. For Smargo readers and Dreambox internal readers
|
||||
frequency will be set by ATR if \fBautospeed\fP is set to 1, default:357
|
||||
.RE
|
||||
.PP
|
||||
\fBautospeed\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = sets mhz according to ATR. Currently only used for smartreader, Smargo and
|
||||
Dreambox internal protocol, other readers will be adapted to use this parameter
|
||||
as well. If You wan't to overclock you're card set it to 0, default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBdeprecated\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
First the SC will be initialized in normal mode. If it fails, the SC will be automatically
|
||||
reverted to deprecated mode, so that the SC speed will not be changed and the communication
|
||||
will remain on normal ATR speed of 9600 baud.
|
||||
|
||||
1 = use deprecated SC mode only, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBmode\fP = \fBmode\fP
|
||||
.RS 3n
|
||||
set card init mode for AzBox internal reader, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBsmargopatch\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = enable workaround for Smartreader+ reader until native mode works, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsc8in1_dtrrts_patch\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = enable fix for SC8in1/MCR DTR/RTS kernel bug, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBuse_gpio\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = use GPIO to init the reader. This needs to be set on WRT54G router, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fB ins2e06\fP = \fBpayload\fP
|
||||
.RS 3n
|
||||
add check control for pin payload (4 hex bytes) for NDS Videoguard 2 SCs, valid for physical readers only, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBins7e\fP = \fBpayload\fP
|
||||
.RS 3n
|
||||
add 26 hex-bytes payload for NDS Videoguard 2 SCs, valid for physical readers only, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBins7e11\fP = \fBTA1 byte\fP
|
||||
.RS 3n
|
||||
set TA1 byte for NDS Videoguard 2 SCs, valid for physical readers only, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBfix07\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1=enable 0x07 fix for NDS Videoguard 2 SCs, valid for physical readers only, default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBforce_irdeto\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = force Irdeto SC mode even if RSA key is set for Irdeto tunnled Nagravion SC, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBnagra_read\fP = \fB0\fP|\fB1\fP|\fB2\fP
|
||||
.RS 3n
|
||||
read Nagravison records (on NCMED SCs only):
|
||||
|
||||
\fB0\fP = disabled (default)
|
||||
\fB1\fP = read all records with expired rights
|
||||
\fB2\fP = read records with valid rights only
|
||||
.RE
|
||||
.PP
|
||||
\fBrsakey\fP = \fBRSA key\fP
|
||||
.RS 3n
|
||||
RSA key for Nagravision/Tiger SCs, CAM key data for Irdeto SCs, Conax SCs, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBdeskey\fP = \fBDES key\fP
|
||||
.RS 3n
|
||||
DES key for Viaccess SCs post-processing, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBboxkey\fP = \fBbox key\fP
|
||||
.RS 3n
|
||||
box key for Nagravision SCs / CAM key for Irdeto SCs
|
||||
.RE
|
||||
.PP
|
||||
\fBpincode\fP = \fBpincode\fP
|
||||
.RS 3n
|
||||
pincode for Conax, Cryptoworks and Viaccess SCs, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBfix9993\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = enable fix for 9993 error with CAID 0919 Videoguard SCs, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBreadtiers\fP = \fB0\fP|\fB1\fP|\fB2\fP
|
||||
.RS 3n
|
||||
method to get tiers of NDS Videoguard SCs:
|
||||
|
||||
\fB0\fP = disabled (default)
|
||||
\fB1\fP = ins70 method
|
||||
\fB2\fP = ins76 method
|
||||
.RE
|
||||
.PP
|
||||
\fBboxid\fP = \fBNDS box ID\fP
|
||||
.RS 3n
|
||||
NDS receiver box id
|
||||
.RE
|
||||
.PP
|
||||
\fBndsversion\fP = \fB0\fP|\fB1\fP|\fB12\fP|\fB2\fP
|
||||
.RS 3n
|
||||
set NDS Videoguard version
|
||||
|
||||
\fB0\fP = autodetection (default)
|
||||
\fB1\fP = NDS Videoguard 1
|
||||
\fB12\fP = NDS Videoguard 1+
|
||||
\fB2\fP = NDS Videoguard 2
|
||||
.RE
|
||||
.PP
|
||||
\fBaeskeys\fP = \fBCAID #0\fP@\fBprovid\fP:\fBAES key #0 CAID #0\fP[,\fBAES key #1 CAID #0\fP],...[;\fBCAID #1\fP@\fBprovid\fP:\fBAES key #0 CAID #1\fP[,\fBAES key #1 CAID #1\fP],...]...
|
||||
.RS 3n
|
||||
multiple 16 bytes AES keys for Viaccess SCs (the used postprocessing AES key is specified through the D2 nano of the ECM)
|
||||
|
||||
special AES keys:
|
||||
|
||||
\fB00\fP = do not return any CW, no AES key specified
|
||||
\fBFF\fP = return CW received from the S, no AES key specified
|
||||
|
||||
example:
|
||||
|
||||
aeskeys = 0500@012345:000102030405060708090a0b0c0d0e0f;0500@543210:000102030405060708090a0b0c0d0e0f,0,0f0e0d0c0b0a090807060504030201
|
||||
.RE
|
||||
.PP
|
||||
\fBkey\fP = \fBDES key\fP
|
||||
.RS 3n
|
||||
key for newcamd remote reader encryption
|
||||
.RE
|
||||
.PP
|
||||
\fBuser\fP = \fBname\fP
|
||||
.RS 3n
|
||||
user for remote reader
|
||||
.RE
|
||||
.PP
|
||||
\fBpassword\fP = \fBpassword\fP
|
||||
.RS 3n
|
||||
password for remote reader
|
||||
.RE
|
||||
.PP
|
||||
\fBservices\fP = \fB[!]services[,[!]<services>]...\fP
|
||||
.RS 3n
|
||||
reader [de]assignment to service group, default=none
|
||||
.RE
|
||||
.PP
|
||||
\fBcaid\fP = \fB<CAID>[&<mask>][:<target CAID>][,<CAID>[&<mask>][:target <CAID>]]...\fP
|
||||
.RS 3n
|
||||
define and mapping of CAIDs for reader, default:all CAIDs with mask FFFF
|
||||
|
||||
example: caid = 0100
|
||||
caid = 0200&ffee:0300
|
||||
caid = 0400&ff00:0500,0600
|
||||
caid = 0702,0722
|
||||
caid = 0702&ffdf (shortcut for the example above)
|
||||
.RE
|
||||
.PP
|
||||
\fBident\fP = \fB<CAID>:<provid>[,provid]...[;<CAID>:<provid>[,provid]...]...\fP
|
||||
.RS 3n
|
||||
set CAID and SC specific ident for reader
|
||||
|
||||
example: ident = 0100:123456,234567;0200:345678,456789
|
||||
.RE
|
||||
.PP
|
||||
\fBclass\fP = \fB[!]class[,[!]class]...\fP
|
||||
.RS 3n
|
||||
set SC specific class in hex for reader
|
||||
|
||||
example: class = 01,02,!1b,!2b
|
||||
.RE
|
||||
.PP
|
||||
\fBchid\fP = \fBCAID:ChID\fP
|
||||
.RS 3n
|
||||
set SC specific ChIDs for reader, default:none
|
||||
|
||||
example: chid = 0100:12
|
||||
.RE
|
||||
.PP
|
||||
\fBgroup\fP = \fB1..64[,1..64]...\fP
|
||||
.RS 3n
|
||||
reader assingment to groups, default:none, \fIrequired\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBaudisabled\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = exclude reader from auto AU, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBauprovid\fP = \fBprovider ID\fP
|
||||
.RS 3n
|
||||
set provider ID to use the right reader for auto AU
|
||||
|
||||
example: auprovid = 123456
|
||||
.RE
|
||||
.PP
|
||||
\fBdisableserverfilter\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = ignore \fBcaid\fP and \fBprovid\fP settings of reader due faulty clients, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBinactivitytimeout\fP = \fBseconds\fP
|
||||
.RS 3n
|
||||
inactivity timeout for all TCP based remote readers, -1 = reconnect on network failure for newcamd, even in idle, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBreconnecttimeout\fP = \fBseconds\fP
|
||||
.RS 3n
|
||||
reconnect if missing answers from a remote reader, default:30
|
||||
.RE
|
||||
.PP
|
||||
\fBreconnectdelay\fP = \fBmilli-seconds\fP
|
||||
.RS 3n
|
||||
set maximum TCP connection block delay, default:60000
|
||||
.RE
|
||||
.PP
|
||||
\fBconnectoninit\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = allow newcamd connections to be established on startup although there isn't a request yet, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBkeepalive\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = allow cs378x TCP socket to be always connected, default:0. Always on if cacheex reader type.
|
||||
.RE
|
||||
.PP
|
||||
\fBfallback\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = define reader as fallback, standard and fallback reader must have the same group, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBfallback_percaid\fP = \fB<CAID>[:<ident>[,ident]]...[;<CAID>[:<ident>[,ident]]...]....\fP
|
||||
.RS 3n
|
||||
use reader as fallback for defined CAIDs only, two-digit wildcard CAIDs are possible, \fBfallback_percaid\fP overrules \fBfallback\fP, default:none
|
||||
|
||||
example: fallback_percaid = 1234:234567;89;10:345678
|
||||
.RE
|
||||
.PP
|
||||
\fBemmcache\fP = \fBusecache,rewrite,logging\fP
|
||||
.RS 3n
|
||||
set EMM cache of local reader:
|
||||
|
||||
\fBusecache\fP = \fB0\fP|\fB1\fP||\fB2\fP
|
||||
|
||||
\fB0\fP = EMM caching disabeld (default)
|
||||
\fB1\fP = enable EMM caching and save EMMs to file after
|
||||
stopping OSCam
|
||||
\fB2\fP = enable EMM caching, don't save EMMs to file
|
||||
after stopping OSCam
|
||||
|
||||
\fBrewrite\fP = determines how often one and the same EMM is
|
||||
written, default:0
|
||||
|
||||
\fBlogging\fP = EMM logging mask:
|
||||
|
||||
\fB0\fP = EMM logging disabled (default)
|
||||
\fB1\fP = logging EMM errors
|
||||
\fB2\fP = logging written EMMs
|
||||
\fB4\fP = logging skipped EMMs
|
||||
\fB8\fP = logging blocked EMMs
|
||||
\fB16\fP = logging disabled AU
|
||||
|
||||
example: emmcache = 1,3,2
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex\fP = \fB0\fP|\fB1\fP|\fB2\fP|\fB3\fP
|
||||
.RS 3n
|
||||
set cache exchange mode
|
||||
|
||||
\fB0\fP: disable cache exchange mode (default)
|
||||
\fB1\fP: enable cache exchange pull mode
|
||||
\fB2\fP: enable cache exchange push mode for camd 3.5x / 3.57x and CCcam
|
||||
protocol
|
||||
\fB3\fP: enable reverse cache exchange push mode for camd 3.5x / 3.57x
|
||||
and CCcam protocol
|
||||
|
||||
\fIIdentical cache exchange modes must be set on local OSCam server and remote OSCam user asccount.\fR
|
||||
|
||||
\fIPlease consider memory consumption.\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_maxhop\fP = \fBhops\fP
|
||||
.RS 3n
|
||||
define maximum hops for cache exchange, default=10
|
||||
.RE
|
||||
.PP
|
||||
\fBcsp_ecm_filter\fP = \fB[caid][&mask][@provid][$servid],n\fP
|
||||
.RS 3n
|
||||
cache exchange incoming ECM filter setting (mode 2 only) for Cardservproxy, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_drop_csp\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = drop incoming Cardservproxy cache (mode 2 only), detection is zero ecmd5, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_allow_request\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = allow incoming ECM request (mode 2), default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_allow_filter\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = allow cache exchange filter (for cache exchange mode 2 only), default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_block_fakecws\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = enable fake DCWs blocking (for cache exchange mode 2 only), get fake DCWs form \fBoscam.fakecws\fP, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBecmwhitelist\fP = [\fBCAID\fP[@\fBprovid\fP]:]\fBlength\fP[,\fBlength\fP]...[;[\fBCAID\fP[@\fBprovid\fP]:]\fBlength\fP[,\fBlength\fP]...]...
|
||||
.RS 3n
|
||||
set valid ECM length per CAID and provid in hex, default:none,provid=000000
|
||||
|
||||
example: ecmwhitelist = 10,20,0a,0b
|
||||
ecmwhitelist = 0100:10,20;0200@123456:0a,4b
|
||||
|
||||
\fIIn normal operation mode this parameter is not required.\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBecmheaderwhitelist\fP = [\fBCAID\fP[@\fBprovid\fP]:]\fBheader\fP[,\fBheader\fP]...[;[\fBCAID\fP[@\fBprovid\fP]:]\fBheader\fP[,\fBheader\fP]...]...
|
||||
.RS 3n
|
||||
set vaild ECM header per CAID and provid in hex, default:none,provid=000000
|
||||
.RE
|
||||
.PP
|
||||
\fBratelimitecm\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
number of different SIDs in ECMs allowed for an interval, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBecmnotfoundlimit\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
number of ECMs with "not found" answer until the reader will be restarted, 0 = no limit, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBresetcycle\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
number of ECMs until SC reset is performed, 0 = disabled, valid for physical readers only, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBratelimitseconds\fP = \fBseconds\fP
|
||||
.RS 3n
|
||||
interval for rate limit, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBecmunique\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = enable check for matching ECM hash in ratelimit slot , default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsrvidholdseconds \fP = \fBseconds\fP
|
||||
.RS 3n
|
||||
time to keep service ID in ratelimit slot, during this time checkeding for ecmunique is disbaled, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcooldown\fP = \fBdelay\fP,\fBduration\fP
|
||||
.RS 3n
|
||||
define cooldown:
|
||||
|
||||
\fBdelay\fP: delay in seconds for which the reader is allowed to do
|
||||
more ECM requests than defined by ecmratelimit,
|
||||
default: none
|
||||
|
||||
\fBduration\fP: duration in seconds the reader needs to cooldown,
|
||||
default:none
|
||||
|
||||
\fIratelimitecm and ratelimitseconds are required\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBblocknano\fP = \fBnano[,nano]...\fP|\fPall\fP
|
||||
.RS 3n
|
||||
list of EMM-nanos to block (in hex w/o 0x) or all EMM-nanos, valid for physical readers only, default:none
|
||||
|
||||
example: blocknano = 45,93,7a,ff
|
||||
blocknano = all
|
||||
.RE
|
||||
.PP
|
||||
\fBblockemm-u\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = block unique EMMs, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBblockemm-s\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = block shared EMMs, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBblockemm-g\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = block global EMMs, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBblockemm-unknown\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = block unknown types of EMMs, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBblockemm-bylen\fP = \fB[length range,length range]...\fP
|
||||
.RS 3n
|
||||
block all types of EMMs by length, default:none
|
||||
|
||||
example: blockemm-bylen = 1-10,11-
|
||||
.RE
|
||||
.PP
|
||||
\fBread_old_classes\fP = \fB0\fP|\fB1\fP \fI(Viaccess SCs only)\fR
|
||||
.RS 3n
|
||||
0 = read only active entitlements
|
||||
1 = read all entitlements (default)
|
||||
.RE
|
||||
.PP
|
||||
\fBsaveemm-u\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = save unique EMMs to log file, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsaveemm-s\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = save shared EMMs to log file, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsaveemm-g\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1= save global EMMs to log file, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsaveemm-unknown\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = save unknown types of EMMs to log file, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsavenano\fP = \fBnano[,nano]....\fP|\fPall\fP \fI(obsolete)\fR
|
||||
.RS 3n
|
||||
list of EMM-nanos to save (in hex w/o 0x) or all EMM-nanos, only valid for physical readers, default:none
|
||||
|
||||
example: savenano = 45,93,7a,ff
|
||||
savenano = all
|
||||
.RE
|
||||
.PP
|
||||
\fBreadnano\fP = \fB[path]filename\fP
|
||||
.RS 3n
|
||||
write file (usually a copy of a file saved by savenano) to your smartcard, if no path is specified, the specified file is searched for in the configuration directory, only valid for physical readers, default:none
|
||||
|
||||
example: readnano = write.emm
|
||||
readnano = /var/oscam/write.emm
|
||||
.RE
|
||||
.PP
|
||||
\fBdropbadcws\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = reject bad CWs, send "not found" instead of bad CWs, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBdisablecrccws\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = disable CRC for CW, default: 0
|
||||
|
||||
\fIIn normal operation mode this parameter is not required. Parameter is incompatible with DVB standard.\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBident\fP = \fB<CAID1>[:<ident1>[,<ident2>]...][;<CAID2>[:<ident3>[,<ident4>]...]]...\fP
|
||||
.RS 3n
|
||||
use this reader as local in loadbalancer's reader selection, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBlb_whitelist_services\fP = \fB<services>,<services>...\fP
|
||||
.RS 3n
|
||||
reader assignement to service group for channels which may never be blocked by the loadbalancer to the reader , default=none
|
||||
.RE
|
||||
.PP
|
||||
\fBlb_weight\fP = \fBweight\fP
|
||||
.RS 3n
|
||||
the higher the value the higher the probability for reader selection in load balacing mode, default:100
|
||||
|
||||
It's an divider for the average responstime.
|
||||
.RE
|
||||
.PP
|
||||
\fBlb_force_fallback\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = set the reader always as fallaback for load balacing without considering the reader's statistics, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcccversion\fP = \fB<main version>.<version>.<sub version>\fP
|
||||
.RS 3n
|
||||
set CCcam version, default:none
|
||||
|
||||
example: cccversion = 1.2.34
|
||||
.RE
|
||||
.PP
|
||||
\fBcccmaxhops\fP = \fBhops\fP
|
||||
.RS 3n
|
||||
set CCcam maximum SC distance hops, default:10
|
||||
|
||||
\fB-1\fP = disabled
|
||||
\fB0\fP = remote local SCs only
|
||||
\fB1\fP = remote local SCs and + 1 hop
|
||||
\fB2\fP = remote local SCs and + 2 hops
|
||||
and so on
|
||||
|
||||
After reading this SC hop will be incremented by one.
|
||||
.RE
|
||||
.PP
|
||||
\fBccchop\fP = \fBhop\fP
|
||||
.RS 3n
|
||||
set hop for non CCCam readers, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcccreshare\fP = \fBhop\fP
|
||||
.RS 3n
|
||||
set reader's CCcam reshare hop, default:0
|
||||
|
||||
\fB-1\fP = reshare value off cccam in global config
|
||||
\fb0\fP = resharing for direct peer only
|
||||
\fBx\fP = resharing for direct peer and share level x
|
||||
.RE
|
||||
.PP
|
||||
\fBcccwantemu\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = request to provide emu from CCCam server, too, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBccckeepalive\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = send keepalive messages to keep connection to remote CCCam server up, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcccreconnect\fP = \fBtimeout\fP
|
||||
.RS 3n
|
||||
reconnect again after ECM request timeout in milli-seconds, default:4000
|
||||
.RE
|
||||
.PP
|
||||
\fBcccmindown\fP = \fBnumber\fP
|
||||
.RS 3n
|
||||
filters all readers with hops smaller than number, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBgbox_reshare\fP = \fBlevel\fP
|
||||
.RS 3n
|
||||
gbox reshare level of local cards, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBgbox_max_distance\fP = \fBdistance\fP
|
||||
.RS 3n
|
||||
maximum distance to receive gbox peer cards, default:2
|
||||
.RE
|
||||
.PP
|
||||
\fBgbox_max_ecm_send\fP = \fBnumber\fP
|
||||
.RS 3n
|
||||
maximum of gbox peers ECMs will be send to, default:3
|
||||
.RE
|
||||
.PP
|
||||
\fBuse_ssl\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = use SSL for ghttp protocol, default:0
|
||||
.RE
|
||||
.SH OVERCLOCKING
|
||||
.TP 3n
|
||||
\(bu
|
||||
Dreambox and other internal readers
|
||||
|
||||
For Dreambox and other internal readers the highest possible clockrate will be
|
||||
auto detected. The \fBmhz\fR parameter lets you override the values chosen by
|
||||
OSCam, if it differs from 357 and 358, but usually you will not set any value
|
||||
for mhz.
|
||||
|
||||
For certain Dreamboxes (especially PPC clones) the default mhz parameter leads
|
||||
to slow ECM times and/or "not found" ECMs. By setting \fBmhz\fR to values like
|
||||
200, 300, 400, ... 1600 you can find a value that works for your receiver and
|
||||
your card. The higher the \fBmhz\fR value, the slower the ECM time (strange enough).
|
||||
|
||||
If you choose the value too low, your card is not recognized (no ATR or "card
|
||||
not supported"). If you choose the value too high, you get slow ECM times. Our
|
||||
experience is that either no \fBmhz\fR line, or a line \fBmhz\fR = 1000 works
|
||||
best.
|
||||
.TP 3n
|
||||
\(bu
|
||||
Phoenix / Smartmouse reader
|
||||
|
||||
Overclocking does not work with Windows and Mac OS X.
|
||||
Set \fBmhz\fR equivalent to the frequency of the reader.
|
||||
OSCam can not set the frequency of the reader.
|
||||
.TP 3n
|
||||
\(bu
|
||||
Smargo Smartreader+
|
||||
|
||||
Use protocol = smargo for the FDDI kernel drivers (no libusb needed) or (not
|
||||
recommended) use protocol = smartreader for OSCam's driver implementation
|
||||
based on libusb.
|
||||
|
||||
Set the reader frequency with the native Smargo Smartreader+ tool (srp_tools).
|
||||
If not setting \fBmhz\fR and \fBcardmhz\fR, OSCam tries to set the baudrate
|
||||
automatically, according to the maximum speed indicated by ATR. Overclocking
|
||||
is possible.
|
||||
.PP
|
||||
OSCam tries to set the baudrate automatically.
|
||||
A standard serial port has limited baudrate settings, so SC overclocking might not work.
|
||||
When using a serial reader the best way for overclocking is connecting it to a FTDI based USB to serial port adapter.
|
||||
|
||||
If overclocking does not work, verify the effective baudrate in the logfile.
|
||||
If it deviates too much from the requested baudrate, the SC will not be recognized (no ATR)
|
||||
and the value for \fBmhz\fR should be adjusted again.
|
||||
The higher the baudrate, the more accurate the effective baudrate can be.
|
||||
.SH CACHE EXCHANGE
|
||||
.TP 3n
|
||||
\(bu
|
||||
pull mode (on request: cache exchange from remote to local OSCam)
|
||||
|
||||
ECM requests will be forwarded to the remote cache exchange partner. If the CW
|
||||
could not be found in the cache of the remote exchange partner, a not found
|
||||
will be answered. If the CW could not be found in the cache of the remote
|
||||
exchange partner but a pending ECM request is open, the request will be
|
||||
re-initiated after the wait time defined in \fBcacheexwaittime\fR.
|
||||
.TP 3n
|
||||
\(bu
|
||||
push mode (continuous: cache exchange from remote to local OSCam)
|
||||
|
||||
CWs from the remote cache exchange partner will be forwarded to the local
|
||||
cache. Forwarding only works while the camd camd 3.5x / 3.57x or CCcam
|
||||
protocol connection between the local and remote OSCam has been established.
|
||||
.TP 3n
|
||||
\(bu
|
||||
reverse push mode (continuous: cache exchange from local to remote OSCam)
|
||||
|
||||
CWs from the local cache will be forwarded to the remote cache exchange
|
||||
partner. Forwarding only works while the camd camd 3.5x / 3.57x or CCcam
|
||||
protocol connection between the remote and local OSCam has been established.
|
||||
.SH EXAMPLES
|
||||
.TP 3n
|
||||
\(bu
|
||||
serial mouse compatible reader
|
||||
|
||||
[reader]
|
||||
label = myserialmousereader
|
||||
detect = cd
|
||||
protocol = mouse
|
||||
device = /dev/ttyS1
|
||||
group = 1
|
||||
caid = 0100
|
||||
services = myservice,!thisservice
|
||||
.TP 3n
|
||||
\(bu
|
||||
USB mouse compatible reader
|
||||
|
||||
[reader]
|
||||
label = myusbmousereader
|
||||
detect = cd
|
||||
protocol = mouse
|
||||
device = /dev/ttyUSB0
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 2
|
||||
caid = 0200
|
||||
.TP 3n
|
||||
\(bu
|
||||
camd 3.78x reader
|
||||
|
||||
[reader]
|
||||
label = mycamd378xreader
|
||||
protocol = cs378x
|
||||
device = 192.168.0.1,1234
|
||||
user = user1
|
||||
password = password1
|
||||
group = 3
|
||||
.TP 3n
|
||||
\(bu
|
||||
newcamd reader
|
||||
|
||||
[reader]
|
||||
label = mynewcamdreader
|
||||
protocol = newcamd
|
||||
key = 0102030405060708091011121314
|
||||
device = 192.168.0.2,2345
|
||||
user = user2
|
||||
password = password2
|
||||
group = 4
|
||||
.TP 3n
|
||||
\(bu
|
||||
CCcam reader
|
||||
|
||||
[reader]
|
||||
label = mycccamreader
|
||||
protocol = cccam
|
||||
device = 192.168.0.3,3456
|
||||
user = user3
|
||||
password = password3
|
||||
group = 5
|
||||
caid = 0300,0400,0500
|
||||
cccversion = 1.2.3
|
||||
.TP 3n
|
||||
\(bu
|
||||
PCSC reader
|
||||
|
||||
[reader]
|
||||
label = mypcscreader
|
||||
protocol = pcsc
|
||||
device = 0
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 6
|
||||
caid = 0600
|
||||
.TP 3n
|
||||
\(bu
|
||||
Smargo Smartreader+
|
||||
|
||||
[reader]
|
||||
label = mysmartreader
|
||||
protocol = smartreader
|
||||
device = 001:002
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 7
|
||||
caid = 0700
|
||||
.TP 3n
|
||||
\(bu
|
||||
internal reader
|
||||
|
||||
[reader]
|
||||
label = myinternalreader
|
||||
protocol = internal
|
||||
device = /dev/sci0
|
||||
group = 8
|
||||
caid = 0800
|
||||
.TP 3n.
|
||||
\(bu
|
||||
sc8in1 reader
|
||||
|
||||
[reader]
|
||||
label = mysc8in1reader
|
||||
protocol = sc8in1
|
||||
device = /dev/ttyUSB0:1
|
||||
group = 9
|
||||
caid = 0900
|
||||
.TP 3n
|
||||
\(bu
|
||||
constant CW
|
||||
|
||||
[reader]
|
||||
label = myconstantcw
|
||||
protocol = constcw
|
||||
device = /var/keys/constant.cw
|
||||
group = 10
|
||||
.TP 3n
|
||||
\(bu
|
||||
gbox reader
|
||||
|
||||
[reader]
|
||||
label = mygboxreader
|
||||
protocol = gbox
|
||||
device = 192.168.0.4,45678,56789
|
||||
user = user4
|
||||
password = password4
|
||||
group = 11
|
||||
caid = 1100
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
32
Distribution/doc/man/oscam.services.5
Normal file
32
Distribution/doc/man/oscam.services.5
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
.TH oscam.services 5
|
||||
.SH NAME
|
||||
\fBoscam.services\fR - definition of services for OSCam
|
||||
.SH SYNOPSIS
|
||||
service definitions
|
||||
.SH DESCRIPTIONS
|
||||
.SS "The [<service name>] section"
|
||||
service name section, service name sections are recurring, \fIrequired\fR, \fImaximum 64 services are allowed\fR
|
||||
.PP
|
||||
\fBcaid\fP = \fBCAID[,CAID]...\fP
|
||||
.RS 3n
|
||||
listing of CAIDs in hex
|
||||
.RE
|
||||
.RE
|
||||
.PP
|
||||
\fBprovid\fP = \fBprovider ID[,provider ID]...\fP
|
||||
.RS 3n
|
||||
listing of provider IDs in hex
|
||||
.RE
|
||||
.RE
|
||||
.PP
|
||||
\fBsrvid\fP = \fBservice ID[,service ID]...\fP
|
||||
.RS 3n
|
||||
listing of service IDs in hex
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
[myservice]
|
||||
CAID=0100,0200,000A
|
||||
provid=000001,ABCDEF
|
||||
srvid=0001,0002,000A,000B
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
24
Distribution/doc/man/oscam.srvid.5
Normal file
24
Distribution/doc/man/oscam.srvid.5
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
.TH oscam.srvid 5
|
||||
.SH NAME
|
||||
\fBoscam.srvid\fR - service ID configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
service ID mappings
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBCAID[,CAID]...\fP:\fBservice ID\fP|\fB[provider]\fP|\fB[name]\fP|\fB[type]\fP|\fB[description]\fP
|
||||
|
||||
.RS 3n
|
||||
mapping between CAID, service ID, provider, name, type and description of service
|
||||
.RE
|
||||
.SH ANNONTATIONS
|
||||
\fIPlease use Unix text file format only.\fR
|
||||
|
||||
You only need the \fBoscam.srvid\fR when using the monitor or the web interface.
|
||||
\fIFor saving memory consumption only insert the service IDs you really need.\fR Some
|
||||
external programs use their own \fBoscam.srvid\fR and do not need the \fBoscam.srvid\fR of OSCam.
|
||||
.SH EXAMPLES
|
||||
0001,0002,0003:000a|my provider 1|tv name 1|tv|my tv package
|
||||
0004,0005,0006:000a|my provider 2|radio name 2|radio|my radio package
|
||||
0006:000b|my provider 3|tv name 3|
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
20
Distribution/doc/man/oscam.srvid2.5
Normal file
20
Distribution/doc/man/oscam.srvid2.5
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
.TH oscam.srvid2 5
|
||||
.SH NAME
|
||||
\fBoscam.srvid2\fR - service ID configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
service ID mappings
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBservice ID\fP:\fBCAID\fP[:\fB@provider ID\fP[\fB@provider ID\fP]...][,:\fBCAID\fP[:\fB@provider ID\fP[\fB@provider ID\fP]...]][\fBname\fP]|[\fBtype\fP]|[\fBdescription\fP]|[\fBprovider\fP]
|
||||
|
||||
.RS 3n
|
||||
mapping between service ID, CAID, provider ID, name, type, description and proivder
|
||||
.RE
|
||||
.SH ANNONTATIONS
|
||||
\fIPlease use Unix text file format only.\fR
|
||||
|
||||
You only need the \fBoscam.srvid2\fR when using the monitor or the web interface.
|
||||
\fIFor saving memory consumption only insert the service IDs you really need.\fR Some
|
||||
external programs use their own \fBoscam.srvid2\fR and do not need the \fBoscam.srvid2\fR of OSCam.
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.tiers\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
20
Distribution/doc/man/oscam.tiers.5
Normal file
20
Distribution/doc/man/oscam.tiers.5
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
.TH oscam.tiers 5
|
||||
.SH NAME
|
||||
\fBoscam.tiers\fR - TIER configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
TIER mappings
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBCAID[,CAID]...\fP:\fBTIER ID\fP|\fBdescription\fP
|
||||
|
||||
.RS 3n
|
||||
mapping between CAID, TIER ID and description of TIER
|
||||
.RE
|
||||
.SH ANNONTATIONS
|
||||
\fIPlease use Unix text file format only.\fR
|
||||
.SH EXAMPLES
|
||||
0001,0002,0003:000a|my TIER 1
|
||||
0004:000b|my TIER 2
|
||||
0005:000b|my TIER 3
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.user\fR(5), \fBoscam.whitelist\fR(5)
|
||||
405
Distribution/doc/man/oscam.user.5
Normal file
405
Distribution/doc/man/oscam.user.5
Normal file
|
|
@ -0,0 +1,405 @@
|
|||
.TH oscam.user 5
|
||||
.SH NAME
|
||||
\fBoscam.user\fR - user configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
The user configuration file for OSCam contains user definitions. [account]
|
||||
sections in \fBoscam.user\fR are \fIrecurring\fR (more than one account).
|
||||
.SH DESCRIPTIONS
|
||||
.SS "The [account] section"
|
||||
.PP
|
||||
\fBuser\fP = \fBname\fP
|
||||
.RS 3n
|
||||
account name, \fIrequired\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBpwd\fP = \fBpassword\fP
|
||||
.RS 3n
|
||||
password for account, \fIrequired\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBdescription\fP = \fBtext\fP
|
||||
.RS 3n
|
||||
description of user account
|
||||
.RE
|
||||
.PP
|
||||
\fBdisabled\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = account disabled, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBhostname\fP = \fBhostname\fP
|
||||
.RS 3n
|
||||
host from which user connection is allowed
|
||||
.RE
|
||||
.PP
|
||||
\fBexpdate\fP = \fB<year>-<month>-<day>\fP|\fB<year>/<month>/<day>\fP
|
||||
.RS 3n
|
||||
expiration date for account, default:none
|
||||
|
||||
example: expdate = 2001-11-21
|
||||
expdate = 2002/12/22
|
||||
.RE
|
||||
.PP
|
||||
\fBallowedprotocols\fP = \fB[camd33][,][camd35][,][cs357x][,][cs378x][,][newcamd][,][cccam][,][gbox][,][radegast]\fP
|
||||
.RS 3n
|
||||
list of all allowed connection protocols, default:all connection protocols
|
||||
.RE
|
||||
.PP
|
||||
\fBallowedtimeframe\fP = \fBDAY@HH:MM-HH:MM[,HH:MM-HH:MM][,HH:MM-HH:MM] [;DAY@HH:MM-HH:MM[,HH:MM-HH:MM][,HH:MM-HH:MM]]\fP
|
||||
.RS 10n
|
||||
where DAY=\fBSUN,MON,TUE,WED,THU,FRI,SAT\fP or \fBALL\fP (for all possible days)
|
||||
.RE
|
||||
.RS 3n
|
||||
|
||||
account enabled from hh:mm to hh:mm for the specified day(s), default:none
|
||||
|
||||
comma (,) to separate times and semicolon(; ) to separate the different days.
|
||||
You can use ALL@ if you want the same time frames for everyday.
|
||||
|
||||
Example:
|
||||
|
||||
allowedtimeframe=ALL@10:00-22:00;MON@00:00-02:00,02:45-04:37; FRI@00:00-10:00,22:00-24:00;SAT@00:00-24:00
|
||||
|
||||
If you use: DAY@22:00-05:00 this will be turned into DAY@00:00-05:00,22:00-24:00
|
||||
|
||||
ALL@ is always checked and used, so you can watch TV the whole day on FRIday in this exemple. There is no problem to overlap ALL@ in a day definition, like for SAT@ definition.
|
||||
.RE
|
||||
.PP
|
||||
\fBmax_connections\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
maximum allowed connections per user when unique level will be adducted, default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBuniq\fP = \fB0\fP|\fB1\fP|\fB2\fP|\fB4\fP
|
||||
.RS 3n
|
||||
unique level:
|
||||
|
||||
\fB0\fP = disabled (default)
|
||||
\fB1\fP = only one connection per user is allowed
|
||||
\fB2\fP = set user to fake if source ip is different
|
||||
(e.g. for newcamd clients with different CAIDs and ports)
|
||||
\fB3\fP = only one connection per user, but only the last login
|
||||
will survive (old MpCS behavior)
|
||||
\fB4\fP = set user only to fake if source ip is different,
|
||||
but only the last login will survive
|
||||
.RE
|
||||
.PP
|
||||
\fBnumusers\fP = \fBquantity\fP
|
||||
.RS 3n
|
||||
anti-cascading: user per account, 0 = anti-cascading disabled, -1 = global value from oscam.conf, default:-1
|
||||
.RE
|
||||
.PP
|
||||
\fBpenalty\fP = \fB0\fP|\fB1\fP|\fB2\fP
|
||||
.RS 3n
|
||||
level of penalty:
|
||||
|
||||
\fB-1\fP = level of oscam.conf (default)
|
||||
\fB 0\fP = only logging
|
||||
\fB 1\fP = send fake CWs
|
||||
\fB 2\fP = temporary user ban
|
||||
\fB 3\fP = send delayed CWs
|
||||
.RE
|
||||
.PP
|
||||
\fBfakedelay\fP = \fB0\fP|\fB1\fP|\fBmilli-seconds\fP
|
||||
.RS 3n
|
||||
set fake delay time individually for user:
|
||||
|
||||
\fB 0\fP = disable fake delay
|
||||
\fB-1\fP = fake delay of oscam.conf (default)
|
||||
.RE
|
||||
.PP
|
||||
\fBacosc_max_ecms_per_minute\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
maximum ecms per minute, 0 = unlimited, -1 = use global setting, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBacosc_max_active_sids\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
maximum active SIDs with anti-cascading over SID, 0 = unlimited, -1 = use global setting, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBacosc_zap_limit\fP = \fBcount\fP
|
||||
.RS 3n
|
||||
zap limit for anti-cascading over SID, 0 = unlimited, -1 = use global setting, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBacosc_penalty\fP = \fB0\fP|\fB1\fP|\fB2\fP|\fB3\fP|\fB4\fP|\fB-1\fP
|
||||
.RS 3n
|
||||
level of penalty with anti-cascading over SID count:
|
||||
|
||||
\fB0\fP = only logging (default)
|
||||
\fB1\fP = send fake CWs
|
||||
\fB2\fP = temporary user ban
|
||||
\fB3\fP = send delayed CWs
|
||||
\fB4\fP = temporary hidecards to the client
|
||||
\fB-1\fP = use global setting
|
||||
.RE
|
||||
.PP
|
||||
\fBacosc_penalty_duration\fP = \fBseconds\fP
|
||||
.RS 3n
|
||||
penalty duration for anti-cascading over SID count, -1 = use global setting, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBacosc_delay\fP = \fBmilli-seconds\fP
|
||||
.RS 3n
|
||||
delay for anti-cascading over SID count, -1 = use global setting, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBfailban\fP = \fB0\fP|\fB2\fP|\fB4\fP|\fB8\fP
|
||||
.RS 3n
|
||||
mask for IP address based blocking:
|
||||
|
||||
\fB0\fP = ignore (default)
|
||||
\fB2\fP = block IP address of a disabled account on connecting
|
||||
\fB4\fP = block IP address of a sleeping account while sleeping comes up
|
||||
\fB8\fP = block duplicate IP address
|
||||
.RE
|
||||
.PP
|
||||
\fBlb_nbest_readers\fP = \fBcounts\fP
|
||||
.RS 3n
|
||||
set count of best readers for load balancing, -1 = use global lb_nbest_readers, default:-1
|
||||
.RE
|
||||
.PP
|
||||
\fBlb_nfb_readers\fP = \fBcounts\fP
|
||||
.RS 3n
|
||||
set count of fallback readers for load balancing, -1 = use global lb_nfb_readers, default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBlb_nbest_percaid\fP = \fBCAID1:count1[,CAID2:count2]...\fP
|
||||
.RS 3n
|
||||
set count of best readers per CAIDs for load balancing, wildcard CAIDs with two-digit CAIDs possible, default:none
|
||||
|
||||
example: lb_nbest_percaid = 0100:4,0200:3,03:2,04:1
|
||||
(wildcard CAIDs 03xx and 04xx)
|
||||
.RE
|
||||
.PP
|
||||
\fBpreferlocalcards\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
SC decoding behavior:.
|
||||
|
||||
\fB-1\fP = global value from oscam.conf (default)
|
||||
\fB0\fP = local SCs used like a remote reader
|
||||
\fB1\fP = prefer cache exchange based SCs
|
||||
\fB2\fP = prefer local SCs
|
||||
.RE
|
||||
.PP
|
||||
\fBcwc_disable\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = disbale CW cycle check, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex\fP = \fB0\fP|\fB1\fP|\fB2\fP|\fB3\fP
|
||||
.RS 3n
|
||||
set cache exchange mode
|
||||
|
||||
\fB0\fP: disable cache exchange mode (default)
|
||||
\fB1\fP: enable cache exchange pull mode
|
||||
\fB2\fP: enable cache exchange push mode for camd 3.5x / 3.57x and
|
||||
CCcam protocol
|
||||
\fB3\fP: enable reverse cache exchange push mode for camd 3.5x / 3.57x
|
||||
and CCcam protocol
|
||||
|
||||
\fIIdentical cache exchange modes must be set on local OSCam user account and remote OSCam server.\fR
|
||||
|
||||
\fIPlease consider memory consumption.\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_maxhop\fP = \fBhops\fP
|
||||
.RS 3n
|
||||
define maximum hops for cache exchange, default=10
|
||||
.RE
|
||||
.PP
|
||||
\fBno_wait_time\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
set wait time behaviour:
|
||||
|
||||
\fB0\fP: use \fBwait_time\fP set in \fBoscam.conf\fP (default)
|
||||
\fB1\fP: do not use \fBwait_time\fP set in \fBoscam.conf\fP
|
||||
.RE
|
||||
.PP
|
||||
\fBcsp_ecm_filter\fP = \fB[caid][&mask][@provid][$servid],n\fP
|
||||
.RS 3n
|
||||
cache exchange incoming ECM filter setting (mode 3 only) for Cardservproxy, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_drop_csp\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = drop incoming Cardservproxy cache (mode 3 only), detection is zero ecmd5, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_allow_request\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = allow incoming ECM request (mode 3 only), default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_allow_filter\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1= allow cache exchange filter (for cache exchange mode 3 only), default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBcacheex_block_fakecws\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
1 = enable fake DCWs blocking (for cache exchange mode 3 only), get fake DCWs form \fBoscam.fakecws\fP, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsleep\fP = \fBminutes\fP
|
||||
.RS 3n
|
||||
time waiting for inactive user, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBsleepsend\fP = \fB0\fP|\fB255\fP
|
||||
.RS 3n
|
||||
255 = \fIOSCam client only\fR: stopping requests until next zap, 255 = \fIcamd 3.x only\fR: stopping requests until restart of camd 3.x client, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBsuppresscmd08\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
0 = tell camd 3.5x, 3.57x and 3.78x clients not to request again for rejected
|
||||
CAID, service ID and provider ID combination, 1 = disable, default:0
|
||||
.RE
|
||||
.PP
|
||||
\fBkeepalive\fP = \fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
0 = disable keepalive between server and client for newcamd or CCcam protocol, default:1
|
||||
.RE
|
||||
.PP
|
||||
\fBumaxidle\fP = \fBseconds\fP
|
||||
.RS 3n
|
||||
value for user being idle before disconnect, 0 = idle disconnect disabled, -1 use clientmaxidle in global section, default:-1
|
||||
.RE
|
||||
.PP
|
||||
\fBcaid\fP = \fB<CAID>[&<mask>][:<target CAID>][,<CAID>[&<mask>][:<target CAID>]]...\fP
|
||||
.RS 3n
|
||||
limit and mapping of CAIDs, default:all CAIDs with mask FFFF
|
||||
|
||||
example: caid = 0100
|
||||
caid = 0200&ffee:0300
|
||||
caid = 0400&ff00:0500,0600
|
||||
caid = 0702,0722
|
||||
caid = 0702&ffdf (shortcut for the example above)
|
||||
.RE
|
||||
.PP
|
||||
\fBau\fP = \fBlabel of reader[,label of reader]...\fP|\fB1\fP
|
||||
.RS 3n
|
||||
AU setting, default:none:
|
||||
|
||||
\fBlabel of reader\fP = sending EMMs to specified reader
|
||||
\fI(security issue: clients can see SC data!)\fR
|
||||
\fB1\fP = auto AU is sending EMMs to \fIall\fR readers
|
||||
\fI(security issue: clients can see SC data!)\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBgroup\fP = \fB1..64[,1..64]...\fP
|
||||
.RS 3n
|
||||
user assingment to reader groups, default:none, \fIrequired\fR
|
||||
.RE
|
||||
.PP
|
||||
\fBbetatunnel\fP = \fB<CAID>.<ServiceID>:<target CAID>[,<CAID>.<ServiceID>:
|
||||
<target CAID>]...\fP
|
||||
.RS 3n
|
||||
Define Betacrypt tunneling.
|
||||
The ServiceID can also be used for wildcarded CAIDs.
|
||||
|
||||
example: betatunnel = 0100.0001:0200,0300.0004:0500
|
||||
betatunnel = 0600.FFFF:0700
|
||||
|
||||
\fIBe carefull using abbreviations.\fR
|
||||
.RE
|
||||
|
||||
.PP
|
||||
\fBemmreassembly\fP = \fB0\fP|\fB1\fP||\fB2\fP
|
||||
.RS 3n
|
||||
EMM reassembly, should be set for Viaccess and Cryptoworks readers if the
|
||||
client that you are using to send EMMs is reassembling them instead of
|
||||
just sending them to OSCam for processing.
|
||||
|
||||
\fB0\fP: disabled
|
||||
\fB1\fP: enabled for DVB API
|
||||
\fB2\fP: enabled (default)
|
||||
.RE
|
||||
.PP
|
||||
\fBservices\fP = \fB[!]services[,[!]<services>]...\fP
|
||||
.RS 3n
|
||||
user [de]assingment to service group, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBident\fP = \fB<CAID>:<provid>[,<provid>,...][;<CAID>:<provid>[,<provid>,...]]...\fP
|
||||
.RS 3n
|
||||
user assingment to SC specific idents, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBclass\fP = \fB[!]class[,[!]class]...\fP
|
||||
.RS 3n
|
||||
user [de]assingment to SC specific classes, default=none
|
||||
|
||||
example: class = 01,02,!03,!04
|
||||
.RE
|
||||
.PP
|
||||
\fBchid\fP = \fB<CAID>:<ChID>[,<CAID>:<ChID>]...\fP
|
||||
.RS 3n
|
||||
user assingment to SC specific ChIDs, default:none
|
||||
.RE
|
||||
.PP
|
||||
\fBmonlevel\fP = \fB0\fP|\fB1\fP|\fB2\fP|\fB3\fP|\fB4\fP
|
||||
.RS 3n
|
||||
monitor level:
|
||||
|
||||
\fB0\fP = no access to monitor (default)
|
||||
\fB1\fP = only server and own procs
|
||||
\fB2\fP = all procs, but viewing only
|
||||
\fB3\fP = all procs, reload of \fBoscam.user\fR possible
|
||||
\fB4\fP = complete access
|
||||
.RE
|
||||
.PP
|
||||
\fBcccmaxhops\fP = \fBhops\fP
|
||||
.RS 3
|
||||
maximum hops limit for CCcam clients, default:10
|
||||
|
||||
\fB-1\fP = CCcam disabled for this user
|
||||
\fB0\fP = local SCs only
|
||||
\fB1\fP = local SCs + 1 hop
|
||||
\fB2\fP = local SCs + 2 hops
|
||||
and so on
|
||||
.RE
|
||||
.PP
|
||||
\fBcccreshare\fP = \fBlevel\fP
|
||||
.RS 3n
|
||||
reshare level for CCcam clients
|
||||
|
||||
\fB-1\fP = use reshare level of \fBoscam.conf\fR (default)
|
||||
\fB0\fP = resharing for direct peer only
|
||||
\fBx\fP = resharing for direct peer and share level x
|
||||
.RE
|
||||
.PP
|
||||
\fBcccignorereshare\fP = \fB-1\fP|\fB0\fP|\fB1\fP
|
||||
.RS 3n
|
||||
CCcam ignore reshare setting:
|
||||
|
||||
\fB-1\fP = use ignore reshare level of \fBoscam.conf\fR (default)
|
||||
\fB0\fP = use ignore reshare setting of server
|
||||
\fB1\fP = use ignore reshare setting of reader or user
|
||||
.RE
|
||||
.PP
|
||||
\fBcccstealth\fP = \fB-1\fP|\fB1\fP
|
||||
.RS 3n
|
||||
CCcam stealth:
|
||||
|
||||
\fB-1\fP = use CCcam stealth of \fBoscam.conf\fR (default)
|
||||
\fB0\fP = use extended OSCam-CCcam protocol
|
||||
\fB1\fP = behaviour like the original CCcam: no activate partner
|
||||
detection and extended OSCam-CCcam protocol, prevent
|
||||
other OSCam to detect the server as OSCam server
|
||||
.RE
|
||||
.SH EXAMPLES
|
||||
[account]
|
||||
user = username
|
||||
pwd = password
|
||||
group = 1
|
||||
au = myserialmousereader
|
||||
services = myservice
|
||||
betatunnel = 0100.0001:0101,0100.0002:0101
|
||||
caid = 0100
|
||||
ident = 0100:000000
|
||||
uniq = 1
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.tiers\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5), \fBoscam.whitelist\fR(5)
|
||||
47
Distribution/doc/man/oscam.whitelist.5
Normal file
47
Distribution/doc/man/oscam.whitelist.5
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
.TH oscam.whitelist 5
|
||||
.SH NAME
|
||||
\fBoscam.whitelist\fR - global ECM length whitelisting configuration file for OSCam
|
||||
.SH SYNOPSIS
|
||||
ECM length whitelisting
|
||||
.SH DESCRIPTIONS
|
||||
.PP
|
||||
\fBw\fP:\fB[CAID]\fP[:]\fB[provider ID]\fP[:]\fB[service ID]\fP[:]\fB[ECM PID]\fP[:]\fB[CHID]\fP[:]\fB[ECM length 1[,ECM length 2]...]]\fP
|
||||
.RS 3n
|
||||
ECM length whitelisting
|
||||
.RE
|
||||
.PP
|
||||
\fBl\fP:\fB[CAID]\fP[:]\fB[provider ID]\fP[:]\fB[service ID]\fP[:]\fB[ECM PID]\fP[:]\fB[CHID]\fP[:]\fB[ECM length 1[,ECM length 2]...]]\fP
|
||||
.RS 3n
|
||||
ECM length whitelisting, does not proceed with any other ECM length
|
||||
whitelisting when matching, abbreviation for normal ECM length
|
||||
whitelisting using w parameter
|
||||
.RE
|
||||
.PP
|
||||
\fBi\fP:\fB[CAID]\fP[:]\fB[provider ID]\fP[:]\fB[service ID]\fP[:]\fB[ECM PID]\fP[:]\fB[CHID]\fP[:]\fB[ECM length 1[,ECM length 2]...]]\fP
|
||||
.RS 3n
|
||||
ignore ECM length
|
||||
.RE
|
||||
.PP
|
||||
\fBm\fP:\fB[CAID]\fP[:]\fB[provider ID]\fP[:]\fB[service ID]\fP[:]\fB[ECM PID]\fP[:]\fB[CHID]\fP[:]\fB[ECM length 1[,ECM length 2]...]]\fP \fB[new CAID]\fP[:]\fB[new provider ID]\fP
|
||||
.RS 3n
|
||||
CAID und provider ID mapping, \fIfirst matching rules\fR, \fImapping is
|
||||
preferred over all other whitelistings\fR
|
||||
.RE
|
||||
.SH ANNONTATIONS
|
||||
\fIPlease use Unix text file format only.\fR
|
||||
.SH EXAMPLES
|
||||
w:0100 # whitelisting for CAID 0100
|
||||
|
||||
i:0200::1234 # ignore CAID 0200 with
|
||||
# service ID 1234
|
||||
|
||||
i:::::2345 # ignore CHID 2345
|
||||
|
||||
m:3456:123456::::: 4567:234567 # mapping
|
||||
|
||||
w: # allow all others (blacklist)
|
||||
|
||||
l:0300 # whitelisting for CAID 0300 not
|
||||
# proceeding if matching
|
||||
.SH "SEE ALSO"
|
||||
\fBlist_smargo\fR(1), \fBoscam\fR(1), \fBoscam.ac\fR(5), \fBoscam.cacheex\fR(5), \fBoscam.cert\fR(5), \fBoscam.conf\fR(5), \fBoscam.dvbapi\fR(5), \fBoscam.fakecws\fR(5), \fBoscam.guess\fR(5), \fBoscam.ird\fR(5), \fBoscam.provid\fR(5), \fBoscam.ratelimit\fR(5), \fBoscam.server\fR(5), \fBoscam.services\fR(5), \fBoscam.srvid\fR(5), \fBoscam.srvid2\fR(5),c\fBoscam.user\fR(5)
|
||||
21
Distribution/doc/txt/list_smargo.txt
Normal file
21
Distribution/doc/txt/list_smargo.txt
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
list_smargo(1) General Commands Manual list_smargo(1)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
list_smargo - list all connected Smartreader+
|
||||
|
||||
SYNOPSIS
|
||||
list_smargo
|
||||
|
||||
DESCRIPTIONS
|
||||
The list_smargo software lists all connected Smartreader+ with bus number and device address.
|
||||
|
||||
SEE ALSO
|
||||
oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5), oscam.guess(5),
|
||||
oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
list_smargo(1)
|
||||
29
Distribution/doc/txt/oscam.ac.txt
Normal file
29
Distribution/doc/txt/oscam.ac.txt
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
oscam.ac(5) File Formats Manual oscam.ac(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.ac - anti-cascading table for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
anti-cascading table
|
||||
|
||||
DESCRIPTIONS
|
||||
<CAID>:<provider ID>=<seconds>
|
||||
define time cycles between CWs changes relating to CAID and provider ID
|
||||
|
||||
*=<seconds>
|
||||
default time cycles between CWs changes required
|
||||
|
||||
EXAMPLES
|
||||
0100:000000=10
|
||||
*=7
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5),
|
||||
oscam.srvid2(5), oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.ac(5)
|
||||
31
Distribution/doc/txt/oscam.cacheex.txt
Normal file
31
Distribution/doc/txt/oscam.cacheex.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
oscam.cacheex(5) File Formats Manual oscam.cacheex(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam..cacheex - global ECM length matching configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
ECM length matching
|
||||
|
||||
DESCRIPTIONS
|
||||
m:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1[,ECM length 2]...]]=[CAID][:][provider
|
||||
ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1[,ECM length 2]...]]
|
||||
ECM length matching from remote cache exchange partner to local
|
||||
cache, for cache exchange pull mode (cacheex = 1) only
|
||||
|
||||
ANNONTATIONS
|
||||
Please use Unix text file format only.
|
||||
|
||||
EXAMPLES
|
||||
m:1234:::::93=5678:::::93 # matching CAID 1234 and CAID 5678 with
|
||||
# ECM length 93
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5), oscam.guess(5),
|
||||
oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid (5),
|
||||
oscam.srvid2(5), oscam.user(5)
|
||||
|
||||
|
||||
|
||||
oscam.cacheex(5)
|
||||
25
Distribution/doc/txt/oscam.cert.txt
Normal file
25
Distribution/doc/txt/oscam.cert.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
oscam.cert(5) File Formats Manual oscam.cert(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.cert - Issuer Public Keys (IPK) for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
Issuer Public Keys (IPK)
|
||||
|
||||
DESCRIPTIONS
|
||||
CAID:reserved:IPK
|
||||
mapping between CAID and IPK/sessions keys in hex, currently for Cryptoworks only
|
||||
|
||||
EXAMPLES
|
||||
0100:00000000:0102030405060708090A0B0C0D0E0F
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5), oscam.guess(5),
|
||||
oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.cert(5)
|
||||
1086
Distribution/doc/txt/oscam.conf.txt
Normal file
1086
Distribution/doc/txt/oscam.conf.txt
Normal file
File diff suppressed because it is too large
Load Diff
82
Distribution/doc/txt/oscam.dvbapi.txt
Normal file
82
Distribution/doc/txt/oscam.dvbapi.txt
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
oscam.dvbapi(5) File Formats Manual oscam.dvbapi(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.dvbapi - DVB API configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
DVBAPI settings, first match - first used
|
||||
|
||||
DESCRIPTIONS
|
||||
P: [CAID]:[provider ID]:[service ID]:[ECM PID]:[CHID] [force]:[PIDx] priority
|
||||
set priority, continue = 1: proceed with priority, recommended for
|
||||
pay-per-view services / EMMs (use carefully), although local SCs
|
||||
will be prioritised higher, default:none
|
||||
|
||||
I: [CAID]:[provider ID]:[service ID]:[ECM PID]:[CHID] [PIDx] ignore
|
||||
set ignore
|
||||
|
||||
J: [CAID]:[provider ID]:[service ID]:[ECM PID] joined CAID:joined provider ID:joined ECM PID
|
||||
join to another ECM PID
|
||||
|
||||
A: ::service ID:[PMT PID] :[provider ID][:][ECM PID]
|
||||
set a dummy ECM request with CAID FFFF for services with a constant CW shown as unencrypted service (for STBs with PMT
|
||||
PID support only)
|
||||
|
||||
A: ::service ID:[video PID] :[provider ID][:][ECM PID]
|
||||
set a dummy ECM request with CAID FFFF for services with a constant CW shown as unencrypted service (for STBs without
|
||||
PMT PID support only)
|
||||
|
||||
X: [CAID]:[provider ID]:[service ID]:[ECM PID]
|
||||
add decoding on an extra demux index on the same CA device (Multi ECM) (not support on all STBs)
|
||||
|
||||
D: [CAID]:[provider ID]:[service ID]:[ECM PID] delay
|
||||
set delay in milli-seconds writing CWs
|
||||
|
||||
M: [CAID]:[provider ID]:[service ID]:[ECM PID] target CAID[:][target provider ID]
|
||||
mapping
|
||||
|
||||
S: [device] [PMT file name]
|
||||
set DVB API device name and PMT file name (valid for STAPI only)
|
||||
|
||||
L: [CAID]:[provider ID]:[service ID]:[ECM PID] length
|
||||
set ECM length in hexadecimal
|
||||
|
||||
ANNONTATIONS
|
||||
Please use Unix text file format only.
|
||||
|
||||
EXAMPLES
|
||||
P: 0100:123456 # prioritise CAID 0100 with provider 123456
|
||||
|
||||
P: :1234 # prioritise ECM with provider ID 1234 on
|
||||
# on any CAID and service
|
||||
|
||||
P: 0200 # prioritise CAID 0200
|
||||
|
||||
P: 0300::9ABC # prioritise CAID 0300 on service 9ABC only
|
||||
|
||||
P: 0400 1 # prioritise CAID 0400 for pay-per-view services
|
||||
|
||||
P: : 1 # prioritise for EMMs
|
||||
|
||||
M: 0500 0600:123456 # map CAID 0500 to provider ID 123456 with
|
||||
# CAID 0600
|
||||
|
||||
D: 0700 200 # wait 200 ms before writing CW for CAID 0700
|
||||
|
||||
I: :654321 # ignore provider ID 654321 for every CAID and
|
||||
# service
|
||||
|
||||
I: 0 # ignore every CAID that was not handled before
|
||||
|
||||
L: 0800 8e # ECM length for CAID 0800 to 8e (hexadecimal)
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.fakecws(5), oscam.guess(5),
|
||||
oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.dvbapi(5)
|
||||
26
Distribution/doc/txt/oscam.guess.txt
Normal file
26
Distribution/doc/txt/oscam.guess.txt
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
oscam.guess(5) File Formats Manual oscam.guess(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.guess - CAID guessing table for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
CAID guessing table
|
||||
|
||||
DESCRIPTIONS
|
||||
<length of ECM>:<CAID>
|
||||
CAID guessing table by len in hex, only needed for protocols (at the moment BOMBA protocol only) that does not pass
|
||||
CAIDs
|
||||
|
||||
EXAMPLES
|
||||
12:3456
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5),
|
||||
oscam.srvid2(5), oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.guess(5)
|
||||
25
Distribution/doc/txt/oscam.ird.txt
Normal file
25
Distribution/doc/txt/oscam.ird.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
oscam.ird(5) File Formats Manual oscam.ird(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.ird - Irdeto guessing table for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
Irdeto guessing table
|
||||
|
||||
DESCRIPTIONS
|
||||
<byte3>:<byte4-7>:<CAID>:<SID>
|
||||
Irdeto guessing table by signature
|
||||
|
||||
EXAMPLES
|
||||
12:0000000a:12ab:cd01
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.ird(5)
|
||||
25
Distribution/doc/txt/oscam.provid.txt
Normal file
25
Distribution/doc/txt/oscam.provid.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
oscam.provid(5) File Formats Manual oscam.provid(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.provid - provider table for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
provider table
|
||||
|
||||
DESCRIPTIONS
|
||||
<caid>:<provid>|<provider>|<satellite>|<language>
|
||||
provider table
|
||||
|
||||
EXAMPLES
|
||||
0100:012345|MyPay-TV|Astra 19E|German
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.provid(5)
|
||||
33
Distribution/doc/txt/oscam.ratelimit.txt
Normal file
33
Distribution/doc/txt/oscam.ratelimit.txt
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
oscam.ratelimit(5) File Formats Manual oscam.ratelimit(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.ratelimit - ECMs ratelimit for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
limit rate of ECMs allowed for an interval
|
||||
|
||||
DESCRIPTIONS
|
||||
CAID:provider ID:service ID:ChID:ratelimitecm:ratelimitseconds:srvidholdseconds
|
||||
|
||||
ratelimitecm
|
||||
number of different SIDs in ECMs allowed for an interval
|
||||
|
||||
ratelimitseconds
|
||||
interval in seconds for ratelimit
|
||||
|
||||
srvidholdseconds
|
||||
extra time in seconds this service ID is kept in a slot before another service ID can take its place
|
||||
|
||||
EXAMPLES
|
||||
0100:00002A:3A3A:4A00:0002:0010:0004
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.server(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.ratelimit(5)
|
||||
709
Distribution/doc/txt/oscam.server.txt
Normal file
709
Distribution/doc/txt/oscam.server.txt
Normal file
|
|
@ -0,0 +1,709 @@
|
|||
oscam.server(5) File Formats Manual oscam.server(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.server - reader configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
The server configuration file for OSCam contains reader parameters. sections in oscam.server are recurring (more than one
|
||||
reader possible). At least one [reader] section is required.
|
||||
|
||||
DESCRIPTIONS
|
||||
The [reader] section
|
||||
label = name
|
||||
name for reader, required
|
||||
|
||||
enable = 0|1
|
||||
0 = deactivate reader, default:1
|
||||
|
||||
description = text
|
||||
description of reader, default:none
|
||||
|
||||
protocol = reader protocol
|
||||
reader protocol, required:
|
||||
|
||||
camd35|cs357x
|
||||
cccam
|
||||
cs378x
|
||||
constcw
|
||||
gbox
|
||||
ghttp
|
||||
internal
|
||||
mouse
|
||||
mp35
|
||||
newcamd|newcamd525
|
||||
newcamd524
|
||||
pcsc
|
||||
radegast
|
||||
scam
|
||||
sc8in1
|
||||
serial
|
||||
smargo
|
||||
smartreader
|
||||
|
||||
device = [<readertype>;]serial:serialnum|bus:device|
|
||||
<device|device:slot>|
|
||||
<ip|hostname>,<port>[,<lport>]|
|
||||
<ip|hostname>,<gboxpport>|
|
||||
<ip|hostname>,<scamport>|
|
||||
pcsc|
|
||||
<0|1>>|
|
||||
constantcw
|
||||
define local or remote reader
|
||||
|
||||
readertype: set reader type
|
||||
|
||||
SR: Smartreader+ (default)
|
||||
Infinity: Infinity USB
|
||||
TripleP1: Smargo Triple Reader port 1
|
||||
TripleP2: Smargo Triple Reader port 2
|
||||
TripleP3: Smargo Triple Reader port 3
|
||||
|
||||
bus:device: bus name and device name of the Smartreader+ or
|
||||
Infinity USB (get the names with lsusb 'Bus'
|
||||
and 'Device')
|
||||
|
||||
serialnum: serial number of reader of the Smartreader+ or
|
||||
Infinity USB
|
||||
|
||||
device: device name
|
||||
|
||||
device:slot: device name and slot number sc8in1 [1-8]
|
||||
(only one SC8in1 reader supported)
|
||||
|
||||
ip|hostname: IP address or host name
|
||||
|
||||
port: TCP/IP port
|
||||
|
||||
lport: remapping to local TCP/IP port
|
||||
|
||||
gboxpport: UDP port for remote gbox peer
|
||||
|
||||
PCSC: number of PCSC reader, starting with 0
|
||||
|
||||
0|1: for Coolstream HD-1 STB only: select reader 0 or
|
||||
reader 1
|
||||
|
||||
constantcw: constant CW file name
|
||||
|
||||
constant CW file format:
|
||||
|
||||
· standard format
|
||||
|
||||
CAID:Provider ID:Service ID:PMT ID:ECM PID::key (16 Bytes seperated by spaces)
|
||||
|
||||
example: 1234:123456:1234:2345:3456::00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
|
||||
· extended OScam format
|
||||
|
||||
CAID:Provider ID:Service ID:PMT ID:ECM PID:Video PID:key (16 Bytes seperated by spaces)
|
||||
|
||||
example: 1234:123456:1234:2345:3456:7890:00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
|
||||
|
||||
detect = [!]CD|[!]DSR|[!]CTS|[!]RING|[!]NONE|[!]gpio[1-7]
|
||||
status detect of card, NONE = no detection, ! = inverse, default:CD
|
||||
|
||||
cardmhz = mhz
|
||||
set standard SC frequency in units of 10 kHz, for Irdeto SC set to 600 mhz, for Dreambox DM800 / DM8000 set to 2700
|
||||
mhz, for Dreambox DM7025 set to 8300 mhz, for older PowerPC Dreambox STBs set to 3150 mhz, refer to OVERCLOCKING,
|
||||
default:357
|
||||
|
||||
mhz = frequency
|
||||
set reader frequency in units of 10 kHz, if mhz > cardmhz you are in overclocking mode. For Smargo readers and Dreambox
|
||||
internal readers frequency will be set by ATR if autospeed is set to 1, default:357
|
||||
|
||||
autospeed = 0|1
|
||||
1 = sets mhz according to ATR. Currently only used for smartreader, Smargo and Dreambox internal protocol, other read‐
|
||||
ers will be adapted to use this parameter as well. If You wan't to overclock you're card set it to 0, default:1
|
||||
|
||||
deprecated = 0|1
|
||||
First the SC will be initialized in normal mode. If it fails, the SC will be automatically reverted to deprecated mode,
|
||||
so that the SC speed will not be changed and the communication will remain on normal ATR speed of 9600 baud.
|
||||
|
||||
1 = use deprecated SC mode only, default:0
|
||||
|
||||
mode = mode
|
||||
set card init mode for AzBox internal reader, default:none
|
||||
|
||||
smargopatch = 0|1
|
||||
1 = enable workaround for Smartreader+ reader until native mode works, default:0
|
||||
|
||||
sc8in1_dtrrts_patch = 0|1
|
||||
1 = enable fix for SC8in1/MCR DTR/RTS kernel bug, default:0
|
||||
|
||||
use_gpio = 0|1
|
||||
1 = use GPIO to init the reader. This needs to be set on WRT54G router, default:0
|
||||
|
||||
ins2e06 = payload
|
||||
add check control for pin payload (4 hex bytes) for NDS Videoguard 2 SCs, valid for physical readers only, default:none
|
||||
|
||||
ins7e = payload
|
||||
add 26 hex-bytes payload for NDS Videoguard 2 SCs, valid for physical readers only, default:none
|
||||
|
||||
ins7e11 = TA1 byte
|
||||
set TA1 byte for NDS Videoguard 2 SCs, valid for physical readers only, default:none
|
||||
|
||||
fix07 = 0|1
|
||||
1=enable 0x07 fix for NDS Videoguard 2 SCs, valid for physical readers only, default:1
|
||||
|
||||
force_irdeto = 0|1
|
||||
1 = force Irdeto SC mode even if RSA key is set for Irdeto tunnled Nagravion SC, default:0
|
||||
|
||||
nagra_read = 0|1|2
|
||||
read Nagravison records (on NCMED SCs only):
|
||||
|
||||
0 = disabled (default)
|
||||
1 = read all records with expired rights
|
||||
2 = read records with valid rights only
|
||||
|
||||
rsakey = RSA key
|
||||
RSA key for Nagravision/Tiger SCs, CAM key data for Irdeto SCs, Conax SCs, default:none
|
||||
|
||||
deskey = DES key
|
||||
DES key for Viaccess SCs post-processing, default:none
|
||||
|
||||
boxkey = box key
|
||||
box key for Nagravision SCs / CAM key for Irdeto SCs
|
||||
|
||||
pincode = pincode
|
||||
pincode for Conax, Cryptoworks and Viaccess SCs, default:none
|
||||
|
||||
fix9993 = 0|1
|
||||
1 = enable fix for 9993 error with CAID 0919 Videoguard SCs, default:0
|
||||
|
||||
readtiers = 0|1|2
|
||||
method to get tiers of NDS Videoguard SCs:
|
||||
|
||||
0 = disabled (default)
|
||||
1 = ins70 method
|
||||
2 = ins76 method
|
||||
|
||||
boxid = NDS box ID
|
||||
NDS receiver box id
|
||||
|
||||
ndsversion = 0|1|12|2
|
||||
set NDS Videoguard version
|
||||
|
||||
0 = autodetection (default)
|
||||
1 = NDS Videoguard 1
|
||||
12 = NDS Videoguard 1+
|
||||
2 = NDS Videoguard 2
|
||||
|
||||
aeskeys = CAID #0@provid:AES key #0 CAID #0[,AES key #1 CAID #0],...[;CAID #1@provid:AES key #0 CAID #1[,AES key #1 CAID
|
||||
#1],...]...
|
||||
multiple 16 bytes AES keys for Viaccess SCs (the used postprocessing AES key is specified through the D2 nano of the
|
||||
ECM)
|
||||
|
||||
special AES keys:
|
||||
|
||||
00 = do not return any CW, no AES key specified
|
||||
FF = return CW received from the S, no AES key specified
|
||||
|
||||
example:
|
||||
|
||||
aeskeys =
|
||||
0500@012345:000102030405060708090a0b0c0d0e0f;0500@543210:000102030405060708090a0b0c0d0e0f,0,0f0e0d0c0b0a090807060504030201
|
||||
|
||||
key = DES key
|
||||
key for newcamd remote reader encryption
|
||||
|
||||
user = name
|
||||
user for remote reader
|
||||
|
||||
password = password
|
||||
password for remote reader
|
||||
|
||||
services = [!]services[,[!]<services>]...
|
||||
reader [de]assignment to service group, default=none
|
||||
|
||||
caid = <CAID>[&<mask>][:<target CAID>][,<CAID>[&<mask>][:target <CAID>]]...
|
||||
define and mapping of CAIDs for reader, default:all CAIDs with mask FFFF
|
||||
|
||||
example: caid = 0100
|
||||
caid = 0200&ffee:0300
|
||||
caid = 0400&ff00:0500,0600
|
||||
caid = 0702,0722
|
||||
caid = 0702&ffdf (shortcut for the example above)
|
||||
|
||||
ident = <CAID>:<provid>[,provid]...[;<CAID>:<provid>[,provid]...]...
|
||||
set CAID and SC specific ident for reader
|
||||
|
||||
example: ident = 0100:123456,234567;0200:345678,456789
|
||||
|
||||
class = [!]class[,[!]class]...
|
||||
set SC specific class in hex for reader
|
||||
|
||||
example: class = 01,02,!1b,!2b
|
||||
|
||||
chid = CAID:ChID
|
||||
set SC specific ChIDs for reader, default:none
|
||||
|
||||
example: chid = 0100:12
|
||||
|
||||
group = 1..64[,1..64]...
|
||||
reader assingment to groups, default:none, required
|
||||
|
||||
audisabled = 0|1
|
||||
1 = exclude reader from auto AU, default:0
|
||||
|
||||
auprovid = provider ID
|
||||
set provider ID to use the right reader for auto AU
|
||||
|
||||
example: auprovid = 123456
|
||||
|
||||
disableserverfilter = 0|1
|
||||
1 = ignore caid and provid settings of reader due faulty clients, default:0
|
||||
|
||||
inactivitytimeout = seconds
|
||||
inactivity timeout for all TCP based remote readers, -1 = reconnect on network failure for newcamd, even in idle,
|
||||
default:0
|
||||
|
||||
reconnecttimeout = seconds
|
||||
reconnect if missing answers from a remote reader, default:30
|
||||
|
||||
reconnectdelay = milli-seconds
|
||||
set maximum TCP connection block delay, default:60000
|
||||
|
||||
connectoninit = 0|1
|
||||
1 = allow newcamd connections to be established on startup although there isn't a request yet, default:0
|
||||
|
||||
keepalive = 0|1
|
||||
1 = allow cs378x TCP socket to be always connected, default:0. Always on if cacheex reader type.
|
||||
|
||||
fallback = 0|1
|
||||
1 = define reader as fallback, standard and fallback reader must have the same group, default:0
|
||||
|
||||
fallback_percaid = <CAID>[:<ident>[,ident]]...[;<CAID>[:<ident>[,ident]]...]....
|
||||
use reader as fallback for defined CAIDs only, two-digit wildcard CAIDs are possible, fallback_percaid overrules fall‐
|
||||
back, default:none
|
||||
|
||||
example: fallback_percaid = 1234:234567;89;10:345678
|
||||
|
||||
emmcache = usecache,rewrite,logging
|
||||
set EMM cache of local reader:
|
||||
|
||||
usecache = 0|1||2
|
||||
|
||||
0 = EMM caching disabeld (default)
|
||||
1 = enable EMM caching and save EMMs to file after
|
||||
stopping OSCam
|
||||
2 = enable EMM caching, don't save EMMs to file
|
||||
after stopping OSCam
|
||||
|
||||
rewrite = determines how often one and the same EMM is
|
||||
written, default:0
|
||||
|
||||
logging = EMM logging mask:
|
||||
|
||||
0 = EMM logging disabled (default)
|
||||
1 = logging EMM errors
|
||||
2 = logging written EMMs
|
||||
4 = logging skipped EMMs
|
||||
8 = logging blocked EMMs
|
||||
16 = logging disabled AU
|
||||
|
||||
example: emmcache = 1,3,2
|
||||
|
||||
cacheex = 0|1|2|3
|
||||
set cache exchange mode
|
||||
|
||||
0: disable cache exchange mode (default)
|
||||
1: enable cache exchange pull mode
|
||||
2: enable cache exchange push mode for camd 3.5x / 3.57x and CCcam
|
||||
protocol
|
||||
3: enable reverse cache exchange push mode for camd 3.5x / 3.57x
|
||||
and CCcam protocol
|
||||
|
||||
Identical cache exchange modes must be set on local OSCam server and remote OSCam user asccount.
|
||||
|
||||
Please consider memory consumption.
|
||||
|
||||
cacheex_maxhop = hops
|
||||
define maximum hops for cache exchange, default=10
|
||||
|
||||
csp_ecm_filter = [caid][&mask][@provid][$servid],n
|
||||
cache exchange incoming ECM filter setting (mode 2 only) for Cardservproxy, default:none
|
||||
|
||||
cacheex_drop_csp = 0|1
|
||||
1 = drop incoming Cardservproxy cache (mode 2 only), detection is zero ecmd5, default:0
|
||||
|
||||
cacheex_allow_request = 0|1
|
||||
1 = allow incoming ECM request (mode 2), default:1
|
||||
|
||||
cacheex_allow_filter = 0|1
|
||||
1 = allow cache exchange filter (for cache exchange mode 2 only), default:1
|
||||
|
||||
cacheex_block_fakecws = 0|1
|
||||
1 = enable fake DCWs blocking (for cache exchange mode 2 only), get fake DCWs form oscam.fakecws, default:0
|
||||
|
||||
ecmwhitelist = [CAID[@provid]:]length[,length]...[;[CAID[@provid]:]length[,length]...]...
|
||||
set valid ECM length per CAID and provid in hex, default:none,provid=000000
|
||||
|
||||
example: ecmwhitelist = 10,20,0a,0b
|
||||
ecmwhitelist = 0100:10,20;0200@123456:0a,4b
|
||||
|
||||
In normal operation mode this parameter is not required.
|
||||
|
||||
ecmheaderwhitelist = [CAID[@provid]:]header[,header]...[;[CAID[@provid]:]header[,header]...]...
|
||||
set vaild ECM header per CAID and provid in hex, default:none,provid=000000
|
||||
|
||||
ratelimitecm = count
|
||||
number of different SIDs in ECMs allowed for an interval, default:0
|
||||
|
||||
ecmnotfoundlimit = count
|
||||
number of ECMs with "not found" answer until the reader will be restarted, 0 = no limit, default:0
|
||||
|
||||
resetcycle = count
|
||||
number of ECMs until SC reset is performed, 0 = disabled, valid for physical readers only, default:0
|
||||
|
||||
ratelimitseconds = seconds
|
||||
interval for rate limit, default:0
|
||||
|
||||
ecmunique = 0|1
|
||||
1 = enable check for matching ECM hash in ratelimit slot , default:0
|
||||
|
||||
srvidholdseconds = seconds
|
||||
time to keep service ID in ratelimit slot, during this time checkeding for ecmunique is disbaled, default:0
|
||||
|
||||
cooldown = delay,duration
|
||||
define cooldown:
|
||||
|
||||
delay: delay in seconds for which the reader is allowed to do
|
||||
more ECM requests than defined by ecmratelimit,
|
||||
default: none
|
||||
|
||||
duration: duration in seconds the reader needs to cooldown,
|
||||
default:none
|
||||
|
||||
ratelimitecm and ratelimitseconds are required
|
||||
|
||||
maxparallel = count
|
||||
maximum number of parallel active services allowed for this reader,
|
||||
0 = unlimited (default). Useful for limiting load on readers with
|
||||
slot restrictions. When the limit is reached, the reader is
|
||||
temporarily skipped and other readers are tried. A service slot
|
||||
expires when no ECM is received within the measured ECM interval
|
||||
plus the paralleltimeout buffer.
|
||||
|
||||
example: maxparallel = 2
|
||||
|
||||
paralleltimeout = milliseconds
|
||||
timeout buffer in milliseconds added to the measured ECM interval
|
||||
to determine when a service slot expires, default: 1000
|
||||
|
||||
example: paralleltimeout = 1500
|
||||
|
||||
parallelfactor = factor
|
||||
multiplier for pending slots used during zapping. Pending
|
||||
slots allow temporary capacity overrun while switching channels.
|
||||
Formula: pending_slots = round(maxparallel * parallelfactor)
|
||||
Supports decimal values (e.g. 1.5 or 2.0), default: 1.5
|
||||
|
||||
When zapping, new services go to pending slots if active slots
|
||||
are full. Pending are promoted to active when slots free up,
|
||||
or dropped when active services prove they're still running.
|
||||
|
||||
Set to 0 to disable pending slots (strict limit, may cause
|
||||
black screen when zapping with single reader).
|
||||
|
||||
example: parallelfactor = 1.5 (with maxparallel=2: 3 pending slots)
|
||||
|
||||
blocknano = nano[,nano]...|all
|
||||
list of EMM-nanos to block (in hex w/o 0x) or all EMM-nanos, valid for physical readers only, default:none
|
||||
|
||||
example: blocknano = 45,93,7a,ff
|
||||
blocknano = all
|
||||
|
||||
blockemm-u = 0|1
|
||||
1 = block unique EMMs, default:0
|
||||
|
||||
blockemm-s = 0|1
|
||||
1 = block shared EMMs, default:0
|
||||
|
||||
blockemm-g = 0|1
|
||||
1 = block global EMMs, default:0
|
||||
|
||||
blockemm-unknown = 0|1
|
||||
1 = block unknown types of EMMs, default:0
|
||||
|
||||
blockemm-bylen = [length range,length range]...
|
||||
block all types of EMMs by length, default:none
|
||||
|
||||
example: blockemm-bylen = 1-10,11-
|
||||
|
||||
read_old_classes = 0|1 (Viaccess SCs only)
|
||||
0 = read only active entitlements 1 = read all entitlements (default)
|
||||
|
||||
saveemm-u = 0|1
|
||||
1 = save unique EMMs to log file, default:0
|
||||
|
||||
saveemm-s = 0|1
|
||||
1 = save shared EMMs to log file, default:0
|
||||
|
||||
saveemm-g = 0|1
|
||||
1= save global EMMs to log file, default:0
|
||||
|
||||
saveemm-unknown = 0|1
|
||||
1 = save unknown types of EMMs to log file, default:0
|
||||
|
||||
savenano = nano[,nano]....|all (obsolete)
|
||||
list of EMM-nanos to save (in hex w/o 0x) or all EMM-nanos, only valid for physical readers, default:none
|
||||
|
||||
example: savenano = 45,93,7a,ff
|
||||
savenano = all
|
||||
|
||||
readnano = [path]filename
|
||||
write file (usually a copy of a file saved by savenano) to your smartcard, if no path is specified, the specified file
|
||||
is searched for in the configuration directory, only valid for physical readers, default:none
|
||||
|
||||
example: readnano = write.emm
|
||||
readnano = /var/oscam/write.emm
|
||||
|
||||
dropbadcws = 0|1
|
||||
1 = reject bad CWs, send "not found" instead of bad CWs, default:0
|
||||
|
||||
disablecrccws = 0|1
|
||||
1 = disable CRC for CW, default: 0
|
||||
|
||||
In normal operation mode this parameter is not required. Parameter is incompatible with DVB standard.
|
||||
|
||||
ident = <CAID1>[:<ident1>[,<ident2>]...][;<CAID2>[:<ident3>[,<ident4>]...]]...
|
||||
use this reader as local in loadbalancer's reader selection, default:none
|
||||
|
||||
lb_whitelist_services = <services>,<services>...
|
||||
reader assignement to service group for channels which may never be blocked by the loadbalancer to the reader ,
|
||||
default=none
|
||||
|
||||
lb_weight = weight
|
||||
the higher the value the higher the probability for reader selection in load balacing mode, default:100
|
||||
|
||||
It's an divider for the average responstime.
|
||||
|
||||
lb_force_fallback = 0|1
|
||||
1 = set the reader always as fallaback for load balacing without considering the reader's statistics, default:0
|
||||
|
||||
cccversion = <main version>.<version>.<sub version>
|
||||
set CCcam version, default:none
|
||||
|
||||
example: cccversion = 1.2.34
|
||||
|
||||
cccmaxhops = hops
|
||||
set CCcam maximum SC distance hops, default:10
|
||||
|
||||
-1 = disabled
|
||||
0 = remote local SCs only
|
||||
1 = remote local SCs and + 1 hop
|
||||
2 = remote local SCs and + 2 hops
|
||||
and so on
|
||||
|
||||
After reading this SC hop will be incremented by one.
|
||||
|
||||
ccchop = hop
|
||||
set hop for non CCCam readers, default:0
|
||||
|
||||
cccreshare = hop
|
||||
set reader's CCcam reshare hop, default:0
|
||||
|
||||
-1 = reshare value off cccam in global config
|
||||
0 = resharing for direct peer only
|
||||
x = resharing for direct peer and share level x
|
||||
|
||||
cccwantemu = 0|1
|
||||
1 = request to provide emu from CCCam server, too, default:0
|
||||
|
||||
ccckeepalive = 0|1
|
||||
1 = send keepalive messages to keep connection to remote CCCam server up, default:0
|
||||
|
||||
cccreconnect = timeout
|
||||
reconnect again after ECM request timeout in milli-seconds, default:4000
|
||||
|
||||
cccmindown = number
|
||||
filters all readers with hops smaller than number, default:0
|
||||
|
||||
gbox_reshare = level
|
||||
gbox reshare level of local cards, default:0
|
||||
|
||||
gbox_max_distance = distance
|
||||
maximum distance to receive gbox peer cards, default:2
|
||||
|
||||
gbox_max_ecm_send = number
|
||||
maximum of gbox peers ECMs will be send to, default:3
|
||||
|
||||
use_ssl = 0|1
|
||||
1 = use SSL for ghttp protocol, default:0
|
||||
|
||||
OVERCLOCKING
|
||||
· Dreambox and other internal readers
|
||||
|
||||
For Dreambox and other internal readers the highest possible clockrate will be auto detected. The mhz parameter lets
|
||||
you override the values chosen by OSCam, if it differs from 357 and 358, but usually you will not set any value for
|
||||
mhz.
|
||||
|
||||
For certain Dreamboxes (especially PPC clones) the default mhz parameter leads to slow ECM times and/or "not found"
|
||||
ECMs. By setting mhz to values like 200, 300, 400, ... 1600 you can find a value that works for your receiver and your
|
||||
card. The higher the mhz value, the slower the ECM time (strange enough).
|
||||
|
||||
If you choose the value too low, your card is not recognized (no ATR or "card not supported"). If you choose the value
|
||||
too high, you get slow ECM times. Our experience is that either no mhz line, or a line mhz = 1000 works best.
|
||||
|
||||
· Phoenix / Smartmouse reader
|
||||
|
||||
Overclocking does not work with Windows and Mac OS X. Set mhz equivalent to the frequency of the reader. OSCam can
|
||||
not set the frequency of the reader.
|
||||
|
||||
· Smargo Smartreader+
|
||||
|
||||
Use protocol = smargo for the FDDI kernel drivers (no libusb needed) or (not recommended) use protocol = smartreader
|
||||
for OSCam's driver implementation based on libusb.
|
||||
|
||||
Set the reader frequency with the native Smargo Smartreader+ tool (srp_tools). If not setting mhz and cardmhz, OSCam
|
||||
tries to set the baudrate automatically, according to the maximum speed indicated by ATR. Overclocking is possible.
|
||||
|
||||
OSCam tries to set the baudrate automatically. A standard serial port has limited baudrate settings, so SC overclocking
|
||||
might not work. When using a serial reader the best way for overclocking is connecting it to a FTDI based USB to serial
|
||||
port adapter.
|
||||
|
||||
If overclocking does not work, verify the effective baudrate in the logfile. If it deviates too much from the requested
|
||||
baudrate, the SC will not be recognized (no ATR) and the value for mhz should be adjusted again. The higher the baudrate,
|
||||
the more accurate the effective baudrate can be.
|
||||
|
||||
CACHE EXCHANGE
|
||||
· pull mode (on request: cache exchange from remote to local OSCam)
|
||||
|
||||
ECM requests will be forwarded to the remote cache exchange partner. If the CW could not be found in the cache of the
|
||||
remote exchange partner, a not found will be answered. If the CW could not be found in the cache of the remote exchange
|
||||
partner but a pending ECM request is open, the request will be re-initiated after the wait time defined in cacheexwait‐
|
||||
time.
|
||||
|
||||
· push mode (continuous: cache exchange from remote to local OSCam)
|
||||
|
||||
CWs from the remote cache exchange partner will be forwarded to the local cache. Forwarding only works while the camd
|
||||
camd 3.5x / 3.57x or CCcam protocol connection between the local and remote OSCam has been established.
|
||||
|
||||
· reverse push mode (continuous: cache exchange from local to remote OSCam)
|
||||
|
||||
CWs from the local cache will be forwarded to the remote cache exchange partner. Forwarding only works while the camd
|
||||
camd 3.5x / 3.57x or CCcam protocol connection between the remote and local OSCam has been established.
|
||||
|
||||
EXAMPLES
|
||||
· serial mouse compatible reader
|
||||
|
||||
[reader]
|
||||
label = myserialmousereader
|
||||
detect = cd
|
||||
protocol = mouse
|
||||
device = /dev/ttyS1
|
||||
group = 1
|
||||
caid = 0100
|
||||
services = myservice,!thisservice
|
||||
|
||||
· USB mouse compatible reader
|
||||
|
||||
[reader]
|
||||
label = myusbmousereader
|
||||
detect = cd
|
||||
protocol = mouse
|
||||
device = /dev/ttyUSB0
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 2
|
||||
caid = 0200
|
||||
|
||||
· camd 3.78x reader
|
||||
|
||||
[reader]
|
||||
label = mycamd378xreader
|
||||
protocol = cs378x
|
||||
device = 192.168.0.1,1234
|
||||
user = user1
|
||||
password = password1
|
||||
group = 3
|
||||
|
||||
· newcamd reader
|
||||
|
||||
[reader]
|
||||
label = mynewcamdreader
|
||||
protocol = newcamd
|
||||
key = 0102030405060708091011121314
|
||||
device = 192.168.0.2,2345
|
||||
user = user2
|
||||
password = password2
|
||||
group = 4
|
||||
|
||||
· CCcam reader
|
||||
|
||||
[reader]
|
||||
label = mycccamreader
|
||||
protocol = cccam
|
||||
device = 192.168.0.3,3456
|
||||
user = user3
|
||||
password = password3
|
||||
group = 5
|
||||
caid = 0300,0400,0500
|
||||
cccversion = 1.2.3
|
||||
|
||||
· PCSC reader
|
||||
|
||||
[reader]
|
||||
label = mypcscreader
|
||||
protocol = pcsc
|
||||
device = 0
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 6
|
||||
caid = 0600
|
||||
|
||||
· Smargo Smartreader+
|
||||
|
||||
[reader]
|
||||
label = mysmartreader
|
||||
protocol = smartreader
|
||||
device = 001:002
|
||||
aeskey = 0102030405060708090a0b0c0d0e0f10
|
||||
group = 7
|
||||
caid = 0700
|
||||
|
||||
· internal reader
|
||||
|
||||
[reader]
|
||||
label = myinternalreader
|
||||
protocol = internal
|
||||
device = /dev/sci0
|
||||
group = 8
|
||||
caid = 0800
|
||||
|
||||
· sc8in1 reader
|
||||
|
||||
[reader]
|
||||
label = mysc8in1reader
|
||||
protocol = sc8in1
|
||||
device = /dev/ttyUSB0:1
|
||||
group = 9
|
||||
caid = 0900
|
||||
|
||||
· constant CW
|
||||
|
||||
[reader]
|
||||
label = myconstantcw
|
||||
protocol = constcw
|
||||
device = /var/keys/constant.cw
|
||||
group = 10
|
||||
|
||||
· gbox reader
|
||||
|
||||
[reader]
|
||||
label = mygboxreader
|
||||
protocol = gbox
|
||||
device = 192.168.0.4,45678,56789
|
||||
user = user4
|
||||
password = password4
|
||||
group = 11
|
||||
caid = 1100
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.services(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.server(5)
|
||||
37
Distribution/doc/txt/oscam.services.txt
Normal file
37
Distribution/doc/txt/oscam.services.txt
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
oscam.services(5) File Formats Manual oscam.services(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.services - definition of services for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
service definitions
|
||||
|
||||
DESCRIPTIONS
|
||||
The [<service name>] section
|
||||
service name section, service name sections are recurring, required, maximum 64 services are allowed
|
||||
|
||||
caid = CAID[,CAID]...
|
||||
listing of CAIDs in hex
|
||||
|
||||
provid = provider ID[,provider ID]...
|
||||
listing of provider IDs in hex
|
||||
|
||||
srvid = service ID[,service ID]...
|
||||
listing of service IDs in hex
|
||||
|
||||
EXAMPLES
|
||||
[myservice]
|
||||
CAID=0100,0200,000A
|
||||
provid=000001,ABCDEF
|
||||
srvid=0001,0002,000A,000B
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.srvid(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.services(5)
|
||||
34
Distribution/doc/txt/oscam.srvid.txt
Normal file
34
Distribution/doc/txt/oscam.srvid.txt
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
oscam.srvid(5) File Formats Manual oscam.srvid(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.srvid - service ID configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
service ID mappings
|
||||
|
||||
DESCRIPTIONS
|
||||
CAID[,CAID]...:service ID|[provider]|[name]|[type]|[description]
|
||||
|
||||
mapping between CAID, service ID, provider, name, type and description of service
|
||||
|
||||
ANNONTATIONS
|
||||
Please use Unix text file format only.
|
||||
|
||||
You only need the oscam.srvid when using the monitor or the web interface. For saving memory consumption only insert the
|
||||
service IDs you really need. Some external programs use their own oscam.srvid and do not need the oscam.srvid of OSCam.
|
||||
|
||||
EXAMPLES
|
||||
0001,0002,0003:000a|my provider 1|tv name 1|tv|my tv package
|
||||
0004,0005,0006:000a|my provider 2|radio name 2|radio|my radio package
|
||||
0006:000b|my provider 3|tv name 3|
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid2(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.srvid(5)
|
||||
30
Distribution/doc/txt/oscam.srvid2.txt
Normal file
30
Distribution/doc/txt/oscam.srvid2.txt
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
oscam.srvid2(5) File Formats Manual oscam.srvid2(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.srvid2 - service ID configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
service ID mappings
|
||||
|
||||
DESCRIPTIONS
|
||||
service ID:CAID[:@provider ID[@provider ID]...][,:CAID[:@provider ID[@provider ID]...]][name]|[type]|[descrip‐
|
||||
tion]|[provider]
|
||||
|
||||
mapping between service ID, CAID, provider ID, name, type, description and proivder
|
||||
|
||||
ANNONTATIONS
|
||||
Please use Unix text file format only.
|
||||
|
||||
You only need the oscam.srvid2 when using the monitor or the web interface. For saving memory consumption only insert the
|
||||
service IDs you really need. Some external programs use their own oscam.srvid2 and do not need the oscam.srvid2 of OSCam.
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5),
|
||||
oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.srvid2(5)
|
||||
31
Distribution/doc/txt/oscam.tiers.txt
Normal file
31
Distribution/doc/txt/oscam.tiers.txt
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
oscam.tiers(5) File Formats Manual oscam.tiers(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.tiers - TIER configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
TIER mappings
|
||||
|
||||
DESCRIPTIONS
|
||||
CAID[,CAID]...:TIER ID|description
|
||||
|
||||
mapping between CAID, TIER ID and description of TIER
|
||||
|
||||
ANNONTATIONS
|
||||
Please use Unix text file format only.
|
||||
|
||||
EXAMPLES
|
||||
0001,0002,0003:000a|my TIER 1
|
||||
0004:000b|my TIER 2
|
||||
0005:000b|my TIER 3
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5),
|
||||
oscam.srvid2(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.tiers(5)
|
||||
150
Distribution/doc/txt/oscam.txt
Normal file
150
Distribution/doc/txt/oscam.txt
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
oscam(1) General Commands Manual oscam(1)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
OSCam - SC server
|
||||
|
||||
DESCRIPTIONS
|
||||
The OSCam software is an open source multi-protocol/multi-platform SC server.
|
||||
|
||||
Please check the compile options for included features in the binary.
|
||||
|
||||
OSCam supports the following protocols:
|
||||
|
||||
· newcamd with cascading/remote server ECM support
|
||||
|
||||
· camd 3.3x TCP
|
||||
|
||||
· camd camd 3.5x / 3.57x UDP with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
|
||||
· camd 3.78x TCP with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
|
||||
· CCcam with cascading/remote server ECM support, ECM and EMM support with size > 256 bytes
|
||||
|
||||
· DVB API with multi tuner and PIP support
|
||||
|
||||
· gbox with cascading/remote server ECM support
|
||||
|
||||
· serial (HSIC, SSSP, BOMBA, DSR 9500)
|
||||
|
||||
· radegast
|
||||
|
||||
OSCam works on the following platforms:
|
||||
|
||||
· Linux (Tuxbox, ARM, MIPS, MIPSel, SH-4, PowerPC, ...)
|
||||
|
||||
· Windows (based on cygwin1.dll)
|
||||
|
||||
· Mac OS X
|
||||
|
||||
OPTIONS
|
||||
-a|--crash-dump
|
||||
write oscam.crash on segfault (needs installed GDB and OSCam compiled with debug infos -ggdb)
|
||||
|
||||
-b|--daemon
|
||||
starts in background, writing oscam.version with starttime and version info in temporary directory
|
||||
|
||||
-B|--pidfile <filename>
|
||||
set PID file, overrides pidfile of oscam.conf, default:none
|
||||
|
||||
-c|--config-dir <directory>
|
||||
read configuration from <directory>, default:see CS_CONFDIR in globals.h, while starting OSCam prints warnings on
|
||||
invalid keywords, comment lines start with # character.
|
||||
|
||||
Autodiscover of the following directories will be done:
|
||||
|
||||
|
||||
· /etc/tuxbox/config
|
||||
|
||||
· /etc/tuxbox/config/oscam
|
||||
|
||||
· /config/oscam
|
||||
|
||||
· /usr/keys
|
||||
|
||||
· /var/etc
|
||||
|
||||
· /var/etc/oscam
|
||||
|
||||
· /var/keys
|
||||
|
||||
· /var/oscam
|
||||
|
||||
· /var/tuxbox/config
|
||||
|
||||
|
||||
-d|--debug <level>
|
||||
debug level mask:
|
||||
|
||||
0 = no debugging (default)
|
||||
2 = ATR parsing info, ECM dumps, CW dumps
|
||||
4 = traffic from/to the reader
|
||||
8 = traffic from/to the clients
|
||||
16 = traffic to the reader-device on IFD layer
|
||||
32 = traffic to the reader-device on I/O layer
|
||||
64 = EMM logging
|
||||
128 = DVBAPI logging
|
||||
256 = load balancing logging
|
||||
512 = cache exchange logging
|
||||
1024 = client ECM logging
|
||||
2048 = CSP logging
|
||||
4096 = CWC logging
|
||||
65535 = debug all
|
||||
|
||||
-g|--gcollect <mode>
|
||||
garbage collector debug mode, default:none:
|
||||
|
||||
1 = immediate free
|
||||
2 = check for double frees
|
||||
|
||||
-h|--help
|
||||
usage
|
||||
|
||||
-I|--syslog-ident <ident>
|
||||
set syslog ident, default:oscam
|
||||
|
||||
-p|--pending-ecm <number>
|
||||
maximum number of pending ECM packets, default:32, maximum:255
|
||||
|
||||
-r|--restart <level>
|
||||
restart level:
|
||||
|
||||
0 = disabled, restart request sets exit status to 99
|
||||
1 = restart activated, web interface can restart oscam (default)
|
||||
2 = like 1, but also restart on segmentation faults
|
||||
|
||||
-S|--show-sensitive
|
||||
do not filter sensitive info (card serial numbers) in the logs
|
||||
|
||||
-s|--capture-segfaults
|
||||
capture segmentation faults
|
||||
|
||||
-t|--temp-dir <directory>
|
||||
use <directory> for temporary data, default:temporary directory of OS
|
||||
|
||||
-V|--build-info
|
||||
show OSCam version info
|
||||
|
||||
-w|--wait <seconds>
|
||||
time waiting for system time to be set correctly
|
||||
|
||||
SIGNALS
|
||||
SIGHUP
|
||||
reinit user db, readers, TIERs, services, clients and anti-cascading, for newcamd connections: after reloading the
|
||||
ident, please restart newcamd client
|
||||
|
||||
SIGUSR1
|
||||
shift debug level to next level (see debug level mask above)
|
||||
|
||||
SIGUSR2
|
||||
get reader SC info
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5),
|
||||
oscam.srvid2(5), oscam.tiers(5), oscam.user(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam(1)
|
||||
309
Distribution/doc/txt/oscam.user.txt
Normal file
309
Distribution/doc/txt/oscam.user.txt
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
oscam.user(5) File Formats Manual oscam.user(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.user - user configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
The user configuration file for OSCam contains user definitions. [account] sections in oscam.user are recurring (more than
|
||||
one account).
|
||||
|
||||
DESCRIPTIONS
|
||||
The [account] section
|
||||
user = name
|
||||
account name, required
|
||||
|
||||
pwd = password
|
||||
password for account, required
|
||||
|
||||
description = text
|
||||
description of user account
|
||||
|
||||
disabled = 0|1
|
||||
1 = account disabled, default:0
|
||||
|
||||
hostname = hostname
|
||||
host from which user connection is allowed
|
||||
|
||||
expdate = <year>-<month>-<day>|<year>/<month>/<day>
|
||||
expiration date for account, default:none
|
||||
|
||||
example: expdate = 2001-11-21
|
||||
expdate = 2002/12/22
|
||||
|
||||
allowedprotocols = [camd33][,][camd35][,][cs357x][,][cs378x][,][newcamd][,][cccam][,][gbox][,][radegast]
|
||||
list of all allowed connection protocols, default:all connection protocols
|
||||
|
||||
allowedtimeframe = DAY@HH:MM-HH:MM[,HH:MM-HH:MM][,HH:MM-HH:MM][;DAY@HH:MM-HH:MM[,HH:MM-HH:MM][,HH:MM-HH:MM]]
|
||||
where DAY=SUN,MON,TUE,WED,THU,FRI,SAT or ALL (for all possible days)
|
||||
|
||||
account enabled from hh:mm to hh:mm for the specified day(s), default:none
|
||||
|
||||
comma (,) to separate times and semicolon(; ) to separate the different days.
|
||||
You can use ALL@ if you want the same time frames for everyday.
|
||||
|
||||
Example:
|
||||
allowedtimeframe = ALL@10:00-22:00;MON@00:00-02:00,02:45-04:37;FRI@00:00-10:00,22:00-24:00;SAT@00:00-24:00
|
||||
|
||||
If you use: DAY@22:00-05:00 this will be turned into DAY@00:00-05:00,22:00-24:00
|
||||
|
||||
ALL@ is always checked and used, so you can watch TV the whole day on FRIday in this exemple. There is no problem to overlap ALL@ in a day definition, like for SAT@ definition.
|
||||
|
||||
max_connections = count
|
||||
maximum allowed connections per user when unique level will be adducted, default:1
|
||||
|
||||
uniq = 0|1|2|4
|
||||
unique level:
|
||||
|
||||
0 = disabled (default)
|
||||
1 = only one connection per user is allowed
|
||||
2 = set user to fake if source ip is different
|
||||
(e.g. for newcamd clients with different CAIDs and ports)
|
||||
3 = only one connection per user, but only the last login
|
||||
will survive (old MpCS behavior)
|
||||
4 = set user only to fake if source ip is different,
|
||||
but only the last login will survive
|
||||
|
||||
numusers = quantity
|
||||
anti-cascading: user per account, 0 = anti-cascading disabled, -1 = global value from oscam.conf, default:-1
|
||||
|
||||
penalty = 0|1|2
|
||||
level of penalty:
|
||||
|
||||
-1 = level of oscam.conf (default)
|
||||
0 = only logging
|
||||
1 = send fake CWs
|
||||
2 = temporary user ban
|
||||
3 = send delayed CWs
|
||||
|
||||
fakedelay = 0|1|milli-seconds
|
||||
set fake delay time individually for user:
|
||||
|
||||
0 = disable fake delay
|
||||
-1 = fake delay of oscam.conf (default)
|
||||
|
||||
acosc_max_ecms_per_minute = count
|
||||
maximum ecms per minute, 0 = unlimited, default:0
|
||||
|
||||
acosc_max_active_sids = count
|
||||
maximum active SIDs with anti-cascading over SID, 0 = unlimited, -1 = use global setting, default:0
|
||||
|
||||
acosc_zap_limit = count
|
||||
zap limit for anti-cascading over SID, 0 = unlimited, -1 = use global setting, default:0
|
||||
|
||||
acosc_penalty = 0|1|2|3|4|-1
|
||||
level of penalty with anti-cascading over SID count:
|
||||
|
||||
0 = only logging (default)
|
||||
1 = send fake CWs
|
||||
2 = temporary user ban
|
||||
3 = send delayed CWs
|
||||
4 = temporary hidecards to the client
|
||||
-1 = use global setting
|
||||
|
||||
acosc_penalty_duration = seconds
|
||||
penalty duration for anti-cascading over SID count, -1 = use global setting, default:0
|
||||
|
||||
acosc_delay = milli-seconds
|
||||
delay for anti-cascading over SID count, -1 = use global setting, default:0
|
||||
|
||||
failban = 0|2|4|8
|
||||
mask for IP address based blocking:
|
||||
|
||||
0 = ignore (default)
|
||||
2 = block IP address of a disabled account on connecting
|
||||
4 = block IP address of a sleeping account while sleeping comes up
|
||||
8 = block duplicate IP address
|
||||
|
||||
lb_nbest_readers = counts
|
||||
set count of best readers for load balancing, -1 = use global lb_nbest_readers, default:-1
|
||||
|
||||
lb_nfb_readers = counts
|
||||
set count of fallback readers for load balancing, -1 = use global lb_nfb_readers, default:1
|
||||
|
||||
lb_nbest_percaid = CAID1:count1[,CAID2:count2]...
|
||||
set count of best readers per CAIDs for load balancing, wildcard CAIDs with two-digit CAIDs possible, default:none
|
||||
|
||||
example: lb_nbest_percaid = 0100:4,0200:3,03:2,04:1
|
||||
(wildcard CAIDs 03xx and 04xx)
|
||||
|
||||
preferlocalcards = 0|1
|
||||
SC decoding behavior:.
|
||||
|
||||
-1 = global value from oscam.conf (default)
|
||||
0 = local SCs used like a remote reader
|
||||
1 = prefer cache exchange based SCs
|
||||
2 = prefer local SCs
|
||||
|
||||
cwc_disable = 0|1
|
||||
1 = disbale CW cycle check, default:0
|
||||
|
||||
cacheex = 0|1|2|3
|
||||
set cache exchange mode
|
||||
|
||||
0: disable cache exchange mode (default)
|
||||
1: enable cache exchange pull mode
|
||||
2: enable cache exchange push mode for camd 3.5x / 3.57x and
|
||||
CCcam protocol
|
||||
3: enable reverse cache exchange push mode for camd 3.5x / 3.57x
|
||||
and CCcam protocol
|
||||
|
||||
Identical cache exchange modes must be set on local OSCam user account and remote OSCam server.
|
||||
|
||||
Please consider memory consumption.
|
||||
|
||||
cacheex_maxhop = hops
|
||||
define maximum hops for cache exchange, default=10
|
||||
|
||||
no_wait_time = 0|1
|
||||
set wait time behaviour:
|
||||
|
||||
0: use wait_time set in oscam.conf (default)
|
||||
1: do not use wait_time set in oscam.conf
|
||||
|
||||
csp_ecm_filter = [caid][&mask][@provid][$servid],n
|
||||
cache exchange incoming ECM filter setting (mode 3 only) for Cardservproxy, default:none
|
||||
|
||||
cacheex_drop_csp = 0|1
|
||||
1 = drop incoming Cardservproxy cache (mode 3 only), detection is zero ecmd5, default:0
|
||||
|
||||
cacheex_allow_request = 0|1
|
||||
1 = allow incoming ECM request (mode 3 only), default:1
|
||||
|
||||
cacheex_allow_filter = 0|1
|
||||
1= allow cache exchange filter (for cache exchange mode 3 only), default:1
|
||||
|
||||
cacheex_block_fakecws = 0|1
|
||||
1 = enable fake DCWs blocking (for cache exchange mode 3 only), get fake DCWs form oscam.fakecws, default:0
|
||||
|
||||
sleep = minutes
|
||||
time waiting for inactive user, default:none
|
||||
|
||||
sleepsend = 0|255
|
||||
255 = OSCam client only: stopping requests until next zap, 255 = camd 3.x only: stopping requests until restart of camd
|
||||
3.x client, default:0
|
||||
|
||||
suppresscmd08 = 0|1
|
||||
0 = tell camd 3.5x, 3.57x and 3.78x clients not to request again for rejected CAID, service ID and provider ID combina‐
|
||||
tion, 1 = disable, default:0
|
||||
|
||||
keepalive = 0|1
|
||||
0 = disable keepalive between server and client for newcamd or CCcam protocol, default:1
|
||||
|
||||
umaxidle = seconds
|
||||
value for user being idle before disconnect, 0 = idle disconnect disabled, -1 use clientmaxidle in global section,
|
||||
default:-1
|
||||
|
||||
caid = <CAID>[&<mask>][:<target CAID>][,<CAID>[&<mask>][:<target CAID>]]...
|
||||
limit and mapping of CAIDs, default:all CAIDs with mask FFFF
|
||||
|
||||
example: caid = 0100
|
||||
caid = 0200&ffee:0300
|
||||
caid = 0400&ff00:0500,0600
|
||||
caid = 0702,0722
|
||||
caid = 0702&ffdf (shortcut for the example above)
|
||||
|
||||
au = label of reader[,label of reader]...|1
|
||||
AU setting, default:none:
|
||||
|
||||
label of reader = sending EMMs to specified reader
|
||||
(security issue: clients can see SC data!)
|
||||
1 = auto AU is sending EMMs to all readers
|
||||
(security issue: clients can see SC data!)
|
||||
|
||||
group = 1..64[,1..64]...
|
||||
user assingment to reader groups, default:none, required
|
||||
|
||||
betatunnel = <CAID>.<ServiceID>:<target CAID>[,<CAID>.<ServiceID>: <target CAID>]...
|
||||
Define Betacrypt tunneling. The ServiceID can also be used for wildcarded CAIDs.
|
||||
|
||||
example: betatunnel = 0100.0001:0200,0300.0004:0500
|
||||
betatunnel = 0600.FFFF:0700
|
||||
|
||||
Be carefull using abbreviations.
|
||||
|
||||
|
||||
emmreassembly = 0|1||2
|
||||
EMM reassembly, should be set for Viaccess and Cryptoworks readers if the client that you are using to send EMMs is
|
||||
reassembling them instead of just sending them to OSCam for processing.
|
||||
|
||||
0: disabled
|
||||
1: enabled for DVB API
|
||||
2: enabled (default)
|
||||
|
||||
services = [!]services[,[!]<services>]...
|
||||
user [de]assingment to service group, default:none
|
||||
|
||||
ident = <CAID>:<provid>[,<provid>,...][;<CAID>:<provid>[,<provid>,...]]...
|
||||
user assingment to SC specific idents, default:none
|
||||
|
||||
class = [!]class[,[!]class]...
|
||||
user [de]assingment to SC specific classes, default=none
|
||||
|
||||
example: class = 01,02,!03,!04
|
||||
|
||||
chid = <CAID>:<ChID>[,<CAID>:<ChID>]...
|
||||
user assingment to SC specific ChIDs, default:none
|
||||
|
||||
monlevel = 0|1|2|3|4
|
||||
monitor level:
|
||||
|
||||
0 = no access to monitor (default)
|
||||
1 = only server and own procs
|
||||
2 = all procs, but viewing only
|
||||
3 = all procs, reload of oscam.user possible
|
||||
4 = complete access
|
||||
|
||||
cccmaxhops = hops
|
||||
maximum hops limit for CCcam clients, default:10
|
||||
|
||||
-1 = CCcam disabled for this user
|
||||
0 = local SCs only
|
||||
1 = local SCs + 1 hop
|
||||
2 = local SCs + 2 hops
|
||||
and so on
|
||||
|
||||
cccreshare = level
|
||||
reshare level for CCcam clients
|
||||
|
||||
-1 = use reshare level of oscam.conf (default)
|
||||
0 = resharing for direct peer only
|
||||
x = resharing for direct peer and share level x
|
||||
|
||||
cccignorereshare = -1|0|1
|
||||
CCcam ignore reshare setting:
|
||||
|
||||
-1 = use ignore reshare level of oscam.conf (default)
|
||||
0 = use ignore reshare setting of server
|
||||
1 = use ignore reshare setting of reader or user
|
||||
|
||||
cccstealth = -1|1
|
||||
CCcam stealth:
|
||||
|
||||
-1 = use CCcam stealth of oscam.conf (default)
|
||||
0 = use extended OSCam-CCcam protocol
|
||||
1 = behaviour like the original CCcam: no activate partner
|
||||
detection and extended OSCam-CCcam protocol, prevent
|
||||
other OSCam to detect the server as OSCam server
|
||||
|
||||
EXAMPLES
|
||||
[account]
|
||||
user = username
|
||||
pwd = password
|
||||
group = 1
|
||||
au = myserialmousereader
|
||||
services = myservice
|
||||
betatunnel = 0100.0001:0101,0100.0002:0101
|
||||
caid = 0100
|
||||
ident = 0100:000000
|
||||
uniq = 1
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.tiers(5),
|
||||
oscam.srvid(5), oscam.srvid2(5), oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
oscam.user(5)
|
||||
53
Distribution/doc/txt/oscam.whitelist.txt
Normal file
53
Distribution/doc/txt/oscam.whitelist.txt
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
oscam.whitelist(5) File Formats Manual oscam.whitelist(5)
|
||||
|
||||
|
||||
|
||||
NAME
|
||||
oscam.whitelist - global ECM length whitelisting configuration file for OSCam
|
||||
|
||||
SYNOPSIS
|
||||
ECM length whitelisting
|
||||
|
||||
DESCRIPTIONS
|
||||
w:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1[,ECM length 2]...]]
|
||||
ECM length whitelisting
|
||||
|
||||
l:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1[,ECM length 2]...]]
|
||||
ECM length whitelisting, does not proceed with any other ECM length
|
||||
whitelisting when matching, abbreviation for normal ECM length
|
||||
whitelisting using w parameter
|
||||
|
||||
i:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1[,ECM length 2]...]]
|
||||
ignore ECM length
|
||||
|
||||
m:[CAID][:][provider ID][:][service ID][:][ECM PID][:][CHID][:][ECM length 1[,ECM length 2]...]] [new CAID][:][new
|
||||
provider ID]
|
||||
CAID und provider ID mapping, first matching rules, mapping is
|
||||
preferred over all other whitelistings
|
||||
|
||||
ANNONTATIONS
|
||||
Please use Unix text file format only.
|
||||
|
||||
EXAMPLES
|
||||
w:0100 # whitelisting for CAID 0100
|
||||
|
||||
i:0200::1234 # ignore CAID 0200 with
|
||||
# service ID 1234
|
||||
|
||||
i:::::2345 # ignore CHID 2345
|
||||
|
||||
m:3456:123456::::: 4567:234567 # mapping
|
||||
|
||||
w: # allow all others (blacklist)
|
||||
|
||||
l:0300 # whitelisting for CAID 0300 not
|
||||
# proceeding if matching
|
||||
|
||||
SEE ALSO
|
||||
list_smargo(1), oscam(1), oscam.ac(5), oscam.cacheex(5), oscam.cert(5), oscam.conf(5), oscam.dvbapi(5), oscam.fakecws(5),
|
||||
oscam.guess(5), oscam.ird(5), oscam.provid(5), oscam.ratelimit(5), oscam.server(5), oscam.services(5), oscam.srvid(5),
|
||||
oscam.srvid2(5),coscam.user(5)
|
||||
|
||||
|
||||
|
||||
oscam.whitelist(5)
|
||||
BIN
Distribution/monitor/mpcsmon-src-0.6.tar.bz2
Normal file
BIN
Distribution/monitor/mpcsmon-src-0.6.tar.bz2
Normal file
Binary file not shown.
140
Distribution/monitor/mpcsmon.sh
Normal file
140
Distribution/monitor/mpcsmon.sh
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
#!/bin/bash
|
||||
|
||||
CSHOST="localhost"
|
||||
CSPORT="988"
|
||||
USR="user"
|
||||
PWD="passwd"
|
||||
NETCAT="nc"
|
||||
DELAY=5
|
||||
|
||||
get_geo()
|
||||
{
|
||||
eval "`echo "$2" | sed -e \"s/^.*${1} /${1}=/g\" -e 's/;.*$//g'`"
|
||||
}
|
||||
|
||||
do_init()
|
||||
{
|
||||
clear
|
||||
sline="`stty -a 2>/dev/null | grep rows 2>/dev/null`"
|
||||
get_geo rows "$sline"
|
||||
get_geo columns "$sline"
|
||||
[ "$rows" -eq 0 ] && rows=25
|
||||
[ "$columns" -eq 0 ] && columns=80
|
||||
rows=`expr $rows - 1`
|
||||
export rows columns
|
||||
|
||||
tput init 2>/dev/null
|
||||
TI_ED="`tput ed 2>/dev/null`"
|
||||
TI_SC="`tput sc 2>/dev/null`"
|
||||
TI_RC="`tput rc 2>/dev/null`"
|
||||
TI_B0="`tput setb 0 2>/dev/null`"
|
||||
TI_B1="`tput setb 5 2>/dev/null`"
|
||||
TI_B2="`tput setb 1 2>/dev/null`"
|
||||
TI_IL="`tput il1 2>/dev/null`"
|
||||
TI_DL="`tput dl1 1 2>/dev/null`"
|
||||
TI_EL="`tput el 2>/dev/null`"
|
||||
export TI_ED TI_B0 TI_B1 TI_B2 TI_IL TI_DL TI_SC TI_RC TI_EL
|
||||
}
|
||||
|
||||
monitor()
|
||||
{
|
||||
$NETCAT -u $CSHOST $CSPORT | awk -W interactive -F"|" '
|
||||
BEGIN{
|
||||
line="---------------------------------------------------------------------";
|
||||
nuser=0;
|
||||
tabsize=(ENVIRON["columns"]-length(line))/2;
|
||||
tab=sprintf("%-*.*s", tabsize, tabsize, "");
|
||||
rows=ENVIRON["rows"];
|
||||
il=ENVIRON["TI_IL"];
|
||||
dl=ENVIRON["TI_DL"];
|
||||
sc=ENVIRON["TI_SC"];
|
||||
rc=ENVIRON["TI_RC"];
|
||||
b0=ENVIRON["TI_B0"];
|
||||
b1=ENVIRON["TI_B1"];
|
||||
b2=ENVIRON["TI_B2"];
|
||||
ed=ENVIRON["TI_ED"];
|
||||
el=ENVIRON["TI_EL"];
|
||||
csr(0, rows);
|
||||
printf("\n%s%s\n", b2, ed);
|
||||
print(tab "Nr User A C Modus Online Sender");
|
||||
print(tab line);
|
||||
csr(5+nuser, rows);
|
||||
cup(5+nuser, 0);
|
||||
printf("%s%s", b0, ed);
|
||||
cup(rows, 0);
|
||||
}
|
||||
|
||||
function csr(row1, row2)
|
||||
{
|
||||
system("tput csr "row1" "row2);
|
||||
}
|
||||
|
||||
function cup(crow, ccol)
|
||||
{
|
||||
system("tput cup "crow" "ccol);
|
||||
}
|
||||
|
||||
/^\[IB....\]/{
|
||||
nuser=0;
|
||||
}
|
||||
/^\[I.....\]/{
|
||||
if (($2!="c") && ($2!="m"))
|
||||
next;
|
||||
printf("%s", sc);
|
||||
cup(4+nuser, 0);
|
||||
ot=$12/60;
|
||||
otm=ot%60; ot/=60;
|
||||
oth=ot%24; ot/=24;
|
||||
if (ot<1)
|
||||
ots=sprintf("%d:%02dh", oth, otm);
|
||||
else
|
||||
ots=sprintf("%dt %dh", ot, oth);
|
||||
|
||||
austate=0+$5;
|
||||
if (austate<0) austate=-austate;
|
||||
printf("%s%s%s%2d %-12.12s%d %d %-10.10s %8.8s %s\n", b2, el,
|
||||
tab, $3, $4, austate, $6, $9, ots, $14);
|
||||
printf("%s", el);
|
||||
nuser++;
|
||||
csr(5+nuser, rows);
|
||||
printf("%s%s", rc, b0);
|
||||
next;
|
||||
}
|
||||
/^\[LOG...\]/{
|
||||
printf("%s%s\n", substr($0, 20, 8), substr($0, 35));
|
||||
next;
|
||||
}
|
||||
{
|
||||
next;
|
||||
}'
|
||||
}
|
||||
|
||||
do_exit()
|
||||
{
|
||||
trap - 1 2 15
|
||||
tput csr 0 $rows 2>/dev/null
|
||||
tput sgr0 2>/dev/null
|
||||
clear
|
||||
exit 0
|
||||
}
|
||||
|
||||
do_init
|
||||
trap do_exit 1 2 15
|
||||
|
||||
[ -n "$1" ] && CSHOST="$1"
|
||||
[ -n "$2" ] && CSPORT="$2"
|
||||
|
||||
while true
|
||||
do
|
||||
(
|
||||
while true
|
||||
do
|
||||
echo "login $USR $PWD"
|
||||
sleep 1
|
||||
echo "log on"
|
||||
sleep 1
|
||||
echo "status"
|
||||
sleep $DELAY
|
||||
done
|
||||
) | monitor
|
||||
done
|
||||
232
LICENSE
Normal file
232
LICENSE
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <https://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.
|
||||
|
||||
oscam-2.26.01-11942-802-with-Advanced-fake-dcw-detection
|
||||
Copyright (C) 2026 mardock2009
|
||||
|
||||
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 <https://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:
|
||||
|
||||
oscam-2.26.01-11942-802-with-Advanced-fake-dcw-detection Copyright (C) 2026 mardock2009
|
||||
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 <https://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 <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
962
Makefile
Normal file
962
Makefile
Normal file
|
|
@ -0,0 +1,962 @@
|
|||
SHELL = /bin/sh
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .o .c
|
||||
.PHONY: all tests help README.build README.config simple default debug config menuconfig allyesconfig allnoconfig defconfig clean distclean submodules
|
||||
|
||||
VER := $(shell ./config.sh --oscam-version)
|
||||
GIT_SHA := $(shell ./config.sh --oscam-commit)
|
||||
BUILD_DATE := $(shell date +"%d.%m.%Y %T")
|
||||
|
||||
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
|
||||
|
||||
# This let's us use uname_S tests to detect cygwin
|
||||
ifneq (,$(findstring CYGWIN,$(uname_S)))
|
||||
uname_S := Cygwin
|
||||
endif
|
||||
|
||||
LINKER_VER_OPT:=-Wl,--version
|
||||
|
||||
# Find OSX SDK
|
||||
ifeq ($(uname_S),Darwin)
|
||||
# Setting OSX_VER allows you to choose prefered version if you have
|
||||
# two SDKs installed. For example if you have 10.6 and 10.5 installed
|
||||
# you can choose 10.5 by using 'make USE_PCSC=1 OSX_VER=10.5'
|
||||
# './config.sh --detect-osx-sdk-version' returns the newest SDK if
|
||||
# SDK_VER is not set.
|
||||
OSX_SDK := $(shell ./config.sh --detect-osx-sdk-version $(OSX_VER))
|
||||
LINKER_VER_OPT:=-Wl,-v
|
||||
endif
|
||||
|
||||
ifeq "$(shell ./config.sh --enabled WITH_SSL)" "Y"
|
||||
override USE_SSL=1
|
||||
override USE_LIBCRYPTO=1
|
||||
endif
|
||||
ifeq "$(shell ./config.sh --enabled WITH_EMU)" "Y"
|
||||
override USE_LIBCRYPTO=1
|
||||
endif
|
||||
ifdef USE_SSL
|
||||
override USE_LIBCRYPTO=1
|
||||
endif
|
||||
|
||||
CONF_DIR = /usr/local/etc
|
||||
|
||||
LIB_PTHREAD = -lpthread
|
||||
LIB_DL = -ldl
|
||||
|
||||
ifeq ($(uname_S),FreeBSD)
|
||||
LIB_DL :=
|
||||
endif
|
||||
|
||||
ifeq "$(shell ./config.sh --enabled MODULE_STREAMRELAY)" "Y"
|
||||
override USE_LIBDVBCSA=1
|
||||
ifeq "$(notdir ${LIBDVBCSA_LIB})" "libdvbcsa.a"
|
||||
override CFLAGS += -DSTATIC_LIBDVBCSA=1
|
||||
else
|
||||
override CFLAGS += -DSTATIC_LIBDVBCSA=0
|
||||
endif
|
||||
endif
|
||||
|
||||
override STD_LIBS := $(LIB_PTHREAD) $(LIB_DL)
|
||||
override STD_DEFS := -D'CS_VERSION="$(VER)"'
|
||||
override STD_DEFS += -D'CS_GIT_COMMIT="$(GIT_SHA)"'
|
||||
override STD_DEFS += -D'CS_BUILD_DATE="$(BUILD_DATE)"'
|
||||
override STD_DEFS += -D'CS_CONFDIR="$(CONF_DIR)"'
|
||||
|
||||
CC = $(CROSS_DIR)$(CROSS)gcc
|
||||
STRIP = $(CROSS_DIR)$(CROSS)strip
|
||||
UPX = $(shell which upx 2>/dev/null || true)
|
||||
SSL = $(shell which openssl 2>/dev/null || true)
|
||||
STAT = $(shell which gnustat 2>/dev/null || which stat 2>/dev/null)
|
||||
SPLIT = $(shell which gsplit 2>/dev/null || which split 2>/dev/null)
|
||||
GREP = $(shell which ggrep 2>/dev/null || which grep 2>/dev/null)
|
||||
GIT = $(shell which git 2>/dev/null || true)
|
||||
|
||||
# Compiler warnings
|
||||
CC_WARN = -W -Wall -Wshadow -Wredundant-decls -Wstrict-prototypes -Wold-style-definition
|
||||
|
||||
# Compiler optimizations
|
||||
CCVERSION := $(shell $(CC) --version 2>/dev/null | head -n 1)
|
||||
ifneq (,$(findstring clang,$(CCVERSION)))
|
||||
CC_OPTS = -O2 -ggdb -pipe -ffunction-sections -fdata-sections -fomit-frame-pointer
|
||||
else
|
||||
CC_OPTS = -O2 -ggdb -pipe -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-schedule-insns
|
||||
endif
|
||||
|
||||
LDFLAGS = -Wl,--gc-sections
|
||||
|
||||
# Enable sse2 on x86, neon on arm
|
||||
TARGETHELP := $(shell $(CC) --target-help 2>&1)
|
||||
ifneq (,$(findstring sse2,$(TARGETHELP)))
|
||||
override CFLAGS += -mmmx -msse -msse2 -msse3
|
||||
else ifneq (,$(findstring neon,$(TARGETHELP)))
|
||||
ifeq "$(shell ./config.sh --enabled WITH_ARM_NEON)" "Y"
|
||||
override CFLAGS += -mfpu=neon
|
||||
endif
|
||||
endif
|
||||
|
||||
# Enable upx compression
|
||||
UPX_VER = $(shell ($(UPX) --version 2>/dev/null || echo "n.a.") | head -n 1)
|
||||
COMP_LEVEL = --best
|
||||
ifdef USE_COMPRESS
|
||||
ifeq ($(UPX_VER),n.a.)
|
||||
override USE_COMPRESS =
|
||||
UPX_COMMAND_OSCAM = $(SAY) "UPX Disabled due to missing upx binary in PATH!";
|
||||
else
|
||||
override STD_DEFS += -D'USE_COMPRESS="$(USE_COMPRESS)"' -D'COMP_LEVEL="$(COMP_LEVEL)"' -D'COMP_VERSION="$(UPX_VER)"'
|
||||
UPX_SPLIT_PREFIX = $(OBJDIR)/signing/upx.
|
||||
UPX_INFO_TOOL = $(shell echo '| UPX = $(UPX)\n')
|
||||
UPX_INFO = $(shell echo '| Packer : $(UPX_VER) (compression level $(COMP_LEVEL))\n')
|
||||
UPX_COMMAND_OSCAM = $(UPX) -q $(COMP_LEVEL) $@ | $(GREP) '^[[:space:]]*[[:digit:]]* ->' | xargs | cat | xargs -0 printf 'UPX \t%s';
|
||||
endif
|
||||
endif
|
||||
|
||||
# Enable binary signing
|
||||
ifeq "$(shell ./config.sh --enabled WITH_SIGNING)" "Y"
|
||||
SIGN_CERT := $(shell ./config.sh --create-cert ecdsa prime256v1 ca 2>/dev/null || false)
|
||||
SIGN_CERT = $(shell ./config.sh --cert-file cert || echo "n.a.")
|
||||
|
||||
ifeq ($(SIGN_CERT),n.a.)
|
||||
override WITH_SIGNING = "N"
|
||||
SIGN_COMMAND_OSCAM = $(SAY) "SIGN Disabled due to missing of certificate files!";
|
||||
else
|
||||
override USE_SSL=1
|
||||
|
||||
SIGN_PRIVKEY = $(shell ./config.sh --cert-file privkey)
|
||||
SIGN_MARKER = $(shell ./config.sh --sign-marker)
|
||||
SIGN_UPXMARKER = $(shell ./config.sh --upx-marker)
|
||||
SIGN_PUBKEY = $(OBJDIR)/signing/pkey
|
||||
SIGN_HASH = $(OBJDIR)/signing/sha256
|
||||
SIGN_DIGEST = $(OBJDIR)/signing/digest
|
||||
SIGN_SUBJECT = $(subst $\',$\'$\"$\'$\"$\',$(shell ./config.sh --cert-info | head -n 1))
|
||||
SIGN_SIGALGO = $(shell ./config.sh --cert-info | tail -n 1)
|
||||
SIGN_VALID = $(shell ./config.sh --cert-info | head -n 4 | tail -n 1)
|
||||
SIGN_PUBALGO = $(shell ./config.sh --cert-info | head -n 5 | tail -n 1)
|
||||
SIGN_PUBBIT = $(shell ./config.sh --cert-info | head -n 6 | tail -n 1)
|
||||
SIGN_VER = ${shell ($(SSL) version 2>/dev/null || echo "n.a.") | head -n 1 | awk -F'(' '{ print $$1 }' | xargs}
|
||||
SIGN_INFO = $(shell echo '| Signing : $(SIGN_VER)\n| $(SIGN_PUBALGO), $(SIGN_PUBBIT), $(SIGN_SIGALGO),\n| Valid $(SIGN_VALID), $(SIGN_SUBJECT)\n')
|
||||
SIGN_INFO_TOOL = $(shell echo '| SSL = $(SSL)\n')
|
||||
override STD_DEFS += -DCERT_ALGO_$(shell ./config.sh --cert-info | head -n 5 | tail -n 1 | awk -F':|-' '{ print toupper($$2) }' | xargs)
|
||||
SIGN_COMMAND_OSCAM += sha256sum $@ | awk '{ print $$1 }' | tr -d '\n' > $(SIGN_HASH);
|
||||
SIGN_COMMAND_OSCAM += printf 'SIGN SHA256('; $(STAT) -c %s $(SIGN_HASH) | tr -d '\n'; printf '): '; cat $(SIGN_HASH); printf ' -> ';
|
||||
SIGN_COMMAND_OSCAM += $(SSL) x509 -pubkey -noout -in $(SIGN_CERT) -out $(SIGN_PUBKEY);
|
||||
SIGN_COMMAND_OSCAM += $(SSL) dgst -sha256 -sign $(SIGN_PRIVKEY) -out $(SIGN_DIGEST) $(SIGN_HASH);
|
||||
SIGN_COMMAND_OSCAM += $(SSL) dgst -sha256 -verify $(SIGN_PUBKEY) -signature $(SIGN_DIGEST) $(SIGN_HASH) | tr -d '\n';
|
||||
SIGN_COMMAND_OSCAM += [ -f $(UPX_SPLIT_PREFIX)aa ] && cat $(UPX_SPLIT_PREFIX)aa > $@;
|
||||
SIGN_COMMAND_OSCAM += printf '$(SIGN_MARKER)' | cat - $(SIGN_DIGEST) >> $@;
|
||||
SIGN_COMMAND_OSCAM += [ -f $(UPX_SPLIT_PREFIX)ab ] && cat $(UPX_SPLIT_PREFIX)ab >> $@;
|
||||
SIGN_COMMAND_OSCAM += printf ' <- DIGEST('; $(STAT) -c %s $(SIGN_DIGEST) | tr -d '\n'; printf ')\n';
|
||||
ifdef USE_COMPRESS
|
||||
ifneq ($(UPX_VER),n.a.)
|
||||
UPX_COMMAND_OSCAM += $(SPLIT) --bytes=$$($(GREP) -oba '$(SIGN_UPXMARKER)' $@ | tail -1 | awk -F':' '{ print $$1 }') $@ $(UPX_SPLIT_PREFIX);
|
||||
UPX_COMMAND_OSCAM += $(SIGN_COMMAND_OSCAM)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# The linker for powerpc have bug that prevents --gc-sections from working
|
||||
# Check for the linker version and if it matches disable --gc-sections
|
||||
# For more information about the bug see:
|
||||
# http://cygwin.com/ml/binutils/2005-01/msg00103.html
|
||||
# The LD output is saved into variable and then processed, because if
|
||||
# the output is piped directly into another command LD creates 4 files
|
||||
# in your /tmp directory and doesn't delete them.
|
||||
LINKER_VER := $(shell set -e; VER="`$(CC) $(LINKER_VER_OPT) 2>&1`"; echo $$VER | head -1 | cut -d' ' -f5)
|
||||
|
||||
# dm500 toolchain
|
||||
ifeq "$(LINKER_VER)" "20040727"
|
||||
LDFLAGS :=
|
||||
endif
|
||||
# dm600/7000/7020 toolchain
|
||||
ifeq "$(LINKER_VER)" "20041121"
|
||||
LDFLAGS :=
|
||||
endif
|
||||
# The OS X linker do not support --gc-sections
|
||||
ifeq ($(uname_S),Darwin)
|
||||
LDFLAGS :=
|
||||
endif
|
||||
|
||||
# The compiler knows for what target it compiles, so use this information
|
||||
TARGET := $(shell $(CC) -dumpmachine 2>/dev/null)
|
||||
|
||||
# Process USE_ variables
|
||||
DEFAULT_STAPI_LIB = -L./stapi -loscam_stapi
|
||||
DEFAULT_STAPI5_LIB = -L./stapi -loscam_stapi5
|
||||
DEFAULT_COOLAPI_LIB = -lnxp -lrt
|
||||
DEFAULT_COOLAPI2_LIB = -llnxUKAL -llnxcssUsr -llnxscsUsr -llnxnotifyqUsr -llnxplatUsr -lrt
|
||||
DEFAULT_SU980_LIB = -lentropic -lrt
|
||||
DEFAULT_AZBOX_LIB = -Lextapi/openxcas -lOpenXCASAPI
|
||||
DEFAULT_LIBCRYPTO_LIB = -lcrypto
|
||||
DEFAULT_SSL_LIB = -lssl
|
||||
DEFAULT_LIBDVBCSA_LIB = -ldvbcsa
|
||||
DEFAULT_LIBUSB_LIB = -lusb-1.0
|
||||
|
||||
# Since FreeBSD 8 (released in 2010) they are using their own
|
||||
# libusb that is API compatible to libusb but with different soname
|
||||
ifeq ($(uname_S),FreeBSD)
|
||||
DEFAULT_SSL_FLAGS = -I/usr/include
|
||||
DEFAULT_LIBUSB_LIB = -lusb
|
||||
DEFAULT_PCSC_FLAGS = -I/usr/local/include/PCSC
|
||||
DEFAULT_PCSC_LIB = -L/usr/local/lib -lpcsclite
|
||||
else ifeq ($(uname_S),Darwin)
|
||||
DEFAULT_SSL_FLAGS = -I/usr/local/opt/openssl/include
|
||||
DEFAULT_SSL_LIB = -L/usr/local/opt/openssl/lib -lssl
|
||||
DEFAULT_LIBCRYPTO_LIB = -L/usr/local/opt/openssl/lib -lcrypto
|
||||
DEFAULT_LIBDVBCSA_FLAGS = -I/usr/local/opt/libdvbcsa/include
|
||||
DEFAULT_LIBDVBCSA_LIB = -L/usr/local/opt/libdvbcsa/lib -ldvbcsa
|
||||
DEFAULT_LIBUSB_FLAGS = -I/usr/local/opt/libusb/include
|
||||
DEFAULT_LIBUSB_LIB = -L/usr/local/opt/libusb/lib -lusb-1.0 -framework IOKit -framework CoreFoundation -framework Security
|
||||
DEFAULT_PCSC_FLAGS = -I/usr/local/opt/pcsc-lite/include/PCSC
|
||||
DEFAULT_PCSC_LIB = -L/usr/local/opt/pcsc-lite/lib -lpcsclite -framework IOKit -framework CoreFoundation -framework PCSC
|
||||
else
|
||||
# Get the compiler's last include PATHs. Basicaly it is /usr/include
|
||||
# but in case of cross compilation it might be something else.
|
||||
#
|
||||
# Since using -Iinc_path instructs the compiler to use inc_path
|
||||
# (without add the toolchain system root) we need to have this hack
|
||||
# to get the "real" last include path. Why we needs this?
|
||||
# Well, the PCSC headers are broken and rely on having the directory
|
||||
# that they are installed it to be in the include PATH.
|
||||
#
|
||||
# We can't just use -I/usr/include/PCSC because it won't work in
|
||||
# case of cross compilation.
|
||||
TOOLCHAIN_INC_DIR := $(strip $(shell echo | $(CC) -Wp,-v -xc - -fsyntax-only 2>&1 | $(GREP) include$ | tail -n 1))
|
||||
DEFAULT_SSL_FLAGS = -I$(TOOLCHAIN_INC_DIR) -I$(TOOLCHAIN_INC_DIR)/../../include -I$(TOOLCHAIN_INC_DIR)/../local/include
|
||||
DEFAULT_PCSC_FLAGS = -I$(TOOLCHAIN_INC_DIR)/PCSC -I$(TOOLCHAIN_INC_DIR)/../../include/PCSC -I$(TOOLCHAIN_INC_DIR)/../local/include/PCSC
|
||||
DEFAULT_PCSC_LIB = -lpcsclite
|
||||
endif
|
||||
|
||||
ifeq ($(uname_S),Cygwin)
|
||||
DEFAULT_PCSC_LIB += -lwinscard
|
||||
endif
|
||||
|
||||
# Function to initialize USE related variables
|
||||
# Usage: $(eval $(call prepare_use_flags,FLAG_NAME,PLUS_TARGET_TEXT))
|
||||
define prepare_use_flags
|
||||
override DEFAULT_$(1)_FLAGS:=$$(strip -DWITH_$(1)=1 $$(DEFAULT_$(1)_FLAGS))
|
||||
ifdef USE_$(1)
|
||||
$(1)_FLAGS:=$$(DEFAULT_$(1)_FLAGS)
|
||||
$(1)_CFLAGS:=$$($(1)_FLAGS)
|
||||
$(1)_LDFLAGS:=$$($(1)_FLAGS)
|
||||
$(1)_LIB:=$$(DEFAULT_$(1)_LIB)
|
||||
ifneq "$(2)" ""
|
||||
override PLUS_TARGET:=$$(PLUS_TARGET)-$(2)
|
||||
endif
|
||||
override USE_CFLAGS+=$$($(1)_CFLAGS)
|
||||
override USE_LDFLAGS+=$$($(1)_LDFLAGS)
|
||||
override USE_LIBS+=$$($(1)_LIB)
|
||||
override USE_FLAGS+=$$(if $$(USE_$(1)),USE_$(1))
|
||||
endif
|
||||
endef
|
||||
|
||||
# Initialize USE variables
|
||||
$(eval $(call prepare_use_flags,STAPI,stapi))
|
||||
$(eval $(call prepare_use_flags,STAPI5,stapi5))
|
||||
$(eval $(call prepare_use_flags,COOLAPI,coolapi))
|
||||
$(eval $(call prepare_use_flags,COOLAPI2,coolapi2))
|
||||
$(eval $(call prepare_use_flags,SU980,su980))
|
||||
$(eval $(call prepare_use_flags,AZBOX,azbox))
|
||||
$(eval $(call prepare_use_flags,AMSMC,amsmc))
|
||||
$(eval $(call prepare_use_flags,MCA,mca))
|
||||
$(eval $(call prepare_use_flags,SSL,ssl))
|
||||
$(eval $(call prepare_use_flags,LIBCRYPTO,))
|
||||
$(eval $(call prepare_use_flags,LIBUSB,libusb))
|
||||
$(eval $(call prepare_use_flags,PCSC,pcsc))
|
||||
$(eval $(call prepare_use_flags,LIBDVBCSA,libdvbcsa))
|
||||
$(eval $(call prepare_use_flags,COMPRESS,upx))
|
||||
|
||||
ifdef USE_SSL
|
||||
SSL_HEADER = $(shell find $(subst -DWITH_SSL=1,,$(subst -I,,$(SSL_FLAGS))) -name opensslv.h -print 2>/dev/null | tail -n 1)
|
||||
SSL_VER = ${shell ($(GREP) 'OpenSSL [[:digit:]][^ ]*' $(SSL_HEADER) /dev/null 2>/dev/null || echo '"n.a."') | tail -n 1 | awk -F'"' '{ print $$2 }' | xargs}
|
||||
SSL_INFO = $(shell echo ', $(SSL_VER)')
|
||||
endif
|
||||
|
||||
# Add PLUS_TARGET and EXTRA_TARGET to TARGET
|
||||
ifdef NO_PLUS_TARGET
|
||||
override TARGET := $(TARGET)$(EXTRA_TARGET)
|
||||
else
|
||||
override TARGET := $(TARGET)$(PLUS_TARGET)$(EXTRA_TARGET)
|
||||
endif
|
||||
|
||||
EXTRA_CFLAGS = $(EXTRA_FLAGS)
|
||||
EXTRA_LDFLAGS = $(EXTRA_FLAGS)
|
||||
|
||||
# Add USE_xxx, EXTRA_xxx and STD_xxx vars
|
||||
override CC_WARN += $(EXTRA_CC_WARN)
|
||||
override CC_OPTS += $(EXTRA_CC_OPTS)
|
||||
override CFLAGS += $(USE_CFLAGS) $(EXTRA_CFLAGS)
|
||||
override LDFLAGS += $(USE_LDFLAGS) $(EXTRA_LDFLAGS)
|
||||
override LIBS += $(USE_LIBS) $(EXTRA_LIBS) $(STD_LIBS)
|
||||
|
||||
override STD_DEFS += -D'CS_TARGET="$(TARGET)"'
|
||||
|
||||
# Setup quiet build
|
||||
Q =
|
||||
SAY = @true
|
||||
ifndef V
|
||||
Q = @
|
||||
NP = --no-print-directory
|
||||
SAY = @echo
|
||||
endif
|
||||
|
||||
BINDIR := Distribution
|
||||
override BUILD_DIR := build
|
||||
OBJDIR := $(BUILD_DIR)/$(TARGET)
|
||||
|
||||
# Include config.mak which contains variables for all enabled modules
|
||||
# These variables will be used to select only needed files for compilation
|
||||
-include $(OBJDIR)/config.mak
|
||||
|
||||
OSCAM_BIN := $(BINDIR)/oscam-$(VER)@$(GIT_SHA)-$(subst cygwin,cygwin.exe,$(TARGET))
|
||||
TESTS_BIN := tests.bin
|
||||
LIST_SMARGO_BIN := $(BINDIR)/list_smargo-$(VER)@$(GIT_SHA)-$(subst cygwin,cygwin.exe,$(TARGET))
|
||||
|
||||
# Build list_smargo-.... only when WITH_LIBUSB build is requested.
|
||||
ifndef USE_LIBUSB
|
||||
override LIST_SMARGO_BIN =
|
||||
endif
|
||||
|
||||
SRC-$(CONFIG_LIB_AES) += cscrypt/aes.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_add.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_asm.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_ctx.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_div.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_exp.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_lib.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_mul.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_print.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_shift.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_sqr.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/bn_word.c
|
||||
SRC-$(CONFIG_LIB_BIGNUM) += cscrypt/mem.c
|
||||
SRC-$(CONFIG_LIB_DES) += cscrypt/des.c
|
||||
SRC-$(CONFIG_LIB_IDEA) += cscrypt/i_cbc.c
|
||||
SRC-$(CONFIG_LIB_IDEA) += cscrypt/i_ecb.c
|
||||
SRC-$(CONFIG_LIB_IDEA) += cscrypt/i_skey.c
|
||||
SRC-y += cscrypt/md5.c
|
||||
SRC-$(CONFIG_LIB_RC6) += cscrypt/rc6.c
|
||||
SRC-$(CONFIG_LIB_SHA1) += cscrypt/sha1.c
|
||||
SRC-$(CONFIG_LIB_MDC2) += cscrypt/mdc2.c
|
||||
SRC-$(CONFIG_LIB_FAST_AES) += cscrypt/fast_aes.c
|
||||
SRC-$(CONFIG_LIB_SHA256) += cscrypt/sha256.c
|
||||
|
||||
SRC-$(CONFIG_WITH_CARDREADER) += csctapi/atr.c
|
||||
SRC-$(CONFIG_WITH_CARDREADER) += csctapi/icc_async.c
|
||||
SRC-$(CONFIG_WITH_CARDREADER) += csctapi/io_serial.c
|
||||
SRC-$(CONFIG_WITH_CARDREADER) += csctapi/protocol_t0.c
|
||||
SRC-$(CONFIG_WITH_CARDREADER) += csctapi/protocol_t1.c
|
||||
SRC-$(CONFIG_CARDREADER_INTERNAL_AZBOX) += csctapi/ifd_azbox.c
|
||||
SRC-$(CONFIG_CARDREADER_INTERNAL_COOLAPI) += csctapi/ifd_cool.c
|
||||
SRC-$(CONFIG_CARDREADER_INTERNAL_COOLAPI2) += csctapi/ifd_cool.c
|
||||
SRC-$(CONFIG_CARDREADER_DB2COM) += csctapi/ifd_db2com.c
|
||||
SRC-$(CONFIG_CARDREADER_MP35) += csctapi/ifd_mp35.c
|
||||
SRC-$(CONFIG_CARDREADER_PCSC) += csctapi/ifd_pcsc.c
|
||||
SRC-$(CONFIG_CARDREADER_PHOENIX) += csctapi/ifd_phoenix.c
|
||||
SRC-$(CONFIG_CARDREADER_DRECAS) += csctapi/ifd_drecas.c
|
||||
SRC-$(CONFIG_CARDREADER_SC8IN1) += csctapi/ifd_sc8in1.c
|
||||
SRC-$(CONFIG_CARDREADER_INTERNAL_SCI) += csctapi/ifd_sci.c
|
||||
SRC-$(CONFIG_CARDREADER_SMARGO) += csctapi/ifd_smargo.c
|
||||
SRC-$(CONFIG_CARDREADER_SMART) += csctapi/ifd_smartreader.c
|
||||
SRC-$(CONFIG_CARDREADER_STINGER) += csctapi/ifd_stinger.c
|
||||
SRC-$(CONFIG_CARDREADER_STAPI) += csctapi/ifd_stapi.c
|
||||
SRC-$(CONFIG_CARDREADER_STAPI5) += csctapi/ifd_stapi.c
|
||||
SRC-$(CONFIG_CARDREADER_INTERNAL_AMSMC) += csctapi/ifd_amsmc.c
|
||||
|
||||
SRC-$(CONFIG_LIB_MINILZO) += minilzo/minilzo.c
|
||||
|
||||
SRC-$(CONFIG_CS_ANTICASC) += module-anticasc.c
|
||||
SRC-$(CONFIG_CS_CACHEEX) += module-cacheex.c
|
||||
SRC-$(CONFIG_MODULE_CAMD33) += module-camd33.c
|
||||
SRC-$(CONFIG_CS_CACHEEX) += module-camd35-cacheex.c
|
||||
SRC-$(sort $(CONFIG_MODULE_CAMD35) $(CONFIG_MODULE_CAMD35_TCP)) += module-camd35.c
|
||||
SRC-$(CONFIG_CS_CACHEEX) += module-cccam-cacheex.c
|
||||
SRC-$(CONFIG_MODULE_CCCAM) += module-cccam.c
|
||||
SRC-$(CONFIG_MODULE_CCCSHARE) += module-cccshare.c
|
||||
SRC-$(CONFIG_MODULE_CONSTCW) += module-constcw.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-osemu.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-biss.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-cryptoworks.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-director.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-irdeto.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-nagravision.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-omnicrypt.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-powervu.c
|
||||
SRC-$(CONFIG_WITH_EMU) += module-emulator-viaccess.c
|
||||
ifeq "$(CONFIG_WITH_EMU)" "y"
|
||||
ifeq "$(CONFIG_WITH_SOFTCAM)" "y"
|
||||
UNAME := $(shell uname -s)
|
||||
ifneq ($(UNAME),Darwin)
|
||||
ifndef ANDROID_NDK
|
||||
ifndef ANDROID_STANDALONE_TOOLCHAIN
|
||||
TOUCH_SK := $(shell touch SoftCam.Key)
|
||||
override LDFLAGS += -Wl,--format=binary -Wl,SoftCam.Key -Wl,--format=default
|
||||
ifneq ($(uname_S),Cygwin)
|
||||
override LDFLAGS += -Wl,-z,noexecstack
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
SRC-$(CONFIG_CS_CACHEEX) += module-csp.c
|
||||
SRC-$(CONFIG_CW_CYCLE_CHECK) += module-cw-cycle-check.c
|
||||
SRC-$(CONFIG_WITH_AZBOX) += module-dvbapi-azbox.c
|
||||
SRC-$(CONFIG_WITH_MCA) += module-dvbapi-mca.c
|
||||
### SRC-$(CONFIG_WITH_COOLAPI) += module-dvbapi-coolapi.c
|
||||
### experimental reversed API
|
||||
SRC-$(CONFIG_WITH_COOLAPI) += module-dvbapi-coolapi-legacy.c
|
||||
SRC-$(CONFIG_WITH_COOLAPI2) += module-dvbapi-coolapi.c
|
||||
SRC-$(CONFIG_WITH_SU980) += module-dvbapi-coolapi.c
|
||||
SRC-$(CONFIG_WITH_STAPI) += module-dvbapi-stapi.c
|
||||
SRC-$(CONFIG_WITH_STAPI5) += module-dvbapi-stapi5.c
|
||||
SRC-$(CONFIG_HAVE_DVBAPI) += module-dvbapi-chancache.c
|
||||
SRC-$(CONFIG_HAVE_DVBAPI) += module-dvbapi.c
|
||||
SRC-$(CONFIG_MODULE_GBOX) += module-gbox-helper.c
|
||||
SRC-$(CONFIG_MODULE_GBOX) += module-gbox-sms.c
|
||||
SRC-$(CONFIG_MODULE_GBOX) += module-gbox-remm.c
|
||||
SRC-$(CONFIG_MODULE_GBOX) += module-gbox-cards.c
|
||||
SRC-$(CONFIG_MODULE_GBOX) += module-gbox.c
|
||||
SRC-$(CONFIG_LCDSUPPORT) += module-lcd.c
|
||||
SRC-$(CONFIG_LEDSUPPORT) += module-led.c
|
||||
SRC-$(CONFIG_MODULE_MONITOR) += module-monitor.c
|
||||
SRC-$(CONFIG_MODULE_NEWCAMD) += module-newcamd.c
|
||||
SRC-$(CONFIG_MODULE_NEWCAMD) += module-newcamd-des.c
|
||||
SRC-$(CONFIG_MODULE_PANDORA) += module-pandora.c
|
||||
SRC-$(CONFIG_MODULE_GHTTP) += module-ghttp.c
|
||||
SRC-$(CONFIG_MODULE_RADEGAST) += module-radegast.c
|
||||
SRC-$(CONFIG_MODULE_SCAM) += module-scam.c
|
||||
SRC-$(CONFIG_MODULE_SERIAL) += module-serial.c
|
||||
SRC-$(CONFIG_MODULE_STREAMRELAY) += module-streamrelay.c
|
||||
SRC-$(CONFIG_WITH_LB) += module-stat.c
|
||||
SRC-$(CONFIG_WEBIF) += module-webif-lib.c
|
||||
SRC-$(CONFIG_WEBIF) += module-webif-tpl.c
|
||||
SRC-$(CONFIG_WEBIF) += module-webif.c
|
||||
SRC-$(CONFIG_WEBIF) += webif/pages.c
|
||||
SRC-$(CONFIG_WEBIF_WIKI) += webif/pages_wiki.c
|
||||
SRC-$(CONFIG_WITH_CARDREADER) += reader-common.c
|
||||
SRC-$(CONFIG_READER_BULCRYPT) += reader-bulcrypt.c
|
||||
SRC-$(CONFIG_READER_CONAX) += reader-conax.c
|
||||
SRC-$(CONFIG_READER_CRYPTOWORKS) += reader-cryptoworks.c
|
||||
SRC-$(CONFIG_READER_DGCRYPT) += reader-dgcrypt.c
|
||||
SRC-$(CONFIG_READER_DRE) += reader-dre.c
|
||||
SRC-$(CONFIG_READER_DRE) += reader-dre-cas.c
|
||||
SRC-$(CONFIG_READER_DRE) += reader-dre-common.c
|
||||
SRC-$(CONFIG_READER_DRE) += reader-dre-st20.c
|
||||
SRC-$(CONFIG_READER_GRIFFIN) += reader-griffin.c
|
||||
SRC-$(CONFIG_READER_IRDETO) += reader-irdeto.c
|
||||
SRC-$(CONFIG_READER_NAGRA_COMMON) += reader-nagra-common.c
|
||||
SRC-$(CONFIG_READER_NAGRA) += reader-nagra.c
|
||||
SRC-$(CONFIG_READER_NAGRA_MERLIN) += reader-nagracak7.c
|
||||
SRC-$(CONFIG_READER_SECA) += reader-seca.c
|
||||
SRC-$(CONFIG_READER_TONGFANG) += reader-tongfang.c
|
||||
SRC-$(CONFIG_READER_VIACCESS) += reader-viaccess.c
|
||||
SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard-common.c
|
||||
SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard1.c
|
||||
SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard12.c
|
||||
SRC-$(CONFIG_READER_VIDEOGUARD) += reader-videoguard2.c
|
||||
SRC-$(CONFIG_WITH_SIGNING) += oscam-signing.c
|
||||
SRC-y += oscam-aes.c
|
||||
SRC-y += oscam-array.c
|
||||
SRC-y += oscam-hashtable.c
|
||||
SRC-y += oscam-cache.c
|
||||
SRC-y += oscam-chk.c
|
||||
SRC-y += oscam-client.c
|
||||
SRC-y += oscam-conf.c
|
||||
SRC-y += oscam-conf-chk.c
|
||||
SRC-y += oscam-conf-mk.c
|
||||
SRC-y += oscam-config-account.c
|
||||
SRC-y += oscam-config-global.c
|
||||
SRC-y += oscam-config-reader.c
|
||||
SRC-y += oscam-config.c
|
||||
SRC-y += oscam-ecm.c
|
||||
SRC-y += oscam-emm.c
|
||||
SRC-y += oscam-emm-cache.c
|
||||
SRC-y += oscam-failban.c
|
||||
SRC-y += oscam-files.c
|
||||
SRC-y += oscam-garbage.c
|
||||
SRC-y += oscam-lock.c
|
||||
SRC-y += oscam-log.c
|
||||
SRC-y += oscam-log-reader.c
|
||||
SRC-y += oscam-net.c
|
||||
SRC-y += oscam-llist.c
|
||||
SRC-y += oscam-reader.c
|
||||
SRC-y += oscam-simples.c
|
||||
SRC-y += oscam-string.c
|
||||
SRC-y += oscam-time.c
|
||||
SRC-y += oscam-work.c
|
||||
SRC-y += oscam.c
|
||||
# config.c is automatically generated by config.sh in OBJDIR
|
||||
SRC-y += config.c
|
||||
ifdef BUILD_TESTS
|
||||
SRC-y += tests.c
|
||||
override STD_DEFS += -DBUILD_TESTS=1
|
||||
endif
|
||||
|
||||
SRC := $(SRC-y)
|
||||
OBJ := $(addprefix $(OBJDIR)/,$(subst .c,.o,$(SRC)))
|
||||
SRC := $(subst config.c,$(OBJDIR)/config.c,$(SRC))
|
||||
|
||||
# The default build target rebuilds the config.mak if needed and then
|
||||
# starts the compilation.
|
||||
all: submodules
|
||||
@./config.sh --use-flags "$(USE_FLAGS)" --objdir "$(OBJDIR)" --make-config.mak
|
||||
@-mkdir -p $(OBJDIR)/cscrypt $(OBJDIR)/csctapi $(OBJDIR)/minilzo $(OBJDIR)/webif $(OBJDIR)/signing
|
||||
@-printf "\
|
||||
+-------------------------------------------------------------------------------\n\
|
||||
| OSCam Ver.: $(VER) sha: $(GIT_SHA) target: $(TARGET)\n\
|
||||
| Build Date: $(BUILD_DATE)\n\
|
||||
| Tools:\n\
|
||||
| CROSS = $(CROSS_DIR)$(CROSS)\n\
|
||||
| CC = $(CC)\n\
|
||||
| STRIP = $(STRIP)\n\
|
||||
$(UPX_INFO_TOOL)\
|
||||
$(SIGN_INFO_TOOL)\
|
||||
| Settings:\n\
|
||||
| CONF_DIR = $(CONF_DIR)\n\
|
||||
| CC_OPTS = $(strip $(CC_OPTS))\n\
|
||||
| CC_WARN = $(strip $(CC_WARN))\n\
|
||||
| CFLAGS = $(strip $(CFLAGS))\n\
|
||||
| LDFLAGS = $(strip $(LDFLAGS))\n\
|
||||
| LIBS = $(strip $(LIBS))\n\
|
||||
| UseFlags = $(addsuffix =1,$(USE_FLAGS))\n\
|
||||
| Config:\n\
|
||||
| Addons : $(shell ./config.sh --use-flags "$(USE_FLAGS)" --show-enabled addons)\n\
|
||||
| Protocols: $(shell ./config.sh --use-flags "$(USE_FLAGS)" --show-enabled protocols | sed -e 's|MODULE_||g')\n\
|
||||
| Readers : $(shell ./config.sh --use-flags "$(USE_FLAGS)" --show-enabled readers | sed -e 's|READER_||g')\n\
|
||||
| CardRdrs : $(shell ./config.sh --use-flags "$(USE_FLAGS)" --show-enabled card_readers | sed -e 's|CARDREADER_||g')\n\
|
||||
| Compiler : $(CCVERSION)$(SSL_INFO)\n\
|
||||
$(UPX_INFO)\
|
||||
$(SIGN_INFO)\
|
||||
| Config : $(OBJDIR)/config.mak\n\
|
||||
| Binary : $(OSCAM_BIN)\n\
|
||||
+-------------------------------------------------------------------------------\n"
|
||||
ifeq "$(shell ./config.sh --enabled WEBIF)" "Y"
|
||||
@$(MAKE) --no-print-directory --quiet -C webif
|
||||
endif
|
||||
@$(MAKE) --no-print-directory $(OSCAM_BIN) $(LIST_SMARGO_BIN)
|
||||
|
||||
$(OSCAM_BIN).debug: $(OBJ)
|
||||
$(SAY) "LINK $@"
|
||||
$(Q)$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $@
|
||||
$(Q)$(SIGN_COMMAND_OSCAM)
|
||||
|
||||
$(OSCAM_BIN): $(OSCAM_BIN).debug
|
||||
$(SAY) "STRIP $@"
|
||||
$(Q)cp $(OSCAM_BIN).debug $(OSCAM_BIN)
|
||||
$(Q)$(STRIP) $(OSCAM_BIN)
|
||||
$(Q)$(SIGN_COMMAND_OSCAM)
|
||||
$(Q)$(UPX_COMMAND_OSCAM)
|
||||
|
||||
$(LIST_SMARGO_BIN): utils/list_smargo.c
|
||||
$(SAY) "BUILD $@"
|
||||
$(Q)$(CC) $(STD_DEFS) $(CC_OPTS) $(CC_WARN) $(CFLAGS) $(LDFLAGS) utils/list_smargo.c $(LIBS) -o $@
|
||||
|
||||
$(OBJDIR)/config.o: $(OBJDIR)/config.c
|
||||
$(SAY) "CONF $<"
|
||||
$(Q)$(CC) $(STD_DEFS) $(CC_OPTS) $(CC_WARN) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/%.o: %.c Makefile
|
||||
@$(CC) $(CFLAGS) -MP -MM -MT $@ -o $(subst .o,.d,$@) $<
|
||||
$(SAY) "CC $<"
|
||||
$(Q)$(CC) $(STD_DEFS) $(CC_OPTS) $(CC_WARN) $(CFLAGS) -c $< -o $@
|
||||
|
||||
-include $(subst .o,.d,$(OBJ))
|
||||
|
||||
tests:
|
||||
@-$(MAKE) --no-print-directory BUILD_TESTS=1 OSCAM_BIN=$(TESTS_BIN)
|
||||
@-touch oscam.c
|
||||
# The above is really hideous hack :-) If we don't force oscam.c recompilation
|
||||
# after we've build the tests binary, the next "normal" compilation would fail
|
||||
# because there would be no run_tests() function. So the touch is there to
|
||||
# ensure oscam.c would be recompiled.
|
||||
|
||||
config:
|
||||
$(SHELL) ./config.sh --gui
|
||||
|
||||
menuconfig: config
|
||||
|
||||
allyesconfig:
|
||||
@echo "Enabling all config options."
|
||||
@-$(SHELL) ./config.sh --enable all
|
||||
|
||||
allnoconfig:
|
||||
@echo "Disabling all config options."
|
||||
@-$(SHELL) ./config.sh --disable all
|
||||
|
||||
defconfig:
|
||||
@echo "Restoring default config."
|
||||
@-$(SHELL) ./config.sh --restore
|
||||
|
||||
clean:
|
||||
@-for FILE in $(BUILD_DIR)/* $(TESTS_BIN) $(TESTS_BIN).debug; do \
|
||||
echo "RM $$FILE"; \
|
||||
rm -rf $$FILE; \
|
||||
done
|
||||
@-rm -rf $(BUILD_DIR) lib
|
||||
|
||||
distclean: clean
|
||||
@-for FILE in $(BINDIR)/list_smargo-* $(BINDIR)/oscam-$(VER)*; do \
|
||||
echo "RM $$FILE"; \
|
||||
rm -rf $$FILE; \
|
||||
done
|
||||
@-$(MAKE) --no-print-directory --quiet -C webif clean
|
||||
|
||||
submodules:
|
||||
@./config.sh --submodule
|
||||
|
||||
README.build:
|
||||
@echo "Extracting 'make help' into $@ file."
|
||||
@-printf "\
|
||||
** This file is generated from 'make help' output, do not edit it. **\n\
|
||||
\n\
|
||||
" > $@
|
||||
@-$(MAKE) --no-print-directory help >> $@
|
||||
@echo "Done."
|
||||
|
||||
README.config:
|
||||
@echo "Extracting 'config.sh --help' into $@ file."
|
||||
@-printf "\
|
||||
** This file is generated from 'config.sh --help' output, do not edit it. **\n\
|
||||
\n\
|
||||
" > $@
|
||||
@-./config.sh --help >> $@
|
||||
@echo "Done."
|
||||
|
||||
help:
|
||||
@-printf "\
|
||||
OSCam build system documentation\n\
|
||||
================================\n\
|
||||
\n\
|
||||
Build variables:\n\
|
||||
The build variables are set on the make command line and control the build\n\
|
||||
process. Setting the variables lets you enable additional features, request\n\
|
||||
extra libraries and more. Currently recognized build variables are:\n\
|
||||
\n\
|
||||
CROSS=prefix - Set tools prefix. This variable is used when OScam is being\n\
|
||||
cross compiled. For example if you want to cross compile\n\
|
||||
for SH4 architecture you can run: 'make CROSS=sh4-linux-'\n\
|
||||
If you don't have the directory where cross compilers are\n\
|
||||
in your PATH you can run:\n\
|
||||
'make CROSS=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-'\n\
|
||||
\n\
|
||||
CROSS_DIR=dir - Set tools directory. This variable is added in front of\n\
|
||||
CROSS variable. CROSS_DIR is useful if you want to use\n\
|
||||
predefined targets that are setting CROSS, but you don't have\n\
|
||||
the cross compilers in your PATH. For example:\n\
|
||||
'make sh4 CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/'\n\
|
||||
'make dm500 CROSS_DIR=/opt/cross/dm500/cdk/bin/'\n\
|
||||
\n\
|
||||
CONF_DIR=/dir - Set OSCam config directory. For example to change config\n\
|
||||
directory to /etc run: 'make CONF_DIR=/etc'\n\
|
||||
The default config directory is: '$(CONF_DIR)'\n\
|
||||
\n\
|
||||
CC_OPTS=text - This variable holds compiler optimization parameters.\n\
|
||||
Default CC_OPTS value is:\n\
|
||||
'$(CC_OPTS)'\n\
|
||||
To add text to this variable set EXTRA_CC_OPTS=text.\n\
|
||||
\n\
|
||||
CC_WARN=text - This variable holds compiler warning parameters.\n\
|
||||
Default CC_WARN value is:\n\
|
||||
'$(CC_WARN)'\n\
|
||||
To add text to this variable set EXTRA_CC_WARN=text.\n\
|
||||
\n\
|
||||
V=1 - Request build process to print verbose messages. By\n\
|
||||
default the only messages that are shown are simple info\n\
|
||||
what is being compiled. To request verbose build run:\n\
|
||||
'make V=1'\n\
|
||||
\n\
|
||||
COMP_LEVEL=text - This variable holds the upx compression level and can be\n\
|
||||
used in combination with USE_COMPRESS=1\n\
|
||||
For example to change compression level to brute\n\
|
||||
you can run: 'make USE_COMPRESS=1 COMP_LEVEL=--brute'\n\
|
||||
To get a list of available compression levels run: 'upx --help'\n\
|
||||
The default upx compression level is: '$(COMP_LEVEL)'\n\
|
||||
\n\
|
||||
Extra build variables:\n\
|
||||
These variables add text to build variables. They are useful if you want\n\
|
||||
to add additional options to already set variables without overwriting them\n\
|
||||
Currently defined EXTRA_xxx variables are:\n\
|
||||
\n\
|
||||
EXTRA_CC_OPTS - Add text to CC_OPTS.\n\
|
||||
Example: 'make EXTRA_CC_OPTS=-Os'\n\
|
||||
\n\
|
||||
EXTRA_CC_WARN - Add text to CC_WARN.\n\
|
||||
Example: 'make EXTRA_CC_WARN=-Wshadow'\n\
|
||||
\n\
|
||||
EXTRA_TARGET - Add text to TARGET.\n\
|
||||
Example: 'make EXTRA_TARGET=-private'\n\
|
||||
\n\
|
||||
EXTRA_CFLAGS - Add text to CFLAGS (affects compilation).\n\
|
||||
Example: 'make EXTRA_CFLAGS=\"-DBLAH=1 -I/opt/local\"'\n\
|
||||
\n\
|
||||
EXTRA_LDFLAGS - Add text to LDFLAGS (affects linking).\n\
|
||||
Example: 'make EXTRA_LDFLAGS=-Llibdir'\n\
|
||||
\n\
|
||||
EXTRA_FLAGS - Add text to both EXTRA_CFLAGS and EXTRA_LDFLAGS.\n\
|
||||
Example: 'make EXTRA_FLAGS=-DBLAH=1'\n\
|
||||
\n\
|
||||
EXTRA_LIBS - Add text to LIBS (affects linking).\n\
|
||||
Example: 'make EXTRA_LIBS=\"-L./stapi -loscam_stapi\"'\n\
|
||||
\n\
|
||||
Use flags:\n\
|
||||
Use flags are used to request additional libraries or features to be used\n\
|
||||
by OSCam. Currently defined USE_xxx flags are:\n\
|
||||
\n\
|
||||
USE_COMPRESS=1 - Request compressing oscam binary with upx.\n\
|
||||
\n\
|
||||
USE_LIBUSB=1 - Request linking with libusb. The variables that control\n\
|
||||
USE_LIBUSB=1 build are:\n\
|
||||
LIBUSB_FLAGS='$(DEFAULT_LIBUSB_FLAGS)'\n\
|
||||
LIBUSB_CFLAGS='$(DEFAULT_LIBUSB_FLAGS)'\n\
|
||||
LIBUSB_LDFLAGS='$(DEFAULT_LIBUSB_FLAGS)'\n\
|
||||
LIBUSB_LIB='$(DEFAULT_LIBUSB_LIB)'\n\
|
||||
Using USE_LIBUSB=1 adds to '-libusb' to PLUS_TARGET.\n\
|
||||
To build with static libusb, set the variable LIBUSB_LIB\n\
|
||||
to contain full path of libusb library. For example:\n\
|
||||
make USE_LIBUSB=1 LIBUSB_LIB=/usr/lib/libusb-1.0.a\n\
|
||||
\n\
|
||||
USE_PCSC=1 - Request linking with PCSC. The variables that control\n\
|
||||
USE_PCSC=1 build are:\n\
|
||||
PCSC_FLAGS='$(DEFAULT_PCSC_FLAGS)'\n\
|
||||
PCSC_CFLAGS='$(DEFAULT_PCSC_FLAGS)'\n\
|
||||
PCSC_LDFLAGS='$(DEFAULT_PCSC_FLAGS)'\n\
|
||||
PCSC_LIB='$(DEFAULT_PCSC_LIB)'\n\
|
||||
Using USE_PCSC=1 adds to '-pcsc' to PLUS_TARGET.\n\
|
||||
To build with static PCSC, set the variable PCSC_LIB\n\
|
||||
to contain full path of PCSC library. For example:\n\
|
||||
make USE_PCSC=1 PCSC_LIB=/usr/local/lib/libpcsclite.a\n\
|
||||
\n\
|
||||
USE_STAPI=1 - Request linking with STAPI. The variables that control\n\
|
||||
USE_STAPI=1 build are:\n\
|
||||
STAPI_FLAGS='$(DEFAULT_STAPI_FLAGS)'\n\
|
||||
STAPI_CFLAGS='$(DEFAULT_STAPI_FLAGS)'\n\
|
||||
STAPI_LDFLAGS='$(DEFAULT_STAPI_FLAGS)'\n\
|
||||
STAPI_LIB='$(DEFAULT_STAPI_LIB)'\n\
|
||||
Using USE_STAPI=1 adds to '-stapi' to PLUS_TARGET.\n\
|
||||
In order for USE_STAPI to work you have to create stapi\n\
|
||||
directory and put liboscam_stapi.a file in it.\n\
|
||||
\n\
|
||||
USE_STAPI5=1 - Request linking with STAPI5. The variables that control\n\
|
||||
USE_STAPI5=1 build are:\n\
|
||||
STAPI5_FLAGS='$(DEFAULT_STAPI5_FLAGS)'\n\
|
||||
STAPI5_CFLAGS='$(DEFAULT_STAPI5_FLAGS)'\n\
|
||||
STAPI5_LDFLAGS='$(DEFAULT_STAPI5_FLAGS)'\n\
|
||||
STAPI5_LIB='$(DEFAULT_STAPI5_LIB)'\n\
|
||||
Using USE_STAPI5=1 adds to '-stapi' to PLUS_TARGET.\n\
|
||||
In order for USE_STAPI5 to work you have to create stapi\n\
|
||||
directory and put liboscam_stapi5.a file in it.\n\
|
||||
\n\
|
||||
USE_COOLAPI=1 - Request support for Coolstream API (libnxp) aka NeutrinoHD\n\
|
||||
box. The variables that control the build are:\n\
|
||||
COOLAPI_FLAGS='$(DEFAULT_COOLAPI_FLAGS)'\n\
|
||||
COOLAPI_CFLAGS='$(DEFAULT_COOLAPI_FLAGS)'\n\
|
||||
COOLAPI_LDFLAGS='$(DEFAULT_COOLAPI_FLAGS)'\n\
|
||||
COOLAPI_LIB='$(DEFAULT_COOLAPI_LIB)'\n\
|
||||
Using USE_COOLAPI=1 adds to '-coolapi' to PLUS_TARGET.\n\
|
||||
In order for USE_COOLAPI to work you have to have libnxp.so\n\
|
||||
library in your cross compilation toolchain.\n\
|
||||
\n\
|
||||
USE_COOLAPI2=1 - Request support for Coolstream API aka NeutrinoHD\n\
|
||||
box. The variables that control the build are:\n\
|
||||
COOLAPI_FLAGS='$(DEFAULT_COOLAPI2_FLAGS)'\n\
|
||||
COOLAPI_CFLAGS='$(DEFAULT_COOLAPI2_FLAGS)'\n\
|
||||
COOLAPI_LDFLAGS='$(DEFAULT_COOLAPI2_FLAGS)'\n\
|
||||
COOLAPI_LIB='$(DEFAULT_COOLAPI2_LIB)'\n\
|
||||
Using USE_COOLAPI2=1 adds to '-coolapi2' to PLUS_TARGET.\n\
|
||||
In order for USE_COOLAPI2 to work you have to have liblnxUKAL.so,\n\
|
||||
liblnxcssUsr.so, liblnxscsUsr.so, liblnxnotifyqUsr.so, liblnxplatUsr.so\n\
|
||||
library in your cross compilation toolchain.\n\
|
||||
\n\
|
||||
USE_SU980=1 - Request support for SU980 API (libentropic) aka Enimga2 arm\n\
|
||||
box. The variables that control the build are:\n\
|
||||
COOLAPI_FLAGS='$(DEFAULT_SU980_FLAGS)'\n\
|
||||
COOLAPI_CFLAGS='$(DEFAULT_SU980_FLAGS)'\n\
|
||||
COOLAPI_LDFLAGS='$(DEFAULT_SU980_FLAGS)'\n\
|
||||
COOLAPI_LIB='$(DEFAULT_SU980_LIB)'\n\
|
||||
Using USE_SU980=1 adds to '-su980' to PLUS_TARGET.\n\
|
||||
In order for USE_SU980 to work you have to have libentropic.a\n\
|
||||
library in your cross compilation toolchain.\n\
|
||||
\n\
|
||||
USE_AZBOX=1 - Request support for AZBOX (openxcas)\n\
|
||||
box. The variables that control the build are:\n\
|
||||
AZBOX_FLAGS='$(DEFAULT_AZBOX_FLAGS)'\n\
|
||||
AZBOX_CFLAGS='$(DEFAULT_AZBOX_FLAGS)'\n\
|
||||
AZBOX_LDFLAGS='$(DEFAULT_AZBOX_FLAGS)'\n\
|
||||
AZBOX_LIB='$(DEFAULT_AZBOX_LIB)'\n\
|
||||
Using USE_AZBOX=1 adds to '-azbox' to PLUS_TARGET.\n\
|
||||
extapi/openxcas/libOpenXCASAPI.a library that is shipped\n\
|
||||
with OSCam is compiled for MIPSEL.\n\
|
||||
\n\
|
||||
USE_AMSMC=1 - Request support for Amlogic SMC internal smartcard reader.\n\
|
||||
Using USE_AMSMC=1 adds '-amsmc' to PLUS_TARGET.\n\
|
||||
This enables support for the internal smartcard slot\n\
|
||||
on set-top boxes using the Amlogic SMC driver (/dev/smc0).\n\
|
||||
\n\
|
||||
USE_MCA=1 - Request support for Matrix Cam Air (MCA).\n\
|
||||
The variables that control the build are:\n\
|
||||
MCA_FLAGS='$(DEFAULT_MCA_FLAGS)'\n\
|
||||
MCA_CFLAGS='$(DEFAULT_MCA_FLAGS)'\n\
|
||||
MCA_LDFLAGS='$(DEFAULT_MCA_FLAGS)'\n\
|
||||
Using USE_MCA=1 adds to '-mca' to PLUS_TARGET.\n\
|
||||
\n\
|
||||
USE_LIBCRYPTO=1 - Request linking with libcrypto instead of using OSCam\n\
|
||||
internal crypto functions. USE_LIBCRYPTO is automatically\n\
|
||||
enabled if the build is configured with SSL support. The\n\
|
||||
variables that control USE_LIBCRYPTO=1 build are:\n\
|
||||
LIBCRYPTO_FLAGS='$(DEFAULT_LIBCRYPTO_FLAGS)'\n\
|
||||
LIBCRYPTO_CFLAGS='$(DEFAULT_LIBCRYPTO_FLAGS)'\n\
|
||||
LIBCRYPTO_LDFLAGS='$(DEFAULT_LIBCRYPTO_FLAGS)'\n\
|
||||
LIBCRYPTO_LIB='$(DEFAULT_LIBCRYPTO_LIB)'\n\
|
||||
\n\
|
||||
USE_SSL=1 - Request linking with libssl. USE_SSL is automatically\n\
|
||||
enabled if the build is configured with SSL support. The\n\
|
||||
variables that control USE_SSL=1 build are:\n\
|
||||
SSL_FLAGS='$(DEFAULT_SSL_FLAGS)'\n\
|
||||
SSL_CFLAGS='$(DEFAULT_SSL_FLAGS)'\n\
|
||||
SSL_LDFLAGS='$(DEFAULT_SSL_FLAGS)'\n\
|
||||
SSL_LIB='$(DEFAULT_SSL_LIB)'\n\
|
||||
Using USE_SSL=1 adds to '-ssl' to PLUS_TARGET.\n\
|
||||
\n\
|
||||
USE_LIBDVBCSA=1 - Request linking with libdvbcsa. USE_LIBDVBCSA is automatically\n\
|
||||
enabled if the build is configured with STREAMRELAY support. The\n\
|
||||
variables that control USE_LIBDVBCSA=1 build are:\n\
|
||||
LIBDVBCSA_FLAGS='$(DEFAULT_LIBDVBCSA_FLAGS)'\n\
|
||||
LIBDVBCSA_CFLAGS='$(DEFAULT_LIBDVBCSA_FLAGS)'\n\
|
||||
LIBDVBCSA_LDFLAGS='$(DEFAULT_LIBDVBCSA_FLAGS)'\n\
|
||||
LIBDVBCSA_LIB='$(DEFAULT_LIBDVBCSA_LIB)'\n\
|
||||
\n\
|
||||
Automatically intialized variables:\n\
|
||||
\n\
|
||||
TARGET=text - This variable is auto detected by using the compiler's\n\
|
||||
-dumpmachine output. To see the target on your machine run:\n\
|
||||
'gcc -dumpmachine'\n\
|
||||
\n\
|
||||
PLUS_TARGET - This variable is added to TARGET and it is set depending\n\
|
||||
on the chosen USE_xxx flags. To disable adding\n\
|
||||
PLUS_TARGET to TARGET, set NO_PLUS_TARGET=1\n\
|
||||
\n\
|
||||
BINDIR - The directory where final oscam binary would be put. The\n\
|
||||
default is: $(BINDIR)\n\
|
||||
\n\
|
||||
OSCAM_BIN=text - This variable controls how the oscam binary will be named.\n\
|
||||
Default OSCAM_BIN value is:\n\
|
||||
'BINDIR/oscam-VER@$GIT_SHA-TARGET'\n\
|
||||
Once the variables (BINDIR, VER, GIT_SHA and TARGET) are\n\
|
||||
replaced, the resulting filename can look like this:\n\
|
||||
'Distribution/oscam-1.20-unstable_svn7404-i486-slackware-linux-static'\n\
|
||||
For example you can run: 'make OSCAM_BIN=my-oscam'\n\
|
||||
\n\
|
||||
Binaries compiled and run during the OSCam build:\n\
|
||||
\n\
|
||||
OSCam builds webif/pages_gen binary that is run by the build system to\n\
|
||||
generate file that holds web pages. To build this binary two variables\n\
|
||||
are used:\n\
|
||||
\n\
|
||||
HOSTCC=gcc - The compiler used for building binaries that are run on\n\
|
||||
the build machine (the host). Default: gcc\n\
|
||||
To use clang for example run: make CC=clang HOSTCC=clang\n\
|
||||
\n\
|
||||
HOSTCFLAGS=xxx - The CFLAGS passed to HOSTCC. See webif/Makefile for the\n\
|
||||
default host cflags.\n\
|
||||
\n\
|
||||
Config targets:\n\
|
||||
make config - Start configuration utility.\n\
|
||||
make allyesconfig - Enable all configuration options.\n\
|
||||
make allnoconfig - Disable all configuration options.\n\
|
||||
make defconfig - Restore default configuration options.\n\
|
||||
\n\
|
||||
Cleaning targets:\n\
|
||||
make clean - Remove '$(BUILD_DIR)' directory which contains compiled\n\
|
||||
object files.\n\
|
||||
make distclean - Executes clean target and also removes binary files\n\
|
||||
located in '$(BINDIR)' directory.\n\
|
||||
\n\
|
||||
Build system files:\n\
|
||||
config.sh - OSCam configuration. Run 'config.sh --help' to see\n\
|
||||
available parameters or 'make config' to start GUI\n\
|
||||
configuratior.\n\
|
||||
Makefile - Main build system file.\n\
|
||||
Makefile.extra - Contains predefined targets. You can use this file\n\
|
||||
as example on how to use the build system.\n\
|
||||
Makefile.local - This file is included in Makefile and allows creation\n\
|
||||
of local build system targets. See Makefile.extra for\n\
|
||||
examples.\n\
|
||||
\n\
|
||||
Here are some of the interesting predefined targets in Makefile.extra.\n\
|
||||
To use them run 'make target ...' where ... can be any extra flag. For\n\
|
||||
example if you want to compile OSCam for Dreambox (DM500) but do not\n\
|
||||
have the compilers in the path, you can run:\n\
|
||||
make dm500 CROSS_DIR=/opt/cross/dm500/cdk/bin/\n\
|
||||
\n\
|
||||
Predefined targets in Makefile.extra:\n\
|
||||
\n\
|
||||
make libusb - Builds OSCam with libusb support\n\
|
||||
make pcsc - Builds OSCam with PCSC support\n\
|
||||
make pcsc-libusb - Builds OSCam with PCSC and libusb support\n\
|
||||
make dm500 - Builds OSCam for Dreambox (DM500)\n\
|
||||
make sh4 - Builds OSCam for SH4 boxes\n\
|
||||
make azbox - Builds OSCam for AZBox STBs\n\
|
||||
make mca - Builds OSCam for Matrix Cam Air (MCA)\n\
|
||||
make coolstream - Builds OSCam for Coolstream HD1\n\
|
||||
make coolstream2 - Builds OSCam for Coolstream HD2\n\
|
||||
make dockstar - Builds OSCam for Dockstar\n\
|
||||
make qboxhd - Builds OSCam for QBoxHD STBs\n\
|
||||
make opensolaris - Builds OSCam for OpenSolaris\n\
|
||||
make uclinux - Builds OSCam for m68k uClinux\n\
|
||||
\n\
|
||||
Predefined targets for static builds:\n\
|
||||
make static - Builds OSCam statically\n\
|
||||
make static-libusb - Builds OSCam with libusb linked statically\n\
|
||||
make static-libcrypto - Builds OSCam with libcrypto linked statically\n\
|
||||
make static-ssl - Builds OSCam with SSL support linked statically\n\
|
||||
\n\
|
||||
Developer targets:\n\
|
||||
make tests - Builds '$(TESTS_BIN)' binary\n\
|
||||
\n\
|
||||
Examples:\n\
|
||||
Build OSCam for SH4 (the compilers are in the path):\n\
|
||||
make CROSS=sh4-linux-\n\n\
|
||||
Build OSCam for SH4 (the compilers are in not in the path):\n\
|
||||
make sh4 CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/\n\
|
||||
make CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/ CROSS=sh4-linux-\n\
|
||||
make CROSS=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-\n\n\
|
||||
Build OSCam for SH4 with STAPI:\n\
|
||||
make CROSS=sh4-linux- USE_STAPI=1\n\n\
|
||||
Build OSCam for SH4 with STAPI and changed configuration directory:\n\
|
||||
make CROSS=sh4-linux- USE_STAPI=1 CONF_DIR=/var/tuxbox/config\n\n\
|
||||
Build OSCam for ARM with COOLAPI (coolstream aka NeutrinoHD):\n\
|
||||
make CROSS=arm-cx2450x-linux-gnueabi- USE_COOLAPI=1\n\n\
|
||||
Build OSCam for ARM with COOLAPI2 (coolstream aka NeutrinoHD):\n\
|
||||
make CROSS=arm-pnx8400-linux-uclibcgnueabi- USE_COOLAPI2=1\n\n\
|
||||
Build OSCam for MIPSEL with AZBOX support:\n\
|
||||
make CROSS=mipsel-linux-uclibc- USE_AZBOX=1\n\n\
|
||||
Build OSCam for ARM with Amlogic SMC internal reader support:\n\
|
||||
make CROSS=aarch64-linux-gnu- USE_AMSMC=1\n\n\
|
||||
Build OSCam for ARM with MCA support:\n\
|
||||
make CROSS=arm-none-linux-gnueabi- USE_MCA=1\n\n\
|
||||
Build OSCam with libusb and PCSC:\n\
|
||||
make USE_LIBUSB=1 USE_PCSC=1\n\n\
|
||||
Build OSCam with static libusb:\n\
|
||||
make USE_LIBUSB=1 LIBUSB_LIB=\"/usr/lib/libusb-1.0.a\"\n\n\
|
||||
Build OSCam with static libcrypto:\n\
|
||||
make USE_LIBCRYPTO=1 LIBCRYPTO_LIB=\"/usr/lib/libcrypto.a\"\n\n\
|
||||
Build OSCam with static libssl and libcrypto:\n\
|
||||
make USE_SSL=1 SSL_LIB=\"/usr/lib/libssl.a\" LIBCRYPTO_LIB=\"/usr/lib/libcrypto.a\"\n\n\
|
||||
Build OSCam with static libdvbcsa:\n\
|
||||
make USE_LIBDVBCSA=1 LIBDVBCSA_LIB=\"/usr/lib/libdvbcsa.a\"\n\n\
|
||||
Build with verbose messages and size optimizations:\n\
|
||||
make V=1 CC_OPTS=-Os\n\n\
|
||||
Build and set oscam file name:\n\
|
||||
make OSCAM_BIN=oscam\n\n\
|
||||
Build and set oscam file name depending on revision:\n\
|
||||
make OSCAM_BIN=oscam-\`./config.sh -r\`\n\n\
|
||||
"
|
||||
|
||||
simple: all
|
||||
default: all
|
||||
debug: all
|
||||
|
||||
-include Makefile.extra
|
||||
-include Makefile.local
|
||||
301
Makefile.extra
Normal file
301
Makefile.extra
Normal file
|
|
@ -0,0 +1,301 @@
|
|||
i386-pc-linux: simple
|
||||
i386-pc-linux-debug: debug
|
||||
i386-pc-freebsd: simple
|
||||
hppa1.1-hp-hpux10.20: simple
|
||||
alpha-dec-osf5.1: simple
|
||||
linux: simple
|
||||
freebsd: simple
|
||||
tuxbox: cross-powerpc-tuxbox-linux
|
||||
tripledragon: cross-powerpc-405-linux
|
||||
win: cross-i386-pc-cygwin
|
||||
cygwin: i386-pc-cygwin
|
||||
macosx: macosx-native
|
||||
linux-pcsc: i386-pc-linux-pcsc
|
||||
dm500: cross-powerpc-tuxbox-linux
|
||||
sh4: cross-sh4-linux
|
||||
sh4-stapi: cross-sh4-linux-stapi
|
||||
i386-pc-linux-libusb: libusb
|
||||
i386-pc-linux-pcsc: pcsc
|
||||
i386-pc-linux-pcsc-libusb: pcsc-libusb
|
||||
libusb-pcsc: pcsc-libusb
|
||||
|
||||
libusb:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_LIBUSB=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
pcsc:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_PCSC=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
pcsc-libusb:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_LIBUSB=1 \
|
||||
USE_PCSC=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
macosx-native:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_PCSC=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
macosx-libusb:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_LIBUSB=1 \
|
||||
USE_PCSC=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-i386-pc-freebsd:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=i386-pc-freebsd5.4- \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-powerpc-tuxbox-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=powerpc-tuxbox-linux-gnu- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-powerpc-tuxbox-linux-uclibc:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=powerpc-tuxbox-linux-uclibc- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-powerpc-405-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=powerpc-405-linux-gnu- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
EXTRA_FLAGS="-DSTB04SCI=1"
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-sh4-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=sh4-linux- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-sh4-linux-stapi:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=sh4-linux- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
USE_STAPI=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-i386-pc-cygwin:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=i686-pc-cygwin- \
|
||||
EXTRA_FLAGS="-static" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
i386-pc-cygwin:
|
||||
$(MAKE) --no-print-directory \
|
||||
EXTRA_FLAGS="-I /tmp/include" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
i386-pc-cygwin-pcsc:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_PCSC=1 \
|
||||
PCSC_LIB="-lwinscard" \
|
||||
EXTRA_FLAGS="-D_WIN32 -I /tmp/include -I ./cygwin -I/usr/include/w32api" \
|
||||
EXTRA_LDFLAGS="-L/cygdrive/c/WINDOWS/system32/" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
i386-pc-cygwin-libusb:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_LIBUSB=1 \
|
||||
LIBUSB_LIB="/usr/lib/libusb-1.0.a" \
|
||||
USE_PCSC=1 \
|
||||
PCSC_LIB="-lwinscard" \
|
||||
EXTRA_LIBS="-lSetupAPI -lOle32 -lshell32" \
|
||||
EXTRA_FLAGS="-D_WIN32 -I /tmp/include -I ./cygwin -I/usr/include/w32api" \
|
||||
EXTRA_LDFLAGS="-L/cygdrive/c/WINDOWS/system32/" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-sparc-sun-solaris2.7:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=sparc-sun-solaris2.7- \
|
||||
EXTRA_LIBS="-lsocket" \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
opensolaris:
|
||||
$(MAKE) --no-print-directory \
|
||||
EXTRA_LIBS="-lsocket -lnsl" \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-rs6000-ibm-aix4.2:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=rs6000-ibm-aix4.2- \
|
||||
LIB_PTHREAD=-lpthreads \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-mips-sgi-irix6.5:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mips-sgi-irix6.5- \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-mipsel-router-linux-uclibc:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mipsel-linux-uclibc- \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-mipsel-router-linux-uclibc927: cross-mipsel-router-linux-uclibc
|
||||
cross-mipsel-router-linux-uclibc928: cross-mipsel-router-linux-uclibc
|
||||
cross-mipsel-router-linux-uclibc929: cross-mipsel-router-linux-uclibc
|
||||
|
||||
cross-mipsel-router-linux-uclibc929-static:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mipsel-linux-uclibc- \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
EXTRA_LDFLAGS="-static" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-mips-router-linux-uclibc:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mips-linux-uclibc- \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-mips-router-linux-uclibc930: cross-mips-router-linux-uclibc
|
||||
cross-mips-router-linux-uclibc931: cross-mips-router-linux-uclibc930
|
||||
cross-mipsel-fonera2: cross-mips-router-linux-uclibc
|
||||
|
||||
cross-mipsel-tuxbox-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mipsel-unknown-linux-gnu- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-mipsel-tuxbox-linux-glibc:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mipsel-linux-glibc- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
EXTRA_FLAGS="-static-libgcc" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-arm-nslu2-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=armv5b-softfloat-linux- \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-armBE-unknown-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-linux- \
|
||||
EXTRA_FLAGS="-mbig-endian" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-armBE-unkown-linux: cross-armBE-unknown-linux
|
||||
|
||||
cross-armLE-unknown-linux:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-linux- \
|
||||
EXTRA_FLAGS="-mlittle-endian" \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cross-armLE-unkown-linux: cross-armLE-unknown-linux
|
||||
|
||||
azbox:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=mipsel-linux-uclibc- \
|
||||
CONF_DIR=/PLUGINS/OpenXCAS/oscamCAS \
|
||||
USE_AZBOX=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
mca:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-none-linux-gnueabi- \
|
||||
CONF_DIR=/var/mca/d1 \
|
||||
USE_MCA=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cool:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-cx2450x-linux-gnueabi- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
USE_COOLAPI=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
cool2:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-pnx8400-linux-uclibcgnueabi- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
USE_COOLAPI2=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
neutrinohd: cool
|
||||
coolstream: cool
|
||||
|
||||
neutrinohd2: cool2
|
||||
coolstream2: cool2
|
||||
|
||||
su980:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-cortex-linux-gnueabi- \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
USE_SU980=1 \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
hypercube: su980
|
||||
|
||||
dockstar:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=arm-openwrt-linux-uclibcgnueabi- \
|
||||
CONF_DIR=/jffs/etc/config/oscam \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
qboxhd:
|
||||
$(MAKE) --no-print-directory \
|
||||
CROSS=sh4-linux- \
|
||||
EXTRA_FLAGS="-DQBOXHD=1" \
|
||||
PLUS_TARGET=-qboxhd \
|
||||
CONF_DIR=/var/tuxbox/config \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
static:
|
||||
$(MAKE) --no-print-directory \
|
||||
EXTRA_FLAGS=-static \
|
||||
EXTRA_TARGET=-static \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
static-libusb:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_LIBUSB=1 \
|
||||
LIBUSB_LIB=/usr/lib/libusb-1.0.a \
|
||||
EXTRA_TARGET=-static \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
static-libcrypto:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_LIBCRYPTO=1 \
|
||||
LIBCRYPTO_LIB=/usr/lib/libcrypto.a \
|
||||
EXTRA_TARGET=-static \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
static-ssl:
|
||||
$(MAKE) --no-print-directory \
|
||||
USE_SSL=1 \
|
||||
SSL_LIB=/usr/lib/libssl.a \
|
||||
LIBCRYPTO_LIB=/usr/lib/libcrypto.a \
|
||||
EXTRA_TARGET=-static \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
android-arm:
|
||||
$(MAKE) --no-print-directory \
|
||||
LIB_RT= \
|
||||
LIB_PTHREAD= \
|
||||
CROSS=arm-linux-androideabi- \
|
||||
$(MAKEFLAGS)
|
||||
|
||||
uclinux:
|
||||
$(MAKE) --no-print-directory \
|
||||
LIB_DL= STRIP=true \
|
||||
CROSS=m68k-uclinux- \
|
||||
$(MAKEFLAGS)
|
||||
302
README.build
Normal file
302
README.build
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
** This file is generated from 'make help' output, do not edit it. **
|
||||
|
||||
OSCam build system documentation
|
||||
================================
|
||||
|
||||
Build variables:
|
||||
The build variables are set on the make command line and control the build
|
||||
process. Setting the variables lets you enable additional features, request
|
||||
extra libraries and more. Currently recognized build variables are:
|
||||
|
||||
CROSS=prefix - Set tools prefix. This variable is used when OScam is being
|
||||
cross compiled. For example if you want to cross compile
|
||||
for SH4 architecture you can run: 'make CROSS=sh4-linux-'
|
||||
If you don't have the directory where cross compilers are
|
||||
in your PATH you can run:
|
||||
'make CROSS=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-'
|
||||
|
||||
CROSS_DIR=dir - Set tools directory. This variable is added in front of
|
||||
CROSS variable. CROSS_DIR is useful if you want to use
|
||||
predefined targets that are setting CROSS, but you don't have
|
||||
the cross compilers in your PATH. For example:
|
||||
'make sh4 CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/'
|
||||
'make dm500 CROSS_DIR=/opt/cross/dm500/cdk/bin/'
|
||||
|
||||
CONF_DIR=/dir - Set OSCam config directory. For example to change config
|
||||
directory to /etc run: 'make CONF_DIR=/etc'
|
||||
The default config directory is: '/usr/local/etc'
|
||||
|
||||
CC_OPTS=text - This variable holds compiler optimization parameters.
|
||||
Default CC_OPTS value is:
|
||||
'-O2 -ggdb -pipe -ffunction-sections -fdata-sections '
|
||||
To add text to this variable set EXTRA_CC_OPTS=text.
|
||||
|
||||
CC_WARN=text - This variable holds compiler warning parameters.
|
||||
Default CC_WARN value is:
|
||||
'-W -Wall -Wshadow -Wredundant-decls -Wstrict-prototypes -Wold-style-definition '
|
||||
To add text to this variable set EXTRA_CC_WARN=text.
|
||||
|
||||
V=1 - Request build process to print verbose messages. By
|
||||
default the only messages that are shown are simple info
|
||||
what is being compiled. To request verbose build run:
|
||||
'make V=1'
|
||||
|
||||
Extra build variables:
|
||||
These variables add text to build variables. They are useful if you want
|
||||
to add additional options to already set variables without overwriting them
|
||||
Currently defined EXTRA_xxx variables are:
|
||||
|
||||
EXTRA_CC_OPTS - Add text to CC_OPTS.
|
||||
Example: 'make EXTRA_CC_OPTS=-Os'
|
||||
|
||||
EXTRA_CC_WARN - Add text to CC_WARN.
|
||||
Example: 'make EXTRA_CC_WARN=-Wshadow'
|
||||
|
||||
EXTRA_TARGET - Add text to TARGET.
|
||||
Example: 'make EXTRA_TARGET=-private'
|
||||
|
||||
EXTRA_CFLAGS - Add text to CFLAGS (affects compilation).
|
||||
Example: 'make EXTRA_CFLAGS="-DBLAH=1 -I/opt/local"'
|
||||
|
||||
EXTRA_LDFLAGS - Add text to LDFLAGS (affects linking).
|
||||
Example: 'make EXTRA_LDFLAGS=-Llibdir'
|
||||
|
||||
EXTRA_FLAGS - Add text to both EXTRA_CFLAGS and EXTRA_LDFLAGS.
|
||||
Example: 'make EXTRA_FLAGS=-DBLAH=1'
|
||||
|
||||
EXTRA_LIBS - Add text to LIBS (affects linking).
|
||||
Example: 'make EXTRA_LIBS="-L./stapi -loscam_stapi"'
|
||||
|
||||
Use flags:
|
||||
Use flags are used to request additional libraries or features to be used
|
||||
by OSCam. Currently defined USE_xxx flags are:
|
||||
|
||||
USE_LIBUSB=1 - Request linking with libusb. The variables that control
|
||||
USE_LIBUSB=1 build are:
|
||||
LIBUSB_FLAGS='-DWITH_LIBUSB=1'
|
||||
LIBUSB_CFLAGS='-DWITH_LIBUSB=1'
|
||||
LIBUSB_LDFLAGS='-DWITH_LIBUSB=1'
|
||||
LIBUSB_LIB='-lusb-1.0 -lrt'
|
||||
Using USE_LIBUSB=1 adds to '-libusb' to PLUS_TARGET.
|
||||
To build with static libusb, set the variable LIBUSB_LIB
|
||||
to contain full path of libusb library. For example:
|
||||
make USE_LIBUSB=1 LIBUSB_LIB=/usr/lib/libusb-1.0.a
|
||||
|
||||
USE_PCSC=1 - Request linking with PCSC. The variables that control
|
||||
USE_PCSC=1 build are:
|
||||
PCSC_FLAGS='-DWITH_PCSC=1 -I/usr/include/PCSC -I/usr/include/../local/include/PCSC'
|
||||
PCSC_CFLAGS='-DWITH_PCSC=1 -I/usr/include/PCSC -I/usr/include/../local/include/PCSC'
|
||||
PCSC_LDFLAGS='-DWITH_PCSC=1 -I/usr/include/PCSC -I/usr/include/../local/include/PCSC'
|
||||
PCSC_LIB='-lpcsclite'
|
||||
Using USE_PCSC=1 adds to '-pcsc' to PLUS_TARGET.
|
||||
To build with static PCSC, set the variable PCSC_LIB
|
||||
to contain full path of PCSC library. For example:
|
||||
make USE_PCSC=1 PCSC_LIB=/usr/local/lib/libpcsclite.a
|
||||
|
||||
USE_STAPI=1 - Request linking with STAPI. The variables that control
|
||||
USE_STAPI=1 build are:
|
||||
STAPI_FLAGS='-DWITH_STAPI=1'
|
||||
STAPI_CFLAGS='-DWITH_STAPI=1'
|
||||
STAPI_LDFLAGS='-DWITH_STAPI=1'
|
||||
STAPI_LIB='-L./stapi -loscam_stapi'
|
||||
Using USE_STAPI=1 adds to '-stapi' to PLUS_TARGET.
|
||||
In order for USE_STAPI to work you have to create stapi
|
||||
directory and put liboscam_stapi.a file in it.
|
||||
|
||||
USE_STAPI5=1 - Request linking with STAPI5. The variables that control
|
||||
USE_STAPI5=1 build are:
|
||||
STAPI5_FLAGS='-DWITH_STAPI5=1'
|
||||
STAPI5_CFLAGS='-DWITH_STAPI5=1'
|
||||
STAPI5_LDFLAGS='-DWITH_STAPI5=1'
|
||||
STAPI5_LIB='-L./stapi -loscam_stapi5'
|
||||
Using USE_STAPI5=1 adds to '-stapi' to PLUS_TARGET.
|
||||
In order for USE_STAPI5 to work you have to create stapi
|
||||
directory and put liboscam_stapi5.a file in it.
|
||||
|
||||
USE_COOLAPI=1 - Request support for Coolstream API (libnxp) aka NeutrinoHD
|
||||
box. The variables that control the build are:
|
||||
COOLAPI_FLAGS='-DWITH_COOLAPI=1'
|
||||
COOLAPI_CFLAGS='-DWITH_COOLAPI=1'
|
||||
COOLAPI_LDFLAGS='-DWITH_COOLAPI=1'
|
||||
COOLAPI_LIB='-lnxp -lrt'
|
||||
Using USE_COOLAPI=1 adds to '-coolapi' to PLUS_TARGET.
|
||||
In order for USE_COOLAPI to work you have to have libnxp.so
|
||||
library in your cross compilation toolchain.
|
||||
|
||||
USE_SU980=1 - Request support for SU980 API (libentropic) aka Enimga2 arm
|
||||
box. The variables that control the build are:
|
||||
COOLAPI_FLAGS='-DWITH_SU980=1'
|
||||
COOLAPI_CFLAGS='-DWITH_SU980=1'
|
||||
COOLAPI_LDFLAGS='-DWITH_SU980=1'
|
||||
COOLAPI_LIB='-lentropic -lrt'
|
||||
Using USE_SU980=1 adds to '-su980' to PLUS_TARGET.
|
||||
In order for USE_SU980 to work you have to have libentropic.a
|
||||
library in your cross compilation toolchain.
|
||||
|
||||
USE_AZBOX=1 - Request support for AZBOX (openxcas)
|
||||
box. The variables that control the build are:
|
||||
AZBOX_FLAGS='-DWITH_AZBOX=1'
|
||||
AZBOX_CFLAGS='-DWITH_AZBOX=1'
|
||||
AZBOX_LDFLAGS='-DWITH_AZBOX=1'
|
||||
AZBOX_LIB='-Lextapi/openxcas -lOpenXCASAPI'
|
||||
Using USE_AZBOX=1 adds to '-azbox' to PLUS_TARGET.
|
||||
extapi/openxcas/libOpenXCASAPI.a library that is shipped
|
||||
with OSCam is compiled for MIPSEL.
|
||||
|
||||
USE_MCA=1 - Request support for Matrix Cam Air (MCA).
|
||||
The variables that control the build are:
|
||||
MCA_FLAGS='-DWITH_MCA=1'
|
||||
MCA_CFLAGS='-DWITH_MCA=1'
|
||||
MCA_LDFLAGS='-DWITH_MCA=1'
|
||||
Using USE_MCA=1 adds to '-mca' to PLUS_TARGET.
|
||||
|
||||
USE_LIBCRYPTO=1 - Request linking with libcrypto instead of using OSCam
|
||||
internal crypto functions. USE_LIBCRYPTO is automatically
|
||||
enabled if the build is configured with SSL support. The
|
||||
variables that control USE_LIBCRYPTO=1 build are:
|
||||
LIBCRYPTO_FLAGS='-DWITH_LIBCRYPTO=1'
|
||||
LIBCRYPTO_CFLAGS='-DWITH_LIBCRYPTO=1'
|
||||
LIBCRYPTO_LDFLAGS='-DWITH_LIBCRYPTO=1'
|
||||
LIBCRYPTO_LIB='-lcrypto'
|
||||
|
||||
USE_SSL=1 - Request linking with libssl. USE_SSL is automatically
|
||||
enabled if the build is configured with SSL support. The
|
||||
variables that control USE_SSL=1 build are:
|
||||
SSL_FLAGS='-DWITH_SSL=1'
|
||||
SSL_CFLAGS='-DWITH_SSL=1'
|
||||
SSL_LDFLAGS='-DWITH_SSL=1'
|
||||
SSL_LIB='-lssl'
|
||||
Using USE_SSL=1 adds to '-ssl' to PLUS_TARGET.
|
||||
|
||||
Automatically intialized variables:
|
||||
|
||||
TARGET=text - This variable is auto detected by using the compiler's
|
||||
-dumpmachine output. To see the target on your machine run:
|
||||
'gcc -dumpmachine'
|
||||
|
||||
PLUS_TARGET - This variable is added to TARGET and it is set depending
|
||||
on the chosen USE_xxx flags. To disable adding
|
||||
PLUS_TARGET to TARGET, set NO_PLUS_TARGET=1
|
||||
|
||||
BINDIR - The directory where final oscam binary would be put. The
|
||||
default is: Distribution
|
||||
|
||||
OSCAM_BIN=text - This variable controls how the oscam binary will be named.
|
||||
Default OSCAM_BIN value is:
|
||||
'BINDIR/oscam-VERSVN_REV-TARGET'
|
||||
Once the variables (BINDIR, VER, SVN_REV and TARGET) are
|
||||
replaced, the resulting filename can look like this:
|
||||
'Distribution/oscam-1.20-unstable_svn7404-i486-slackware-linux-static'
|
||||
For example you can run: 'make OSCAM_BIN=my-oscam'
|
||||
|
||||
Binaries compiled and run during the OSCam build:
|
||||
|
||||
OSCam builds webif/pages_gen binary that is run by the build system to
|
||||
generate file that holds web pages. To build this binary two variables
|
||||
are used:
|
||||
|
||||
HOSTCC=gcc - The compiler used for building binaries that are run on
|
||||
the build machine (the host). Default: gcc
|
||||
To use clang for example run: make CC=clang HOSTCC=clang
|
||||
|
||||
HOSTCFLAGS=xxx - The CFLAGS passed to HOSTCC. See webif/Makefile for the
|
||||
default host cflags.
|
||||
|
||||
Config targets:
|
||||
make config - Start configuration utility.
|
||||
make allyesconfig - Enable all configuration options.
|
||||
make allnoconfig - Disable all configuration options.
|
||||
make defconfig - Restore default configuration options.
|
||||
|
||||
Cleaning targets:
|
||||
make clean - Remove 'build' directory which contains compiled
|
||||
object files.
|
||||
make distclean - Executes clean target and also removes binary files
|
||||
located in 'Distribution' directory.
|
||||
|
||||
Build system files:
|
||||
config.sh - OSCam configuration. Run 'config.sh --help' to see
|
||||
available parameters or 'make config' to start GUI
|
||||
configuratior.
|
||||
Makefile - Main build system file.
|
||||
Makefile.extra - Contains predefined targets. You can use this file
|
||||
as example on how to use the build system.
|
||||
Makefile.local - This file is included in Makefile and allows creation
|
||||
of local build system targets. See Makefile.extra for
|
||||
examples.
|
||||
|
||||
Here are some of the interesting predefined targets in Makefile.extra.
|
||||
To use them run 'make target ...' where ... can be any extra flag. For
|
||||
example if you want to compile OSCam for Dreambox (DM500) but do not
|
||||
have the compilers in the path, you can run:
|
||||
make dm500 CROSS_DIR=/opt/cross/dm500/cdk/bin/
|
||||
|
||||
Predefined targets in Makefile.extra:
|
||||
|
||||
make libusb - Builds OSCam with libusb support
|
||||
make pcsc - Builds OSCam with PCSC support
|
||||
make pcsc-libusb - Builds OSCam with PCSC and libusb support
|
||||
make dm500 - Builds OSCam for Dreambox (DM500)
|
||||
make sh4 - Builds OSCam for SH4 boxes
|
||||
make azbox - Builds OSCam for AZBox STBs
|
||||
make mca - Builds OSCam for Matrix Cam Air (MCA)
|
||||
make coolstream - Builds OSCam for Coolstream
|
||||
make dockstar - Builds OSCam for Dockstar
|
||||
make qboxhd - Builds OSCam for QBoxHD STBs
|
||||
make opensolaris - Builds OSCam for OpenSolaris
|
||||
make uclinux - Builds OSCam for m68k uClinux
|
||||
|
||||
Predefined targets for static builds:
|
||||
make static - Builds OSCam statically
|
||||
make static-libusb - Builds OSCam with libusb linked statically
|
||||
make static-libcrypto - Builds OSCam with libcrypto linked statically
|
||||
make static-ssl - Builds OSCam with SSL support linked statically
|
||||
|
||||
Developer targets:
|
||||
make tests - Builds 'tests.bin' binary
|
||||
|
||||
Examples:
|
||||
Build OSCam for SH4 (the compilers are in the path):
|
||||
make CROSS=sh4-linux-
|
||||
|
||||
Build OSCam for SH4 (the compilers are in not in the path):
|
||||
make sh4 CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/
|
||||
make CROSS_DIR=/opt/STM/STLinux-2.3/devkit/sh4/bin/ CROSS=sh4-linux-
|
||||
make CROSS=/opt/STM/STLinux-2.3/devkit/sh4/bin/sh4-linux-
|
||||
|
||||
Build OSCam for SH4 with STAPI:
|
||||
make CROSS=sh4-linux- USE_STAPI=1
|
||||
|
||||
Build OSCam for SH4 with STAPI and changed configuration directory:
|
||||
make CROSS=sh4-linux- USE_STAPI=1 CONF_DIR=/var/tuxbox/config
|
||||
|
||||
Build OSCam for ARM with COOLAPI (coolstream aka NeutrinoHD):
|
||||
make CROSS=arm-cx2450x-linux-gnueabi- USE_COOLAPI=1
|
||||
|
||||
Build OSCam for MIPSEL with AZBOX support:
|
||||
make CROSS=mipsel-linux-uclibc- USE_AZBOX=1
|
||||
|
||||
Build OSCam for ARM with MCA support:
|
||||
make CROSS=arm-none-linux-gnueabi- USE_MCA=1
|
||||
|
||||
Build OSCam with libusb and PCSC:
|
||||
make USE_LIBUSB=1 USE_PCSC=1
|
||||
|
||||
Build OSCam with static libusb:
|
||||
make USE_LIBUSB=1 LIBUSB_LIB="/usr/lib/libusb-1.0.a"
|
||||
|
||||
Build OSCam with static libcrypto:
|
||||
make USE_LIBCRYPTO=1 LIBCRYPTO_LIB="/usr/lib/libcrypto.a"
|
||||
|
||||
Build OSCam with static libssl and libcrypto:
|
||||
make USE_SSL=1 SSL_LIB="/usr/lib/libssl.a" LIBCRYPTO_LIB="/usr/lib/libcrypto.a"
|
||||
|
||||
Build with verbose messages and size optimizations:
|
||||
make V=1 CC_OPTS=-Os
|
||||
|
||||
Build and set oscam file name:
|
||||
make OSCAM_BIN=oscam
|
||||
|
||||
Build and set oscam file name depending on revision:
|
||||
make OSCAM_BIN=oscam-`./config.sh -r`
|
||||
|
||||
87
README.config
Normal file
87
README.config
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
** This file is generated from 'config.sh --help' output, do not edit it. **
|
||||
|
||||
OSCam config
|
||||
Usage: config.sh [parameters]
|
||||
|
||||
-g, --gui Start interactive configuration
|
||||
|
||||
-s, --show-enabled [param] Show enabled configuration options.
|
||||
-Z, --show-disabled [param] Show disabled configuration options.
|
||||
-S, --show-valid [param] Show valid configuration options.
|
||||
Possible params: all, addons, protocols,
|
||||
readers, card_readers
|
||||
|
||||
-l, --list-config List active configuration variables.
|
||||
-e, --enabled [option] Check if certain option is enabled.
|
||||
-d, --disabled [option] Check if certain option is disabled.
|
||||
|
||||
-E, --enable [option] Enable config option.
|
||||
-D, --disable [option] Disable config option.
|
||||
|
||||
The following [option]s enable or disable multiple settings.
|
||||
all - Everything.
|
||||
addons - All addons.
|
||||
protocols - All protocols.
|
||||
readers - All readers.
|
||||
card_readers - All card readers.
|
||||
|
||||
-R, --restore Restore default config.
|
||||
|
||||
-cc, --create-cert [option] Create a new self signed X.509 certificate and private key.
|
||||
|
||||
The following [option]s in this order are supported:
|
||||
ecdsa|rsa - key type (default: ecdsa)
|
||||
prime256v1|4096 - key length (default: prime256v1), any ecdsa curve or rsa length should work
|
||||
ca - create Root CA certificates
|
||||
subject - X.509 certificate subject e.g. 'My OSCam Distribution'
|
||||
|
||||
-cf, --cert-file [option] Get filename of requested (cert|privkey) type.
|
||||
-ci, --cert-info Get a list of useful certificate information.
|
||||
-cl, --add-cert [option] Create symlinks to use a custom, pre-created set of X.509 certificate and private key.
|
||||
|
||||
The following [option]s in this order are mandatory:
|
||||
certificate filename - relative/absolute path to certificate file
|
||||
private key filename - relative/absolute path to private key file
|
||||
|
||||
-sm, --sign-marker Get Oscam binary signature marker.
|
||||
-um, --upx-marker Get Oscam binary upx marker.
|
||||
-v, --oscam-version Display OSCam version.
|
||||
-c, --oscam-commit Display OSCam GIT short commit sha 8-digits.
|
||||
|
||||
-O, --detect-osx-sdk-version Find where OS X SDK is located
|
||||
|
||||
-h, --help Display this help text.
|
||||
|
||||
Examples:
|
||||
# Enable WEBIF and SSL
|
||||
./config.sh --enable WEBIF WITH_SSL
|
||||
|
||||
# Disable WEBIF but enable WITH_SSL
|
||||
./config.sh --disable WEBIF --enable WITH_SSL
|
||||
|
||||
# Restore defaults and disable WEBIF and READER_NAGRA
|
||||
./config.sh --restore --disable WEBIF READER_NAGRA
|
||||
|
||||
# Use default config with only one enabled reader
|
||||
./config.sh --restore --disable readers --enable READER_BULCRYPT
|
||||
|
||||
# Disable everything and enable webif one module and one card reader
|
||||
./config.sh --disable all --enable WEBIF MODULE_NEWCAMD READER_BULCRYPT
|
||||
|
||||
# Disable all card readers except INTERNAL
|
||||
./config.sh -D card_readers -E CARDREADER_INTERNAL
|
||||
|
||||
# Create new self signed private key and certificate with defaults
|
||||
./config.sh --create-cert
|
||||
|
||||
# Create new self signed private key and certificate with custom settings
|
||||
./config.sh --create-cert rsa 4096
|
||||
|
||||
# Create new Root CA with private key and certificate with custom settings
|
||||
./config.sh --create-cert ecdsa prime256v1 ca 'My OSCam Distribution'
|
||||
|
||||
Available options:
|
||||
addons: WEBIF WEBIF_LIVELOG WEBIF_JQUERY WITH_COMPRESS_WEBIF WITH_SSL HAVE_DVBAPI WITH_EXTENDED_CW WITH_NEUTRINO READ_SDT_CHARSETS CS_ANTICASC WITH_DEBUG MODULE_MONITOR WITH_LB CS_CACHEEX CS_CACHEEX_AIO CW_CYCLE_CHECK LCDSUPPORT LEDSUPPORT CLOCKFIX IPV6SUPPORT WITH_ARM_NEON WITH_SIGNING WITH_EMU WITH_SOFTCAM
|
||||
protocols: MODULE_CAMD33 MODULE_CAMD35 MODULE_CAMD35_TCP MODULE_NEWCAMD MODULE_CCCAM MODULE_CCCSHARE MODULE_GBOX MODULE_RADEGAST MODULE_SCAM MODULE_SERIAL MODULE_CONSTCW MODULE_PANDORA MODULE_GHTTP MODULE_STREAMRELAY
|
||||
readers: READER_NAGRA READER_NAGRA_MERLIN READER_IRDETO READER_CONAX READER_CRYPTOWORKS READER_SECA READER_VIACCESS READER_VIDEOGUARD READER_DRE READER_TONGFANG READER_BULCRYPT READER_GRIFFIN READER_DGCRYPT
|
||||
card_readers: CARDREADER_PHOENIX CARDREADER_INTERNAL CARDREADER_SC8IN1 CARDREADER_MP35 CARDREADER_SMARGO CARDREADER_DB2COM CARDREADER_STAPI CARDREADER_STAPI5 CARDREADER_STINGER CARDREADER_DRECAS
|
||||
418
README.dvbapi_protocol
Normal file
418
README.dvbapi_protocol
Normal file
|
|
@ -0,0 +1,418 @@
|
|||
DVBAPI
|
||||
======
|
||||
DVB API stands for Linux DVB Application Programming Interface, so in short it is a set of API calls which are used on
|
||||
linux to handle DVB hardware. From the OSCam point of view the most interesting part is to be able to provide all data
|
||||
necessary for channel decryption. The OSCam DVBAPI module was written to handle this work.
|
||||
|
||||
Architecture
|
||||
============
|
||||
A DVBAPI module needs the following information to decrypt a channel:
|
||||
- PMT table (information from TV receiver software about the requested channel for livetv/recording and the ECM PIDs)
|
||||
- CAT table (needed to get information about EMM type and PIDs)
|
||||
- Filtered ECM/EMM data
|
||||
|
||||
If OSCam is able to decrypt a service, information about the decrypted PIDs (audio, video, etc) and CW (keys)
|
||||
is sent back to the TV receiver software from the CAM device.
|
||||
|
||||
History
|
||||
=======
|
||||
The first and "standard" use case is probably Enigma. OSCam creates a /tmp/camd.socket. Enigma sends the PMT data to
|
||||
this socket and as a result OSCam opens the necessary DVB demux devices (e.g. /dev/dvb/adapter0/demux0) and filters
|
||||
for ECM, CAT and EMM data. These data are then parsed by the OSCam dvbapi module and as a result the CA_SET_PID and
|
||||
CA_SET_DESCR ioctl calls are made, leading to proper decryption. All this was working on the same hardware and the
|
||||
same DVB devices were used. This kind of usage was mainly for linux STB.
|
||||
|
||||
Next step was generic PC support, by extending the dvbapi module to send PIDs and keys back to TV software (initially
|
||||
via a special UDP socket, later via the same /tmp/camd.socket). The TV software was able to use this information in
|
||||
software decryption (DeCSA).
|
||||
|
||||
At some point, the OpenPLi team created a new CaPMT interface, which was then implemented in OSCam (as pmt_mode=6).
|
||||
It is described here: http://wiki.openpli.org/caPMT
|
||||
The main feature was reverting the roles: OSCam now acts as a client and connects to /tmp/.listen.camd.socket created
|
||||
by Enigma. This way multiple Software CAMs could be running and connecting to Enigma's .listen.camd.socket. Another
|
||||
important improvement in this mode (also implemented in OSCam) was the ability to handle extra CA_PMT list managements.
|
||||
This allows to use one socket connection to handle more than one channel at a time (previously clients had to manage
|
||||
a single connection to /tmp/camd.socket per subscribed channel).
|
||||
|
||||
As the .listen.camd.socket mode makes less sense on generic PC platform (the OSCam is still server, while the client
|
||||
could be any PC software used), the second feature which allows handling multiple channels on single socket connection
|
||||
was extended to cover other modes (not only pmt_mode=6) in OSCam.
|
||||
|
||||
Network mode
|
||||
============
|
||||
The last feature that was added was a network mode. The change was made to be able to connect to an OSCam instance
|
||||
which is not running on the same machine where the TV receiver software (and a DVB hardware) runs.
|
||||
|
||||
Why not use dedicated protocols like newcamd/camd in such cases?
|
||||
- To have ECM/EMM handling in OSCam, where it belongs. It is better maintained and fixes come in quicker.
|
||||
- OSCam knows what readers it has, so it could do load balance/filtering/priorities etc.
|
||||
|
||||
As a result, instead of /tmp/camd.socket (which could be used only on the same machine) a listening_socket parameter
|
||||
was added. So the unix domain socket switched to a fully-featured TCP socket which can be connected from any network
|
||||
client.
|
||||
|
||||
As a result besides CA_SET_PID and CA_SET_DESCR new calls were passed to socket: DMX_SET_FILTER and DMX_STOP. The TV
|
||||
receiver software has to filter the demux itself (according to the new calls above) and send results like ECM/EMM/CAT
|
||||
data back to OSCam using the same connection. Because OSCam was only aware of PMT data on the socket, a new
|
||||
DVBAPI_FILTER_DATA command (0xffff0000) was added to handle client data from filters.
|
||||
|
||||
This way, communication between the TV receiver software and OSCam could be finally done using only one single TCP
|
||||
connection. Moreover, the demux is only accessed by a single TV receiver software process, which from the architecture's
|
||||
point of view is definitely a better solution.
|
||||
|
||||
New protocol description (socket commands)
|
||||
===========================================
|
||||
As there are more and more dvbapi clients, some problems start to appear. First of all there was some kind of mess
|
||||
because OSCam's network mode doesn't take into account the endianness in first form of the network protocol. Second,
|
||||
it was not consistant (e.g. PID was always send as little endian in DMX_STOP, while the rest depend on OSCam's host
|
||||
architecture). Finally the standard API ioctl codes for CA_SET_PID, CA_SET_DESCR, DMX_SET_FILTER and DMX_STOP behave
|
||||
differently. These codes are composed by a macro which takes into account the length of the associated structures and
|
||||
on some hardware the first bits of the MSB was different. So the clients had to do some strange workarounds with
|
||||
the MSB byte: fix 0x80 -> 0x40 and 0x20 -> 0x00 when needed
|
||||
|
||||
Finally, the first byte sent to client was an adapter index, which was not always needed in all commands. Now the
|
||||
first 4-byte integer is unique operation code, so a client will know what is the request type and could read the rest
|
||||
of data according to the following description (and field sizes).
|
||||
|
||||
To address all above problems and additionally make smooth transitions when updating the protocol in the future there
|
||||
was added some kind of "handshake" for clients. All new implementations should use it. Currently the old and new
|
||||
implementations should work fine, but in the future a network client which will not introduce itself (thus not providing
|
||||
it's supported protocol version) may be dropped/ignored by OSCam.
|
||||
|
||||
All multibyte integers (if not specified otherwise) should be send using network byte order, so your client should use
|
||||
ntoh() functions when receiving. OSCam is doing hton() before sending and vice versa.
|
||||
|
||||
Just right after a client connects to an OSCam network socket, it should send a greeting in format:
|
||||
|
||||
-= DVBAPI_CLIENT_INFO =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_CLIENT_INFO
|
||||
uint16_t protocol version supported by client
|
||||
uint8_t size of followed string (255 bytes max)
|
||||
string name and version of the client (string length should be max 255 bytes)
|
||||
|
||||
The server will respond with a similar reply:
|
||||
|
||||
-= DVBAPI_SERVER_INFO =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_SERVER_INFO
|
||||
uint16_t protocol version supported by OSCam
|
||||
uint8_t size of followed string (255 bytes max)
|
||||
string OSCam version and build (string length should be max 255 bytes)
|
||||
|
||||
Next, when a client wants to start a channel, it should send the PMT data (program map table). The PMT data structure
|
||||
starts with constant AOT_CA_PMT (0x9F8032). The data format of the CA_PMT is described in chapter 8.4.3.4 (page 30) of
|
||||
the EN 50221 PDF (european standard).
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Please note that OSCam is expecting a number of private descriptors injected
|
||||
into the CA PMT data. They shall be located inside the program info loop. All
|
||||
supported descriptors follow the structure defined in 2.6 of Rec. ITU H.222.0
|
||||
and they are the following:
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| descriptor_tag | Identification | Usage |
|
||||
---------------------------------------------------------------------
|
||||
| 0x81 | enigma_namespace_descriptor | optional |
|
||||
| 0x82 | demux_ca_mask_device_descriptor | deprecated |
|
||||
| 0x83 | adapter_device_descriptor | mandatory |
|
||||
| 0x84 | pmt_pid_descriptor | mandatory |
|
||||
| 0x85 | service_type_mask_descriptor | optional |
|
||||
| 0x86 | demux_device_descriptor | mandatory |
|
||||
| 0x87 | ca_device_descriptor | mandatory |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Descriptors marked as "mandatory" shall be present in the CA PMT message, in
|
||||
order OSCam to get all necessary information for the specified program. Below
|
||||
is a detailed description for each of the supported descriptors with its
|
||||
structure and usage.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
1. Enigma namespace descriptor
|
||||
|
||||
Provides additional information for the program specified, such as enigma
|
||||
namespace (orbital position, frequency and polarization), transport stream id
|
||||
and original network id. Although its presense in the CA PMT is optional, it
|
||||
is advised to be included as OSCam utilizes these information in many aspects.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| enigma_namespace_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| enigma_namespace | 32 | uimsbf |
|
||||
| transport_stream_id | 16 | uimsbf |
|
||||
| original_network_id | 16 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x81.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x08.
|
||||
|
||||
ens - This is the enigma namespace as defined in OpenPLi, openATV and other
|
||||
open enigma2 images. An example implementation can be found at:
|
||||
https://github.com/OpenPLi/enigma2/blob/develop/lib/dvb/frontend.cpp#L476
|
||||
|
||||
transport_stream_id – The transport stream id as defined in various DVB SI
|
||||
tables.
|
||||
|
||||
original_network_id - The original network id as defined in various DVB SI
|
||||
tables.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
2. Demux and ca mask device descriptor
|
||||
|
||||
It was used to provide information about the demux device as well as the ca
|
||||
device(s) carrying the specified program. It was created for the DM7025 set top
|
||||
box and it is now considered deprecated. Many hosts use this descriptor in a
|
||||
different way (carrying different information) than it was originaly designed
|
||||
leading to confusion. OSCam will continue to support this descriptor as some
|
||||
legacy hosts still use it. For newer hosts, the adapter_device_descriptor (tag
|
||||
0x83), the demux_device_descriptor (tag 0x86) and the ca_device_descriptor (tag
|
||||
0x87) shall be used for sending the necessary data to OSCam.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| demux_ca_mask_device_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| ca_mask | 8 | uimsbf |
|
||||
| demux_device | 8 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x82.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x02.
|
||||
|
||||
ca_mask - It is a bit mask of the ca device(s) carrying the specified program.
|
||||
Bit 0 corresonds to ca0, bit 1 corresponds to ca1 and so on.
|
||||
|
||||
demux_device - The demux device that carries the specified program. It is
|
||||
limited to values between 0x00 and 0x08 in older enigma2 images.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
3. Adapter device descriptor
|
||||
|
||||
Provides information about the adapter device carrying the specified program.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| adapter_device_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| adapter_device | 8 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x83.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x01.
|
||||
|
||||
adapter_device - The adapter device that carries the specified program. It can
|
||||
take values from 0x00 to 0xFF, thus a maximum number of different 256 adapters
|
||||
are supported.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
4. PMT pid descriptor
|
||||
|
||||
Provides information about the PMT pid of the specified program.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| pmt_pid_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| pmt_pid | 16 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x84.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x02.
|
||||
|
||||
pmt_pid - The pid that carries the PMT table of the specified program.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
5. Service type mask descriptor
|
||||
|
||||
It provides information about the type (live tv, recording, streaming service,
|
||||
or any combination) of the program specified. It's currently not unitilized in
|
||||
OSCam and its usage in considered optional.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| service_type_mask_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| service_type_mask | 32 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x85.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x04.
|
||||
|
||||
service_type_mask - This is a bit mask of the different service types enabled
|
||||
for the specified program. Service type values are defined in enigma2 and can
|
||||
be found at https://github.com/OpenPLi/enigma2/blob/develop/lib/dvb/pmt.h#L135
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
6. Demux device descriptor
|
||||
|
||||
It is used to provide information about the demux device carrying the specified
|
||||
program. It is a replacement to the deprecated demux_ca_mask_device_descriptor
|
||||
(tag 0x82), as it supports up to 256 different demux devices.
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| demux_device_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| demux_device | 8 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x86.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x01.
|
||||
|
||||
demux_device - The demux device that carries the specified program. Its value
|
||||
can be between 0x00 and 0xFF.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
7. Ca device descriptor
|
||||
|
||||
This descriptor provides OSCam with information about the ca device carrying
|
||||
the specified program. It is created as a replacement to the deprecated
|
||||
demux_ca_mask_device_descriptor (tag 0x82). It has the following syntax:
|
||||
|
||||
---------------------------------------------------------------------
|
||||
| Syntax | No. of bits | Mnemonic |
|
||||
---------------------------------------------------------------------
|
||||
| ca_device_descriptor(){ | | |
|
||||
| descriptor_tag | 8 | uimsbf |
|
||||
| descriptor_length | 8 | uimsbf |
|
||||
| ca_device | 8 | uimsbf |
|
||||
| } | | |
|
||||
---------------------------------------------------------------------
|
||||
|
||||
decriptor_tag - The tag of the descriptor is equal to 0x87.
|
||||
|
||||
descriptor_length - The length of the descriptor is equal to 0x01.
|
||||
|
||||
ca_device - The ca device that carries the specified program. Its value can be
|
||||
between 0x00 and 0xFF (256 different ca devices supported).
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
After OSCam parses the PMT data, it starts filtering ECM PIDs. It sends the following request to the client:
|
||||
|
||||
-= DVBAPI_DMX_SET_FILTER =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_DMX_SET_FILTER
|
||||
uint8_t adapter index
|
||||
uint8_t demux index
|
||||
uint8_t filter number
|
||||
*** The following data are the fields from the dmx_sct_filter_params structure (added separately to avoid padding problems)
|
||||
uint16_t pid
|
||||
uint8_t[16] filter data (filter.filter)
|
||||
uint8_t[16] filter mask (filter.mask)
|
||||
uint8_t[16] filter mode (filter.mode)
|
||||
uint32_t timeout
|
||||
uint32_t flags
|
||||
|
||||
The client should then filter the data and pass it back to OSCam using the following frame:
|
||||
|
||||
-= DVBAPI_FILTER_DATA =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_FILTER_DATA
|
||||
uint8_t demux index
|
||||
uint8_t filter number
|
||||
uint8_t[] filtered data from demux
|
||||
|
||||
When OSCam is able to decrypt a channel, it initially sends a list of PIDs associated with the descrambler index using
|
||||
this packet:
|
||||
|
||||
-= DVBAPI_CA_SET_PID =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_CA_SET_PID
|
||||
uint8_t adapter index
|
||||
ca_pid_t 8-byte ca_pid_t structure (the pid and index fields are in network byte order)
|
||||
|
||||
And also sends the CW for decryption:
|
||||
|
||||
-= DVBAPI_CA_SET_DESCR =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_CA_SET_DESCR
|
||||
uint8_t adapter index
|
||||
ca_descr_t 16-byte ca_descr_t structure (the index and parity fields are in network byte order)
|
||||
|
||||
When OSCam wants to inform the client about stopping a filter, it sends the following packet:
|
||||
|
||||
-= DVBAPI_DMX_STOP =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_DMX_STOP
|
||||
uint8_t adapter index
|
||||
uint8_t demux index
|
||||
uint8_t filter number
|
||||
uint16_t PID to stop filtering
|
||||
|
||||
When the client closes connection, all associated channels are stopped in OSCam.
|
||||
|
||||
Alternatively when there is a need to stop channel decoding, while having the connection still open you can send a
|
||||
special '3f' packed to OSCam. To stop decoding the specified demux, the following CA_PMT data should be sent to OSCam:
|
||||
9F 80 3f 04 83 02 00 <demux index>
|
||||
If <demux index> is 0xff, then it is parsed as a wildcard and all demuxers associated with the connection are stopped.
|
||||
|
||||
In protocol version 2 the new packet with ECM info data was introduced:
|
||||
|
||||
-= DVBAPI_ECM_INFO =-
|
||||
-----------------------------------------------------------------------
|
||||
type/size description
|
||||
-----------------------------------------------------------------------
|
||||
uint32_t operation code -> DVBAPI_ECM_INFO
|
||||
uint8_t adapter index
|
||||
uint16_t Service ID
|
||||
uint16_t CAID
|
||||
uint16_t PID
|
||||
uint32_t Provider ID
|
||||
uint32_t ECM time (ms)
|
||||
uint8_t size of followed string (255 bytes max)
|
||||
string cardsystem name (string length should be max 255 bytes)
|
||||
uint8_t size of followed string (255 bytes max)
|
||||
string reader name (string length should be max 255 bytes)
|
||||
uint8_t size of followed string (255 bytes max)
|
||||
string from - source name (string length should be max 255 bytes)
|
||||
uint8_t size of followed string (255 bytes max)
|
||||
string protocol name (string length should be max 255 bytes)
|
||||
uint8_t hops (cccam & gbox; set to 0 otherwise)
|
||||
188
README.md
Normal file
188
README.md
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
# OSCam with AI Fake DCW Detector
|
||||
|
||||

|
||||
|
||||
## Overview
|
||||
|
||||
This repository contains a modified version of **OSCam** enhanced with an advanced **AI-inspired Fake DCW Detection and Voting System**.
|
||||
|
||||
The goal of this system is to improve stability and reliability when multiple Control Word (CW) sources are available, such as:
|
||||
|
||||
- Local readers
|
||||
- CacheEx peers
|
||||
- CSP sources
|
||||
- Virtual readers
|
||||
|
||||
Instead of accepting the first CW received, this implementation collects multiple candidates and selects the most reliable one using weighted voting logic.
|
||||
|
||||
---
|
||||
|
||||
# 🔍 Problem It Solves
|
||||
|
||||
In multi-reader or CacheEx environments, fake or unstable DCWs can appear.
|
||||
|
||||
Default behavior:
|
||||
- First CW wins
|
||||
- Possible glitches, freezing, or unstable decoding
|
||||
|
||||
With AI Fake DCW Detector:
|
||||
- Multiple CWs are collected
|
||||
- Sources are tracked
|
||||
- Votes are counted
|
||||
- Local readers can be weighted higher
|
||||
- Majority or timeout logic is applied
|
||||
- A reliable CW is selected
|
||||
|
||||
Result:
|
||||
|
||||
✔ Reduced fake DCWs
|
||||
✔ Increased decoding stability
|
||||
✔ Better CacheEx reliability
|
||||
✔ Smarter CW selection
|
||||
|
||||
---
|
||||
|
||||
# 🧠 Core Functions
|
||||
|
||||
## 1️⃣ `cw_vote_add()`
|
||||
|
||||
This function is called whenever a new CW is received.
|
||||
|
||||
It:
|
||||
|
||||
- Compares the CW with existing candidates
|
||||
- Increases vote count if it matches
|
||||
- Adds a new candidate if it is unique
|
||||
- Tracks:
|
||||
- Total votes
|
||||
- Local votes
|
||||
- Reader source
|
||||
- CW value
|
||||
- Identifies whether the source is:
|
||||
- Local reader
|
||||
- Virtual reader
|
||||
- CacheEx client
|
||||
- CSP source
|
||||
|
||||
Each CW candidate is stored in a voting pool.
|
||||
|
||||
---
|
||||
|
||||
## 2️⃣ `cw_vote_decide()`
|
||||
|
||||
This function determines the final CW to use.
|
||||
|
||||
### Decision Process
|
||||
|
||||
1. Count total votes
|
||||
2. Verify minimum vote requirement
|
||||
3. Calculate effective score:
|
||||
4. Check for majority (> 50%)
|
||||
5. Apply timeout logic
|
||||
6. Apply fallback strategy if necessary
|
||||
|
||||
If a winner is found:
|
||||
|
||||
- CW is copied into `er->cw`
|
||||
- CacheEx hit statistics are updated
|
||||
- Optional logging is performed
|
||||
|
||||
If no clear winner exists, the system waits for more votes unless timeout rules apply.
|
||||
|
||||
---
|
||||
|
||||
# ⚙ Configuration Options
|
||||
|
||||
| Parameter | Description |
|
||||
|------------|------------|
|
||||
| `cwvote_enabled` | Enable/disable voting system |
|
||||
| `cwvote_max_candidates` | Maximum CW candidates stored |
|
||||
| `cwvote_compare_len` | Number of bytes used for CW comparison |
|
||||
| `cwvote_local_weight` | Weight multiplier for local votes |
|
||||
| `cwvote_min_votes` | Minimum required votes before decision |
|
||||
| `cwvote_timeout` | Timeout in milliseconds |
|
||||
| `cwvote_fallback` | Fallback mode (1 = best candidate, 2 = first candidate) |
|
||||
| `cwvote_log_enabled` | Enable detailed debug logging |
|
||||
|
||||
---
|
||||
|
||||
# 🏆 Winner Selection Logic
|
||||
|
||||
A CW is selected if:
|
||||
|
||||
- It has a strict majority (> 50%)
|
||||
OR
|
||||
- Timeout is reached and fallback mode allows selection
|
||||
|
||||
If timeout occurs and:
|
||||
|
||||
- `fallback = 1` → best scoring candidate is selected
|
||||
- `fallback = 2` → first candidate (slot 0) is selected
|
||||
|
||||
---
|
||||
|
||||
# 📊 Intelligent Source Awareness
|
||||
|
||||
The system distinguishes between:
|
||||
|
||||
- Trusted local readers
|
||||
- Virtual readers
|
||||
- CacheEx clients
|
||||
- CSP sources
|
||||
|
||||
Local readers can be weighted higher using `cwvote_local_weight`, improving reliability in hybrid environments.
|
||||
|
||||
---
|
||||
|
||||
# 📈 CacheEx Integration
|
||||
|
||||
If the winning CW originates from CacheEx:
|
||||
|
||||
- `cwcacheexhit` counters are incremented
|
||||
- Client and account statistics are updated
|
||||
- Global hit statistics are updated
|
||||
|
||||
This improves monitoring accuracy and performance analysis.
|
||||
|
||||
---
|
||||
|
||||
# 🚀 Advantages
|
||||
|
||||
- Detects and filters fake DCWs
|
||||
- Improves stability in multi-reader setups
|
||||
- Reduces glitching and freezing
|
||||
- Configurable and flexible logic
|
||||
- Seamlessly integrated into OSCam core
|
||||
|
||||
---
|
||||
|
||||
# 🧩 AI Concept
|
||||
|
||||
Although not based on machine learning, this system applies AI-style decision logic:
|
||||
|
||||
- Aggregates multiple inputs
|
||||
- Applies weighted scoring
|
||||
- Uses majority validation
|
||||
- Implements adaptive timeout fallback
|
||||
|
||||
It behaves like deterministic intelligence for CW selection.
|
||||
|
||||
---
|
||||
|
||||
# Intended Use
|
||||
|
||||
Designed for:
|
||||
|
||||
- Emulated environments
|
||||
- CacheEx-heavy setups
|
||||
- Multi-reader configurations
|
||||
- Advanced OSCam tuning
|
||||
- High-stability streaming environments
|
||||
|
||||
---
|
||||
|
||||
# License
|
||||
|
||||
Based on the OSCam open-source project.
|
||||
This repository includes custom modifications implementing advanced CW voting and fake DCW detection logic.
|
||||
|
||||
0
SoftCam.Key
Normal file
0
SoftCam.Key
Normal file
110
config.h
Normal file
110
config.h
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
||||
#define WITH_EMU 1
|
||||
#define WITH_SOFTCAM 1
|
||||
#define WEBIF 1
|
||||
#define WEBIF_LIVELOG 1
|
||||
#define WEBIF_JQUERY 1
|
||||
#define WEBIF_WIKI 1
|
||||
//#define WITH_COMPRESS_WEBIF 1
|
||||
//#define WITH_SSL 1
|
||||
#if defined(__linux__) || defined(__CYGWIN__)
|
||||
//#define HAVE_DVBAPI 1
|
||||
#define WITH_EXTENDED_CW 1
|
||||
#endif
|
||||
//#define WITH_NEUTRINO 1
|
||||
#define READ_SDT_CHARSETS 1
|
||||
//#define CLOCKFIX 1
|
||||
//#define CS_ANTICASC 1
|
||||
#define WITH_DEBUG 1
|
||||
#define WITH_LB 1
|
||||
#define CS_CACHEEX 1
|
||||
#define CS_CACHEEX_AIO 1
|
||||
#define CW_CYCLE_CHECK 1
|
||||
//#define LCDSUPPORT 1
|
||||
//#define LEDSUPPORT 1
|
||||
#define IPV6SUPPORT 1
|
||||
//#define WITH_ARM_NEON 1
|
||||
//#define WITH_SIGNING 1
|
||||
//#define MODULE_MONITOR 1
|
||||
|
||||
#define MODULE_CAMD33 1
|
||||
//#define MODULE_CAMD35 1
|
||||
#define MODULE_CAMD35_TCP 1
|
||||
#define MODULE_NEWCAMD 1
|
||||
#define MODULE_CCCAM 1
|
||||
#define MODULE_CCCSHARE 1
|
||||
//#define MODULE_GBOX 1
|
||||
//#define MODULE_RADEGAST 1
|
||||
//#define MODULE_SERIAL 1
|
||||
//#define MODULE_CONSTCW 1
|
||||
//#define MODULE_PANDORA 1
|
||||
//#define MODULE_GHTTP 1
|
||||
//#define MODULE_SCAM 1
|
||||
#define MODULE_STREAMRELAY 1
|
||||
|
||||
#define WITH_CARDREADER 1
|
||||
|
||||
#ifdef WITH_CARDREADER
|
||||
|
||||
//#define READER_NAGRA 1
|
||||
//#define READER_NAGRA_MERLIN 1
|
||||
//#define READER_IRDETO 1
|
||||
//#define READER_CONAX 1
|
||||
//#define READER_CRYPTOWORKS 1
|
||||
//#define READER_SECA 1
|
||||
#define READER_VIACCESS 1
|
||||
//#define READER_VIDEOGUARD 1
|
||||
//#define READER_DRE 1
|
||||
//#define READER_TONGFANG 1
|
||||
//#define READER_BULCRYPT 1
|
||||
//#define READER_GRIFFIN 1
|
||||
//#define READER_DGCRYPT 1
|
||||
|
||||
//#define CARDREADER_PHOENIX 1
|
||||
//#define CARDREADER_INTERNAL 1
|
||||
//#define CARDREADER_MP35 1
|
||||
//#define CARDREADER_SC8IN1 1
|
||||
//#define CARDREADER_SMARGO 1
|
||||
//#define CARDREADER_DB2COM 1
|
||||
//#define CARDREADER_STINGER 1
|
||||
//#define CARDREADER_DRECAS 1
|
||||
|
||||
#ifdef WITH_PCSC
|
||||
//#define CARDREADER_PCSC 1
|
||||
#endif
|
||||
|
||||
#ifdef WITH_LIBUSB
|
||||
#define CARDREADER_SMART 1
|
||||
#endif
|
||||
|
||||
// CARDREADER_INTERNAL_{AZBOX,COOLAPI,AMSMC,SCI} are internal variables
|
||||
// do not touch them
|
||||
#if (defined(CARDREADER_INTERNAL) && defined(WITH_AZBOX))
|
||||
#define CARDREADER_INTERNAL_AZBOX 1
|
||||
#elif (defined(CARDREADER_INTERNAL) && (defined(WITH_COOLAPI) || defined(WITH_SU980)))
|
||||
#define CARDREADER_INTERNAL_COOLAPI 1
|
||||
#elif defined(CARDREADER_INTERNAL) && defined(WITH_COOLAPI2)
|
||||
#define CARDREADER_INTERNAL_COOLAPI2 1
|
||||
#elif defined(CARDREADER_INTERNAL) && defined(WITH_AMSMC)
|
||||
#define CARDREADER_INTERNAL_AMSMC 1
|
||||
#elif defined(CARDREADER_INTERNAL)
|
||||
#define CARDREADER_INTERNAL_SCI 1
|
||||
#endif
|
||||
|
||||
#ifdef WITH_STAPI
|
||||
//#define CARDREADER_STAPI 1
|
||||
#endif
|
||||
|
||||
#ifdef WITH_STAPI5
|
||||
//#define CARDREADER_STAPI5 1
|
||||
#endif
|
||||
|
||||
#ifdef READER_DRE
|
||||
#define READER_DRECAS 1
|
||||
#endif
|
||||
|
||||
#endif // WITH_CARDREADER
|
||||
|
||||
#endif //OSCAM_CONFIG_H_
|
||||
16
cscrypt/CMakeLists.txt
Normal file
16
cscrypt/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
project (cscrypt)
|
||||
if (OSCamOperatingSystem MATCHES "Mac OS X" AND SWVER GREATER 10.5 AND HAVE_LIBCRYPTO)
|
||||
file (GLOB cscrypt_mac "bn*" "mem*" "aes*" "sha1*")
|
||||
file (GLOB cscrypt_srcs "*.c")
|
||||
list(REMOVE_ITEM cscrypt_srcs ${cscrypt_mac})
|
||||
file (GLOB cscrypt_hdrs "*.h")
|
||||
list(REMOVE_ITEM cscrypt_hdrs ${cscrypt_mac})
|
||||
else (OSCamOperatingSystem MATCHES "Mac OS X" AND SWVER GREATER 10.5 AND HAVE_LIBCRYPTO)
|
||||
file (GLOB cscrypt_srcs "*.c")
|
||||
file (GLOB cscrypt_hdrs "*.h")
|
||||
endif (OSCamOperatingSystem MATCHES "Mac OS X" AND SWVER GREATER 10.5 AND HAVE_LIBCRYPTO)
|
||||
|
||||
set (lib_name "cscrypt")
|
||||
|
||||
add_library (${lib_name} STATIC ${cscrypt_srcs} ${cscrypt_hdrs})
|
||||
|
||||
2
cscrypt/Makefile
Normal file
2
cscrypt/Makefile
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
parent:
|
||||
@$(MAKE) --no-print-directory -C ..
|
||||
1309
cscrypt/aes.c
Normal file
1309
cscrypt/aes.c
Normal file
File diff suppressed because it is too large
Load Diff
45
cscrypt/aes.h
Normal file
45
cscrypt/aes.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#if defined(WITH_SSL) || defined(WITH_LIBCRYPTO)
|
||||
# include <openssl/aes.h>
|
||||
#else
|
||||
#ifndef HEADER_AES_H
|
||||
#define HEADER_AES_H
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
/* Because array size can't be a const in C, the following two are macros.
|
||||
Both sizes are in bytes. */
|
||||
#define AES_MAXNR 14
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
# define GETU32(pt) (((uint32_t)(pt)[0] << 24) ^ ((uint32_t)(pt)[1] << 16) ^ ((uint32_t)(pt)[2] << 8) ^ ((uint32_t)(pt)[3]))
|
||||
# define PUTU32(ct, st) { (ct)[0] = (uint8_t)((st) >> 24); (ct)[1] = (uint8_t)((st) >> 16); (ct)[2] = (uint8_t)((st) >> 8); (ct)[3] = (uint8_t)(st); }
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define MAXKC (256/32)
|
||||
#define MAXKB (256/8)
|
||||
#define MAXNR 14
|
||||
|
||||
/* This controls loop-unrolling in aes_core.c */
|
||||
#undef FULL_UNROLL
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
struct aes_key_st
|
||||
{
|
||||
uint32_t rd_key[4 * (AES_MAXNR + 1)];
|
||||
int rounds;
|
||||
};
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
|
||||
int AES_set_encrypt_key(const uint8_t *userKey, const int bits, AES_KEY *key);
|
||||
int AES_set_decrypt_key(const uint8_t *userKey, const int bits, AES_KEY *key);
|
||||
|
||||
void AES_encrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key);
|
||||
void AES_decrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key);
|
||||
|
||||
void AES_cbc_encrypt(const uint8_t *in, uint8_t *out, const unsigned long length,
|
||||
const AES_KEY *key, uint8_t *ivec, const int enc);
|
||||
#endif /* !HEADER_AES_H */
|
||||
|
||||
#endif
|
||||
516
cscrypt/bn.h
Normal file
516
cscrypt/bn.h
Normal file
|
|
@ -0,0 +1,516 @@
|
|||
#ifndef CSCRYPT_BN_H_
|
||||
#define CSCRYPT_BN_H_
|
||||
|
||||
#if defined(WITH_SSL) || defined(WITH_LIBCRYPTO)
|
||||
#include <openssl/bn.h>
|
||||
#else
|
||||
/* crypto/bn/bn.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#define I386_Only
|
||||
|
||||
#ifdef __LP64__
|
||||
#define SIXTY_FOUR_BIT
|
||||
#else
|
||||
#define THIRTY_TWO_BIT
|
||||
#endif
|
||||
|
||||
#ifndef HEADER_BN_H
|
||||
#define HEADER_BN_H
|
||||
|
||||
#ifndef NO_FP_API
|
||||
#include <stdio.h> /* FILE */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
#undef BN_LLONG /* experimental, so far... */
|
||||
#endif
|
||||
|
||||
#define BN_MUL_COMBA
|
||||
#define BN_SQR_COMBA
|
||||
#define BN_RECURSION
|
||||
#define RECP_MUL_MOD
|
||||
#define MONT_MUL_MOD
|
||||
|
||||
/* This next option uses the C libraries (2 word)/(1 word) function.
|
||||
* If it is not defined, I use my C version (which is slower).
|
||||
* The reason for this flag is that when the particular C compiler
|
||||
* library routine is used, and the library is linked with a different
|
||||
* compiler, the library is missing. This mostly happens when the
|
||||
* library is built with gcc and then linked using normal cc. This would
|
||||
* be a common occurrence because gcc normally produces code that is
|
||||
* 2 times faster than system compilers for the big number stuff.
|
||||
* For machines with only one compiler (or shared libraries), this should
|
||||
* be on. Again this in only really a problem on machines
|
||||
* using "long long's", are 32bit, and are not using my assembler code. */
|
||||
#if defined(MSDOS) || defined(WINDOWS) || defined(WIN32) || defined(linux)
|
||||
# ifndef BN_DIV2W
|
||||
# define BN_DIV2W
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* assuming long is 64bit - this is the DEC Alpha
|
||||
* unsigned long long is only 64 bits :-(, don't define
|
||||
* BN_LLONG for the DEC Alpha */
|
||||
#ifdef SIXTY_FOUR_BIT_LONG
|
||||
#define BN_ULLONG unsigned long long
|
||||
#define BN_ULONG unsigned long
|
||||
#define BN_LONG long
|
||||
#define BN_BITS 128
|
||||
#define BN_BYTES 8
|
||||
#define BN_BITS2 64
|
||||
#define BN_BITS4 32
|
||||
#define BN_MASK (0xffffffffffffffffffffffffffffffffLL)
|
||||
#define BN_MASK2 (0xffffffffffffffffL)
|
||||
#define BN_MASK2l (0xffffffffL)
|
||||
#define BN_MASK2h (0xffffffff00000000L)
|
||||
#define BN_MASK2h1 (0xffffffff80000000L)
|
||||
#define BN_TBIT (0x8000000000000000L)
|
||||
#define BN_DEC_CONV (10000000000000000000UL)
|
||||
#define BN_DEC_FMT1 "%lu"
|
||||
#define BN_DEC_FMT2 "%019lu"
|
||||
#define BN_DEC_NUM 19
|
||||
#endif
|
||||
|
||||
/* This is where the long long data type is 64 bits, but long is 32.
|
||||
* For machines where there are 64bit registers, this is the mode to use.
|
||||
* IRIX, on R4000 and above should use this mode, along with the relevant
|
||||
* assembler code :-). Do NOT define BN_LLONG. */
|
||||
#ifdef SIXTY_FOUR_BIT
|
||||
#undef BN_LLONG
|
||||
#undef BN_ULLONG
|
||||
#define BN_ULONG unsigned long long
|
||||
#define BN_LONG long long
|
||||
#define BN_BITS 128
|
||||
#define BN_BYTES 8
|
||||
#define BN_BITS2 64
|
||||
#define BN_BITS4 32
|
||||
#define BN_MASK2 (0xffffffffffffffffLL)
|
||||
#define BN_MASK2l (0xffffffffL)
|
||||
#define BN_MASK2h (0xffffffff00000000LL)
|
||||
#define BN_MASK2h1 (0xffffffff80000000LL)
|
||||
#define BN_TBIT (0x8000000000000000LL)
|
||||
#define BN_DEC_CONV (10000000000000000000UL)
|
||||
#define BN_DEC_FMT1 "%llu"
|
||||
#define BN_DEC_FMT2 "%019llu"
|
||||
#define BN_DEC_NUM 19
|
||||
#endif
|
||||
|
||||
#ifdef THIRTY_TWO_BIT
|
||||
#if defined(WIN32) && !defined(__GNUC__)
|
||||
#define BN_ULLONG unsigned _int64
|
||||
#else
|
||||
#define BN_ULLONG unsigned long long
|
||||
#endif
|
||||
#define BN_ULONG unsigned long
|
||||
#define BN_LONG long
|
||||
#define BN_BITS 64
|
||||
#define BN_BYTES 4
|
||||
#define BN_BITS2 32
|
||||
#define BN_BITS4 16
|
||||
#ifdef WIN32
|
||||
|
||||
/* VC++ doesn't like the LL suffix */
|
||||
#define BN_MASK (0xffffffffffffffffL)
|
||||
#else
|
||||
#define BN_MASK (0xffffffffffffffffLL)
|
||||
#endif
|
||||
#define BN_MASK2 (0xffffffffL)
|
||||
#define BN_MASK2l (0xffff)
|
||||
#define BN_MASK2h1 (0xffff8000L)
|
||||
#define BN_MASK2h (0xffff0000L)
|
||||
#define BN_TBIT (0x80000000L)
|
||||
#define BN_DEC_CONV (1000000000L)
|
||||
#define BN_DEC_FMT1 "%lu"
|
||||
#define BN_DEC_FMT2 "%09lu"
|
||||
#define BN_DEC_NUM 9
|
||||
#endif
|
||||
|
||||
#ifdef SIXTEEN_BIT
|
||||
#ifndef BN_DIV2W
|
||||
#define BN_DIV2W
|
||||
#endif
|
||||
#define BN_ULLONG unsigned long
|
||||
#define BN_ULONG unsigned short
|
||||
#define BN_LONG short
|
||||
#define BN_BITS 32
|
||||
#define BN_BYTES 2
|
||||
#define BN_BITS2 16
|
||||
#define BN_BITS4 8
|
||||
#define BN_MASK (0xffffffff)
|
||||
#define BN_MASK2 (0xffff)
|
||||
#define BN_MASK2l (0xff)
|
||||
#define BN_MASK2h1 (0xff80)
|
||||
#define BN_MASK2h (0xff00)
|
||||
#define BN_TBIT (0x8000)
|
||||
#define BN_DEC_CONV (100000)
|
||||
#define BN_DEC_FMT1 "%u"
|
||||
#define BN_DEC_FMT2 "%05u"
|
||||
#define BN_DEC_NUM 5
|
||||
#endif
|
||||
|
||||
#ifdef EIGHT_BIT
|
||||
#ifndef BN_DIV2W
|
||||
#define BN_DIV2W
|
||||
#endif
|
||||
#define BN_ULLONG unsigned short
|
||||
#define BN_ULONG unsigned char
|
||||
#define BN_LONG char
|
||||
#define BN_BITS 16
|
||||
#define BN_BYTES 1
|
||||
#define BN_BITS2 8
|
||||
#define BN_BITS4 4
|
||||
#define BN_MASK (0xffff)
|
||||
#define BN_MASK2 (0xff)
|
||||
#define BN_MASK2l (0xf)
|
||||
#define BN_MASK2h1 (0xf8)
|
||||
#define BN_MASK2h (0xf0)
|
||||
#define BN_TBIT (0x80)
|
||||
#define BN_DEC_CONV (100)
|
||||
#define BN_DEC_FMT1 "%u"
|
||||
#define BN_DEC_FMT2 "%02u"
|
||||
#define BN_DEC_NUM 2
|
||||
#endif
|
||||
|
||||
#define BN_DEFAULT_BITS 1280
|
||||
|
||||
#ifdef BIGNUM
|
||||
#undef BIGNUM
|
||||
#endif
|
||||
|
||||
#define BN_FLG_MALLOCED 0x01
|
||||
#define BN_FLG_STATIC_DATA 0x02
|
||||
#define BN_FLG_FREE 0x8000 /* used for debuging */
|
||||
#define BN_set_flags(b,n) ((b)->flags|=(n))
|
||||
#define BN_get_flags(b,n) ((b)->flags&(n))
|
||||
|
||||
typedef struct bignum_st
|
||||
{
|
||||
BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
|
||||
int top; /* Index of last used d +1. */
|
||||
/* The next are internal book keeping for bn_expand. */
|
||||
int dmax; /* Size of the d array. */
|
||||
int neg; /* one if the number is negative */
|
||||
int flags;
|
||||
} BIGNUM;
|
||||
|
||||
/* Used for temp variables */
|
||||
#define BN_CTX_NUM 16
|
||||
#define BN_CTX_NUM_POS 12
|
||||
typedef struct bignum_ctx
|
||||
{
|
||||
int tos;
|
||||
BIGNUM bn[BN_CTX_NUM];
|
||||
int flags;
|
||||
int depth;
|
||||
int pos[BN_CTX_NUM_POS];
|
||||
int too_many;
|
||||
} BN_CTX;
|
||||
|
||||
typedef struct bn_blinding_st
|
||||
{
|
||||
int init;
|
||||
BIGNUM *A;
|
||||
BIGNUM *Ai;
|
||||
BIGNUM *mod; /* just a reference */
|
||||
} BN_BLINDING;
|
||||
|
||||
/* Used for montgomery multiplication */
|
||||
typedef struct bn_mont_ctx_st
|
||||
{
|
||||
int ri; /* number of bits in R */
|
||||
BIGNUM RR; /* used to convert to montgomery form */
|
||||
BIGNUM N; /* The modulus */
|
||||
BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 */
|
||||
/* (Ni is only stored for bignum algorithm) */
|
||||
BN_ULONG n0; /* least significant word of Ni */
|
||||
int flags;
|
||||
} BN_MONT_CTX;
|
||||
|
||||
/* Used for reciprocal division/mod functions
|
||||
* It cannot be shared between threads */
|
||||
typedef struct bn_recp_ctx_st
|
||||
{
|
||||
BIGNUM N; /* the divisor */
|
||||
BIGNUM Nr; /* the reciprocal */
|
||||
int num_bits;
|
||||
int shift;
|
||||
int flags;
|
||||
} BN_RECP_CTX;
|
||||
|
||||
#define BN_to_montgomery(r,a,mont,ctx) BN_mod_mul_montgomery(\
|
||||
r,a,&((mont)->RR),(mont),ctx)
|
||||
|
||||
#define BN_prime_checks 0 /* default: select number of iterations based on the size of the number */
|
||||
|
||||
/* number of Miller-Rabin iterations for an error rate of less than 2^-80
|
||||
* for random 'b'-bit input, b >= 100 (taken from table 4.4 in the Handbook
|
||||
* of Applied Cryptography [Menezes, van Oorschot, Vanstone; CRC Press 1996];
|
||||
* original paper: Damgaard, Landrock, Pomerance: Average case error estimates
|
||||
* for the strong probable prime test. -- Math. Comp. 61 (1993) 177-194) */
|
||||
#define BN_prime_checks_for_size(b) ((b) >= 1300 ? 2 : \
|
||||
(b) >= 850 ? 3 : \
|
||||
(b) >= 650 ? 4 : \
|
||||
(b) >= 550 ? 5 : \
|
||||
(b) >= 450 ? 6 : \
|
||||
(b) >= 400 ? 7 : \
|
||||
(b) >= 350 ? 8 : \
|
||||
(b) >= 300 ? 9 : \
|
||||
(b) >= 250 ? 12 : \
|
||||
(b) >= 200 ? 15 : \
|
||||
(b) >= 150 ? 18 : \
|
||||
/* b >= 100 */ 27)
|
||||
|
||||
#define BN_num_bytes(a) ((BN_num_bits(a)+7)/8)
|
||||
#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w)))
|
||||
#define BN_is_zero(a) (((a)->top == 0) || BN_is_word(a,0))
|
||||
#define BN_is_one(a) (BN_is_word((a),1))
|
||||
#define BN_is_odd(a) (((a)->top > 0) && ((a)->d[0] & 1))
|
||||
#define BN_one(a) (BN_set_word((a),1))
|
||||
#define BN_zero(a) (BN_set_word((a),0))
|
||||
|
||||
/*#define BN_ascii2bn(a) BN_hex2bn(a) */
|
||||
/*#define BN_bn2ascii(a) BN_bn2hex(a) */
|
||||
|
||||
const BIGNUM *BN_value_one(void);
|
||||
char *BN_options(void);
|
||||
BN_CTX *BN_CTX_new(void);
|
||||
void BN_CTX_init(BN_CTX *c);
|
||||
void BN_CTX_free(BN_CTX *c);
|
||||
void BN_CTX_start(BN_CTX *ctx);
|
||||
BIGNUM *BN_CTX_get(BN_CTX *ctx);
|
||||
void BN_CTX_end(BN_CTX *ctx);
|
||||
int BN_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
int BN_rand_range(BIGNUM *rnd, BIGNUM *range);
|
||||
int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range);
|
||||
int BN_num_bits(const BIGNUM *a);
|
||||
int BN_num_bits_word(BN_ULONG);
|
||||
BIGNUM *BN_new(void);
|
||||
void BN_init(BIGNUM *);
|
||||
void BN_clear_free(BIGNUM *a);
|
||||
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
|
||||
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2bin(const BIGNUM *a, unsigned char *to);
|
||||
BIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret);
|
||||
int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
|
||||
int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
|
||||
int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx);
|
||||
BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_mul_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_add_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_sub_word(BIGNUM *a, BN_ULONG w);
|
||||
int BN_set_word(BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_get_word(const BIGNUM *a);
|
||||
int BN_cmp(const BIGNUM *a, const BIGNUM *b);
|
||||
void BN_free(BIGNUM *a);
|
||||
int BN_is_bit_set(const BIGNUM *a, int n);
|
||||
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
|
||||
int BN_lshift1(BIGNUM *r, BIGNUM *a);
|
||||
int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx);
|
||||
int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mod_exp_mont(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp2_mont(BIGNUM *r, BIGNUM *a1, BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_mask_bits(BIGNUM *a, int n);
|
||||
int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
|
||||
#ifndef NO_FP_API
|
||||
int BN_print_fp(FILE *fp, const BIGNUM *a);
|
||||
#endif
|
||||
#ifdef HEADER_BIO_H
|
||||
int BN_print(BIO *fp, const BIGNUM *a);
|
||||
#else
|
||||
int BN_print(void *fp, const BIGNUM *a);
|
||||
#endif
|
||||
int BN_reciprocal(BIGNUM *r, BIGNUM *m, int len, BN_CTX *ctx);
|
||||
int BN_rshift(BIGNUM *r, BIGNUM *a, int n);
|
||||
int BN_rshift1(BIGNUM *r, BIGNUM *a);
|
||||
void BN_clear(BIGNUM *a);
|
||||
BIGNUM *BN_dup(const BIGNUM *a);
|
||||
int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
|
||||
int BN_set_bit(BIGNUM *a, int n);
|
||||
int BN_clear_bit(BIGNUM *a, int n);
|
||||
char *BN_bn2hex(const BIGNUM *a);
|
||||
char *BN_bn2dec(const BIGNUM *a);
|
||||
int BN_hex2bn(BIGNUM **a, const char *str);
|
||||
int BN_dec2bn(BIGNUM **a, const char *str);
|
||||
int BN_gcd(BIGNUM *r, BIGNUM *in_a, BIGNUM *in_b, BN_CTX *ctx);
|
||||
BIGNUM *BN_mod_inverse(BIGNUM *ret, BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
|
||||
BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe, BIGNUM *add, BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg);
|
||||
int BN_is_prime(const BIGNUM *p, int nchecks, void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg);
|
||||
int BN_is_prime_fasttest(const BIGNUM *p, int nchecks, void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg, int do_trial_division);
|
||||
BN_MONT_CTX *BN_MONT_CTX_new(void);
|
||||
void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
|
||||
int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, BN_CTX *ctx);
|
||||
void BN_MONT_CTX_free(BN_MONT_CTX *mont);
|
||||
int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *modulus, BN_CTX *ctx);
|
||||
BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from);
|
||||
BN_BLINDING *BN_BLINDING_new(BIGNUM *A, BIGNUM *Ai, BIGNUM *mod);
|
||||
void BN_BLINDING_free(BN_BLINDING *b);
|
||||
int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx);
|
||||
int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *r, BN_CTX *ctx);
|
||||
int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
|
||||
void BN_set_params(int mul, int high, int low, int mont);
|
||||
int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
|
||||
void BN_RECP_CTX_init(BN_RECP_CTX *recp);
|
||||
BN_RECP_CTX *BN_RECP_CTX_new(void);
|
||||
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
|
||||
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
|
||||
int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *x, BIGNUM *y, BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx);
|
||||
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *m, BN_RECP_CTX *recp, BN_CTX *ctx);
|
||||
|
||||
/* library internal functions */
|
||||
#define bn_expand(a,bits) ((((((bits+BN_BITS2-1))/BN_BITS2)) <= (a)->dmax)?\
|
||||
(a):bn_expand2((a),(bits)/BN_BITS2+1))
|
||||
#define bn_wexpand(a,words) (((words) <= (a)->dmax)?(a):bn_expand2((a),(words)))
|
||||
BIGNUM *bn_expand2(BIGNUM *a, int words);
|
||||
|
||||
#define bn_fix_top(a) \
|
||||
{ \
|
||||
BN_ULONG *ftl; \
|
||||
if ((a)->top > 0) \
|
||||
{ \
|
||||
for (ftl= &((a)->d[(a)->top-1]); (a)->top > 0; (a)->top--) \
|
||||
if (*(ftl--)) break; \
|
||||
} \
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w);
|
||||
BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w);
|
||||
void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num);
|
||||
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);
|
||||
BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, int num);
|
||||
BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp, int num);
|
||||
|
||||
#ifdef BN_DEBUG
|
||||
void bn_dump1(FILE *o, const char *a, BN_ULONG *b, int n);
|
||||
# define bn_print(a) {fprintf(stderr, #a "="); BN_print_fp(stderr,a); \
|
||||
fprintf(stderr,"\n");}
|
||||
# define bn_dump(a,n) bn_dump1(stderr,#a,a,n);
|
||||
#else
|
||||
# define bn_print(a)
|
||||
# define bn_dump(a,b)
|
||||
#endif
|
||||
|
||||
int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_BN_strings(void);
|
||||
|
||||
/* Error codes for the BN functions. */
|
||||
/* Function codes. */
|
||||
#define BN_F_BN_BLINDING_CONVERT 100
|
||||
#define BN_F_BN_BLINDING_INVERT 101
|
||||
#define BN_F_BN_BLINDING_NEW 102
|
||||
#define BN_F_BN_BLINDING_UPDATE 103
|
||||
#define BN_F_BN_BN2DEC 104
|
||||
#define BN_F_BN_BN2HEX 105
|
||||
#define BN_F_BN_CTX_GET 116
|
||||
#define BN_F_BN_CTX_NEW 106
|
||||
#define BN_F_BN_DIV 107
|
||||
#define BN_F_BN_EXPAND2 108
|
||||
#define BN_F_BN_MOD_EXP2_MONT 118
|
||||
#define BN_F_BN_MOD_EXP_MONT 109
|
||||
#define BN_F_BN_MOD_EXP_MONT_WORD 117
|
||||
#define BN_F_BN_MOD_INVERSE 110
|
||||
#define BN_F_BN_MOD_MUL_RECIPROCAL 111
|
||||
#define BN_F_BN_MPI2BN 112
|
||||
#define BN_F_BN_NEW 113
|
||||
#define BN_F_BN_RAND 114
|
||||
#define BN_F_BN_RAND_RANGE 122
|
||||
#define BN_F_BN_USUB 115
|
||||
|
||||
/* Reason codes. */
|
||||
#define BN_R_ARG2_LT_ARG3 100
|
||||
#define BN_R_BAD_RECIPROCAL 101
|
||||
#define BN_R_BIGNUM_TOO_LONG 114
|
||||
#define BN_R_CALLED_WITH_EVEN_MODULUS 102
|
||||
#define BN_R_DIV_BY_ZERO 103
|
||||
#define BN_R_ENCODING_ERROR 104
|
||||
#define BN_R_EXPAND_ON_STATIC_BIGNUM_DATA 105
|
||||
#define BN_R_INVALID_LENGTH 106
|
||||
#define BN_R_INVALID_RANGE 115
|
||||
#define BN_R_NOT_INITIALIZED 107
|
||||
#define BN_R_NO_INVERSE 108
|
||||
#define BN_R_TOO_MANY_TEMPORARY_VARIABLES 109
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
327
cscrypt/bn_add.c
Normal file
327
cscrypt/bn_add.c
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_add.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "openssl_mods.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
/* r can == a or b */
|
||||
int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
const BIGNUM *tmp;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
/* a + b a+b
|
||||
* a + -b a-b
|
||||
* -a + b b-a
|
||||
* -a + -b -(a+b)
|
||||
*/
|
||||
if(a->neg ^ b->neg)
|
||||
{
|
||||
/* only one is negative */
|
||||
if(a->neg)
|
||||
{
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
|
||||
/* we are now a - b */
|
||||
|
||||
if(BN_ucmp(a, b) < 0)
|
||||
{
|
||||
if(!BN_usub(r, b, a)) { return (0); }
|
||||
r->neg = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!BN_usub(r, a, b)) { return (0); }
|
||||
r->neg = 0;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
if(a->neg) /* both are neg */
|
||||
{ r->neg = 1; }
|
||||
else
|
||||
{ r->neg = 0; }
|
||||
|
||||
if(!BN_uadd(r, a, b)) { return (0); }
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* unsigned add of b to a, r must be large enough */
|
||||
int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
register int i;
|
||||
int max, min;
|
||||
BN_ULONG *ap, *bp, *rp, carry, t1;
|
||||
const BIGNUM *tmp;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
if(a->top < b->top)
|
||||
{
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
max = a->top;
|
||||
min = b->top;
|
||||
|
||||
if(bn_wexpand(r, max + 1) == NULL)
|
||||
{ return (0); }
|
||||
|
||||
r->top = max;
|
||||
|
||||
|
||||
ap = a->d;
|
||||
bp = b->d;
|
||||
rp = r->d;
|
||||
|
||||
carry = bn_add_words(rp, ap, bp, min);
|
||||
rp += min;
|
||||
ap += min;
|
||||
i = min;
|
||||
|
||||
if(carry)
|
||||
{
|
||||
while(i < max)
|
||||
{
|
||||
i++;
|
||||
t1 = *(ap++);
|
||||
if((*(rp++) = (t1 + 1)&BN_MASK2) >= t1)
|
||||
{
|
||||
carry = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if((i >= max) && carry)
|
||||
{
|
||||
*(rp++) = 1;
|
||||
r->top++;
|
||||
}
|
||||
}
|
||||
if(rp != ap)
|
||||
{
|
||||
for(; i < max; i++)
|
||||
{ *(rp++) = *(ap++); }
|
||||
}
|
||||
/* memcpy(rp,ap,sizeof(*ap)*(max-i));*/
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* unsigned subtraction of b from a, a must be larger than b. */
|
||||
int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int max, min;
|
||||
register BN_ULONG t1, t2, *ap, *bp, *rp;
|
||||
int i, carry;
|
||||
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
if(a->top < b->top) /* hmm... should not be happening */
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
max = a->top;
|
||||
min = b->top;
|
||||
if(bn_wexpand(r, max) == NULL) { return (0); }
|
||||
|
||||
ap = a->d;
|
||||
bp = b->d;
|
||||
rp = r->d;
|
||||
|
||||
#if 1
|
||||
carry = 0;
|
||||
for(i = 0; i < min; i++)
|
||||
{
|
||||
t1 = *(ap++);
|
||||
t2 = *(bp++);
|
||||
if(carry)
|
||||
{
|
||||
carry = (t1 <= t2);
|
||||
t1 = (t1 - t2 - 1)&BN_MASK2;
|
||||
}
|
||||
else
|
||||
{
|
||||
carry = (t1 < t2);
|
||||
t1 = (t1 - t2)&BN_MASK2;
|
||||
}
|
||||
#if defined(IRIX_CC_BUG) && !defined(LINT)
|
||||
int dummy;
|
||||
dummy = t1;
|
||||
#endif
|
||||
*(rp++) = t1 & BN_MASK2;
|
||||
}
|
||||
#else
|
||||
carry = bn_sub_words(rp, ap, bp, min);
|
||||
ap += min;
|
||||
bp += min;
|
||||
rp += min;
|
||||
i = min;
|
||||
#endif
|
||||
if(carry) /* subtracted */
|
||||
{
|
||||
while(i < max)
|
||||
{
|
||||
i++;
|
||||
t1 = *(ap++);
|
||||
t2 = (t1 - 1)&BN_MASK2;
|
||||
*(rp++) = t2;
|
||||
if(t1 > t2) { break; }
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
memcpy(rp, ap, sizeof(*rp) * (max - i));
|
||||
#else
|
||||
if(rp != ap)
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
if(i++ >= max) { break; }
|
||||
rp[0] = ap[0];
|
||||
if(i++ >= max) { break; }
|
||||
rp[1] = ap[1];
|
||||
if(i++ >= max) { break; }
|
||||
rp[2] = ap[2];
|
||||
if(i++ >= max) { break; }
|
||||
rp[3] = ap[3];
|
||||
rp += 4;
|
||||
ap += 4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
r->top = max;
|
||||
bn_fix_top(r);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int max;
|
||||
int add = 0, neg = 0;
|
||||
const BIGNUM *tmp;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
/* a - b a-b
|
||||
* a - -b a+b
|
||||
* -a - b -(a+b)
|
||||
* -a - -b b-a
|
||||
*/
|
||||
if(a->neg)
|
||||
{
|
||||
if(b->neg)
|
||||
{
|
||||
tmp = a;
|
||||
a = b;
|
||||
b = tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
add = 1;
|
||||
neg = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(b->neg)
|
||||
{
|
||||
add = 1;
|
||||
neg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(add)
|
||||
{
|
||||
if(!BN_uadd(r, a, b)) { return (0); }
|
||||
r->neg = neg;
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* We are actually doing a - b :-) */
|
||||
|
||||
max = (a->top > b->top) ? a->top : b->top;
|
||||
if(bn_wexpand(r, max) == NULL) { return (0); }
|
||||
if(BN_ucmp(a, b) < 0)
|
||||
{
|
||||
if(!BN_usub(r, b, a)) { return (0); }
|
||||
r->neg = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!BN_usub(r, a, b)) { return (0); }
|
||||
r->neg = 0;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
#endif
|
||||
854
cscrypt/bn_asm.c
Normal file
854
cscrypt/bn_asm.c
Normal file
|
|
@ -0,0 +1,854 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_asm.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#ifndef BN_DEBUG
|
||||
# undef NDEBUG /* avoid conflicting definitions */
|
||||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "bn_lcl.h"
|
||||
#include "openssl_mods.h"
|
||||
|
||||
#if defined(BN_LLONG) || defined(BN_UMULT_HIGH)
|
||||
|
||||
BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
|
||||
{
|
||||
BN_ULONG c1 = 0;
|
||||
|
||||
assert(num >= 0);
|
||||
if(num <= 0) { return (c1); }
|
||||
|
||||
while(num&~3)
|
||||
{
|
||||
mul_add(rp[0], ap[0], w, c1);
|
||||
mul_add(rp[1], ap[1], w, c1);
|
||||
mul_add(rp[2], ap[2], w, c1);
|
||||
mul_add(rp[3], ap[3], w, c1);
|
||||
ap += 4;
|
||||
rp += 4;
|
||||
num -= 4;
|
||||
}
|
||||
if(num)
|
||||
{
|
||||
mul_add(rp[0], ap[0], w, c1);
|
||||
if(--num == 0) { return c1; }
|
||||
mul_add(rp[1], ap[1], w, c1);
|
||||
if(--num == 0) { return c1; }
|
||||
mul_add(rp[2], ap[2], w, c1);
|
||||
return c1;
|
||||
}
|
||||
|
||||
return (c1);
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
|
||||
{
|
||||
BN_ULONG c1 = 0;
|
||||
|
||||
assert(num >= 0);
|
||||
if(num <= 0) { return (c1); }
|
||||
|
||||
while(num&~3)
|
||||
{
|
||||
mul(rp[0], ap[0], w, c1);
|
||||
mul(rp[1], ap[1], w, c1);
|
||||
mul(rp[2], ap[2], w, c1);
|
||||
mul(rp[3], ap[3], w, c1);
|
||||
ap += 4;
|
||||
rp += 4;
|
||||
num -= 4;
|
||||
}
|
||||
if(num)
|
||||
{
|
||||
mul(rp[0], ap[0], w, c1);
|
||||
if(--num == 0) { return c1; }
|
||||
mul(rp[1], ap[1], w, c1);
|
||||
if(--num == 0) { return c1; }
|
||||
mul(rp[2], ap[2], w, c1);
|
||||
}
|
||||
return (c1);
|
||||
}
|
||||
|
||||
void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
|
||||
{
|
||||
assert(n >= 0);
|
||||
if(n <= 0) { return; }
|
||||
while(n&~3)
|
||||
{
|
||||
sqr(r[0], r[1], a[0]);
|
||||
sqr(r[2], r[3], a[1]);
|
||||
sqr(r[4], r[5], a[2]);
|
||||
sqr(r[6], r[7], a[3]);
|
||||
a += 4;
|
||||
r += 8;
|
||||
n -= 4;
|
||||
}
|
||||
if(n)
|
||||
{
|
||||
sqr(r[0], r[1], a[0]);
|
||||
if(--n == 0) { return; }
|
||||
sqr(r[2], r[3], a[1]);
|
||||
if(--n == 0) { return; }
|
||||
sqr(r[4], r[5], a[2]);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */
|
||||
|
||||
BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
|
||||
{
|
||||
BN_ULONG c = 0;
|
||||
BN_ULONG bl, bh;
|
||||
|
||||
assert(num >= 0);
|
||||
if(num <= 0) { return ((BN_ULONG)0); }
|
||||
|
||||
bl = LBITS(w);
|
||||
bh = HBITS(w);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
mul_add(rp[0], ap[0], bl, bh, c);
|
||||
if(--num == 0) { break; }
|
||||
mul_add(rp[1], ap[1], bl, bh, c);
|
||||
if(--num == 0) { break; }
|
||||
mul_add(rp[2], ap[2], bl, bh, c);
|
||||
if(--num == 0) { break; }
|
||||
mul_add(rp[3], ap[3], bl, bh, c);
|
||||
if(--num == 0) { break; }
|
||||
ap += 4;
|
||||
rp += 4;
|
||||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w)
|
||||
{
|
||||
BN_ULONG carry = 0;
|
||||
BN_ULONG bl, bh;
|
||||
|
||||
assert(num >= 0);
|
||||
if(num <= 0) { return ((BN_ULONG)0); }
|
||||
|
||||
bl = LBITS(w);
|
||||
bh = HBITS(w);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
mul(rp[0], ap[0], bl, bh, carry);
|
||||
if(--num == 0) { break; }
|
||||
mul(rp[1], ap[1], bl, bh, carry);
|
||||
if(--num == 0) { break; }
|
||||
mul(rp[2], ap[2], bl, bh, carry);
|
||||
if(--num == 0) { break; }
|
||||
mul(rp[3], ap[3], bl, bh, carry);
|
||||
if(--num == 0) { break; }
|
||||
ap += 4;
|
||||
rp += 4;
|
||||
}
|
||||
return (carry);
|
||||
}
|
||||
|
||||
void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
|
||||
{
|
||||
assert(n >= 0);
|
||||
if(n <= 0) { return; }
|
||||
for(;;)
|
||||
{
|
||||
sqr64(r[0], r[1], a[0]);
|
||||
if(--n == 0) { break; }
|
||||
|
||||
sqr64(r[2], r[3], a[1]);
|
||||
if(--n == 0) { break; }
|
||||
|
||||
sqr64(r[4], r[5], a[2]);
|
||||
if(--n == 0) { break; }
|
||||
|
||||
sqr64(r[6], r[7], a[3]);
|
||||
if(--n == 0) { break; }
|
||||
|
||||
a += 4;
|
||||
r += 8;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !(defined(BN_LLONG) || defined(BN_UMULT_HIGH)) */
|
||||
|
||||
#if defined(BN_LLONG) && defined(BN_DIV2W)
|
||||
|
||||
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
|
||||
{
|
||||
return ((BN_ULONG)(((((BN_ULLONG)h) << BN_BITS2) | l) / (BN_ULLONG)d));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* Divide h,l by d and return the result. */
|
||||
/* I need to test this some more :-( */
|
||||
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
|
||||
{
|
||||
BN_ULONG dh, dl, q, ret = 0, th, tl, t;
|
||||
int i, count = 2;
|
||||
|
||||
if(d == 0) { return (BN_MASK2); }
|
||||
|
||||
i = BN_num_bits_word(d);
|
||||
assert((i == BN_BITS2) || (h > (BN_ULONG)1 << i));
|
||||
|
||||
i = BN_BITS2 - i;
|
||||
if(h >= d) { h -= d; }
|
||||
|
||||
if(i)
|
||||
{
|
||||
d <<= i;
|
||||
h = (h << i) | (l >> (BN_BITS2 - i));
|
||||
l <<= i;
|
||||
}
|
||||
dh = (d & BN_MASK2h) >> BN_BITS4;
|
||||
dl = (d & BN_MASK2l);
|
||||
for(;;)
|
||||
{
|
||||
if((h >> BN_BITS4) == dh)
|
||||
{ q = BN_MASK2l; }
|
||||
else
|
||||
{ q = h / dh; }
|
||||
|
||||
th = q * dh;
|
||||
tl = dl * q;
|
||||
for(;;)
|
||||
{
|
||||
t = h - th;
|
||||
if((t & BN_MASK2h) ||
|
||||
((tl) <= (
|
||||
(t << BN_BITS4) |
|
||||
((l & BN_MASK2h) >> BN_BITS4))))
|
||||
{ break; }
|
||||
q--;
|
||||
th -= dh;
|
||||
tl -= dl;
|
||||
}
|
||||
t = (tl >> BN_BITS4);
|
||||
tl = (tl << BN_BITS4)&BN_MASK2h;
|
||||
th += t;
|
||||
|
||||
if(l < tl) { th++; }
|
||||
l -= tl;
|
||||
if(h < th)
|
||||
{
|
||||
h += d;
|
||||
q--;
|
||||
}
|
||||
h -= th;
|
||||
|
||||
if(--count == 0) { break; }
|
||||
|
||||
ret = q << BN_BITS4;
|
||||
h = ((h << BN_BITS4) | (l >> BN_BITS4))&BN_MASK2;
|
||||
l = (l & BN_MASK2l) << BN_BITS4;
|
||||
}
|
||||
ret |= q;
|
||||
return (ret);
|
||||
}
|
||||
#endif /* !defined(BN_LLONG) && defined(BN_DIV2W) */
|
||||
|
||||
#ifdef BN_LLONG
|
||||
BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
BN_ULLONG ll = 0;
|
||||
|
||||
assert(n >= 0);
|
||||
if(n <= 0) { return ((BN_ULONG)0); }
|
||||
|
||||
for(;;)
|
||||
{
|
||||
ll += (BN_ULLONG)a[0] + b[0];
|
||||
r[0] = (BN_ULONG)ll & BN_MASK2;
|
||||
ll >>= BN_BITS2;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
ll += (BN_ULLONG)a[1] + b[1];
|
||||
r[1] = (BN_ULONG)ll & BN_MASK2;
|
||||
ll >>= BN_BITS2;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
ll += (BN_ULLONG)a[2] + b[2];
|
||||
r[2] = (BN_ULONG)ll & BN_MASK2;
|
||||
ll >>= BN_BITS2;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
ll += (BN_ULLONG)a[3] + b[3];
|
||||
r[3] = (BN_ULONG)ll & BN_MASK2;
|
||||
ll >>= BN_BITS2;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
a += 4;
|
||||
b += 4;
|
||||
r += 4;
|
||||
}
|
||||
return ((BN_ULONG)ll);
|
||||
}
|
||||
#else /* !BN_LLONG */
|
||||
BN_ULONG bn_add_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
BN_ULONG c, l, t;
|
||||
|
||||
assert(n >= 0);
|
||||
if(n <= 0) { return ((BN_ULONG)0); }
|
||||
|
||||
c = 0;
|
||||
for(;;)
|
||||
{
|
||||
t = a[0];
|
||||
t = (t + c)&BN_MASK2;
|
||||
c = (t < c);
|
||||
l = (t + b[0])&BN_MASK2;
|
||||
c += (l < t);
|
||||
r[0] = l;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
t = a[1];
|
||||
t = (t + c)&BN_MASK2;
|
||||
c = (t < c);
|
||||
l = (t + b[1])&BN_MASK2;
|
||||
c += (l < t);
|
||||
r[1] = l;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
t = a[2];
|
||||
t = (t + c)&BN_MASK2;
|
||||
c = (t < c);
|
||||
l = (t + b[2])&BN_MASK2;
|
||||
c += (l < t);
|
||||
r[2] = l;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
t = a[3];
|
||||
t = (t + c)&BN_MASK2;
|
||||
c = (t < c);
|
||||
l = (t + b[3])&BN_MASK2;
|
||||
c += (l < t);
|
||||
r[3] = l;
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
a += 4;
|
||||
b += 4;
|
||||
r += 4;
|
||||
}
|
||||
return ((BN_ULONG)c);
|
||||
}
|
||||
#endif /* !BN_LLONG */
|
||||
|
||||
BN_ULONG bn_sub_words(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
BN_ULONG t1, t2;
|
||||
int c = 0;
|
||||
|
||||
assert(n >= 0);
|
||||
if(n <= 0) { return ((BN_ULONG)0); }
|
||||
|
||||
for(;;)
|
||||
{
|
||||
t1 = a[0];
|
||||
t2 = b[0];
|
||||
r[0] = (t1 - t2 - c)&BN_MASK2;
|
||||
if(t1 != t2) { c = (t1 < t2); }
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
t1 = a[1];
|
||||
t2 = b[1];
|
||||
r[1] = (t1 - t2 - c)&BN_MASK2;
|
||||
if(t1 != t2) { c = (t1 < t2); }
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
t1 = a[2];
|
||||
t2 = b[2];
|
||||
r[2] = (t1 - t2 - c)&BN_MASK2;
|
||||
if(t1 != t2) { c = (t1 < t2); }
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
t1 = a[3];
|
||||
t2 = b[3];
|
||||
r[3] = (t1 - t2 - c)&BN_MASK2;
|
||||
if(t1 != t2) { c = (t1 < t2); }
|
||||
if(--n <= 0) { break; }
|
||||
|
||||
a += 4;
|
||||
b += 4;
|
||||
r += 4;
|
||||
}
|
||||
return (c);
|
||||
}
|
||||
|
||||
#ifdef BN_MUL_COMBA
|
||||
|
||||
#undef bn_mul_comba8
|
||||
#undef bn_mul_comba4
|
||||
#undef bn_sqr_comba8
|
||||
#undef bn_sqr_comba4
|
||||
|
||||
/* mul_add_c(a,b,c0,c1,c2) -- c+=a*b for three word number c=(c2,c1,c0) */
|
||||
/* mul_add_c2(a,b,c0,c1,c2) -- c+=2*a*b for three word number c=(c2,c1,c0) */
|
||||
/* sqr_add_c(a,i,c0,c1,c2) -- c+=a[i]^2 for three word number c=(c2,c1,c0) */
|
||||
/* sqr_add_c2(a,i,c0,c1,c2) -- c+=2*a[i]*a[j] for three word number c=(c2,c1,c0) */
|
||||
|
||||
#ifdef BN_LLONG
|
||||
#define mul_add_c(a,b,c0,c1,c2) \
|
||||
t=(BN_ULLONG)a*b; \
|
||||
t1=(BN_ULONG)Lw(t); \
|
||||
t2=(BN_ULONG)Hw(t); \
|
||||
c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \
|
||||
c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++;
|
||||
|
||||
#define mul_add_c2(a,b,c0,c1,c2) \
|
||||
t=(BN_ULLONG)a*b; \
|
||||
tt=(t+t)&BN_MASK; \
|
||||
if (tt < t) c2++; \
|
||||
t1=(BN_ULONG)Lw(tt); \
|
||||
t2=(BN_ULONG)Hw(tt); \
|
||||
c0=(c0+t1)&BN_MASK2; \
|
||||
if ((c0 < t1) && (((++t2)&BN_MASK2) == 0)) c2++; \
|
||||
c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++;
|
||||
|
||||
#define sqr_add_c(a,i,c0,c1,c2) \
|
||||
t=(BN_ULLONG)a[i]*a[i]; \
|
||||
t1=(BN_ULONG)Lw(t); \
|
||||
t2=(BN_ULONG)Hw(t); \
|
||||
c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \
|
||||
c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++;
|
||||
|
||||
#define sqr_add_c2(a,i,j,c0,c1,c2) \
|
||||
mul_add_c2((a)[i],(a)[j],c0,c1,c2)
|
||||
|
||||
#elif defined(BN_UMULT_HIGH)
|
||||
|
||||
#define mul_add_c(a,b,c0,c1,c2) { \
|
||||
BN_ULONG ta=(a),tb=(b); \
|
||||
t1 = ta * tb; \
|
||||
t2 = BN_UMULT_HIGH(ta,tb); \
|
||||
c0 += t1; t2 += (c0<t1)?1:0; \
|
||||
c1 += t2; c2 += (c1<t2)?1:0; \
|
||||
}
|
||||
|
||||
#define mul_add_c2(a,b,c0,c1,c2) { \
|
||||
BN_ULONG ta=(a),tb=(b),t0; \
|
||||
t1 = BN_UMULT_HIGH(ta,tb); \
|
||||
t0 = ta * tb; \
|
||||
t2 = t1+t1; c2 += (t2<t1)?1:0; \
|
||||
t1 = t0+t0; t2 += (t1<t0)?1:0; \
|
||||
c0 += t1; t2 += (c0<t1)?1:0; \
|
||||
c1 += t2; c2 += (c1<t2)?1:0; \
|
||||
}
|
||||
|
||||
#define sqr_add_c(a,i,c0,c1,c2) { \
|
||||
BN_ULONG ta=(a)[i]; \
|
||||
t1 = ta * ta; \
|
||||
t2 = BN_UMULT_HIGH(ta,ta); \
|
||||
c0 += t1; t2 += (c0<t1)?1:0; \
|
||||
c1 += t2; c2 += (c1<t2)?1:0; \
|
||||
}
|
||||
|
||||
#define sqr_add_c2(a,i,j,c0,c1,c2) \
|
||||
mul_add_c2((a)[i],(a)[j],c0,c1,c2)
|
||||
|
||||
#else /* !BN_LLONG */
|
||||
#define mul_add_c(a,b,c0,c1,c2) \
|
||||
t1=LBITS(a); t2=HBITS(a); \
|
||||
bl=LBITS(b); bh=HBITS(b); \
|
||||
mul64(t1,t2,bl,bh); \
|
||||
c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \
|
||||
c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++;
|
||||
|
||||
#define mul_add_c2(a,b,c0,c1,c2) \
|
||||
t1=LBITS(a); t2=HBITS(a); \
|
||||
bl=LBITS(b); bh=HBITS(b); \
|
||||
mul64(t1,t2,bl,bh); \
|
||||
if (t2 & BN_TBIT) c2++; \
|
||||
t2=(t2+t2)&BN_MASK2; \
|
||||
if (t1 & BN_TBIT) t2++; \
|
||||
t1=(t1+t1)&BN_MASK2; \
|
||||
c0=(c0+t1)&BN_MASK2; \
|
||||
if ((c0 < t1) && (((++t2)&BN_MASK2) == 0)) c2++; \
|
||||
c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++;
|
||||
|
||||
#define sqr_add_c(a,i,c0,c1,c2) \
|
||||
sqr64(t1,t2,(a)[i]); \
|
||||
c0=(c0+t1)&BN_MASK2; if ((c0) < t1) t2++; \
|
||||
c1=(c1+t2)&BN_MASK2; if ((c1) < t2) c2++;
|
||||
|
||||
#define sqr_add_c2(a,i,j,c0,c1,c2) \
|
||||
mul_add_c2((a)[i],(a)[j],c0,c1,c2)
|
||||
#endif /* !BN_LLONG */
|
||||
|
||||
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
|
||||
{
|
||||
#ifdef BN_LLONG
|
||||
BN_ULLONG t;
|
||||
#else
|
||||
BN_ULONG bl, bh;
|
||||
#endif
|
||||
BN_ULONG t1, t2;
|
||||
BN_ULONG c1, c2, c3;
|
||||
|
||||
c1 = 0;
|
||||
c2 = 0;
|
||||
c3 = 0;
|
||||
mul_add_c(a[0], b[0], c1, c2, c3);
|
||||
r[0] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[0], b[1], c2, c3, c1);
|
||||
mul_add_c(a[1], b[0], c2, c3, c1);
|
||||
r[1] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[2], b[0], c3, c1, c2);
|
||||
mul_add_c(a[1], b[1], c3, c1, c2);
|
||||
mul_add_c(a[0], b[2], c3, c1, c2);
|
||||
r[2] = c3;
|
||||
c3 = 0;
|
||||
mul_add_c(a[0], b[3], c1, c2, c3);
|
||||
mul_add_c(a[1], b[2], c1, c2, c3);
|
||||
mul_add_c(a[2], b[1], c1, c2, c3);
|
||||
mul_add_c(a[3], b[0], c1, c2, c3);
|
||||
r[3] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[4], b[0], c2, c3, c1);
|
||||
mul_add_c(a[3], b[1], c2, c3, c1);
|
||||
mul_add_c(a[2], b[2], c2, c3, c1);
|
||||
mul_add_c(a[1], b[3], c2, c3, c1);
|
||||
mul_add_c(a[0], b[4], c2, c3, c1);
|
||||
r[4] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[0], b[5], c3, c1, c2);
|
||||
mul_add_c(a[1], b[4], c3, c1, c2);
|
||||
mul_add_c(a[2], b[3], c3, c1, c2);
|
||||
mul_add_c(a[3], b[2], c3, c1, c2);
|
||||
mul_add_c(a[4], b[1], c3, c1, c2);
|
||||
mul_add_c(a[5], b[0], c3, c1, c2);
|
||||
r[5] = c3;
|
||||
c3 = 0;
|
||||
mul_add_c(a[6], b[0], c1, c2, c3);
|
||||
mul_add_c(a[5], b[1], c1, c2, c3);
|
||||
mul_add_c(a[4], b[2], c1, c2, c3);
|
||||
mul_add_c(a[3], b[3], c1, c2, c3);
|
||||
mul_add_c(a[2], b[4], c1, c2, c3);
|
||||
mul_add_c(a[1], b[5], c1, c2, c3);
|
||||
mul_add_c(a[0], b[6], c1, c2, c3);
|
||||
r[6] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[0], b[7], c2, c3, c1);
|
||||
mul_add_c(a[1], b[6], c2, c3, c1);
|
||||
mul_add_c(a[2], b[5], c2, c3, c1);
|
||||
mul_add_c(a[3], b[4], c2, c3, c1);
|
||||
mul_add_c(a[4], b[3], c2, c3, c1);
|
||||
mul_add_c(a[5], b[2], c2, c3, c1);
|
||||
mul_add_c(a[6], b[1], c2, c3, c1);
|
||||
mul_add_c(a[7], b[0], c2, c3, c1);
|
||||
r[7] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[7], b[1], c3, c1, c2);
|
||||
mul_add_c(a[6], b[2], c3, c1, c2);
|
||||
mul_add_c(a[5], b[3], c3, c1, c2);
|
||||
mul_add_c(a[4], b[4], c3, c1, c2);
|
||||
mul_add_c(a[3], b[5], c3, c1, c2);
|
||||
mul_add_c(a[2], b[6], c3, c1, c2);
|
||||
mul_add_c(a[1], b[7], c3, c1, c2);
|
||||
r[8] = c3;
|
||||
c3 = 0;
|
||||
mul_add_c(a[2], b[7], c1, c2, c3);
|
||||
mul_add_c(a[3], b[6], c1, c2, c3);
|
||||
mul_add_c(a[4], b[5], c1, c2, c3);
|
||||
mul_add_c(a[5], b[4], c1, c2, c3);
|
||||
mul_add_c(a[6], b[3], c1, c2, c3);
|
||||
mul_add_c(a[7], b[2], c1, c2, c3);
|
||||
r[9] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[7], b[3], c2, c3, c1);
|
||||
mul_add_c(a[6], b[4], c2, c3, c1);
|
||||
mul_add_c(a[5], b[5], c2, c3, c1);
|
||||
mul_add_c(a[4], b[6], c2, c3, c1);
|
||||
mul_add_c(a[3], b[7], c2, c3, c1);
|
||||
r[10] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[4], b[7], c3, c1, c2);
|
||||
mul_add_c(a[5], b[6], c3, c1, c2);
|
||||
mul_add_c(a[6], b[5], c3, c1, c2);
|
||||
mul_add_c(a[7], b[4], c3, c1, c2);
|
||||
r[11] = c3;
|
||||
c3 = 0;
|
||||
mul_add_c(a[7], b[5], c1, c2, c3);
|
||||
mul_add_c(a[6], b[6], c1, c2, c3);
|
||||
mul_add_c(a[5], b[7], c1, c2, c3);
|
||||
r[12] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[6], b[7], c2, c3, c1);
|
||||
mul_add_c(a[7], b[6], c2, c3, c1);
|
||||
r[13] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[7], b[7], c3, c1, c2);
|
||||
r[14] = c3;
|
||||
r[15] = c1;
|
||||
}
|
||||
|
||||
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
|
||||
{
|
||||
#ifdef BN_LLONG
|
||||
BN_ULLONG t;
|
||||
#else
|
||||
BN_ULONG bl, bh;
|
||||
#endif
|
||||
BN_ULONG t1, t2;
|
||||
BN_ULONG c1, c2, c3;
|
||||
|
||||
c1 = 0;
|
||||
c2 = 0;
|
||||
c3 = 0;
|
||||
mul_add_c(a[0], b[0], c1, c2, c3);
|
||||
r[0] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[0], b[1], c2, c3, c1);
|
||||
mul_add_c(a[1], b[0], c2, c3, c1);
|
||||
r[1] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[2], b[0], c3, c1, c2);
|
||||
mul_add_c(a[1], b[1], c3, c1, c2);
|
||||
mul_add_c(a[0], b[2], c3, c1, c2);
|
||||
r[2] = c3;
|
||||
c3 = 0;
|
||||
mul_add_c(a[0], b[3], c1, c2, c3);
|
||||
mul_add_c(a[1], b[2], c1, c2, c3);
|
||||
mul_add_c(a[2], b[1], c1, c2, c3);
|
||||
mul_add_c(a[3], b[0], c1, c2, c3);
|
||||
r[3] = c1;
|
||||
c1 = 0;
|
||||
mul_add_c(a[3], b[1], c2, c3, c1);
|
||||
mul_add_c(a[2], b[2], c2, c3, c1);
|
||||
mul_add_c(a[1], b[3], c2, c3, c1);
|
||||
r[4] = c2;
|
||||
c2 = 0;
|
||||
mul_add_c(a[2], b[3], c3, c1, c2);
|
||||
mul_add_c(a[3], b[2], c3, c1, c2);
|
||||
r[5] = c3;
|
||||
c3 = 0;
|
||||
mul_add_c(a[3], b[3], c1, c2, c3);
|
||||
r[6] = c1;
|
||||
r[7] = c2;
|
||||
}
|
||||
|
||||
void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
|
||||
{
|
||||
#ifdef BN_LLONG
|
||||
BN_ULLONG t, tt;
|
||||
#else
|
||||
BN_ULONG bl, bh;
|
||||
#endif
|
||||
BN_ULONG t1, t2;
|
||||
BN_ULONG c1, c2, c3;
|
||||
|
||||
c1 = 0;
|
||||
c2 = 0;
|
||||
c3 = 0;
|
||||
sqr_add_c(a, 0, c1, c2, c3);
|
||||
r[0] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c2(a, 1, 0, c2, c3, c1);
|
||||
r[1] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c(a, 1, c3, c1, c2);
|
||||
sqr_add_c2(a, 2, 0, c3, c1, c2);
|
||||
r[2] = c3;
|
||||
c3 = 0;
|
||||
sqr_add_c2(a, 3, 0, c1, c2, c3);
|
||||
sqr_add_c2(a, 2, 1, c1, c2, c3);
|
||||
r[3] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c(a, 2, c2, c3, c1);
|
||||
sqr_add_c2(a, 3, 1, c2, c3, c1);
|
||||
sqr_add_c2(a, 4, 0, c2, c3, c1);
|
||||
r[4] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c2(a, 5, 0, c3, c1, c2);
|
||||
sqr_add_c2(a, 4, 1, c3, c1, c2);
|
||||
sqr_add_c2(a, 3, 2, c3, c1, c2);
|
||||
r[5] = c3;
|
||||
c3 = 0;
|
||||
sqr_add_c(a, 3, c1, c2, c3);
|
||||
sqr_add_c2(a, 4, 2, c1, c2, c3);
|
||||
sqr_add_c2(a, 5, 1, c1, c2, c3);
|
||||
sqr_add_c2(a, 6, 0, c1, c2, c3);
|
||||
r[6] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c2(a, 7, 0, c2, c3, c1);
|
||||
sqr_add_c2(a, 6, 1, c2, c3, c1);
|
||||
sqr_add_c2(a, 5, 2, c2, c3, c1);
|
||||
sqr_add_c2(a, 4, 3, c2, c3, c1);
|
||||
r[7] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c(a, 4, c3, c1, c2);
|
||||
sqr_add_c2(a, 5, 3, c3, c1, c2);
|
||||
sqr_add_c2(a, 6, 2, c3, c1, c2);
|
||||
sqr_add_c2(a, 7, 1, c3, c1, c2);
|
||||
r[8] = c3;
|
||||
c3 = 0;
|
||||
sqr_add_c2(a, 7, 2, c1, c2, c3);
|
||||
sqr_add_c2(a, 6, 3, c1, c2, c3);
|
||||
sqr_add_c2(a, 5, 4, c1, c2, c3);
|
||||
r[9] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c(a, 5, c2, c3, c1);
|
||||
sqr_add_c2(a, 6, 4, c2, c3, c1);
|
||||
sqr_add_c2(a, 7, 3, c2, c3, c1);
|
||||
r[10] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c2(a, 7, 4, c3, c1, c2);
|
||||
sqr_add_c2(a, 6, 5, c3, c1, c2);
|
||||
r[11] = c3;
|
||||
c3 = 0;
|
||||
sqr_add_c(a, 6, c1, c2, c3);
|
||||
sqr_add_c2(a, 7, 5, c1, c2, c3);
|
||||
r[12] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c2(a, 7, 6, c2, c3, c1);
|
||||
r[13] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c(a, 7, c3, c1, c2);
|
||||
r[14] = c3;
|
||||
r[15] = c1;
|
||||
}
|
||||
|
||||
void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
|
||||
{
|
||||
#ifdef BN_LLONG
|
||||
BN_ULLONG t, tt;
|
||||
#else
|
||||
BN_ULONG bl, bh;
|
||||
#endif
|
||||
BN_ULONG t1, t2;
|
||||
BN_ULONG c1, c2, c3;
|
||||
|
||||
c1 = 0;
|
||||
c2 = 0;
|
||||
c3 = 0;
|
||||
sqr_add_c(a, 0, c1, c2, c3);
|
||||
r[0] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c2(a, 1, 0, c2, c3, c1);
|
||||
r[1] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c(a, 1, c3, c1, c2);
|
||||
sqr_add_c2(a, 2, 0, c3, c1, c2);
|
||||
r[2] = c3;
|
||||
c3 = 0;
|
||||
sqr_add_c2(a, 3, 0, c1, c2, c3);
|
||||
sqr_add_c2(a, 2, 1, c1, c2, c3);
|
||||
r[3] = c1;
|
||||
c1 = 0;
|
||||
sqr_add_c(a, 2, c2, c3, c1);
|
||||
sqr_add_c2(a, 3, 1, c2, c3, c1);
|
||||
r[4] = c2;
|
||||
c2 = 0;
|
||||
sqr_add_c2(a, 3, 2, c3, c1, c2);
|
||||
r[5] = c3;
|
||||
c3 = 0;
|
||||
sqr_add_c(a, 3, c1, c2, c3);
|
||||
r[6] = c1;
|
||||
r[7] = c2;
|
||||
}
|
||||
#else /* !BN_MUL_COMBA */
|
||||
|
||||
/* hmm... is it faster just to do a multiply? */
|
||||
#undef bn_sqr_comba4
|
||||
void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a)
|
||||
{
|
||||
BN_ULONG t[8];
|
||||
bn_sqr_normal(r, a, 4, t);
|
||||
}
|
||||
|
||||
#undef bn_sqr_comba8
|
||||
void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a)
|
||||
{
|
||||
BN_ULONG t[16];
|
||||
bn_sqr_normal(r, a, 8, t);
|
||||
}
|
||||
|
||||
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
|
||||
{
|
||||
r[4] = bn_mul_words(&(r[0]), a, 4, b[0]);
|
||||
r[5] = bn_mul_add_words(&(r[1]), a, 4, b[1]);
|
||||
r[6] = bn_mul_add_words(&(r[2]), a, 4, b[2]);
|
||||
r[7] = bn_mul_add_words(&(r[3]), a, 4, b[3]);
|
||||
}
|
||||
|
||||
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b)
|
||||
{
|
||||
r[ 8] = bn_mul_words(&(r[0]), a, 8, b[0]);
|
||||
r[ 9] = bn_mul_add_words(&(r[1]), a, 8, b[1]);
|
||||
r[10] = bn_mul_add_words(&(r[2]), a, 8, b[2]);
|
||||
r[11] = bn_mul_add_words(&(r[3]), a, 8, b[3]);
|
||||
r[12] = bn_mul_add_words(&(r[4]), a, 8, b[4]);
|
||||
r[13] = bn_mul_add_words(&(r[5]), a, 8, b[5]);
|
||||
r[14] = bn_mul_add_words(&(r[6]), a, 8, b[6]);
|
||||
r[15] = bn_mul_add_words(&(r[7]), a, 8, b[7]);
|
||||
}
|
||||
|
||||
#endif /* !BN_MUL_COMBA */
|
||||
#endif
|
||||
146
cscrypt/bn_ctx.c
Normal file
146
cscrypt/bn_ctx.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_ctx.c */
|
||||
/* Written by Ulf Moeller for the OpenSSL project. */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BN_CTX_DEBUG
|
||||
# undef NDEBUG /* avoid conflicting definitions */
|
||||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
#include "bn.h"
|
||||
#include "openssl_mods.h"
|
||||
|
||||
BN_CTX *BN_CTX_new(void)
|
||||
{
|
||||
BN_CTX *ret;
|
||||
|
||||
ret = (BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));
|
||||
if(ret == NULL)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
BN_CTX_init(ret);
|
||||
ret->flags = BN_FLG_MALLOCED;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void BN_CTX_init(BN_CTX *ctx)
|
||||
{
|
||||
int i;
|
||||
ctx->tos = 0;
|
||||
ctx->flags = 0;
|
||||
ctx->depth = 0;
|
||||
ctx->too_many = 0;
|
||||
for(i = 0; i < BN_CTX_NUM; i++)
|
||||
{ BN_init(&(ctx->bn[i])); }
|
||||
}
|
||||
|
||||
void BN_CTX_free(BN_CTX *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(ctx == NULL) { return; }
|
||||
assert(ctx->depth == 0);
|
||||
|
||||
for(i = 0; i < BN_CTX_NUM; i++)
|
||||
{ BN_clear_free(&(ctx->bn[i])); }
|
||||
if(ctx->flags & BN_FLG_MALLOCED)
|
||||
{ OPENSSL_free(ctx); }
|
||||
}
|
||||
|
||||
void BN_CTX_start(BN_CTX *ctx)
|
||||
{
|
||||
if(ctx->depth < BN_CTX_NUM_POS)
|
||||
{ ctx->pos[ctx->depth] = ctx->tos; }
|
||||
ctx->depth++;
|
||||
}
|
||||
|
||||
BIGNUM *BN_CTX_get(BN_CTX *ctx)
|
||||
{
|
||||
if(ctx->depth > BN_CTX_NUM_POS || ctx->tos >= BN_CTX_NUM)
|
||||
{
|
||||
if(!ctx->too_many)
|
||||
{
|
||||
/* disable error code until BN_CTX_end is called: */
|
||||
ctx->too_many = 1;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return (&(ctx->bn[ctx->tos++]));
|
||||
}
|
||||
|
||||
void BN_CTX_end(BN_CTX *ctx)
|
||||
{
|
||||
if(ctx == NULL) { return; }
|
||||
assert(ctx->depth > 0);
|
||||
if(ctx->depth == 0)
|
||||
/* should never happen, but we can tolerate it if not in
|
||||
* debug mode (could be a 'goto err' in the calling function
|
||||
* before BN_CTX_start was reached) */
|
||||
{ BN_CTX_start(ctx); }
|
||||
|
||||
ctx->too_many = 0;
|
||||
ctx->depth--;
|
||||
if(ctx->depth < BN_CTX_NUM_POS)
|
||||
{ ctx->tos = ctx->pos[ctx->depth]; }
|
||||
}
|
||||
#endif
|
||||
391
cscrypt/bn_div.c
Normal file
391
cscrypt/bn_div.c
Normal file
|
|
@ -0,0 +1,391 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_div.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "openssl_mods.h"
|
||||
#include "bn_lcl.h"
|
||||
|
||||
/* The old slow way */
|
||||
#if 0
|
||||
int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
|
||||
BN_CTX *ctx)
|
||||
{
|
||||
int i, nm, nd;
|
||||
int ret = 0;
|
||||
BIGNUM *D;
|
||||
|
||||
bn_check_top(m);
|
||||
bn_check_top(d);
|
||||
if(BN_is_zero(d))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if(BN_ucmp(m, d) < 0)
|
||||
{
|
||||
if(rem != NULL)
|
||||
{
|
||||
if(BN_copy(rem, m) == NULL) { return (0); }
|
||||
}
|
||||
if(dv != NULL) { BN_zero(dv); }
|
||||
return (1);
|
||||
}
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
D = BN_CTX_get(ctx);
|
||||
if(dv == NULL) { dv = BN_CTX_get(ctx); }
|
||||
if(rem == NULL) { rem = BN_CTX_get(ctx); }
|
||||
if(D == NULL || dv == NULL || rem == NULL)
|
||||
{ goto end; }
|
||||
|
||||
nd = BN_num_bits(d);
|
||||
nm = BN_num_bits(m);
|
||||
if(BN_copy(D, d) == NULL) { goto end; }
|
||||
if(BN_copy(rem, m) == NULL) { goto end; }
|
||||
|
||||
/* The next 2 are needed so we can do a dv->d[0]|=1 later
|
||||
* since BN_lshift1 will only work once there is a value :-) */
|
||||
BN_zero(dv);
|
||||
bn_wexpand(dv, 1);
|
||||
dv->top = 1;
|
||||
|
||||
if(!BN_lshift(D, D, nm - nd)) { goto end; }
|
||||
for(i = nm - nd; i >= 0; i--)
|
||||
{
|
||||
if(!BN_lshift1(dv, dv)) { goto end; }
|
||||
if(BN_ucmp(rem, D) >= 0)
|
||||
{
|
||||
dv->d[0] |= 1;
|
||||
if(!BN_usub(rem, rem, D)) { goto end; }
|
||||
}
|
||||
/* CAN IMPROVE (and have now :=) */
|
||||
if(!BN_rshift1(D, D)) { goto end; }
|
||||
}
|
||||
rem->neg = BN_is_zero(rem) ? 0 : m->neg;
|
||||
dv->neg = m->neg ^ d->neg;
|
||||
ret = 1;
|
||||
end:
|
||||
BN_CTX_end(ctx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC) && !defined(BN_DIV3W)
|
||||
# if defined(__GNUC__) && __GNUC__>=2
|
||||
# if defined(__i386) || defined (__i386__)
|
||||
/*
|
||||
* There were two reasons for implementing this template:
|
||||
* - GNU C generates a call to a function (__udivdi3 to be exact)
|
||||
* in reply to ((((BN_ULLONG)n0)<<BN_BITS2)|n1)/d0 (I fail to
|
||||
* understand why...);
|
||||
* - divl doesn't only calculate quotient, but also leaves
|
||||
* remainder in %edx which we can definitely use here:-)
|
||||
*
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
# define bn_div_words(n0,n1,d0) \
|
||||
({ __asm__ volatile ( \
|
||||
"divl %4" \
|
||||
: "=a"(q), "=d"(rem) \
|
||||
: "a"(n1), "d"(n0), "g"(d0) \
|
||||
: "cc"); \
|
||||
q; \
|
||||
})
|
||||
# define REMAINDER_IS_ALREADY_CALCULATED
|
||||
# endif /* __<cpu> */
|
||||
# endif /* __GNUC__ */
|
||||
#endif /* NO_ASM */
|
||||
|
||||
int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
|
||||
BN_CTX *ctx)
|
||||
{
|
||||
int norm_shift, i, j, loop;
|
||||
BIGNUM *tmp, wnum, *snum, *sdiv, *res;
|
||||
BN_ULONG *resp, *wnump;
|
||||
BN_ULONG d0, d1;
|
||||
int num_n, div_n;
|
||||
|
||||
bn_check_top(num);
|
||||
bn_check_top(divisor);
|
||||
|
||||
if(BN_is_zero(divisor))
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if(BN_ucmp(num, divisor) < 0)
|
||||
{
|
||||
if(rm != NULL)
|
||||
{
|
||||
if(BN_copy(rm, num) == NULL) { return (0); }
|
||||
}
|
||||
if(dv != NULL) { BN_zero(dv); }
|
||||
return (1);
|
||||
}
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
tmp = BN_CTX_get(ctx);
|
||||
snum = BN_CTX_get(ctx);
|
||||
sdiv = BN_CTX_get(ctx);
|
||||
if(dv == NULL)
|
||||
{ res = BN_CTX_get(ctx); }
|
||||
else { res = dv; }
|
||||
if(sdiv == NULL || res == NULL) { goto err; }
|
||||
tmp->neg = 0;
|
||||
|
||||
/* First we normalise the numbers */
|
||||
norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
|
||||
BN_lshift(sdiv, divisor, norm_shift);
|
||||
sdiv->neg = 0;
|
||||
norm_shift += BN_BITS2;
|
||||
BN_lshift(snum, num, norm_shift);
|
||||
snum->neg = 0;
|
||||
div_n = sdiv->top;
|
||||
num_n = snum->top;
|
||||
loop = num_n - div_n;
|
||||
|
||||
/* Lets setup a 'window' into snum
|
||||
* This is the part that corresponds to the current
|
||||
* 'area' being divided */
|
||||
BN_init(&wnum);
|
||||
wnum.d = &(snum->d[loop]);
|
||||
wnum.top = div_n;
|
||||
wnum.dmax = snum->dmax + 1; /* a bit of a lie */
|
||||
|
||||
/* Get the top 2 words of sdiv */
|
||||
/* i=sdiv->top; */
|
||||
d0 = sdiv->d[div_n - 1];
|
||||
d1 = (div_n == 1) ? 0 : sdiv->d[div_n - 2];
|
||||
|
||||
/* pointer to the 'top' of snum */
|
||||
wnump = &(snum->d[num_n - 1]);
|
||||
|
||||
/* Setup to 'res' */
|
||||
res->neg = (num->neg ^ divisor->neg);
|
||||
if(!bn_wexpand(res, (loop + 1))) { goto err; }
|
||||
res->top = loop;
|
||||
resp = &(res->d[loop - 1]);
|
||||
|
||||
/* space for temp */
|
||||
if(!bn_wexpand(tmp, (div_n + 1))) { goto err; }
|
||||
|
||||
if(BN_ucmp(&wnum, sdiv) >= 0)
|
||||
{
|
||||
if(!BN_usub(&wnum, &wnum, sdiv)) { goto err; }
|
||||
*resp = 1;
|
||||
res->d[res->top - 1] = 1;
|
||||
}
|
||||
else
|
||||
{ res->top--; }
|
||||
resp--;
|
||||
|
||||
for(i = 0; i < loop - 1; i++)
|
||||
{
|
||||
BN_ULONG q, l0;
|
||||
#if defined(BN_DIV3W) && !defined(NO_ASM)
|
||||
BN_ULONG bn_div_3_words(BN_ULONG *, BN_ULONG, BN_ULONG);
|
||||
q = bn_div_3_words(wnump, d1, d0);
|
||||
#else
|
||||
BN_ULONG n0, n1, rem = 0;
|
||||
|
||||
n0 = wnump[0];
|
||||
n1 = wnump[-1];
|
||||
if(n0 == d0)
|
||||
{ q = BN_MASK2; }
|
||||
else /* n0 < d0 */
|
||||
{
|
||||
#ifdef BN_LLONG
|
||||
BN_ULLONG t2;
|
||||
|
||||
#if defined(BN_LLONG) && defined(BN_DIV2W) && !defined(bn_div_words)
|
||||
q = (BN_ULONG)(((((BN_ULLONG)n0) << BN_BITS2) | n1) / d0);
|
||||
#else
|
||||
q = bn_div_words(n0, n1, d0);
|
||||
#endif
|
||||
|
||||
#ifndef REMAINDER_IS_ALREADY_CALCULATED
|
||||
/*
|
||||
* rem doesn't have to be BN_ULLONG. The least we
|
||||
* know it's less that d0, isn't it?
|
||||
*/
|
||||
rem = (n1 - q * d0)&BN_MASK2;
|
||||
#endif
|
||||
t2 = (BN_ULLONG)d1 * q;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(t2 <= ((((BN_ULLONG)rem) << BN_BITS2) | wnump[-2]))
|
||||
{ break; }
|
||||
q--;
|
||||
rem += d0;
|
||||
if(rem < d0) { break; } /* don't let rem overflow */
|
||||
t2 -= d1;
|
||||
}
|
||||
#else /* !BN_LLONG */
|
||||
BN_ULONG t2l, t2h, ql, qh;
|
||||
|
||||
q = bn_div_words(n0, n1, d0);
|
||||
#ifndef REMAINDER_IS_ALREADY_CALCULATED
|
||||
rem = (n1 - q * d0)&BN_MASK2;
|
||||
#endif
|
||||
|
||||
#ifdef BN_UMULT_HIGH
|
||||
t2l = d1 * q;
|
||||
t2h = BN_UMULT_HIGH(d1, q);
|
||||
#else
|
||||
t2l = LBITS(d1);
|
||||
t2h = HBITS(d1);
|
||||
ql = LBITS(q);
|
||||
qh = HBITS(q);
|
||||
mul64(t2l, t2h, ql, qh); /* t2=(BN_ULLONG)d1*q; */
|
||||
#endif
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if((t2h < rem) ||
|
||||
((t2h == rem) && (t2l <= wnump[-2])))
|
||||
{ break; }
|
||||
q--;
|
||||
rem += d0;
|
||||
if(rem < d0) { break; } /* don't let rem overflow */
|
||||
if(t2l < d1) { t2h--; }
|
||||
t2l -= d1;
|
||||
}
|
||||
#endif /* !BN_LLONG */
|
||||
}
|
||||
#endif /* !BN_DIV3W */
|
||||
|
||||
l0 = bn_mul_words(tmp->d, sdiv->d, div_n, q);
|
||||
wnum.d--;
|
||||
wnum.top++;
|
||||
tmp->d[div_n] = l0;
|
||||
for(j = div_n + 1; j > 0; j--)
|
||||
if(tmp->d[j - 1]) { break; }
|
||||
tmp->top = j;
|
||||
|
||||
j = wnum.top;
|
||||
BN_sub(&wnum, &wnum, tmp);
|
||||
|
||||
snum->top = snum->top + wnum.top - j;
|
||||
|
||||
if(wnum.neg)
|
||||
{
|
||||
q--;
|
||||
j = wnum.top;
|
||||
BN_add(&wnum, &wnum, sdiv);
|
||||
snum->top += wnum.top - j;
|
||||
}
|
||||
*(resp--) = q;
|
||||
wnump--;
|
||||
}
|
||||
if(rm != NULL)
|
||||
{
|
||||
BN_rshift(rm, snum, norm_shift);
|
||||
rm->neg = num->neg;
|
||||
}
|
||||
BN_CTX_end(ctx);
|
||||
return (1);
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* rem != m */
|
||||
int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
|
||||
{
|
||||
#if 0 /* The old slow way */
|
||||
int i, nm, nd;
|
||||
BIGNUM *dv;
|
||||
|
||||
if(BN_ucmp(m, d) < 0)
|
||||
{ return ((BN_copy(rem, m) == NULL) ? 0 : 1); }
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
dv = BN_CTX_get(ctx);
|
||||
|
||||
if(!BN_copy(rem, m)) { goto err; }
|
||||
|
||||
nm = BN_num_bits(rem);
|
||||
nd = BN_num_bits(d);
|
||||
if(!BN_lshift(dv, d, nm - nd)) { goto err; }
|
||||
for(i = nm - nd; i >= 0; i--)
|
||||
{
|
||||
if(BN_cmp(rem, dv) >= 0)
|
||||
{
|
||||
if(!BN_sub(rem, rem, dv)) { goto err; }
|
||||
}
|
||||
if(!BN_rshift1(dv, dv)) { goto err; }
|
||||
}
|
||||
BN_CTX_end(ctx);
|
||||
return (1);
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return (0);
|
||||
#else
|
||||
return (BN_div(NULL, rem, m, d, ctx));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
529
cscrypt/bn_exp.c
Normal file
529
cscrypt/bn_exp.c
Normal file
|
|
@ -0,0 +1,529 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_exp.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "bn_lcl.h"
|
||||
|
||||
#define TABLE_SIZE 32
|
||||
|
||||
/* slow but works */
|
||||
int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *t;
|
||||
int r = 0;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
bn_check_top(m);
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
if((t = BN_CTX_get(ctx)) == NULL) { goto err; }
|
||||
if(a == b)
|
||||
{
|
||||
if(!BN_sqr(t, a, ctx)) { goto err; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!BN_mul(t, a, b, ctx)) { goto err; }
|
||||
}
|
||||
if(!BN_mod(ret, t, m, ctx)) { goto err; }
|
||||
r = 1;
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return (r);
|
||||
}
|
||||
|
||||
|
||||
int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
|
||||
BN_CTX *ctx)
|
||||
{
|
||||
int ret;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(p);
|
||||
bn_check_top(m);
|
||||
|
||||
ret = BN_mod_exp_simple(r, a, p, m, ctx);
|
||||
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* The old fallback, simple version :-) */
|
||||
int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
|
||||
BN_CTX *ctx)
|
||||
{
|
||||
int i, j = 0, bits, ret = 0, wstart = 0, wend = 0, window, wvalue = 0, ts = 0;
|
||||
int start = 1;
|
||||
BIGNUM *d;
|
||||
BIGNUM val[TABLE_SIZE];
|
||||
|
||||
bits = BN_num_bits(p);
|
||||
|
||||
if(bits == 0)
|
||||
{
|
||||
BN_one(r);
|
||||
return (1);
|
||||
}
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
if((d = BN_CTX_get(ctx)) == NULL) { goto err; }
|
||||
|
||||
BN_init(&(val[0]));
|
||||
ts = 1;
|
||||
if(!BN_mod(&(val[0]), a, m, ctx)) { goto err; } /* 1 */
|
||||
|
||||
window = BN_window_bits_for_exponent_size(bits);
|
||||
if(window > 1)
|
||||
{
|
||||
if(!BN_mod_mul(d, &(val[0]), &(val[0]), m, ctx))
|
||||
{ goto err; } /* 2 */
|
||||
j = 1 << (window - 1);
|
||||
for(i = 1; i < j; i++)
|
||||
{
|
||||
BN_init(&(val[i]));
|
||||
if(!BN_mod_mul(&(val[i]), &(val[i - 1]), d, m, ctx))
|
||||
{ goto err; }
|
||||
}
|
||||
ts = i;
|
||||
}
|
||||
|
||||
start = 1; /* This is used to avoid multiplication etc
|
||||
* when there is only the value '1' in the
|
||||
* buffer. */
|
||||
wstart = bits - 1; /* The top bit of the window */
|
||||
|
||||
if(!BN_one(r)) { goto err; }
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(BN_is_bit_set(p, wstart) == 0)
|
||||
{
|
||||
if(!start)
|
||||
if(!BN_mod_mul(r, r, r, m, ctx))
|
||||
{ goto err; }
|
||||
if(wstart == 0) { break; }
|
||||
wstart--;
|
||||
continue;
|
||||
}
|
||||
/* We now have wstart on a 'set' bit, we now need to work out
|
||||
* how bit a window to do. To do this we need to scan
|
||||
* forward until the last set bit before the end of the
|
||||
* window */
|
||||
j = wstart;
|
||||
wvalue = 1;
|
||||
wend = 0;
|
||||
for(i = 1; i < window; i++)
|
||||
{
|
||||
if(wstart - i < 0) { break; }
|
||||
if(BN_is_bit_set(p, wstart - i))
|
||||
{
|
||||
wvalue <<= (i - wend);
|
||||
wvalue |= 1;
|
||||
wend = i;
|
||||
}
|
||||
}
|
||||
|
||||
/* wend is the size of the current window */
|
||||
j = wend + 1;
|
||||
/* add the 'bytes above' */
|
||||
if(!start)
|
||||
for(i = 0; i < j; i++)
|
||||
{
|
||||
if(!BN_mod_mul(r, r, r, m, ctx))
|
||||
{ goto err; }
|
||||
}
|
||||
|
||||
/* wvalue will be an odd number < 2^window */
|
||||
if(!BN_mod_mul(r, r, &(val[wvalue >> 1]), m, ctx))
|
||||
{ goto err; }
|
||||
|
||||
/* move the 'window' down further */
|
||||
wstart -= wend + 1;
|
||||
wvalue = 0;
|
||||
start = 0;
|
||||
if(wstart < 0) { break; }
|
||||
}
|
||||
ret = 1;
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
for(i = 0; i < ts; i++)
|
||||
{ BN_clear_free(&(val[i])); }
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
|
||||
{
|
||||
/* like BN_mod, but returns non-negative remainder
|
||||
* (i.e., 0 <= r < |d| always holds)
|
||||
*/
|
||||
|
||||
if (!(BN_mod(r, m, d, ctx)))
|
||||
return 0;
|
||||
if (!r->neg)
|
||||
return 1;
|
||||
/* now -|d| < r < 0, so we have to set r : = r + |d| */
|
||||
return (d->neg ? BN_sub : BN_add)(r, r, d);
|
||||
}
|
||||
|
||||
/* solves ax == 1 (mod n) */
|
||||
BIGNUM *
|
||||
BN_mod_inverse(BIGNUM *ret, BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *A, *B, *X, *Y, *M, *D, *T = NULL;
|
||||
int sign;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(n);
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
A = BN_CTX_get(ctx);
|
||||
B = BN_CTX_get(ctx);
|
||||
X = BN_CTX_get(ctx);
|
||||
D = BN_CTX_get(ctx);
|
||||
M = BN_CTX_get(ctx);
|
||||
Y = BN_CTX_get(ctx);
|
||||
T = BN_CTX_get(ctx);
|
||||
if (T == NULL) goto err;
|
||||
|
||||
if (ret == NULL) goto err;
|
||||
|
||||
BN_one(X);
|
||||
BN_zero(Y);
|
||||
if (BN_copy(B, a) == NULL) goto err;
|
||||
if (BN_copy(A, n) == NULL) goto err;
|
||||
A->neg = 0;
|
||||
if (B->neg || (BN_ucmp(B, A) >= 0)) {
|
||||
if (!BN_nnmod(B, B, A, ctx)) goto err;
|
||||
}
|
||||
sign = -1;
|
||||
/* From B = a mod |n|, A = |n| it follows that
|
||||
*
|
||||
* 0 <= B < A,
|
||||
* -sign*X*a == B (mod |n|),
|
||||
* sign*Y*a == A (mod |n|).
|
||||
*/
|
||||
|
||||
if (BN_is_odd(n) && (BN_num_bits(n) <= (BN_BITS <= 32 ? 450 : 2048))) {
|
||||
/* Binary inversion algorithm; requires odd modulus.
|
||||
* This is faster than the general algorithm if the modulus
|
||||
* is sufficiently small (about 400 .. 500 bits on 32-bit
|
||||
* sytems, but much more on 64-bit systems)
|
||||
*/
|
||||
int shift;
|
||||
|
||||
while (!BN_is_zero(B)) {
|
||||
/*
|
||||
* 0 < B < |n|,
|
||||
* 0 < A <= |n|,
|
||||
* (1) -sign*X*a == B (mod |n|),
|
||||
* (2) sign*Y*a == A (mod |n|)
|
||||
*/
|
||||
|
||||
/* Now divide B by the maximum possible power of two in the integers,
|
||||
* and divide X by the same value mod |n|.
|
||||
* When we're done, (1) still holds.
|
||||
*/
|
||||
shift = 0;
|
||||
while (!BN_is_bit_set(B, shift)) /* note that 0 < B */ {
|
||||
shift++;
|
||||
|
||||
if (BN_is_odd(X)) {
|
||||
if (!BN_uadd(X, X, n)) goto err;
|
||||
}
|
||||
/* now X is even, so we can easily divide it by two */
|
||||
if (!BN_rshift1(X, X)) goto err;
|
||||
}
|
||||
if (shift > 0) {
|
||||
if (!BN_rshift(B, B, shift)) goto err;
|
||||
}
|
||||
|
||||
|
||||
/* Same for A and Y. Afterwards, (2) still holds. */
|
||||
shift = 0;
|
||||
while (!BN_is_bit_set(A, shift)) /* note that 0 < A */ {
|
||||
shift++;
|
||||
|
||||
if (BN_is_odd(Y)) {
|
||||
if (!BN_uadd(Y, Y, n)) goto err;
|
||||
}
|
||||
/* now Y is even */
|
||||
if (!BN_rshift1(Y, Y)) goto err;
|
||||
}
|
||||
if (shift > 0) {
|
||||
if (!BN_rshift(A, A, shift)) goto err;
|
||||
}
|
||||
|
||||
/* We still have (1) and (2).
|
||||
* Both A and B are odd.
|
||||
* The following computations ensure that
|
||||
*
|
||||
* 0 <= B < |n|,
|
||||
* 0 < A < |n|,
|
||||
* (1) -sign*X*a == B (mod |n|),
|
||||
* (2) sign*Y*a == A (mod |n|),
|
||||
*
|
||||
* and that either A or B is even in the next iteration.
|
||||
*/
|
||||
if (BN_ucmp(B, A) >= 0) {
|
||||
/* -sign*(X + Y)*a == B - A (mod |n|) */
|
||||
if (!BN_uadd(X, X, Y)) goto err;
|
||||
/* NB: we could use BN_mod_add_quick(X, X, Y, n), but that
|
||||
* actually makes the algorithm slower
|
||||
*/
|
||||
if (!BN_usub(B, B, A)) goto err;
|
||||
} else {
|
||||
/* sign*(X + Y)*a == A - B (mod |n|) */
|
||||
if (!BN_uadd(Y, Y, X)) goto err;
|
||||
/* as above, BN_mod_add_quick(Y, Y, X, n) would slow things down */
|
||||
if (!BN_usub(A, A, B)) goto err;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* general inversion algorithm */
|
||||
|
||||
while (!BN_is_zero(B)) {
|
||||
BIGNUM *tmp;
|
||||
|
||||
/*
|
||||
* 0 < B < A,
|
||||
* (*) -sign*X*a == B (mod |n|),
|
||||
* sign*Y*a == A (mod |n|)
|
||||
*/
|
||||
|
||||
/* (D, M) : = (A/B, A%B) ... */
|
||||
if (BN_num_bits(A) == BN_num_bits(B)) {
|
||||
if (!BN_one(D)) goto err;
|
||||
if (!BN_sub(M, A, B)) goto err;
|
||||
} else if (BN_num_bits(A) == BN_num_bits(B) + 1) {
|
||||
/* A/B is 1, 2, or 3 */
|
||||
if (!BN_lshift1(T, B)) goto err;
|
||||
if (BN_ucmp(A, T) < 0) {
|
||||
/* A < 2*B, so D = 1 */
|
||||
if (!BN_one(D)) goto err;
|
||||
if (!BN_sub(M, A, B)) goto err;
|
||||
} else {
|
||||
/* A >= 2*B, so D = 2 or D = 3 */
|
||||
if (!BN_sub(M, A, T)) goto err;
|
||||
if (!BN_add(D, T, B)) goto err;
|
||||
/* use D ( := 3 * B) as temp */
|
||||
if (BN_ucmp(A, D) < 0) {
|
||||
/* A < 3*B, so D = 2 */
|
||||
if (!BN_set_word(D, 2)) goto err;
|
||||
/* M ( = A - 2*B) already has the correct value */
|
||||
} else {
|
||||
/* only D = 3 remains */
|
||||
if (!BN_set_word(D, 3)) goto err;
|
||||
/* currently M = A - 2 * B,
|
||||
* but we need M = A - 3 * B
|
||||
*/
|
||||
if (!BN_sub(M, M, B)) goto err;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!BN_div(D, M, A, B, ctx)) goto err;
|
||||
}
|
||||
|
||||
/* Now
|
||||
* A = D*B + M;
|
||||
* thus we have
|
||||
* (**) sign*Y*a == D*B + M (mod |n|).
|
||||
*/
|
||||
|
||||
tmp = A; /* keep the BIGNUM object, the value does not matter */
|
||||
|
||||
/* (A, B) : = (B, A mod B) ... */
|
||||
A = B;
|
||||
B = M;
|
||||
/* ... so we have 0 <= B < A again */
|
||||
|
||||
/* Since the former M is now B and the former B is now A,
|
||||
* (**) translates into
|
||||
* sign*Y*a == D*A + B (mod |n|),
|
||||
* i.e.
|
||||
* sign*Y*a - D*A == B (mod |n|).
|
||||
* Similarly, (*) translates into
|
||||
* -sign*X*a == A (mod |n|).
|
||||
*
|
||||
* Thus,
|
||||
* sign*Y*a + D*sign*X*a == B (mod |n|),
|
||||
* i.e.
|
||||
* sign*(Y + D*X)*a == B (mod |n|).
|
||||
*
|
||||
* So if we set (X, Y, sign) : = (Y + D*X, X, -sign), we arrive back at
|
||||
* -sign*X*a == B (mod |n|),
|
||||
* sign*Y*a == A (mod |n|).
|
||||
* Note that X and Y stay non-negative all the time.
|
||||
*/
|
||||
|
||||
/* most of the time D is very small, so we can optimize tmp : = D*X+Y */
|
||||
if (BN_is_one(D)) {
|
||||
if (!BN_add(tmp, X, Y)) goto err;
|
||||
} else {
|
||||
if (BN_is_word(D, 2)) {
|
||||
if (!BN_lshift1(tmp, X)) goto err;
|
||||
} else if (BN_is_word(D, 4)) {
|
||||
if (!BN_lshift(tmp, X, 2)) goto err;
|
||||
} else if (D->top == 1) {
|
||||
if (!BN_copy(tmp, X)) goto err;
|
||||
if (!BN_mul_word(tmp, D->d[0])) goto err;
|
||||
} else {
|
||||
if (!BN_mul(tmp, D, X, ctx)) goto err;
|
||||
}
|
||||
if (!BN_add(tmp, tmp, Y)) goto err;
|
||||
}
|
||||
|
||||
M = Y; /* keep the BIGNUM object, the value does not matter */
|
||||
Y = X;
|
||||
X = tmp;
|
||||
sign = -sign;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The while loop (Euclid's algorithm) ends when
|
||||
* A == gcd(a, n);
|
||||
* we have
|
||||
* sign*Y*a == A (mod |n|),
|
||||
* where Y is non-negative.
|
||||
*/
|
||||
|
||||
if (sign < 0) {
|
||||
if (!BN_sub(Y, n, Y)) goto err;
|
||||
}
|
||||
/* Now Y*a == A (mod |n|). */
|
||||
|
||||
|
||||
if (BN_is_one(A)) {
|
||||
/* Y*a == 1 (mod |n|) */
|
||||
if (!Y->neg && BN_ucmp(Y, n) < 0) {
|
||||
if (!BN_copy(ret, Y)) goto err;
|
||||
} else {
|
||||
if (!BN_nnmod(ret, Y, n, ctx)) goto err;
|
||||
}
|
||||
} else {
|
||||
goto err;
|
||||
}
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
419
cscrypt/bn_lcl.h
Normal file
419
cscrypt/bn_lcl.h
Normal file
|
|
@ -0,0 +1,419 @@
|
|||
/* crypto/bn/bn_lcl.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BN_LCL_H
|
||||
#define HEADER_BN_LCL_H
|
||||
|
||||
#include "bn.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* BN_window_bits_for_exponent_size -- macro for sliding window mod_exp functions
|
||||
*
|
||||
*
|
||||
* For window size 'w' (w >= 2) and a random 'b' bits exponent,
|
||||
* the number of multiplications is a constant plus on average
|
||||
*
|
||||
* 2^(w-1) + (b-w)/(w+1);
|
||||
*
|
||||
* here 2^(w-1) is for precomputing the table (we actually need
|
||||
* entries only for windows that have the lowest bit set), and
|
||||
* (b-w)/(w+1) is an approximation for the expected number of
|
||||
* w-bit windows, not counting the first one.
|
||||
*
|
||||
* Thus we should use
|
||||
*
|
||||
* w >= 6 if b > 671
|
||||
* w = 5 if 671 > b > 239
|
||||
* w = 4 if 239 > b > 79
|
||||
* w = 3 if 79 > b > 23
|
||||
* w <= 2 if 23 > b
|
||||
*
|
||||
* (with draws in between). Very small exponents are often selected
|
||||
* with low Hamming weight, so we use w = 1 for b <= 23.
|
||||
*/
|
||||
#if 1
|
||||
#define BN_window_bits_for_exponent_size(b) \
|
||||
((b) > 671 ? 6 : \
|
||||
(b) > 239 ? 5 : \
|
||||
(b) > 79 ? 4 : \
|
||||
(b) > 23 ? 3 : 1)
|
||||
#else
|
||||
/* Old SSLeay/OpenSSL table.
|
||||
* Maximum window size was 5, so this table differs for b==1024;
|
||||
* but it coincides for other interesting values (b==160, b==512).
|
||||
*/
|
||||
#define BN_window_bits_for_exponent_size(b) \
|
||||
((b) > 255 ? 5 : \
|
||||
(b) > 127 ? 4 : \
|
||||
(b) > 17 ? 3 : 1)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Pentium pro 16,16,16,32,64 */
|
||||
/* Alpha 16,16,16,16.64 */
|
||||
#define BN_MULL_SIZE_NORMAL (16) /* 32 */
|
||||
#define BN_MUL_RECURSIVE_SIZE_NORMAL (16) /* 32 less than */
|
||||
#define BN_SQR_RECURSIVE_SIZE_NORMAL (16) /* 32 */
|
||||
#define BN_MUL_LOW_RECURSIVE_SIZE_NORMAL (32) /* 32 */
|
||||
#define BN_MONT_CTX_SET_SIZE_WORD (64) /* 32 */
|
||||
|
||||
#if !defined(NO_ASM) && !defined(NO_INLINE_ASM) && !defined(PEDANTIC)
|
||||
/*
|
||||
* BN_UMULT_HIGH section.
|
||||
*
|
||||
* No, I'm not trying to overwhelm you when stating that the
|
||||
* product of N-bit numbers is 2*N bits wide:-) No, I don't expect
|
||||
* you to be impressed when I say that if the compiler doesn't
|
||||
* support 2*N integer type, then you have to replace every N*N
|
||||
* multiplication with 4 (N/2)*(N/2) accompanied by some shifts
|
||||
* and additions which unavoidably results in severe performance
|
||||
* penalties. Of course provided that the hardware is capable of
|
||||
* producing 2*N result... That's when you normally start
|
||||
* considering assembler implementation. However! It should be
|
||||
* pointed out that some CPUs (most notably Alpha, PowerPC and
|
||||
* upcoming IA-64 family:-) provide *separate* instruction
|
||||
* calculating the upper half of the product placing the result
|
||||
* into a general purpose register. Now *if* the compiler supports
|
||||
* inline assembler, then it's not impossible to implement the
|
||||
* "bignum" routines (and have the compiler optimize 'em)
|
||||
* exhibiting "native" performance in C. That's what BN_UMULT_HIGH
|
||||
* macro is about:-)
|
||||
*
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
# if defined(__alpha) && (defined(SIXTY_FOUR_BIT_LONG) || defined(SIXTY_FOUR_BIT))
|
||||
# if defined(__DECC)
|
||||
# include <c_asm.h>
|
||||
# define BN_UMULT_HIGH(a,b) (BN_ULONG)asm("umulh %a0,%a1,%v0",(a),(b))
|
||||
# elif defined(__GNUC__)
|
||||
# define BN_UMULT_HIGH(a,b) ({ \
|
||||
register BN_ULONG ret; \
|
||||
__asm__ ("umulh %1,%2,%0" \
|
||||
: "=r"(ret) \
|
||||
: "r"(a), "r"(b)); \
|
||||
ret; })
|
||||
# endif /* compiler */
|
||||
# elif defined(_ARCH_PPC) && defined(__64BIT__) && defined(SIXTY_FOUR_BIT_LONG)
|
||||
# if defined(__GNUC__)
|
||||
# define BN_UMULT_HIGH(a,b) ({ \
|
||||
register BN_ULONG ret; \
|
||||
__asm__ ("mulhdu %0,%1,%2" \
|
||||
: "=r"(ret) \
|
||||
: "r"(a), "r"(b)); \
|
||||
ret; })
|
||||
# endif /* compiler */
|
||||
# endif /* cpu */
|
||||
#endif /* NO_ASM */
|
||||
|
||||
/*************************************************************
|
||||
* Using the long long type
|
||||
*/
|
||||
#define Lw(t) (((BN_ULONG)(t))&BN_MASK2)
|
||||
#define Hw(t) (((BN_ULONG)((t)>>BN_BITS2))&BN_MASK2)
|
||||
|
||||
/* This is used for internal error checking and is not normally used */
|
||||
#ifdef BN_DEBUG
|
||||
# include <assert.h>
|
||||
# define bn_check_top(a) assert ((a)->top >= 0 && (a)->top <= (a)->dmax);
|
||||
#else
|
||||
# define bn_check_top(a)
|
||||
#endif
|
||||
|
||||
/* This macro is to add extra stuff for development checking */
|
||||
#ifdef BN_DEBUG
|
||||
#define bn_set_max(r) ((r)->max=(r)->top,BN_set_flags((r),BN_FLG_STATIC_DATA))
|
||||
#else
|
||||
#define bn_set_max(r)
|
||||
#endif
|
||||
|
||||
/* These macros are used to 'take' a section of a bignum for read only use */
|
||||
#define bn_set_low(r,a,n) \
|
||||
{ \
|
||||
(r)->top=((a)->top > (n))?(n):(a)->top; \
|
||||
(r)->d=(a)->d; \
|
||||
(r)->neg=(a)->neg; \
|
||||
(r)->flags|=BN_FLG_STATIC_DATA; \
|
||||
bn_set_max(r); \
|
||||
}
|
||||
|
||||
#define bn_set_high(r,a,n) \
|
||||
{ \
|
||||
if ((a)->top > (n)) \
|
||||
{ \
|
||||
(r)->top=(a)->top-n; \
|
||||
(r)->d= &((a)->d[n]); \
|
||||
} \
|
||||
else \
|
||||
(r)->top=0; \
|
||||
(r)->neg=(a)->neg; \
|
||||
(r)->flags|=BN_FLG_STATIC_DATA; \
|
||||
bn_set_max(r); \
|
||||
}
|
||||
|
||||
#ifdef BN_LLONG
|
||||
#define mul_add(r,a,w,c) { \
|
||||
BN_ULLONG t; \
|
||||
t=(BN_ULLONG)w * (a) + (r) + (c); \
|
||||
(r)= Lw(t); \
|
||||
(c)= Hw(t); \
|
||||
}
|
||||
|
||||
#define mul(r,a,w,c) { \
|
||||
BN_ULLONG t; \
|
||||
t=(BN_ULLONG)w * (a) + (c); \
|
||||
(r)= Lw(t); \
|
||||
(c)= Hw(t); \
|
||||
}
|
||||
|
||||
#define sqr(r0,r1,a) { \
|
||||
BN_ULLONG t; \
|
||||
t=(BN_ULLONG)(a)*(a); \
|
||||
(r0)=Lw(t); \
|
||||
(r1)=Hw(t); \
|
||||
}
|
||||
|
||||
#elif defined(BN_UMULT_HIGH)
|
||||
#define mul_add(r,a,w,c) { \
|
||||
BN_ULONG high,low,ret,tmp=(a); \
|
||||
ret = (r); \
|
||||
high= BN_UMULT_HIGH(w,tmp); \
|
||||
ret += (c); \
|
||||
low = (w) * tmp; \
|
||||
(c) = (ret<(c))?1:0; \
|
||||
(c) += high; \
|
||||
ret += low; \
|
||||
(c) += (ret<low)?1:0; \
|
||||
(r) = ret; \
|
||||
}
|
||||
|
||||
#define mul(r,a,w,c) { \
|
||||
BN_ULONG high,low,ret,ta=(a); \
|
||||
low = (w) * ta; \
|
||||
high= BN_UMULT_HIGH(w,ta); \
|
||||
ret = low + (c); \
|
||||
(c) = high; \
|
||||
(c) += (ret<low)?1:0; \
|
||||
(r) = ret; \
|
||||
}
|
||||
|
||||
#define sqr(r0,r1,a) { \
|
||||
BN_ULONG tmp=(a); \
|
||||
(r0) = tmp * tmp; \
|
||||
(r1) = BN_UMULT_HIGH(tmp,tmp); \
|
||||
}
|
||||
|
||||
#else
|
||||
/*************************************************************
|
||||
* No long long type
|
||||
*/
|
||||
|
||||
#define LBITS(a) ((a)&BN_MASK2l)
|
||||
#define HBITS(a) (((a)>>BN_BITS4)&BN_MASK2l)
|
||||
#define L2HBITS(a) ((BN_ULONG)((a)&BN_MASK2l)<<BN_BITS4)
|
||||
|
||||
#define LLBITS(a) ((a)&BN_MASKl)
|
||||
#define LHBITS(a) (((a)>>BN_BITS2)&BN_MASKl)
|
||||
#define LL2HBITS(a) ((BN_ULLONG)((a)&BN_MASKl)<<BN_BITS2)
|
||||
|
||||
#define mul64(l,h,bl,bh) \
|
||||
{ \
|
||||
BN_ULONG m,m1,lt,ht; \
|
||||
\
|
||||
lt=l; \
|
||||
ht=h; \
|
||||
m =(bh)*(lt); \
|
||||
lt=(bl)*(lt); \
|
||||
m1=(bl)*(ht); \
|
||||
ht =(bh)*(ht); \
|
||||
m=(m+m1)&BN_MASK2; if (m < m1) ht+=L2HBITS(1L); \
|
||||
ht+=HBITS(m); \
|
||||
m1=L2HBITS(m); \
|
||||
lt=(lt+m1)&BN_MASK2; if (lt < m1) ht++; \
|
||||
(l)=lt; \
|
||||
(h)=ht; \
|
||||
}
|
||||
|
||||
#define sqr64(lo,ho,in) \
|
||||
{ \
|
||||
BN_ULONG l,h,m; \
|
||||
\
|
||||
h=(in); \
|
||||
l=LBITS(h); \
|
||||
h=HBITS(h); \
|
||||
m =(l)*(h); \
|
||||
l*=l; \
|
||||
h*=h; \
|
||||
h+=(m&BN_MASK2h1)>>(BN_BITS4-1); \
|
||||
m =(m&BN_MASK2l)<<(BN_BITS4+1); \
|
||||
l=(l+m)&BN_MASK2; if (l < m) h++; \
|
||||
(lo)=l; \
|
||||
(ho)=h; \
|
||||
}
|
||||
|
||||
#define mul_add(r,a,bl,bh,c) { \
|
||||
BN_ULONG l,h; \
|
||||
\
|
||||
h= (a); \
|
||||
l=LBITS(h); \
|
||||
h=HBITS(h); \
|
||||
mul64(l,h,(bl),(bh)); \
|
||||
\
|
||||
/* non-multiply part */ \
|
||||
l=(l+(c))&BN_MASK2; if (l < (c)) h++; \
|
||||
(c)=(r); \
|
||||
l=(l+(c))&BN_MASK2; if (l < (c)) h++; \
|
||||
(c)=h&BN_MASK2; \
|
||||
(r)=l; \
|
||||
}
|
||||
|
||||
#define mul(r,a,bl,bh,c) { \
|
||||
BN_ULONG l,h; \
|
||||
\
|
||||
h= (a); \
|
||||
l=LBITS(h); \
|
||||
h=HBITS(h); \
|
||||
mul64(l,h,(bl),(bh)); \
|
||||
\
|
||||
/* non-multiply part */ \
|
||||
l+=(c); if ((l&BN_MASK2) < (c)) h++; \
|
||||
(c)=h&BN_MASK2; \
|
||||
(r)=l&BN_MASK2; \
|
||||
}
|
||||
#endif /* !BN_LLONG */
|
||||
|
||||
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb);
|
||||
void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
|
||||
void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
|
||||
void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp);
|
||||
void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a);
|
||||
void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a);
|
||||
int bn_cmp_words(BN_ULONG *a, BN_ULONG *b, int n);
|
||||
void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, BN_ULONG *t);
|
||||
void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b,
|
||||
int tn, int n, BN_ULONG *t);
|
||||
void bn_sqr_recursive(BN_ULONG *r, BN_ULONG *a, int n2, BN_ULONG *t);
|
||||
void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n);
|
||||
void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
BN_ULONG *t);
|
||||
void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2,
|
||||
BN_ULONG *t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
775
cscrypt/bn_lib.c
Normal file
775
cscrypt/bn_lib.c
Normal file
|
|
@ -0,0 +1,775 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_lib.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#ifndef BN_DEBUG
|
||||
# undef NDEBUG /* avoid conflicting definitions */
|
||||
# define NDEBUG
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include "bn_lcl.h"
|
||||
#include "openssl_mods.h"
|
||||
|
||||
//const char *BN_version="Big Number 42";
|
||||
|
||||
/* For a 32 bit machine
|
||||
* 2 - 4 == 128
|
||||
* 3 - 8 == 256
|
||||
* 4 - 16 == 512
|
||||
* 5 - 32 == 1024
|
||||
* 6 - 64 == 2048
|
||||
* 7 - 128 == 4096
|
||||
* 8 - 256 == 8192
|
||||
*/
|
||||
static int bn_limit_bits = 0;
|
||||
static int bn_limit_num = 8; /* (1<<bn_limit_bits) */
|
||||
static int bn_limit_bits_low = 0;
|
||||
static int bn_limit_num_low = 8; /* (1<<bn_limit_bits_low) */
|
||||
static int bn_limit_bits_high = 0;
|
||||
static int bn_limit_num_high = 8; /* (1<<bn_limit_bits_high) */
|
||||
static int bn_limit_bits_mont = 0;
|
||||
static int bn_limit_num_mont = 8; /* (1<<bn_limit_bits_mont) */
|
||||
|
||||
void BN_set_params(int mult, int high, int low, int mont)
|
||||
{
|
||||
if(mult >= 0)
|
||||
{
|
||||
if(mult > (int)(sizeof(int) * 8) - 1)
|
||||
{ mult = sizeof(int) * 8 - 1; }
|
||||
bn_limit_bits = mult;
|
||||
bn_limit_num = 1 << mult;
|
||||
}
|
||||
if(high >= 0)
|
||||
{
|
||||
if(high > (int)(sizeof(int) * 8) - 1)
|
||||
{ high = sizeof(int) * 8 - 1; }
|
||||
bn_limit_bits_high = high;
|
||||
bn_limit_num_high = 1 << high;
|
||||
}
|
||||
if(low >= 0)
|
||||
{
|
||||
if(low > (int)(sizeof(int) * 8) - 1)
|
||||
{ low = sizeof(int) * 8 - 1; }
|
||||
bn_limit_bits_low = low;
|
||||
bn_limit_num_low = 1 << low;
|
||||
}
|
||||
if(mont >= 0)
|
||||
{
|
||||
if(mont > (int)(sizeof(int) * 8) - 1)
|
||||
{ mont = sizeof(int) * 8 - 1; }
|
||||
bn_limit_bits_mont = mont;
|
||||
bn_limit_num_mont = 1 << mont;
|
||||
}
|
||||
}
|
||||
|
||||
int BN_get_params(int which)
|
||||
{
|
||||
if(which == 0) { return (bn_limit_bits); }
|
||||
else if(which == 1) { return (bn_limit_bits_high); }
|
||||
else if(which == 2) { return (bn_limit_bits_low); }
|
||||
else if(which == 3) { return (bn_limit_bits_mont); }
|
||||
else { return (0); }
|
||||
}
|
||||
|
||||
const BIGNUM *BN_value_one(void)
|
||||
{
|
||||
static const BN_ULONG data_one = 1L;
|
||||
static const BIGNUM const_one = {(BN_ULONG *) &data_one, 1, 1, 0, BN_FLG_STATIC_DATA};
|
||||
|
||||
return (&const_one);
|
||||
}
|
||||
|
||||
char *BN_options(void)
|
||||
{
|
||||
static int init = 0;
|
||||
static char data[16];
|
||||
|
||||
if(!init)
|
||||
{
|
||||
init++;
|
||||
#ifdef BN_LLONG
|
||||
snprintf(data, sizeof(data), "bn(%d,%d)", (int)sizeof(BN_ULLONG) * 8,
|
||||
(int)sizeof(BN_ULONG) * 8);
|
||||
#else
|
||||
snprintf(data, sizeof(data), "bn(%d,%d)", (int)sizeof(BN_ULONG) * 8,
|
||||
(int)sizeof(BN_ULONG) * 8);
|
||||
#endif
|
||||
}
|
||||
return (data);
|
||||
}
|
||||
|
||||
int BN_num_bits_word(BN_ULONG l)
|
||||
{
|
||||
static const char bits[256] =
|
||||
{
|
||||
0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
};
|
||||
|
||||
#if defined(SIXTY_FOUR_BIT_LONG)
|
||||
if(l & 0xffffffff00000000L)
|
||||
{
|
||||
if(l & 0xffff000000000000L)
|
||||
{
|
||||
if(l & 0xff00000000000000L)
|
||||
{
|
||||
return (bits[(int)(l >> 56)] + 56);
|
||||
}
|
||||
else { return (bits[(int)(l >> 48)] + 48); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if(l & 0x0000ff0000000000L)
|
||||
{
|
||||
return (bits[(int)(l >> 40)] + 40);
|
||||
}
|
||||
else { return (bits[(int)(l >> 32)] + 32); }
|
||||
}
|
||||
}
|
||||
else
|
||||
#else
|
||||
#ifdef SIXTY_FOUR_BIT
|
||||
if(l & 0xffffffff00000000LL)
|
||||
{
|
||||
if(l & 0xffff000000000000LL)
|
||||
{
|
||||
if(l & 0xff00000000000000LL)
|
||||
{
|
||||
return (bits[(int)(l >> 56)] + 56);
|
||||
}
|
||||
else { return (bits[(int)(l >> 48)] + 48); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if(l & 0x0000ff0000000000LL)
|
||||
{
|
||||
return (bits[(int)(l >> 40)] + 40);
|
||||
}
|
||||
else { return (bits[(int)(l >> 32)] + 32); }
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
|
||||
if(l & 0xffff0000L)
|
||||
{
|
||||
if(l & 0xff000000L)
|
||||
{ return (bits[(int)(l >> 24L)] + 24); }
|
||||
else { return (bits[(int)(l >> 16L)] + 16); }
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG)
|
||||
if(l & 0xff00L)
|
||||
{ return (bits[(int)(l >> 8)] + 8); }
|
||||
else
|
||||
#endif
|
||||
return (bits[(int)(l)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int BN_num_bits(const BIGNUM *a)
|
||||
{
|
||||
BN_ULONG l;
|
||||
int i;
|
||||
|
||||
bn_check_top(a);
|
||||
|
||||
if(a->top == 0) { return (0); }
|
||||
l = a->d[a->top - 1];
|
||||
assert(l != 0);
|
||||
i = (a->top - 1) * BN_BITS2;
|
||||
return (i + BN_num_bits_word(l));
|
||||
}
|
||||
|
||||
void BN_clear_free(BIGNUM *a)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(a == NULL) { return; }
|
||||
if(a->d != NULL)
|
||||
{
|
||||
memset(a->d, 0, a->dmax * sizeof(a->d[0]));
|
||||
if(!(BN_get_flags(a, BN_FLG_STATIC_DATA)))
|
||||
{ OPENSSL_free(a->d); }
|
||||
}
|
||||
i = BN_get_flags(a, BN_FLG_MALLOCED);
|
||||
memset(a, 0, sizeof(BIGNUM));
|
||||
if(i)
|
||||
{ OPENSSL_free(a); }
|
||||
}
|
||||
|
||||
void BN_free(BIGNUM *a)
|
||||
{
|
||||
if(a == NULL) { return; }
|
||||
if((a->d != NULL) && !(BN_get_flags(a, BN_FLG_STATIC_DATA)))
|
||||
{ OPENSSL_free(a->d); }
|
||||
a->flags |= BN_FLG_FREE; /* REMOVE? */
|
||||
if(a->flags & BN_FLG_MALLOCED)
|
||||
{ OPENSSL_free(a); }
|
||||
}
|
||||
|
||||
void BN_init(BIGNUM *a)
|
||||
{
|
||||
memset(a, 0, sizeof(BIGNUM));
|
||||
}
|
||||
|
||||
BIGNUM *BN_new(void)
|
||||
{
|
||||
BIGNUM *ret;
|
||||
|
||||
if((ret = (BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
ret->flags = BN_FLG_MALLOCED;
|
||||
ret->top = 0;
|
||||
ret->neg = 0;
|
||||
ret->dmax = 0;
|
||||
ret->d = NULL;
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* This is an internal function that should not be used in applications.
|
||||
* It ensures that 'b' has enough room for a 'words' word number number.
|
||||
* It is mostly used by the various BIGNUM routines. If there is an error,
|
||||
* NULL is returned. If not, 'b' is returned. */
|
||||
|
||||
BIGNUM *bn_expand2(BIGNUM *b, int words)
|
||||
{
|
||||
BN_ULONG *A, *a;
|
||||
const BN_ULONG *B;
|
||||
int i;
|
||||
|
||||
bn_check_top(b);
|
||||
|
||||
if(words > b->dmax)
|
||||
{
|
||||
if(words > (INT_MAX / (4 * BN_BITS2)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bn_check_top(b);
|
||||
if(BN_get_flags(b, BN_FLG_STATIC_DATA))
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
a = A = (BN_ULONG *)OPENSSL_malloc(sizeof(BN_ULONG) * (words + 1));
|
||||
if(A == NULL)
|
||||
{
|
||||
return (NULL);
|
||||
}
|
||||
#if 1
|
||||
B = b->d;
|
||||
/* Check if the previous number needs to be copied */
|
||||
if(B != NULL)
|
||||
{
|
||||
#if 0
|
||||
/* This lot is an unrolled loop to copy b->top
|
||||
* BN_ULONGs from B to A
|
||||
*/
|
||||
/*
|
||||
* I have nothing against unrolling but it's usually done for
|
||||
* several reasons, namely:
|
||||
* - minimize percentage of decision making code, i.e. branches;
|
||||
* - avoid cache trashing;
|
||||
* - make it possible to schedule loads earlier;
|
||||
* Now let's examine the code below. The cornerstone of C is
|
||||
* "programmer is always right" and that's what we love it for:-)
|
||||
* For this very reason C compilers have to be paranoid when it
|
||||
* comes to data aliasing and assume the worst. Yeah, but what
|
||||
* does it mean in real life? This means that loop body below will
|
||||
* be compiled to sequence of loads immediately followed by stores
|
||||
* as compiler assumes the worst, something in A==B+1 style. As a
|
||||
* result CPU pipeline is going to starve for incoming data. Secondly
|
||||
* if A and B happen to share same cache line such code is going to
|
||||
* cause severe cache trashing. Both factors have severe impact on
|
||||
* performance of modern CPUs and this is the reason why this
|
||||
* particular piece of code is #ifdefed away and replaced by more
|
||||
* "friendly" version found in #else section below. This comment
|
||||
* also applies to BN_copy function.
|
||||
*
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
for(i = b->top & (~7); i > 0; i -= 8)
|
||||
{
|
||||
A[0] = B[0];
|
||||
A[1] = B[1];
|
||||
A[2] = B[2];
|
||||
A[3] = B[3];
|
||||
A[4] = B[4];
|
||||
A[5] = B[5];
|
||||
A[6] = B[6];
|
||||
A[7] = B[7];
|
||||
A += 8;
|
||||
B += 8;
|
||||
}
|
||||
switch(b->top & 7)
|
||||
{
|
||||
case 7:
|
||||
A[6] = B[6];
|
||||
case 6:
|
||||
A[5] = B[5];
|
||||
case 5:
|
||||
A[4] = B[4];
|
||||
case 4:
|
||||
A[3] = B[3];
|
||||
case 3:
|
||||
A[2] = B[2];
|
||||
case 2:
|
||||
A[1] = B[1];
|
||||
case 1:
|
||||
A[0] = B[0];
|
||||
case 0:
|
||||
/* I need the 'case 0' entry for utrix cc.
|
||||
* If the optimizer is turned on, it does the
|
||||
* switch table by doing
|
||||
* a=top&7
|
||||
* a--;
|
||||
* goto jump_table[a];
|
||||
* If top is 0, this makes us jump to 0xffffffc
|
||||
* which is rather bad :-(.
|
||||
* eric 23-Apr-1998
|
||||
*/
|
||||
;
|
||||
}
|
||||
#else
|
||||
for(i = b->top >> 2; i > 0; i--, A += 4, B += 4)
|
||||
{
|
||||
/*
|
||||
* The fact that the loop is unrolled
|
||||
* 4-wise is a tribute to Intel. It's
|
||||
* the one that doesn't have enough
|
||||
* registers to accomodate more data.
|
||||
* I'd unroll it 8-wise otherwise:-)
|
||||
*
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
BN_ULONG a0, a1, a2, a3;
|
||||
a0 = B[0];
|
||||
a1 = B[1];
|
||||
a2 = B[2];
|
||||
a3 = B[3];
|
||||
A[0] = a0;
|
||||
A[1] = a1;
|
||||
A[2] = a2;
|
||||
A[3] = a3;
|
||||
}
|
||||
switch(b->top & 3)
|
||||
{
|
||||
case 3:
|
||||
A[2] = B[2]; /* fallthrough */
|
||||
case 2:
|
||||
A[1] = B[1]; /* fallthrough */
|
||||
case 1:
|
||||
A[0] = B[0]; /* fallthrough */
|
||||
case 0: ; /* ultrix cc workaround, see above */
|
||||
}
|
||||
#endif
|
||||
OPENSSL_free(b->d);
|
||||
}
|
||||
|
||||
b->d = a;
|
||||
b->dmax = words;
|
||||
|
||||
/* Now need to zero any data between b->top and b->max */
|
||||
|
||||
A = &(b->d[b->top]);
|
||||
for(i = (b->dmax - b->top) >> 3; i > 0; i--, A += 8)
|
||||
{
|
||||
A[0] = 0;
|
||||
A[1] = 0;
|
||||
A[2] = 0;
|
||||
A[3] = 0;
|
||||
A[4] = 0;
|
||||
A[5] = 0;
|
||||
A[6] = 0;
|
||||
A[7] = 0;
|
||||
}
|
||||
for(i = (b->dmax - b->top) & 7; i > 0; i--, A++)
|
||||
{ A[0] = 0; }
|
||||
#else
|
||||
memset(A, 0, sizeof(BN_ULONG) * (words + 1));
|
||||
memcpy(A, b->d, sizeof(b->d[0])*b->top);
|
||||
b->d = a;
|
||||
b->max = words;
|
||||
#endif
|
||||
|
||||
/* memset(&(p[b->max]),0,((words+1)-b->max)*sizeof(BN_ULONG)); */
|
||||
/* { int i; for (i=b->max; i<words+1; i++) p[i]=i;} */
|
||||
|
||||
}
|
||||
return (b);
|
||||
}
|
||||
|
||||
BIGNUM *BN_dup(const BIGNUM *a)
|
||||
{
|
||||
BIGNUM *r;
|
||||
|
||||
if(a == NULL) { return NULL; }
|
||||
|
||||
bn_check_top(a);
|
||||
|
||||
r = BN_new();
|
||||
if(r == NULL) { return (NULL); }
|
||||
return ((BIGNUM *)BN_copy(r, a));
|
||||
}
|
||||
|
||||
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int i;
|
||||
BN_ULONG *A;
|
||||
const BN_ULONG *B;
|
||||
|
||||
bn_check_top(b);
|
||||
|
||||
if(a == b) { return (a); }
|
||||
if(bn_wexpand(a, b->top) == NULL) { return (NULL); }
|
||||
|
||||
#if 1
|
||||
A = a->d;
|
||||
B = b->d;
|
||||
for(i = b->top >> 2; i > 0; i--, A += 4, B += 4)
|
||||
{
|
||||
BN_ULONG a0, a1, a2, a3;
|
||||
a0 = B[0];
|
||||
a1 = B[1];
|
||||
a2 = B[2];
|
||||
a3 = B[3];
|
||||
A[0] = a0;
|
||||
A[1] = a1;
|
||||
A[2] = a2;
|
||||
A[3] = a3;
|
||||
}
|
||||
switch(b->top & 3)
|
||||
{
|
||||
case 3:
|
||||
A[2] = B[2]; /* fallthrough */
|
||||
case 2:
|
||||
A[1] = B[1]; /* fallthrough */
|
||||
case 1:
|
||||
A[0] = B[0]; /* fallthrough */
|
||||
case 0: ; /* ultrix cc workaround, see comments in bn_expand2 */
|
||||
}
|
||||
#else
|
||||
memcpy(a->d, b->d, sizeof(b->d[0])*b->top);
|
||||
#endif
|
||||
|
||||
/* memset(&(a->d[b->top]),0,sizeof(a->d[0])*(a->max-b->top));*/
|
||||
a->top = b->top;
|
||||
if((a->top == 0) && (a->d != NULL))
|
||||
{ a->d[0] = 0; }
|
||||
a->neg = b->neg;
|
||||
return (a);
|
||||
}
|
||||
|
||||
void BN_clear(BIGNUM *a)
|
||||
{
|
||||
if(a->d != NULL)
|
||||
{ memset(a->d, 0, a->dmax * sizeof(a->d[0])); }
|
||||
a->top = 0;
|
||||
a->neg = 0;
|
||||
}
|
||||
|
||||
BN_ULONG BN_get_word(const BIGNUM *a)
|
||||
{
|
||||
if(a->top > 1)
|
||||
{ return BN_MASK2; }
|
||||
else if(a->top == 1)
|
||||
{ return a->d[0]; }
|
||||
/* a->top == 0 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BN_set_word(BIGNUM *a, BN_ULONG w)
|
||||
{
|
||||
bn_check_top(a);
|
||||
if(bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) { return (0); }
|
||||
a->neg = 0;
|
||||
a->d[0] = w;
|
||||
a->top = (w ? 1 : 0);
|
||||
bn_check_top(a);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/* ignore negative */
|
||||
BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
|
||||
{
|
||||
unsigned int i, m;
|
||||
unsigned int n;
|
||||
BN_ULONG l;
|
||||
|
||||
if(ret == NULL) { ret = BN_new(); }
|
||||
if(ret == NULL) { return (NULL); }
|
||||
l = 0;
|
||||
n = len;
|
||||
if(n == 0)
|
||||
{
|
||||
ret->top = 0;
|
||||
return (ret);
|
||||
}
|
||||
if(bn_expand(ret, (int)(n + 2) * 8) == NULL)
|
||||
{ return (NULL); }
|
||||
i = ((n - 1) / BN_BYTES) + 1;
|
||||
m = ((n - 1) % (BN_BYTES));
|
||||
ret->top = i;
|
||||
while(n-- > 0)
|
||||
{
|
||||
l = (l << 8L) | *(s++);
|
||||
if(m-- == 0)
|
||||
{
|
||||
ret->d[--i] = l;
|
||||
l = 0;
|
||||
m = BN_BYTES - 1;
|
||||
}
|
||||
}
|
||||
/* need to call this due to clear byte at top if avoiding
|
||||
* having the top bit set (-ve number) */
|
||||
bn_fix_top(ret);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
/* ignore negative */
|
||||
int BN_bn2bin(const BIGNUM *a, unsigned char *to)
|
||||
{
|
||||
int n, i;
|
||||
BN_ULONG l;
|
||||
|
||||
n = i = BN_num_bytes(a);
|
||||
while(i-- > 0)
|
||||
{
|
||||
l = a->d[i / BN_BYTES];
|
||||
*(to++) = (unsigned char)(l >> (8 * (i % BN_BYTES))) & 0xff;
|
||||
}
|
||||
return (n);
|
||||
}
|
||||
|
||||
int BN_ucmp(const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int i;
|
||||
BN_ULONG t1, t2, *ap, *bp;
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
i = a->top - b->top;
|
||||
if(i != 0) { return (i); }
|
||||
ap = a->d;
|
||||
bp = b->d;
|
||||
for(i = a->top - 1; i >= 0; i--)
|
||||
{
|
||||
t1 = ap[i];
|
||||
t2 = bp[i];
|
||||
if(t1 != t2)
|
||||
{ return (t1 > t2 ? 1 : -1); }
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int BN_cmp(const BIGNUM *a, const BIGNUM *b)
|
||||
{
|
||||
int i;
|
||||
int gt, lt;
|
||||
BN_ULONG t1, t2;
|
||||
|
||||
if((a == NULL) || (b == NULL))
|
||||
{
|
||||
if(a != NULL)
|
||||
{ return (-1); }
|
||||
else if(b != NULL)
|
||||
{ return (1); }
|
||||
else
|
||||
{ return (0); }
|
||||
}
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
|
||||
if(a->neg != b->neg)
|
||||
{
|
||||
if(a->neg)
|
||||
{ return (-1); }
|
||||
else { return (1); }
|
||||
}
|
||||
if(a->neg == 0)
|
||||
{
|
||||
gt = 1;
|
||||
lt = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gt = -1;
|
||||
lt = 1;
|
||||
}
|
||||
|
||||
if(a->top > b->top) { return (gt); }
|
||||
if(a->top < b->top) { return (lt); }
|
||||
for(i = a->top - 1; i >= 0; i--)
|
||||
{
|
||||
t1 = a->d[i];
|
||||
t2 = b->d[i];
|
||||
if(t1 > t2) { return (gt); }
|
||||
if(t1 < t2) { return (lt); }
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int BN_set_bit(BIGNUM *a, int n)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
i = n / BN_BITS2;
|
||||
j = n % BN_BITS2;
|
||||
if(a->top <= i)
|
||||
{
|
||||
if(bn_wexpand(a, i + 1) == NULL) { return (0); }
|
||||
for(k = a->top; k < i + 1; k++)
|
||||
{ a->d[k] = 0; }
|
||||
a->top = i + 1;
|
||||
}
|
||||
|
||||
a->d[i] |= (((BN_ULONG)1) << j);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int BN_clear_bit(BIGNUM *a, int n)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
i = n / BN_BITS2;
|
||||
j = n % BN_BITS2;
|
||||
if(a->top <= i) { return (0); }
|
||||
|
||||
a->d[i] &= (~(((BN_ULONG)1) << j));
|
||||
bn_fix_top(a);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int BN_is_bit_set(const BIGNUM *a, int n)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if(n < 0) { return (0); }
|
||||
i = n / BN_BITS2;
|
||||
j = n % BN_BITS2;
|
||||
if(a->top <= i) { return (0); }
|
||||
return ((a->d[i] & (((BN_ULONG)1) << j)) ? 1 : 0);
|
||||
}
|
||||
|
||||
int BN_mask_bits(BIGNUM *a, int n)
|
||||
{
|
||||
int b, w;
|
||||
|
||||
w = n / BN_BITS2;
|
||||
b = n % BN_BITS2;
|
||||
if(w >= a->top) { return (0); }
|
||||
if(b == 0)
|
||||
{ a->top = w; }
|
||||
else
|
||||
{
|
||||
a->top = w + 1;
|
||||
a->d[w] &= ~(BN_MASK2 << b);
|
||||
}
|
||||
bn_fix_top(a);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int bn_cmp_words(BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
int i;
|
||||
BN_ULONG aa, bb;
|
||||
|
||||
aa = a[n - 1];
|
||||
bb = b[n - 1];
|
||||
if(aa != bb) { return ((aa > bb) ? 1 : -1); }
|
||||
for(i = n - 2; i >= 0; i--)
|
||||
{
|
||||
aa = a[i];
|
||||
bb = b[i];
|
||||
if(aa != bb) { return ((aa > bb) ? 1 : -1); }
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
804
cscrypt/bn_mul.c
Normal file
804
cscrypt/bn_mul.c
Normal file
|
|
@ -0,0 +1,804 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_mul.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "bn_lcl.h"
|
||||
#include "openssl_mods.h"
|
||||
|
||||
#ifdef BN_RECURSION
|
||||
/* Karatsuba recursive multiplication algorithm
|
||||
* (cf. Knuth, The Art of Computer Programming, Vol. 2) */
|
||||
|
||||
/* r is 2*n2 words in size,
|
||||
* a and b are both n2 words in size.
|
||||
* n2 must be a power of 2.
|
||||
* We multiply and return the result.
|
||||
* t must be 2*n2 words in size
|
||||
* We calculate
|
||||
* a[0]*b[0]
|
||||
* a[0]*b[0]+a[1]*b[1]+(a[0]-a[1])*(b[1]-b[0])
|
||||
* a[1]*b[1]
|
||||
*/
|
||||
void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
BN_ULONG *t)
|
||||
{
|
||||
int n = n2 / 2, c1, c2;
|
||||
unsigned int neg, zero;
|
||||
BN_ULONG ln, lo, *p;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
printf(" bn_mul_recursive %d * %d\n", n2, n2);
|
||||
# endif
|
||||
# ifdef BN_MUL_COMBA
|
||||
# if 0
|
||||
if(n2 == 4)
|
||||
{
|
||||
bn_mul_comba4(r, a, b);
|
||||
return;
|
||||
}
|
||||
# endif
|
||||
if(n2 == 8)
|
||||
{
|
||||
bn_mul_comba8(r, a, b);
|
||||
return;
|
||||
}
|
||||
# endif /* BN_MUL_COMBA */
|
||||
if(n2 < BN_MUL_RECURSIVE_SIZE_NORMAL)
|
||||
{
|
||||
/* This should not happen */
|
||||
bn_mul_normal(r, a, n2, b, n2);
|
||||
return;
|
||||
}
|
||||
/* r=(a[0]-a[1])*(b[1]-b[0]) */
|
||||
c1 = bn_cmp_words(a, &(a[n]), n);
|
||||
c2 = bn_cmp_words(&(b[n]), b, n);
|
||||
zero = neg = 0;
|
||||
switch(c1 * 3 + c2)
|
||||
{
|
||||
case -4:
|
||||
bn_sub_words(t, &(a[n]), a, n); /* - */
|
||||
bn_sub_words(&(t[n]), b, &(b[n]), n); /* - */
|
||||
break;
|
||||
case -3:
|
||||
zero = 1;
|
||||
break;
|
||||
case -2:
|
||||
bn_sub_words(t, &(a[n]), a, n); /* - */
|
||||
bn_sub_words(&(t[n]), &(b[n]), b, n); /* + */
|
||||
neg = 1;
|
||||
break;
|
||||
case -1:
|
||||
case 0:
|
||||
case 1:
|
||||
zero = 1;
|
||||
break;
|
||||
case 2:
|
||||
bn_sub_words(t, a, &(a[n]), n); /* + */
|
||||
bn_sub_words(&(t[n]), b, &(b[n]), n); /* - */
|
||||
neg = 1;
|
||||
break;
|
||||
case 3:
|
||||
zero = 1;
|
||||
break;
|
||||
case 4:
|
||||
bn_sub_words(t, a, &(a[n]), n);
|
||||
bn_sub_words(&(t[n]), &(b[n]), b, n);
|
||||
break;
|
||||
}
|
||||
|
||||
# ifdef BN_MUL_COMBA
|
||||
if(n == 4)
|
||||
{
|
||||
if(!zero)
|
||||
{ bn_mul_comba4(&(t[n2]), t, &(t[n])); }
|
||||
else
|
||||
{ memset(&(t[n2]), 0, 8 * sizeof(BN_ULONG)); }
|
||||
|
||||
bn_mul_comba4(r, a, b);
|
||||
bn_mul_comba4(&(r[n2]), &(a[n]), &(b[n]));
|
||||
}
|
||||
else if(n == 8)
|
||||
{
|
||||
if(!zero)
|
||||
{ bn_mul_comba8(&(t[n2]), t, &(t[n])); }
|
||||
else
|
||||
{ memset(&(t[n2]), 0, 16 * sizeof(BN_ULONG)); }
|
||||
|
||||
bn_mul_comba8(r, a, b);
|
||||
bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n]));
|
||||
}
|
||||
else
|
||||
# endif /* BN_MUL_COMBA */
|
||||
{
|
||||
p = &(t[n2 * 2]);
|
||||
if(!zero)
|
||||
{ bn_mul_recursive(&(t[n2]), t, &(t[n]), n, p); }
|
||||
else
|
||||
{ memset(&(t[n2]), 0, n2 * sizeof(BN_ULONG)); }
|
||||
bn_mul_recursive(r, a, b, n, p);
|
||||
bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), n, p);
|
||||
}
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
|
||||
* r[10] holds (a[0]*b[0])
|
||||
* r[32] holds (b[1]*b[1])
|
||||
*/
|
||||
|
||||
c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
|
||||
|
||||
if(neg) /* if t[32] is negative */
|
||||
{
|
||||
c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Might have a carry */
|
||||
c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
|
||||
}
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
|
||||
* r[10] holds (a[0]*b[0])
|
||||
* r[32] holds (b[1]*b[1])
|
||||
* c1 holds the carry bits
|
||||
*/
|
||||
c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
|
||||
if(c1)
|
||||
{
|
||||
p = &(r[n + n2]);
|
||||
lo = *p;
|
||||
ln = (lo + c1)&BN_MASK2;
|
||||
*p = ln;
|
||||
|
||||
/* The overflow will stop before we over write
|
||||
* words we should not overwrite */
|
||||
if(ln < (BN_ULONG)c1)
|
||||
{
|
||||
do
|
||||
{
|
||||
p++;
|
||||
lo = *p;
|
||||
ln = (lo + 1)&BN_MASK2;
|
||||
*p = ln;
|
||||
}
|
||||
while(ln == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* n+tn is the word length
|
||||
* t needs to be n*4 is size, as does r */
|
||||
void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int tn,
|
||||
int n, BN_ULONG *t)
|
||||
{
|
||||
int c1, c2, i, j, n2 = n * 2;
|
||||
unsigned int neg;
|
||||
BN_ULONG ln, lo, *p;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
printf(" bn_mul_part_recursive %d * %d\n", tn + n, tn + n);
|
||||
# endif
|
||||
if(n < 8)
|
||||
{
|
||||
i = tn + n;
|
||||
bn_mul_normal(r, a, i, b, i);
|
||||
return;
|
||||
}
|
||||
|
||||
/* r=(a[0]-a[1])*(b[1]-b[0]) */
|
||||
c1 = bn_cmp_words(a, &(a[n]), n);
|
||||
c2 = bn_cmp_words(&(b[n]), b, n);
|
||||
neg = 0;
|
||||
switch(c1 * 3 + c2)
|
||||
{
|
||||
case -4:
|
||||
bn_sub_words(t, &(a[n]), a, n); /* - */
|
||||
bn_sub_words(&(t[n]), b, &(b[n]), n); /* - */
|
||||
break;
|
||||
case -3:
|
||||
case -2:
|
||||
bn_sub_words(t, &(a[n]), a, n); /* - */
|
||||
bn_sub_words(&(t[n]), &(b[n]), b, n); /* + */
|
||||
neg = 1;
|
||||
break;
|
||||
case -1:
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
bn_sub_words(t, a, &(a[n]), n); /* + */
|
||||
bn_sub_words(&(t[n]), b, &(b[n]), n); /* - */
|
||||
neg = 1;
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
bn_sub_words(t, a, &(a[n]), n);
|
||||
bn_sub_words(&(t[n]), &(b[n]), b, n);
|
||||
break;
|
||||
}
|
||||
/* The zero case isn't yet implemented here. The speedup
|
||||
would probably be negligible. */
|
||||
# if 0
|
||||
if(n == 4)
|
||||
{
|
||||
bn_mul_comba4(&(t[n2]), t, &(t[n]));
|
||||
bn_mul_comba4(r, a, b);
|
||||
bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
|
||||
memset(&(r[n2 + tn * 2]), 0, sizeof(BN_ULONG) * (n2 - tn * 2));
|
||||
}
|
||||
else
|
||||
# endif
|
||||
if(n == 8)
|
||||
{
|
||||
bn_mul_comba8(&(t[n2]), t, &(t[n]));
|
||||
bn_mul_comba8(r, a, b);
|
||||
bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
|
||||
memset(&(r[n2 + tn * 2]), 0, sizeof(BN_ULONG) * (n2 - tn * 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
p = &(t[n2 * 2]);
|
||||
bn_mul_recursive(&(t[n2]), t, &(t[n]), n, p);
|
||||
bn_mul_recursive(r, a, b, n, p);
|
||||
i = n / 2;
|
||||
/* If there is only a bottom half to the number,
|
||||
* just do it */
|
||||
j = tn - i;
|
||||
if(j == 0)
|
||||
{
|
||||
bn_mul_recursive(&(r[n2]), &(a[n]), &(b[n]), i, p);
|
||||
memset(&(r[n2 + i * 2]), 0, sizeof(BN_ULONG) * (n2 - i * 2));
|
||||
}
|
||||
else if(j > 0) /* eg, n == 16, i == 8 and tn == 11 */
|
||||
{
|
||||
bn_mul_part_recursive(&(r[n2]), &(a[n]), &(b[n]),
|
||||
j, i, p);
|
||||
memset(&(r[n2 + tn * 2]), 0,
|
||||
sizeof(BN_ULONG) * (n2 - tn * 2));
|
||||
}
|
||||
else /* (j < 0) eg, n == 16, i == 8 and tn == 5 */
|
||||
{
|
||||
memset(&(r[n2]), 0, sizeof(BN_ULONG)*n2);
|
||||
if(tn < BN_MUL_RECURSIVE_SIZE_NORMAL)
|
||||
{
|
||||
bn_mul_normal(&(r[n2]), &(a[n]), tn, &(b[n]), tn);
|
||||
}
|
||||
else
|
||||
{
|
||||
for(;;)
|
||||
{
|
||||
i /= 2;
|
||||
if(i < tn)
|
||||
{
|
||||
bn_mul_part_recursive(&(r[n2]),
|
||||
&(a[n]), &(b[n]),
|
||||
tn - i, i, p);
|
||||
break;
|
||||
}
|
||||
else if(i == tn)
|
||||
{
|
||||
bn_mul_recursive(&(r[n2]),
|
||||
&(a[n]), &(b[n]),
|
||||
i, p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0]), c1 is the sign
|
||||
* r[10] holds (a[0]*b[0])
|
||||
* r[32] holds (b[1]*b[1])
|
||||
*/
|
||||
|
||||
c1 = (int)(bn_add_words(t, r, &(r[n2]), n2));
|
||||
|
||||
if(neg) /* if t[32] is negative */
|
||||
{
|
||||
c1 -= (int)(bn_sub_words(&(t[n2]), t, &(t[n2]), n2));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Might have a carry */
|
||||
c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), t, n2));
|
||||
}
|
||||
|
||||
/* t[32] holds (a[0]-a[1])*(b[1]-b[0])+(a[0]*b[0])+(a[1]*b[1])
|
||||
* r[10] holds (a[0]*b[0])
|
||||
* r[32] holds (b[1]*b[1])
|
||||
* c1 holds the carry bits
|
||||
*/
|
||||
c1 += (int)(bn_add_words(&(r[n]), &(r[n]), &(t[n2]), n2));
|
||||
if(c1)
|
||||
{
|
||||
p = &(r[n + n2]);
|
||||
lo = *p;
|
||||
ln = (lo + c1)&BN_MASK2;
|
||||
*p = ln;
|
||||
|
||||
/* The overflow will stop before we over write
|
||||
* words we should not overwrite */
|
||||
if(ln < (BN_ULONG)c1)
|
||||
{
|
||||
do
|
||||
{
|
||||
p++;
|
||||
lo = *p;
|
||||
ln = (lo + 1)&BN_MASK2;
|
||||
*p = ln;
|
||||
}
|
||||
while(ln == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* a and b must be the same size, which is n2.
|
||||
* r needs to be n2 words and t needs to be n2*2
|
||||
*/
|
||||
void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
|
||||
BN_ULONG *t)
|
||||
{
|
||||
int n = n2 / 2;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
printf(" bn_mul_low_recursive %d * %d\n", n2, n2);
|
||||
# endif
|
||||
|
||||
bn_mul_recursive(r, a, b, n, &(t[0]));
|
||||
if(n >= BN_MUL_LOW_RECURSIVE_SIZE_NORMAL)
|
||||
{
|
||||
bn_mul_low_recursive(&(t[0]), &(a[0]), &(b[n]), n, &(t[n2]));
|
||||
bn_add_words(&(r[n]), &(r[n]), &(t[0]), n);
|
||||
bn_mul_low_recursive(&(t[0]), &(a[n]), &(b[0]), n, &(t[n2]));
|
||||
bn_add_words(&(r[n]), &(r[n]), &(t[0]), n);
|
||||
}
|
||||
else
|
||||
{
|
||||
bn_mul_low_normal(&(t[0]), &(a[0]), &(b[n]), n);
|
||||
bn_mul_low_normal(&(t[n]), &(a[n]), &(b[0]), n);
|
||||
bn_add_words(&(r[n]), &(r[n]), &(t[0]), n);
|
||||
bn_add_words(&(r[n]), &(r[n]), &(t[n]), n);
|
||||
}
|
||||
}
|
||||
|
||||
/* a and b must be the same size, which is n2.
|
||||
* r needs to be n2 words and t needs to be n2*2
|
||||
* l is the low words of the output.
|
||||
* t needs to be n2*3
|
||||
*/
|
||||
void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l, int n2, BN_ULONG *t)
|
||||
{
|
||||
int i, n;
|
||||
int c1, c2;
|
||||
int neg = 0, oneg;
|
||||
BN_ULONG ll, lc, *lp, *mp;
|
||||
|
||||
# ifdef BN_COUNT
|
||||
printf(" bn_mul_high %d * %d\n", n2, n2);
|
||||
# endif
|
||||
n = n2 / 2;
|
||||
|
||||
/* Calculate (al-ah)*(bh-bl) */
|
||||
c1 = bn_cmp_words(&(a[0]), &(a[n]), n);
|
||||
c2 = bn_cmp_words(&(b[n]), &(b[0]), n);
|
||||
switch(c1 * 3 + c2)
|
||||
{
|
||||
case -4:
|
||||
bn_sub_words(&(r[0]), &(a[n]), &(a[0]), n);
|
||||
bn_sub_words(&(r[n]), &(b[0]), &(b[n]), n);
|
||||
break;
|
||||
case -3:
|
||||
break;
|
||||
case -2:
|
||||
bn_sub_words(&(r[0]), &(a[n]), &(a[0]), n);
|
||||
bn_sub_words(&(r[n]), &(b[n]), &(b[0]), n);
|
||||
neg = 1;
|
||||
break;
|
||||
case -1:
|
||||
case 0:
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
bn_sub_words(&(r[0]), &(a[0]), &(a[n]), n);
|
||||
bn_sub_words(&(r[n]), &(b[0]), &(b[n]), n);
|
||||
neg = 1;
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
bn_sub_words(&(r[0]), &(a[0]), &(a[n]), n);
|
||||
bn_sub_words(&(r[n]), &(b[n]), &(b[0]), n);
|
||||
break;
|
||||
}
|
||||
|
||||
oneg = neg;
|
||||
/* t[10] = (a[0]-a[1])*(b[1]-b[0]) */
|
||||
/* r[10] = (a[1]*b[1]) */
|
||||
# ifdef BN_MUL_COMBA
|
||||
if(n == 8)
|
||||
{
|
||||
bn_mul_comba8(&(t[0]), &(r[0]), &(r[n]));
|
||||
bn_mul_comba8(r, &(a[n]), &(b[n]));
|
||||
}
|
||||
else
|
||||
# endif
|
||||
{
|
||||
bn_mul_recursive(&(t[0]), &(r[0]), &(r[n]), n, &(t[n2]));
|
||||
bn_mul_recursive(r, &(a[n]), &(b[n]), n, &(t[n2]));
|
||||
}
|
||||
|
||||
/* s0 == low(al*bl)
|
||||
* s1 == low(ah*bh)+low((al-ah)*(bh-bl))+low(al*bl)+high(al*bl)
|
||||
* We know s0 and s1 so the only unknown is high(al*bl)
|
||||
* high(al*bl) == s1 - low(ah*bh+s0+(al-ah)*(bh-bl))
|
||||
* high(al*bl) == s1 - (r[0]+l[0]+t[0])
|
||||
*/
|
||||
if(l != NULL)
|
||||
{
|
||||
lp = &(t[n2 + n]);
|
||||
c1 = (int)(bn_add_words(lp, &(r[0]), &(l[0]), n));
|
||||
}
|
||||
else
|
||||
{
|
||||
c1 = 0;
|
||||
lp = &(r[0]);
|
||||
}
|
||||
|
||||
if(neg)
|
||||
{ neg = (int)(bn_sub_words(&(t[n2]), lp, &(t[0]), n)); }
|
||||
else
|
||||
{
|
||||
bn_add_words(&(t[n2]), lp, &(t[0]), n);
|
||||
}
|
||||
|
||||
if(l != NULL)
|
||||
{
|
||||
bn_sub_words(&(t[n2 + n]), &(l[n]), &(t[n2]), n);
|
||||
}
|
||||
else
|
||||
{
|
||||
lp = &(t[n2 + n]);
|
||||
mp = &(t[n2]);
|
||||
for(i = 0; i < n; i++)
|
||||
{ lp[i] = ((~mp[i]) + 1)&BN_MASK2; }
|
||||
}
|
||||
|
||||
/* s[0] = low(al*bl)
|
||||
* t[3] = high(al*bl)
|
||||
* t[10] = (a[0]-a[1])*(b[1]-b[0]) neg is the sign
|
||||
* r[10] = (a[1]*b[1])
|
||||
*/
|
||||
/* R[10] = al*bl
|
||||
* R[21] = al*bl + ah*bh + (a[0]-a[1])*(b[1]-b[0])
|
||||
* R[32] = ah*bh
|
||||
*/
|
||||
/* R[1]=t[3]+l[0]+r[0](+-)t[0] (have carry/borrow)
|
||||
* R[2]=r[0]+t[3]+r[1](+-)t[1] (have carry/borrow)
|
||||
* R[3]=r[1]+(carry/borrow)
|
||||
*/
|
||||
if(l != NULL)
|
||||
{
|
||||
lp = &(t[n2]);
|
||||
c1 = (int)(bn_add_words(lp, &(t[n2 + n]), &(l[0]), n));
|
||||
}
|
||||
else
|
||||
{
|
||||
lp = &(t[n2 + n]);
|
||||
c1 = 0;
|
||||
}
|
||||
c1 += (int)(bn_add_words(&(t[n2]), lp, &(r[0]), n));
|
||||
if(oneg)
|
||||
{ c1 -= (int)(bn_sub_words(&(t[n2]), &(t[n2]), &(t[0]), n)); }
|
||||
else
|
||||
{ c1 += (int)(bn_add_words(&(t[n2]), &(t[n2]), &(t[0]), n)); }
|
||||
|
||||
c2 = (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n2 + n]), n));
|
||||
c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(r[n]), n));
|
||||
if(oneg)
|
||||
{ c2 -= (int)(bn_sub_words(&(r[0]), &(r[0]), &(t[n]), n)); }
|
||||
else
|
||||
{ c2 += (int)(bn_add_words(&(r[0]), &(r[0]), &(t[n]), n)); }
|
||||
|
||||
if(c1 != 0) /* Add starting at r[0], could be +ve or -ve */
|
||||
{
|
||||
i = 0;
|
||||
if(c1 > 0)
|
||||
{
|
||||
lc = c1;
|
||||
do
|
||||
{
|
||||
ll = (r[i] + lc)&BN_MASK2;
|
||||
r[i++] = ll;
|
||||
lc = (lc > ll);
|
||||
}
|
||||
while(lc);
|
||||
}
|
||||
else
|
||||
{
|
||||
lc = -c1;
|
||||
do
|
||||
{
|
||||
ll = r[i];
|
||||
r[i++] = (ll - lc)&BN_MASK2;
|
||||
lc = (lc > ll);
|
||||
}
|
||||
while(lc);
|
||||
}
|
||||
}
|
||||
if(c2 != 0) /* Add starting at r[1] */
|
||||
{
|
||||
i = n;
|
||||
if(c2 > 0)
|
||||
{
|
||||
lc = c2;
|
||||
do
|
||||
{
|
||||
ll = (r[i] + lc)&BN_MASK2;
|
||||
r[i++] = ll;
|
||||
lc = (lc > ll);
|
||||
}
|
||||
while(lc);
|
||||
}
|
||||
else
|
||||
{
|
||||
lc = -c2;
|
||||
do
|
||||
{
|
||||
ll = r[i];
|
||||
r[i++] = (ll - lc)&BN_MASK2;
|
||||
lc = (lc > ll);
|
||||
}
|
||||
while(lc);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* BN_RECURSION */
|
||||
|
||||
int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
int top, al, bl;
|
||||
BIGNUM *rr;
|
||||
int ret = 0;
|
||||
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
|
||||
int i;
|
||||
#endif
|
||||
#ifdef BN_RECURSION
|
||||
BIGNUM *t;
|
||||
int j, k;
|
||||
#endif
|
||||
|
||||
#ifdef BN_COUNT
|
||||
printf("BN_mul %d * %d\n", a->top, b->top);
|
||||
#endif
|
||||
|
||||
bn_check_top(a);
|
||||
bn_check_top(b);
|
||||
bn_check_top(r);
|
||||
|
||||
al = a->top;
|
||||
bl = b->top;
|
||||
|
||||
if((al == 0) || (bl == 0))
|
||||
{
|
||||
BN_zero(r);
|
||||
return (1);
|
||||
}
|
||||
top = al + bl;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
if((r == a) || (r == b))
|
||||
{
|
||||
if((rr = BN_CTX_get(ctx)) == NULL) { goto err; }
|
||||
}
|
||||
else
|
||||
{ rr = r; }
|
||||
rr->neg = a->neg ^ b->neg;
|
||||
|
||||
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
|
||||
i = al - bl;
|
||||
#endif
|
||||
#ifdef BN_MUL_COMBA
|
||||
if(i == 0)
|
||||
{
|
||||
# if 0
|
||||
if(al == 4)
|
||||
{
|
||||
if(bn_wexpand(rr, 8) == NULL) { goto err; }
|
||||
rr->top = 8;
|
||||
bn_mul_comba4(rr->d, a->d, b->d);
|
||||
goto end;
|
||||
}
|
||||
# endif
|
||||
if(al == 8)
|
||||
{
|
||||
if(bn_wexpand(rr, 16) == NULL) { goto err; }
|
||||
rr->top = 16;
|
||||
bn_mul_comba8(rr->d, a->d, b->d);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
#endif /* BN_MUL_COMBA */
|
||||
#ifdef BN_RECURSION
|
||||
if((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL))
|
||||
{
|
||||
if(i == 1 && !BN_get_flags(b, BN_FLG_STATIC_DATA))
|
||||
{
|
||||
if(bn_wexpand(b, al) == NULL) { goto err; }
|
||||
b->d[bl] = 0;
|
||||
bl++;
|
||||
i--;
|
||||
}
|
||||
else if(i == -1 && !BN_get_flags(a, BN_FLG_STATIC_DATA))
|
||||
{
|
||||
if(bn_wexpand(a, bl) == NULL) { goto err; }
|
||||
a->d[al] = 0;
|
||||
al++;
|
||||
i++;
|
||||
}
|
||||
if(i == 0)
|
||||
{
|
||||
/* symmetric and > 4 */
|
||||
/* 16 or larger */
|
||||
j = BN_num_bits_word((BN_ULONG)al);
|
||||
j = 1 << (j - 1);
|
||||
k = j + j;
|
||||
t = BN_CTX_get(ctx);
|
||||
if(al == j) /* exact multiple */
|
||||
{
|
||||
if(bn_wexpand(t, k * 2) == NULL) { goto err; }
|
||||
if(bn_wexpand(rr, k * 2) == NULL) { goto err; }
|
||||
bn_mul_recursive(rr->d, a->d, b->d, al, t->d);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bn_wexpand(a, k) == NULL) { goto err; }
|
||||
if(bn_wexpand(b, k) == NULL) { goto err; }
|
||||
if(bn_wexpand(t, k * 4) == NULL) { goto err; }
|
||||
if(bn_wexpand(rr, k * 4) == NULL) { goto err; }
|
||||
for(i = a->top; i < k; i++)
|
||||
{ a->d[i] = 0; }
|
||||
for(i = b->top; i < k; i++)
|
||||
{ b->d[i] = 0; }
|
||||
bn_mul_part_recursive(rr->d, a->d, b->d, al - j, j, t->d);
|
||||
}
|
||||
rr->top = top;
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
#endif /* BN_RECURSION */
|
||||
if(bn_wexpand(rr, top) == NULL) { goto err; }
|
||||
rr->top = top;
|
||||
bn_mul_normal(rr->d, a->d, al, b->d, bl);
|
||||
|
||||
#if defined(BN_MUL_COMBA) || defined(BN_RECURSION)
|
||||
end:
|
||||
#endif
|
||||
bn_fix_top(rr);
|
||||
if(r != rr) { BN_copy(r, rr); }
|
||||
ret = 1;
|
||||
err:
|
||||
BN_CTX_end(ctx);
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
|
||||
{
|
||||
BN_ULONG *rr;
|
||||
|
||||
#ifdef BN_COUNT
|
||||
printf(" bn_mul_normal %d * %d\n", na, nb);
|
||||
#endif
|
||||
|
||||
if(na < nb)
|
||||
{
|
||||
int itmp;
|
||||
BN_ULONG *ltmp;
|
||||
|
||||
itmp = na;
|
||||
na = nb;
|
||||
nb = itmp;
|
||||
ltmp = a;
|
||||
a = b;
|
||||
b = ltmp;
|
||||
|
||||
}
|
||||
rr = &(r[na]);
|
||||
rr[0] = bn_mul_words(r, a, na, b[0]);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(--nb <= 0) { return; }
|
||||
rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]);
|
||||
if(--nb <= 0) { return; }
|
||||
rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]);
|
||||
if(--nb <= 0) { return; }
|
||||
rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]);
|
||||
if(--nb <= 0) { return; }
|
||||
rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
|
||||
rr += 4;
|
||||
r += 4;
|
||||
b += 4;
|
||||
}
|
||||
}
|
||||
|
||||
void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n)
|
||||
{
|
||||
#ifdef BN_COUNT
|
||||
printf(" bn_mul_low_normal %d * %d\n", n, n);
|
||||
#endif
|
||||
bn_mul_words(r, a, n, b[0]);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
if(--n <= 0) { return; }
|
||||
bn_mul_add_words(&(r[1]), a, n, b[1]);
|
||||
if(--n <= 0) { return; }
|
||||
bn_mul_add_words(&(r[2]), a, n, b[2]);
|
||||
if(--n <= 0) { return; }
|
||||
bn_mul_add_words(&(r[3]), a, n, b[3]);
|
||||
if(--n <= 0) { return; }
|
||||
bn_mul_add_words(&(r[4]), a, n, b[4]);
|
||||
r += 4;
|
||||
b += 4;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
299
cscrypt/bn_print.c
Normal file
299
cscrypt/bn_print.c
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_print.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "bn_lcl.h"
|
||||
#include "buffer.h"
|
||||
#include "openssl_mods.h"
|
||||
|
||||
static const char *Hex = "0123456789ABCDEF";
|
||||
|
||||
/* Must 'OPENSSL_free' the returned data */
|
||||
char *BN_bn2hex(const BIGNUM *a)
|
||||
{
|
||||
int i, j, v, z = 0;
|
||||
char *buf;
|
||||
char *p;
|
||||
|
||||
buf = (char *)OPENSSL_malloc(a->top * BN_BYTES * 2 + 2);
|
||||
if(buf == NULL)
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
p = buf;
|
||||
if(a->neg) { *(p++) = '-'; }
|
||||
if(a->top == 0) { *(p++) = '0'; }
|
||||
for(i = a->top - 1; i >= 0; i--)
|
||||
{
|
||||
for(j = BN_BITS2 - 8; j >= 0; j -= 8)
|
||||
{
|
||||
/* strip leading zeros */
|
||||
v = ((int)(a->d[i] >> (long)j)) & 0xff;
|
||||
if(z || (v != 0))
|
||||
{
|
||||
*(p++) = Hex[v >> 4];
|
||||
*(p++) = Hex[v & 0x0f];
|
||||
z = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
*p = '\0';
|
||||
err:
|
||||
return (buf);
|
||||
}
|
||||
|
||||
/* Must 'OPENSSL_free' the returned data */
|
||||
char *BN_bn2dec(const BIGNUM *a)
|
||||
{
|
||||
int i = 0, num;
|
||||
char *buf = NULL;
|
||||
char *p;
|
||||
BIGNUM *t = NULL;
|
||||
BN_ULONG *bn_data = NULL, *lp;
|
||||
|
||||
i = BN_num_bits(a) * 3;
|
||||
num = (i / 10 + i / 1000 + 3) + 1;
|
||||
bn_data = (BN_ULONG *)OPENSSL_malloc((num / BN_DEC_NUM + 1) * sizeof(BN_ULONG));
|
||||
buf = (char *)OPENSSL_malloc(num + 3);
|
||||
if((buf == NULL) || (bn_data == NULL))
|
||||
{
|
||||
goto err;
|
||||
}
|
||||
if((t = BN_dup(a)) == NULL) { goto err; }
|
||||
|
||||
p = buf;
|
||||
lp = bn_data;
|
||||
if(t->neg) { *(p++) = '-'; }
|
||||
if(t->top == 0)
|
||||
{
|
||||
*(p++) = '0';
|
||||
*(p++) = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
while(!BN_is_zero(t))
|
||||
{
|
||||
*lp = BN_div_word(t, BN_DEC_CONV);
|
||||
lp++;
|
||||
}
|
||||
lp--;
|
||||
/* We now have a series of blocks, BN_DEC_NUM chars
|
||||
* in length, where the last one needs truncation.
|
||||
* The blocks need to be reversed in order. */
|
||||
snprintf(p, num + 3 - (p - buf), BN_DEC_FMT1, *lp);
|
||||
while(*p) { p++; }
|
||||
while(lp != bn_data)
|
||||
{
|
||||
lp--;
|
||||
snprintf(p, num + 3 - (p - buf), BN_DEC_FMT2, *lp);
|
||||
while(*p) { p++; }
|
||||
}
|
||||
}
|
||||
err:
|
||||
if(bn_data != NULL) { OPENSSL_free(bn_data); }
|
||||
if(t != NULL) { BN_free(t); }
|
||||
return (buf);
|
||||
}
|
||||
|
||||
int BN_hex2bn(BIGNUM **bn, const char *a)
|
||||
{
|
||||
BIGNUM *ret = NULL;
|
||||
BN_ULONG l = 0;
|
||||
int neg = 0, h, i, j, k, c;
|
||||
int m = 0;
|
||||
int num;
|
||||
|
||||
if((a == NULL) || (*a == '\0')) { return (0); }
|
||||
|
||||
if(*a == '-')
|
||||
{
|
||||
neg = 1;
|
||||
a++;
|
||||
}
|
||||
|
||||
for(i = 0; isxdigit((unsigned char) a[i]); i++)
|
||||
{ ; }
|
||||
|
||||
num = i + neg;
|
||||
if(bn == NULL) { return (num); }
|
||||
|
||||
/* a is the start of the hex digits, and it is 'i' long */
|
||||
if(*bn == NULL)
|
||||
{
|
||||
if((ret = BN_new()) == NULL) { return (0); }
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = *bn;
|
||||
BN_zero(ret);
|
||||
}
|
||||
|
||||
/* i is the number of hex digests; */
|
||||
if(bn_expand(ret, i * 4) == NULL) { goto err; }
|
||||
|
||||
j = i; /* least significant 'hex' */
|
||||
h = 0;
|
||||
while(j > 0)
|
||||
{
|
||||
m = ((BN_BYTES * 2) <= j) ? (BN_BYTES * 2) : j;
|
||||
l = 0;
|
||||
for(;;)
|
||||
{
|
||||
c = a[j - m];
|
||||
if((c >= '0') && (c <= '9')) { k = c - '0'; }
|
||||
else if((c >= 'a') && (c <= 'f')) { k = c - 'a' + 10; }
|
||||
else if((c >= 'A') && (c <= 'F')) { k = c - 'A' + 10; }
|
||||
else { k = 0; } /* paranoia */
|
||||
l = (l << 4) | k;
|
||||
|
||||
if(--m <= 0)
|
||||
{
|
||||
ret->d[h++] = l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
j -= (BN_BYTES * 2);
|
||||
}
|
||||
ret->top = h;
|
||||
bn_fix_top(ret);
|
||||
ret->neg = neg;
|
||||
|
||||
*bn = ret;
|
||||
return (num);
|
||||
err:
|
||||
if(*bn == NULL) { BN_free(ret); }
|
||||
return (0);
|
||||
}
|
||||
|
||||
int BN_dec2bn(BIGNUM **bn, const char *a)
|
||||
{
|
||||
BIGNUM *ret = NULL;
|
||||
BN_ULONG l = 0;
|
||||
int neg = 0, i, j;
|
||||
int num;
|
||||
|
||||
if((a == NULL) || (*a == '\0')) { return (0); }
|
||||
if(*a == '-')
|
||||
{
|
||||
neg = 1;
|
||||
a++;
|
||||
}
|
||||
|
||||
for(i = 0; isdigit((unsigned char) a[i]); i++)
|
||||
{ ; }
|
||||
|
||||
num = i + neg;
|
||||
if(bn == NULL) { return (num); }
|
||||
|
||||
/* a is the start of the digits, and it is 'i' long.
|
||||
* We chop it into BN_DEC_NUM digits at a time */
|
||||
if(*bn == NULL)
|
||||
{
|
||||
if((ret = BN_new()) == NULL) { return (0); }
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = *bn;
|
||||
BN_zero(ret);
|
||||
}
|
||||
|
||||
/* i is the number of digests, a bit of an over expand; */
|
||||
if(bn_expand(ret, i * 4) == NULL) { goto err; }
|
||||
|
||||
j = BN_DEC_NUM - (i % BN_DEC_NUM);
|
||||
if(j == BN_DEC_NUM) { j = 0; }
|
||||
l = 0;
|
||||
while(*a)
|
||||
{
|
||||
l *= 10;
|
||||
l += *a - '0';
|
||||
a++;
|
||||
if(++j == BN_DEC_NUM)
|
||||
{
|
||||
BN_mul_word(ret, BN_DEC_CONV);
|
||||
BN_add_word(ret, l);
|
||||
l = 0;
|
||||
j = 0;
|
||||
}
|
||||
}
|
||||
ret->neg = neg;
|
||||
|
||||
bn_fix_top(ret);
|
||||
*bn = ret;
|
||||
return (num);
|
||||
err:
|
||||
if(*bn == NULL) { BN_free(ret); }
|
||||
return (0);
|
||||
}
|
||||
|
||||
#ifdef BN_DEBUG
|
||||
void bn_dump1(FILE *o, const char *a, BN_ULONG *b, int n)
|
||||
{
|
||||
int i;
|
||||
fprintf(o, "%s=", a);
|
||||
for(i = n - 1; i >= 0; i--)
|
||||
{ fprintf(o, "%08lX", b[i]); } /* assumes 32-bit BN_ULONG */
|
||||
fprintf(o, "\n");
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
211
cscrypt/bn_shift.c
Normal file
211
cscrypt/bn_shift.c
Normal file
|
|
@ -0,0 +1,211 @@
|
|||
#include "bn.h"
|
||||
|
||||
#ifndef WITH_LIBCRYPTO
|
||||
//FIXME Not checked on threadsafety yet; after checking please remove this line
|
||||
/* crypto/bn/bn_shift.c */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The license and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution license
|
||||
* [including the GNU Public License.]
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "bn_lcl.h"
|
||||
#include "openssl_mods.h"
|
||||
|
||||
int BN_lshift1(BIGNUM *r, BIGNUM *a)
|
||||
{
|
||||
register BN_ULONG *ap, *rp, t, c;
|
||||
int i;
|
||||
|
||||
if(r != a)
|
||||
{
|
||||
r->neg = a->neg;
|
||||
if(bn_wexpand(r, a->top + 1) == NULL) { return (0); }
|
||||
r->top = a->top;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(bn_wexpand(r, a->top + 1) == NULL) { return (0); }
|
||||
}
|
||||
ap = a->d;
|
||||
rp = r->d;
|
||||
c = 0;
|
||||
for(i = 0; i < a->top; i++)
|
||||
{
|
||||
t = *(ap++);
|
||||
*(rp++) = ((t << 1) | c)&BN_MASK2;
|
||||
c = (t & BN_TBIT) ? 1 : 0;
|
||||
}
|
||||
if(c)
|
||||
{
|
||||
*rp = 1;
|
||||
r->top++;
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
int BN_rshift1(BIGNUM *r, BIGNUM *a)
|
||||
{
|
||||
BN_ULONG *ap, *rp, t, c;
|
||||
int i;
|
||||
|
||||
if(BN_is_zero(a))
|
||||
{
|
||||
BN_zero(r);
|
||||
return (1);
|
||||
}
|
||||
if(a != r)
|
||||
{
|
||||
if(bn_wexpand(r, a->top) == NULL) { return (0); }
|
||||
r->top = a->top;
|
||||
r->neg = a->neg;
|
||||
}
|
||||
ap = a->d;
|
||||
rp = r->d;
|
||||
c = 0;
|
||||
for(i = a->top - 1; i >= 0; i--)
|
||||
{
|
||||
t = ap[i];
|
||||
rp[i] = ((t >> 1)&BN_MASK2) | c;
|
||||
c = (t & 1) ? BN_TBIT : 0;
|
||||
}
|
||||
bn_fix_top(r);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
|
||||
{
|
||||
int i, nw, lb, rb;
|
||||
BN_ULONG *t, *f;
|
||||
BN_ULONG l;
|
||||
|
||||
r->neg = a->neg;
|
||||
if(bn_wexpand(r, a->top + (n / BN_BITS2) + 1) == NULL) { return (0); }
|
||||
nw = n / BN_BITS2;
|
||||
lb = n % BN_BITS2;
|
||||
rb = BN_BITS2 - lb;
|
||||
f = a->d;
|
||||
t = r->d;
|
||||
t[a->top + nw] = 0;
|
||||
if(lb == 0)
|
||||
for(i = a->top - 1; i >= 0; i--)
|
||||
{ t[nw + i] = f[i]; }
|
||||
else
|
||||
for(i = a->top - 1; i >= 0; i--)
|
||||
{
|
||||
l = f[i];
|
||||
t[nw + i + 1] |= (l >> rb)&BN_MASK2;
|
||||
t[nw + i] = (l << lb)&BN_MASK2;
|
||||
}
|
||||
memset(t, 0, nw * sizeof(t[0]));
|
||||
/* for (i=0; i<nw; i++)
|
||||
t[i]=0;*/
|
||||
r->top = a->top + nw + 1;
|
||||
bn_fix_top(r);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int BN_rshift(BIGNUM *r, BIGNUM *a, int n)
|
||||
{
|
||||
int i, j, nw, lb, rb;
|
||||
BN_ULONG *t, *f;
|
||||
BN_ULONG l, tmp;
|
||||
|
||||
nw = n / BN_BITS2;
|
||||
rb = n % BN_BITS2;
|
||||
lb = BN_BITS2 - rb;
|
||||
if(nw > a->top || a->top == 0)
|
||||
{
|
||||
BN_zero(r);
|
||||
return (1);
|
||||
}
|
||||
if(r != a)
|
||||
{
|
||||
r->neg = a->neg;
|
||||
if(bn_wexpand(r, a->top - nw + 1) == NULL) { return (0); }
|
||||
}
|
||||
else
|
||||
{
|
||||
if(n == 0)
|
||||
{ return 1; } /* or the copying loop will go berserk */
|
||||
}
|
||||
|
||||
f = &(a->d[nw]);
|
||||
t = r->d;
|
||||
j = a->top - nw;
|
||||
r->top = j;
|
||||
|
||||
if(rb == 0)
|
||||
{
|
||||
for(i = j + 1; i > 0; i--)
|
||||
{ *(t++) = *(f++); }
|
||||
}
|
||||
else
|
||||
{
|
||||
l = *(f++);
|
||||
for(i = 1; i < j; i++)
|
||||
{
|
||||
tmp = (l >> rb)&BN_MASK2;
|
||||
l = *(f++);
|
||||
*(t++) = (tmp | (l << lb))&BN_MASK2;
|
||||
}
|
||||
*(t++) = (l >> rb)&BN_MASK2;
|
||||
}
|
||||
*t = 0;
|
||||
bn_fix_top(r);
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user