Compare commits
112 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b0b7e1575 | ||
|
|
b853fd604a | ||
|
|
7943f1860e | ||
|
|
57591d01a9 | ||
|
|
daa541a654 | ||
|
|
7e449bff7b | ||
|
|
22e21715f2 | ||
|
|
0e53223fc5 | ||
|
|
9d7b1ed4b8 | ||
|
|
965bba59bf | ||
|
|
bfb35cd968 | ||
|
|
c979a3da74 | ||
|
|
eb012d9538 | ||
|
|
31d63481d5 | ||
|
|
8b1756eb89 | ||
|
|
89d354e927 | ||
|
|
5366997e79 | ||
|
|
13af87abaa | ||
|
|
918afb35fb | ||
|
|
f800dc2f51 | ||
|
|
a3d03e5211 | ||
|
|
f77e46eeb0 | ||
|
|
e6f7f1b7b3 | ||
|
|
b2082bf854 | ||
|
|
23f8d829bf | ||
|
|
1200fe92ee | ||
|
|
c6bf88e25f | ||
|
|
aeab6f03de | ||
|
|
490251f101 | ||
|
|
d2b7363769 | ||
|
|
86cca0804c | ||
|
|
a7a7c4750c | ||
|
|
8caaf85fbb | ||
|
|
f5856d7591 | ||
|
|
eeb7d72686 | ||
|
|
1508f432ad | ||
|
|
08bd10230f | ||
|
|
13cf62cf8b | ||
|
|
8ebccddc50 | ||
|
|
ebabc39c3e | ||
|
|
88975cc9ed | ||
|
|
8b7e99556a | ||
|
|
44603e4884 | ||
|
|
859c1a0757 | ||
|
|
e6ac5fa3f0 | ||
|
|
f893ee93cc | ||
|
|
fbba173a1f | ||
|
|
8078a346d1 | ||
|
|
13f09ea5aa | ||
|
|
030c674fbc | ||
|
|
1e26d47230 | ||
|
|
fe4cf3c00d | ||
|
|
c5f8c9e73e | ||
|
|
41b8baec2a | ||
|
|
fb588dda64 | ||
|
|
1ece43b1cb | ||
|
|
20edbdcb3d | ||
|
|
6c7492046b | ||
|
|
88b0bccea1 | ||
|
|
708932b383 | ||
|
|
226c5bcef0 | ||
|
|
4a7b143d50 | ||
|
|
ff413aac3e | ||
|
|
f1a36eba42 | ||
|
|
844306dbe4 | ||
|
|
8ff2e4c4eb | ||
|
|
0ad0a208d5 | ||
|
|
59d5c6c0fa | ||
|
|
35b852cfeb | ||
|
|
88a507932e | ||
|
|
aa2244308d | ||
|
|
e1e3676660 | ||
|
|
d4ffed77ab | ||
|
|
82aca41962 | ||
|
|
b6b7cd90c0 | ||
|
|
e92ccb49ff | ||
|
|
9feb3f8739 | ||
|
|
1dce245cce | ||
|
|
b650fb67c0 | ||
|
|
70859dfdaa | ||
|
|
fc403b6267 | ||
|
|
aefb37e563 | ||
|
|
90586aa018 | ||
|
|
dc99d2b3e6 | ||
|
|
d9d8b158c5 | ||
|
|
f175bf4c0b | ||
|
|
41df2d0c0b | ||
|
|
2f3d5d27a5 | ||
|
|
57727c43fe | ||
|
|
6fc15b72e7 | ||
|
|
65464950e0 | ||
|
|
1e89afd60e | ||
|
|
a4f407f361 | ||
|
|
e8d1f6b66b | ||
|
|
a43678d209 | ||
|
|
9022262489 | ||
|
|
06f66198d9 | ||
|
|
d2092a0902 | ||
|
|
9b82067638 | ||
|
|
5476b7da72 | ||
|
|
a912487ea3 | ||
|
|
3cbc9a1dd5 | ||
|
|
6992ff74de | ||
|
|
24b3388802 | ||
|
|
4023deead8 | ||
|
|
5e3ce59ce8 | ||
|
|
10cc56b84e | ||
|
|
0c3dd74309 | ||
|
|
f4465cd21b | ||
|
|
80bc7cc9d0 | ||
|
|
6709cdfabf | ||
|
|
3066499e09 |
154
.clang-format
Normal file
154
.clang-format
Normal file
@@ -0,0 +1,154 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -2
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveMacros: false
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveBitFields: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Right
|
||||
AlignOperands: Align
|
||||
AlignTrailingComments: true
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllConstructorInitializersOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortEnumsOnASingleLine: true
|
||||
AllowShortBlocksOnASingleLine: Never
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: All
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: false
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: true
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakInheritanceList: BeforeColon
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 80
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DeriveLineEnding: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeBlocks: Preserve
|
||||
IncludeCategories:
|
||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||
Priority: 2
|
||||
SortPriority: 0
|
||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||
Priority: 3
|
||||
SortPriority: 0
|
||||
- Regex: '.*'
|
||||
Priority: 1
|
||||
SortPriority: 0
|
||||
IncludeIsMainRegex: '(Test)?$'
|
||||
IncludeIsMainSourceRegex: ''
|
||||
IndentCaseLabels: false
|
||||
IndentCaseBlocks: false
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentExternBlock: AfterExternBlock
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertTrailingCommas: None
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBinPackProtocolList: Auto
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCBreakBeforeNestedBlockParam: true
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: true
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 19
|
||||
PenaltyBreakComment: 300
|
||||
PenaltyBreakFirstLessLess: 120
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyBreakTemplateDeclaration: 10
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 60
|
||||
PointerAlignment: Right
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: true
|
||||
SortIncludes: true
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCpp11BracedList: true
|
||||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
SpacesInAngles: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
SpaceBeforeSquareBrackets: false
|
||||
Standard: c++17
|
||||
StatementMacros:
|
||||
- Q_UNUSED
|
||||
- QT_REQUIRE_VERSION
|
||||
TabWidth: 8
|
||||
UseCRLF: false
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros:
|
||||
- STRINGIZE
|
||||
- PP_STRINGIZE
|
||||
- BOOST_PP_STRINGIZE
|
||||
...
|
||||
|
||||
32
.github/workflows/c-cpp.yml
vendored
Normal file
32
.github/workflows/c-cpp.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
name: C/C++ CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
#install pandoc
|
||||
- name: Install pandoc package
|
||||
run: |
|
||||
sudo apt-get -y install pandoc
|
||||
- name: autoconf
|
||||
run: autoreconf -i
|
||||
- name: configure
|
||||
run: ./configure
|
||||
- name: make
|
||||
run: make
|
||||
- name: make check
|
||||
run: make check
|
||||
- name: make distcheck
|
||||
run: make distcheck
|
||||
55
.github/workflows/codeql.yml
vendored
Normal file
55
.github/workflows/codeql.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'master' ]
|
||||
pull_request:
|
||||
branches: [ 'master' ]
|
||||
schedule:
|
||||
- cron: '4 11 * * 6'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'cpp' ]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
|
||||
|
||||
- name: Install pandoc package
|
||||
run: |
|
||||
sudo apt-get -y install pandoc
|
||||
- name: autoconf
|
||||
run: autoreconf -i
|
||||
- name: configure
|
||||
run: ./configure
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: +security-and-quality
|
||||
|
||||
- name: make
|
||||
run: make
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
61
.gitignore
vendored
61
.gitignore
vendored
@@ -1,3 +1,10 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
# Tempfiles
|
||||
*~
|
||||
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
@@ -16,10 +23,6 @@
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
@@ -30,3 +33,53 @@
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
src/stenc
|
||||
tests/scsi
|
||||
tests/output
|
||||
|
||||
# Other outputs
|
||||
man/stenc.1
|
||||
|
||||
# dist outputs
|
||||
*.tar.gz
|
||||
|
||||
# Generated Makefile
|
||||
# (meta build system like autotools,
|
||||
# can automatically generate from config.status script
|
||||
# (which is called by configure script))
|
||||
Makefile
|
||||
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
/ar-lib
|
||||
/mdate-sh
|
||||
/py-compile
|
||||
/test-driver
|
||||
/ylwrap
|
||||
.deps/
|
||||
.dirstamp
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
autom4te.cache
|
||||
/autoscan.log
|
||||
/autoscan-*.log
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/config.cache
|
||||
/config.guess
|
||||
/config.h
|
||||
/config.h.in
|
||||
/config.log
|
||||
/config.status
|
||||
/config.sub
|
||||
/configure
|
||||
/configure.scan
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
|
||||
/tests/*.log
|
||||
/tests/*.trs
|
||||
|
||||
9
AUTHORS
9
AUTHORS
@@ -1,9 +0,0 @@
|
||||
stenc AUTHORS
|
||||
===============================================================================
|
||||
|
||||
The authors of stenc are
|
||||
|
||||
John Coleman <ninthclowd@user.sourceforge.net>
|
||||
Samuel Martinez Jr. <sam_martinez_82@hotmail.com>
|
||||
|
||||
|
||||
15
AUTHORS.md
Normal file
15
AUTHORS.md
Normal file
@@ -0,0 +1,15 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 stenc authors
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
-->
|
||||
|
||||
stenc AUTHORS
|
||||
=============
|
||||
|
||||
The authors of stenc are
|
||||
|
||||
* John Coleman <ninthclowd@user.sourceforge.net>
|
||||
* Samuel Martinez Jr. <sam_martinez_82@hotmail.com>
|
||||
* Jonas Stein <news@jonasstein.de>
|
||||
* James Wilson <jmw@jmw.name>
|
||||
9
CONTRIBUTING.md
Normal file
9
CONTRIBUTING.md
Normal file
@@ -0,0 +1,9 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 stenc authors
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
-->
|
||||
|
||||
The Stenc team is looking forward to your contribution.
|
||||
Please prepare a pull request, or send us your `.patch` file
|
||||
Leave also a note, how you have tested the code.
|
||||
340
COPYING
340
COPYING
@@ -1,340 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) 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
|
||||
this service 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 make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
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
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the 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 a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE 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.
|
||||
|
||||
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
|
||||
convey 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 2 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, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision 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, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This 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 Library General
|
||||
Public License instead of this License.
|
||||
46
ChangeLog
46
ChangeLog
@@ -1,3 +1,49 @@
|
||||
xxxx-xx-xx
|
||||
* Version upgraded to 2.x.x
|
||||
* Removed KeyInfo; use standard library to parse hex strings
|
||||
* define C++17 as minimal C++ version
|
||||
* build manpage with pandoc
|
||||
* Dropped AIX support. If you can test and develop code for AIX, please contact us.
|
||||
* Added bash completion
|
||||
|
||||
2022-04-25 Jonas Stein <news@jonasstein.de>
|
||||
* Version upgraded to 1.1.1
|
||||
* Testframework Catch added
|
||||
* Fixed bug (mixed HEX macro and std::hex)
|
||||
* More constants marked with const
|
||||
|
||||
2022-04-22 Jonas Stein <news@jonasstein.de>
|
||||
* Version upgraded to 1.1.0
|
||||
* Code cleanup
|
||||
* Use /dev/random to create a key
|
||||
|
||||
2020-06-16 Jonas Stein <news@jonasstein.de>
|
||||
* Version upgraded to 1.0.8
|
||||
* Merged patches to fix make files and provide more error messages
|
||||
|
||||
2018-02-13 Jonas Stein <news@jonasstein.de>
|
||||
* Merged patches from various sources
|
||||
* move from SF to github in cooperation with John Coleman
|
||||
|
||||
2017-11-20 Adam Nielsen <malvineous@shikadi.net>
|
||||
* Add patch which fixes double free bug (import from upstream git)
|
||||
|
||||
2017-11-19 Denys Berkovskyy <berkovskyy@gmail.com>
|
||||
* Add patches which enable compilation of stenc on kfreebsd architecture. The changes include addition of FreeBSD detection to configure.ac and modification of source code to use FreeBSD specific includes.
|
||||
* Bump standards version to 4.1.1. Switch to the https form of the copyright-format URL in the Format field of debian/copyright file.
|
||||
* Add patches to fix lintian warnings (fix typo in manpage and rename configure.in to configure.ac)
|
||||
* Add patch to fix inclusion of standard headers on non-linux systems (Closes: Debian bug 881781)
|
||||
|
||||
2014-01-06 John Coleman <jcoleman1981@live.com>
|
||||
* Version upgraded to 1.0.7
|
||||
* Included unistd.h in scsiencrypt.cpp to prevent compile issue on ArchLinux per report by fukawi2@gmail.com
|
||||
* Remove the --enable-swapbit and modified code to use the BYTE_ORDER and__BYTE_ORDER macros
|
||||
* -kd argument added to specify a uKAD via command line
|
||||
* -k option now required to set the output key file when using the -g option
|
||||
* status is now simplified, --detail argument added to restore previous behavior
|
||||
* the program now sets the umask when creating a new key file to prevent other users from being able to read it
|
||||
* Some devices will issue an I/O error on the first command sent to the device after a tape is inserted. Modified the program to retry 1 time if the first command fails.
|
||||
|
||||
2012-02-29 John Coleman <ninthclowd@users.sourceforge.net>
|
||||
* Version upgraded to 1.0.6
|
||||
* The --protect option now should work properly and the --unprotect option has been added. If you specify neither, the drive will use it's default.
|
||||
|
||||
3
ChangeLog.license
Normal file
3
ChangeLog.license
Normal file
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2022 stenc authors
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
3
INSTALL.license
Normal file
3
INSTALL.license
Normal file
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 1994 Free Software Foundation, Inc.
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
7
LICENSES/BSL-1.0.txt
Normal file
7
LICENSES/BSL-1.0.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
121
LICENSES/CC0-1.0.txt
Normal file
121
LICENSES/CC0-1.0.txt
Normal file
@@ -0,0 +1,121 @@
|
||||
Creative Commons Legal Code
|
||||
|
||||
CC0 1.0 Universal
|
||||
|
||||
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||
HEREUNDER.
|
||||
|
||||
Statement of Purpose
|
||||
|
||||
The laws of most jurisdictions throughout the world automatically confer
|
||||
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||
authorship and/or a database (each, a "Work").
|
||||
|
||||
Certain owners wish to permanently relinquish those rights to a Work for
|
||||
the purpose of contributing to a commons of creative, cultural and
|
||||
scientific works ("Commons") that the public can reliably and without fear
|
||||
of later claims of infringement build upon, modify, incorporate in other
|
||||
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||
and for any purposes, including without limitation commercial purposes.
|
||||
These owners may contribute to the Commons to promote the ideal of a free
|
||||
culture and the further production of creative, cultural and scientific
|
||||
works, or to gain reputation or greater distribution for their Work in
|
||||
part through the use and efforts of others.
|
||||
|
||||
For these and/or other purposes and motivations, and without any
|
||||
expectation of additional consideration or compensation, the person
|
||||
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||
|
||||
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||
protected by copyright and related or neighboring rights ("Copyright and
|
||||
Related Rights"). Copyright and Related Rights include, but are not
|
||||
limited to, the following:
|
||||
|
||||
i. the right to reproduce, adapt, distribute, perform, display,
|
||||
communicate, and translate a Work;
|
||||
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||
iii. publicity and privacy rights pertaining to a person's image or
|
||||
likeness depicted in a Work;
|
||||
iv. rights protecting against unfair competition in regards to a Work,
|
||||
subject to the limitations in paragraph 4(a), below;
|
||||
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||
in a Work;
|
||||
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||
European Parliament and of the Council of 11 March 1996 on the legal
|
||||
protection of databases, and under any national implementation
|
||||
thereof, including any amended or successor version of such
|
||||
directive); and
|
||||
vii. other similar, equivalent or corresponding rights throughout the
|
||||
world based on applicable law or treaty, and any national
|
||||
implementations thereof.
|
||||
|
||||
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||
of action, whether now known or unknown (including existing as well as
|
||||
future claims and causes of action), in the Work (i) in all territories
|
||||
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||
treaty (including future time extensions), (iii) in any current or future
|
||||
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||
including without limitation commercial, advertising or promotional
|
||||
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||
member of the public at large and to the detriment of Affirmer's heirs and
|
||||
successors, fully intending that such Waiver shall not be subject to
|
||||
revocation, rescission, cancellation, termination, or any other legal or
|
||||
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||
as contemplated by Affirmer's express Statement of Purpose.
|
||||
|
||||
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||
be judged legally invalid or ineffective under applicable law, then the
|
||||
Waiver shall be preserved to the maximum extent permitted taking into
|
||||
account Affirmer's express Statement of Purpose. In addition, to the
|
||||
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||
maximum duration provided by applicable law or treaty (including future
|
||||
time extensions), (iii) in any current or future medium and for any number
|
||||
of copies, and (iv) for any purpose whatsoever, including without
|
||||
limitation commercial, advertising or promotional purposes (the
|
||||
"License"). The License shall be deemed effective as of the date CC0 was
|
||||
applied by Affirmer to the Work. Should any part of the License for any
|
||||
reason be judged legally invalid or ineffective under applicable law, such
|
||||
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||
of the License, and in such case Affirmer hereby affirms that he or she
|
||||
will not (i) exercise any of his or her remaining Copyright and Related
|
||||
Rights in the Work or (ii) assert any associated claims and causes of
|
||||
action with respect to the Work, in either case contrary to Affirmer's
|
||||
express Statement of Purpose.
|
||||
|
||||
4. Limitations and Disclaimers.
|
||||
|
||||
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||
surrendered, licensed or otherwise affected by this document.
|
||||
b. Affirmer offers the Work as-is and makes no representations or
|
||||
warranties of any kind concerning the Work, express, implied,
|
||||
statutory or otherwise, including without limitation warranties of
|
||||
title, merchantability, fitness for a particular purpose, non
|
||||
infringement, or the absence of latent or other defects, accuracy, or
|
||||
the present or absence of errors, whether or not discoverable, all to
|
||||
the greatest extent permissible under applicable law.
|
||||
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||
that may apply to the Work or any use thereof, including without
|
||||
limitation any person's Copyright and Related Rights in the Work.
|
||||
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||
consents, permissions or other rights required for any use of the
|
||||
Work.
|
||||
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||
party to this document and has no duty or obligation with respect to
|
||||
this CC0 or use of the Work.
|
||||
117
LICENSES/GPL-2.0-or-later.txt
Normal file
117
LICENSES/GPL-2.0-or-later.txt
Normal file
@@ -0,0 +1,117 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) 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 this service 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 make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. 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.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and modification follow.
|
||||
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions of the 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 a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE 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.
|
||||
|
||||
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 convey 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 an idea of what it does. Copyright (C) yyyy 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 2 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, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author Gnomovision 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, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice
|
||||
@@ -1,2 +1,6 @@
|
||||
SUBDIRS = src man
|
||||
EXTRA_DIST = buildconf
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
SUBDIRS = src man tests bash-completion
|
||||
# EXTRA_DIST = buildconf
|
||||
|
||||
680
Makefile.in
680
Makefile.in
@@ -1,680 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = .
|
||||
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
|
||||
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
|
||||
depcomp install-sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
configure.lineno config.status.lineno
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
|
||||
html-recursive info-recursive install-data-recursive \
|
||||
install-dvi-recursive install-exec-recursive \
|
||||
install-html-recursive install-info-recursive \
|
||||
install-pdf-recursive install-ps-recursive install-recursive \
|
||||
installcheck-recursive installdirs-recursive pdf-recursive \
|
||||
ps-recursive uninstall-recursive
|
||||
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
|
||||
distclean-recursive maintainer-clean-recursive
|
||||
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
|
||||
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
|
||||
distdir dist dist-all distcheck
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
distdir = $(PACKAGE)-$(VERSION)
|
||||
top_distdir = $(distdir)
|
||||
am__remove_distdir = \
|
||||
{ test ! -d "$(distdir)" \
|
||||
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
||||
&& rm -fr "$(distdir)"; }; }
|
||||
am__relativize = \
|
||||
dir0=`pwd`; \
|
||||
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
|
||||
sed_rest='s,^[^/]*/*,,'; \
|
||||
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
|
||||
sed_butlast='s,/*[^/]*$$,,'; \
|
||||
while test -n "$$dir1"; do \
|
||||
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
|
||||
if test "$$first" != "."; then \
|
||||
if test "$$first" = ".."; then \
|
||||
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
|
||||
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
|
||||
else \
|
||||
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
|
||||
if test "$$first2" = "$$first"; then \
|
||||
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
|
||||
else \
|
||||
dir2="../$$dir2"; \
|
||||
fi; \
|
||||
dir0="$$dir0"/"$$first"; \
|
||||
fi; \
|
||||
fi; \
|
||||
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
|
||||
done; \
|
||||
reldir="$$dir2"
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
distcleancheck_listfiles = find . -type f -print
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = src man
|
||||
EXTRA_DIST = buildconf
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
am--refresh:
|
||||
@:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
|
||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
|
||||
&& exit 0; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
echo ' $(SHELL) ./config.status'; \
|
||||
$(SHELL) ./config.status;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
$(am__aclocal_m4_deps):
|
||||
|
||||
config.h: stamp-h1
|
||||
@if test ! -f $@; then \
|
||||
rm -f stamp-h1; \
|
||||
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
|
||||
else :; fi
|
||||
|
||||
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
|
||||
@rm -f stamp-h1
|
||||
cd $(top_builddir) && $(SHELL) ./config.status config.h
|
||||
$(srcdir)/config.h.in: $(am__configure_deps)
|
||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
||||
rm -f stamp-h1
|
||||
touch $@
|
||||
|
||||
distclean-hdr:
|
||||
-rm -f config.h stamp-h1
|
||||
|
||||
# This directory's subdirectories are mostly independent; you can cd
|
||||
# into them and run `make' without going through this Makefile.
|
||||
# To change the values of `make' variables: instead of editing Makefiles,
|
||||
# (1) if the variable is set in `config.status', edit `config.status'
|
||||
# (which will cause the Makefiles to be regenerated when you run `make');
|
||||
# (2) otherwise, pass the desired values on the `make' command line.
|
||||
$(RECURSIVE_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
dot_seen=yes; \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done; \
|
||||
if test "$$dot_seen" = "no"; then \
|
||||
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
|
||||
fi; test -z "$$fail"
|
||||
|
||||
$(RECURSIVE_CLEAN_TARGETS):
|
||||
@fail= failcom='exit 1'; \
|
||||
for f in x $$MAKEFLAGS; do \
|
||||
case $$f in \
|
||||
*=* | --[!k]*);; \
|
||||
*k*) failcom='fail=yes';; \
|
||||
esac; \
|
||||
done; \
|
||||
dot_seen=no; \
|
||||
case "$@" in \
|
||||
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
|
||||
*) list='$(SUBDIRS)' ;; \
|
||||
esac; \
|
||||
rev=''; for subdir in $$list; do \
|
||||
if test "$$subdir" = "."; then :; else \
|
||||
rev="$$subdir $$rev"; \
|
||||
fi; \
|
||||
done; \
|
||||
rev="$$rev ."; \
|
||||
target=`echo $@ | sed s/-recursive//`; \
|
||||
for subdir in $$rev; do \
|
||||
echo "Making $$target in $$subdir"; \
|
||||
if test "$$subdir" = "."; then \
|
||||
local_target="$$target-am"; \
|
||||
else \
|
||||
local_target="$$target"; \
|
||||
fi; \
|
||||
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|
||||
|| eval $$failcom; \
|
||||
done && test -z "$$fail"
|
||||
tags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
|
||||
done
|
||||
ctags-recursive:
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
|
||||
done
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
|
||||
include_option=--etags-include; \
|
||||
empty_fix=.; \
|
||||
else \
|
||||
include_option=--include; \
|
||||
empty_fix=; \
|
||||
fi; \
|
||||
list='$(SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test ! -f $$subdir/TAGS || \
|
||||
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
|
||||
fi; \
|
||||
done; \
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
$(am__remove_distdir)
|
||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
test -d "$(distdir)/$$subdir" \
|
||||
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
|
||||
if test "$$subdir" = .; then :; else \
|
||||
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
|
||||
$(am__relativize); \
|
||||
new_distdir=$$reldir; \
|
||||
dir1=$$subdir; dir2="$(top_distdir)"; \
|
||||
$(am__relativize); \
|
||||
new_top_distdir=$$reldir; \
|
||||
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
|
||||
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
|
||||
($(am__cd) $$subdir && \
|
||||
$(MAKE) $(AM_MAKEFLAGS) \
|
||||
top_distdir="$$new_top_distdir" \
|
||||
distdir="$$new_distdir" \
|
||||
am__remove_distdir=: \
|
||||
am__skip_length_check=: \
|
||||
am__skip_mode_fix=: \
|
||||
distdir) \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
-test -n "$(am__skip_mode_fix)" \
|
||||
|| find "$(distdir)" -type d ! -perm -755 \
|
||||
-exec chmod u+rwx,go+rx {} \; -o \
|
||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
||||
|| chmod -R a+r "$(distdir)"
|
||||
dist-gzip: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-bzip2: distdir
|
||||
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-lzma: distdir
|
||||
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-shar: distdir
|
||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist-zip: distdir
|
||||
-rm -f $(distdir).zip
|
||||
zip -rq $(distdir).zip $(distdir)
|
||||
$(am__remove_distdir)
|
||||
|
||||
dist dist-all: distdir
|
||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
||||
$(am__remove_distdir)
|
||||
|
||||
# This target untars the dist file and tries a VPATH configuration. Then
|
||||
# it guarantees that the distribution is self-contained by making another
|
||||
# tarfile.
|
||||
distcheck: dist
|
||||
case '$(DIST_ARCHIVES)' in \
|
||||
*.tar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
||||
*.tar.bz2*) \
|
||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
||||
*.tar.lzma*) \
|
||||
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
|
||||
*.tar.xz*) \
|
||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
||||
*.tar.Z*) \
|
||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
||||
*.shar.gz*) \
|
||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
||||
mkdir $(distdir)/_build
|
||||
mkdir $(distdir)/_inst
|
||||
chmod a-w $(distdir)
|
||||
test -d $(distdir)/_build || exit 0; \
|
||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
||||
&& am__cwd=`pwd` \
|
||||
&& $(am__cd) $(distdir)/_build \
|
||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
||||
distuninstallcheck \
|
||||
&& chmod -R a-w "$$dc_install_base" \
|
||||
&& ({ \
|
||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
||||
&& rm -rf "$$dc_destdir" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
||||
&& rm -rf $(DIST_ARCHIVES) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
||||
&& cd "$$am__cwd" \
|
||||
|| exit 1
|
||||
$(am__remove_distdir)
|
||||
@(echo "$(distdir) archives ready for distribution: "; \
|
||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
||||
distuninstallcheck:
|
||||
@$(am__cd) '$(distuninstallcheck_dir)' \
|
||||
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|
||||
|| { echo "ERROR: files left after uninstall:" ; \
|
||||
if test -n "$(DESTDIR)"; then \
|
||||
echo " (check DESTDIR support)"; \
|
||||
fi ; \
|
||||
$(distuninstallcheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
distcleancheck: distclean
|
||||
@if test '$(srcdir)' = . ; then \
|
||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
||||
$(distcleancheck_listfiles) ; \
|
||||
exit 1; } >&2
|
||||
check-am: all-am
|
||||
check: check-recursive
|
||||
all-am: Makefile config.h
|
||||
installdirs: installdirs-recursive
|
||||
installdirs-am:
|
||||
install: install-recursive
|
||||
install-exec: install-exec-recursive
|
||||
install-data: install-data-recursive
|
||||
uninstall: uninstall-recursive
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-recursive
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-recursive
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
|
||||
|
||||
dvi: dvi-recursive
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-recursive
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-recursive
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-recursive
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-recursive
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-recursive
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-recursive
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-recursive
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-recursive
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-recursive
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-recursive
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-recursive
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am:
|
||||
|
||||
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
|
||||
ctags-recursive install-am install-strip tags-recursive
|
||||
|
||||
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
|
||||
all all-am am--refresh check check-am clean clean-generic \
|
||||
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
|
||||
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
||||
distclean distclean-generic distclean-hdr distclean-tags \
|
||||
distcleancheck distdir distuninstallcheck dvi dvi-am html \
|
||||
html-am info info-am install install-am install-data \
|
||||
install-data-am install-dvi install-dvi-am install-exec \
|
||||
install-exec-am install-html install-html-am install-info \
|
||||
install-info-am install-man install-pdf install-pdf-am \
|
||||
install-ps install-ps-am install-strip installcheck \
|
||||
installcheck-am installdirs installdirs-am maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
|
||||
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
17
README
17
README
@@ -1,17 +0,0 @@
|
||||
SCSI Tape Encryption program. Sets and retrieves encryption settings
|
||||
on certain SCSI devices with hardware based encryption. See INSTALL for
|
||||
general installation instructions.
|
||||
|
||||
For additional information run 'man stenc' after installation.
|
||||
|
||||
Program copyright 2012 contributing authors.
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
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.
|
||||
|
||||
86
README.md
Normal file
86
README.md
Normal file
@@ -0,0 +1,86 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 stenc authors
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
-->
|
||||
|
||||
[](https://api.reuse.software/info/github.com/scsitape/stenc/)
|
||||
|
||||
Stenc
|
||||
-----
|
||||
|
||||
SCSI Tape Encryption Manager - Manages hardware encryption on LTO tape drives (starting with generation 4).
|
||||
Program should work on any other SCSI security protocol (SSP) capable tape drives.
|
||||
Supports key change auditing and key descriptors (uKAD).
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* SCSI hardware-based encryption management
|
||||
* Supports Linux and FreeBSD
|
||||
* Supports most SSP compliant devices, such as LTO-4 tape drives
|
||||
* Key change audit logging
|
||||
* AES Encryption
|
||||
* Key Descriptor Management
|
||||
|
||||
Get the source code and compile
|
||||
-------------------------------
|
||||
|
||||
```
|
||||
git clone https://github.com/scsitape/stenc.git
|
||||
cd stenc/
|
||||
autoreconf --install
|
||||
./autogen.sh && ./configure
|
||||
make check # optionally run the catch testing framework
|
||||
make
|
||||
```
|
||||
|
||||
Usage example
|
||||
-------------
|
||||
|
||||
```
|
||||
$ stenc -f /dev/nst0
|
||||
Status for /dev/nst0 (TANDBERG LTO-6 HH 3579)
|
||||
--------------------------------------------------
|
||||
Reading: Decrypting (AES-256-GCM-128)
|
||||
Writing: Encrypting (AES-256-GCM-128)
|
||||
Protecting from raw read
|
||||
Key instance counter: 1
|
||||
Drive key desc. (U-KAD): mykey20170113
|
||||
Supported algorithms:
|
||||
1 AES-256-GCM-128
|
||||
Key descriptors allowed, maximum 32 bytes
|
||||
Raw decryption mode allowed, raw read enabled by default
|
||||
```
|
||||
|
||||
Linux Packages
|
||||
--------------
|
||||
[](https://repology.org/metapackage/stenc)
|
||||
|
||||
Requirements
|
||||
------------
|
||||
AIX support was suspended on 2022-05-08 until we have contributors who can develop and test the code on AIX.
|
||||
|
||||
License
|
||||
-------
|
||||
Program copyright 2012-2022 contributing authors.
|
||||
|
||||
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; version 2 of the License.
|
||||
|
||||
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.
|
||||
|
||||
Further reading
|
||||
---------------
|
||||
|
||||
IBM Tape Library Guide for Open Systems
|
||||
ISBN-13: 9780738458342
|
||||
http://www.redbooks.ibm.com/abstracts/sg245946.html?Open
|
||||
|
||||
|
||||
SCSI-Programming-HOWTO
|
||||
https://tldp.org/HOWTO/archived/SCSI-Programming-HOWTO/SCSI-Programming-HOWTO-9.html
|
||||
951
aclocal.m4
vendored
951
aclocal.m4
vendored
@@ -1,951 +0,0 @@
|
||||
# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
|
||||
[m4_warning([this file was generated for autoconf 2.67.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically `autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
# (This private macro should not be called outside this file.)
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.11'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.11.1], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
# _AM_AUTOCONF_VERSION(VERSION)
|
||||
# -----------------------------
|
||||
# aclocal traces this macro to find the Autoconf version.
|
||||
# This is a private macro too. Using m4_define simplifies
|
||||
# the logic in aclocal, which can simply ignore this definition.
|
||||
m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.11.1])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 9
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])dnl
|
||||
AC_SUBST([$1_FALSE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
|
||||
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
|
||||
m4_define([_AM_COND_VALUE_$1], [$2])dnl
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 10
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], UPC, [depcc="$UPC" am_compiler_list=],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
am__universal=false
|
||||
m4_case([$1], [CC],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac],
|
||||
[CXX],
|
||||
[case " $depcc " in #(
|
||||
*\ -arch\ *\ -arch\ *) am__universal=true ;;
|
||||
esac])
|
||||
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this. Also, some Intel
|
||||
# versions had trouble with output in subdirs
|
||||
am__obj=sub/conftest.${OBJEXT-o}
|
||||
am__minus_obj="-o $am__obj"
|
||||
case $depmode in
|
||||
gcc)
|
||||
# This depmode causes a compiler race in universal mode.
|
||||
test "$am__universal" = false || continue
|
||||
;;
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
msvisualcpp | msvcmsys)
|
||||
# This compiler won't grok `-c -o', but also, the minuso test has
|
||||
# not run yet. These depmodes are late enough in the game, and
|
||||
# so weak that their functioning should not be impacted.
|
||||
am__obj=conftest.${OBJEXT-o}
|
||||
am__minus_obj=
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=$am__obj \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 5
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[{
|
||||
# Autoconf 2.62 quotes --file arguments for eval, but not when files
|
||||
# are listed without --file. Let's play safe and only enable the eval
|
||||
# if we detect the quoting.
|
||||
case $CONFIG_FILES in
|
||||
*\'*) eval set x "$CONFIG_FILES" ;;
|
||||
*) set x $CONFIG_FILES ;;
|
||||
esac
|
||||
shift
|
||||
for mf
|
||||
do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# Grep'ing the whole file is not good either: AIX grep has a line
|
||||
# limit of 2048, but all sed's we know have understand at least 4000.
|
||||
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
}
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 16
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.62])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`"; then
|
||||
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
|
||||
# is not polluted with repeated "-I."
|
||||
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
|
||||
[_AM_DEPENDENCIES(OBJC)],
|
||||
[define([AC_PROG_OBJC],
|
||||
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
|
||||
])
|
||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
|
||||
dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
|
||||
dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
|
||||
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
|
||||
AC_CONFIG_COMMANDS_PRE(dnl
|
||||
[m4_provide_if([_AM_COMPILER_EXEEXT],
|
||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
|
||||
])
|
||||
|
||||
dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
|
||||
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
|
||||
dnl mangled by Autoconf and run in a shell conditional statement.
|
||||
m4_define([_AC_COMPILER_EXEEXT],
|
||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_arg=$1
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$_am_arg | $_am_arg:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
if test x"${install_sh}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
|
||||
*)
|
||||
install_sh="\${SHELL} $am_aux_dir/install-sh"
|
||||
esac
|
||||
fi
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo this is the am__doit target
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# Ignore all kinds of additional output from `make'.
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
;;
|
||||
esac
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
case `$am_make -s -f confmf 2> /dev/null` in #(
|
||||
*the\ am__doit\ target*)
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 6
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check for `mkdir -p'.
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[AC_PREREQ([2.60])dnl
|
||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
|
||||
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
|
||||
dnl while keeping a definition of mkdir_p for backward compatibility.
|
||||
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
|
||||
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
|
||||
dnl Makefile.ins that do not define MKDIR_P, so we do our own
|
||||
dnl adjustment using top_builddir (which is defined more often than
|
||||
dnl MKDIR_P).
|
||||
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
|
||||
case $mkdir_p in
|
||||
[[\\/$]]* | ?:[[\\/]]*) ;;
|
||||
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
|
||||
esac
|
||||
])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 5
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Reject unsafe characters in $srcdir or the absolute working directory
|
||||
# name. Accept space and tab only in the latter.
|
||||
am_lf='
|
||||
'
|
||||
case `pwd` in
|
||||
*[[\\\"\#\$\&\'\`$am_lf]]*)
|
||||
AC_MSG_ERROR([unsafe absolute working directory name]);;
|
||||
esac
|
||||
case $srcdir in
|
||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
|
||||
AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
|
||||
esac
|
||||
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t "$srcdir/configure" conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006, 2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
|
||||
# This macro is traced by Automake.
|
||||
AC_DEFUN([_AM_SUBST_NOTMAKE])
|
||||
|
||||
# AM_SUBST_NOTMAKE(VARIABLE)
|
||||
# ---------------------------
|
||||
# Public sister of _AM_SUBST_NOTMAKE.
|
||||
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
7
autogen.sh
Executable file
7
autogen.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
autoreconf --install || exit 1
|
||||
8
bash-completion/Makefile.am
Normal file
8
bash-completion/Makefile.am
Normal file
@@ -0,0 +1,8 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
if ENABLE_BASH_COMPLETION
|
||||
bashcompletiondir = $(BASH_COMPLETION_DIR)
|
||||
dist_bashcompletion_DATA = stenc
|
||||
endif
|
||||
49
bash-completion/stenc
Normal file
49
bash-completion/stenc
Normal file
@@ -0,0 +1,49 @@
|
||||
#/usr/bin/env bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#stenc bash completion
|
||||
|
||||
_stenc () {
|
||||
local cur prev words cword
|
||||
_init_completion || return
|
||||
|
||||
COMPREPLY=()
|
||||
|
||||
case $prev in
|
||||
--version )
|
||||
return
|
||||
;;
|
||||
-f )
|
||||
#list tape devices
|
||||
if [[ $(uname) == Linux ]]; then
|
||||
for tape in /sys/class/scsi_tape/*;
|
||||
do devs+="/dev/${tape##*/} ";
|
||||
done;
|
||||
COMPREPLY=($(compgen -W "$devs" -- "$cur"))
|
||||
else
|
||||
_filedir
|
||||
fi
|
||||
return
|
||||
;;
|
||||
-e | --encrypt )
|
||||
COMPREPLY=($(compgen -W 'off on' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
-d | --decrypt )
|
||||
COMPREPLY=($(compgen -W 'off on mixed' -- "$cur"))
|
||||
return
|
||||
;;
|
||||
-k | --key-file )
|
||||
_filedir
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ $cur == -* ]]; then
|
||||
COMPREPLY=($(compgen -W '-f --file -e --encrypt -d --decrypt -k --key-file -a --algorithm --allow-raw-read --no-allow-raw-read --ckod -h --help --version' -- "$cur"))
|
||||
return
|
||||
fi
|
||||
}
|
||||
complete -F _stenc stenc
|
||||
@@ -1,6 +0,0 @@
|
||||
#! /bin/sh
|
||||
aclocal
|
||||
autoconf
|
||||
autoheader
|
||||
automake --add-missing --copy
|
||||
|
||||
55
config.h.in
55
config.h.in
@@ -1,55 +0,0 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define if you want to debug SCSI Communication */
|
||||
#undef DEBUGSCSI
|
||||
|
||||
/* "" */
|
||||
#undef DEFAULT_ALGORITHM
|
||||
|
||||
/* "" */
|
||||
#undef DEFAULT_CEEM
|
||||
|
||||
/* "" */
|
||||
#undef DEFAULT_KEYSIZE
|
||||
|
||||
/* "" */
|
||||
#undef DISABLE_DEVICE_NAME_CONVERSION
|
||||
|
||||
/* "" */
|
||||
#undef MAX_TAPE_READ_BLOCKS
|
||||
|
||||
/* "" */
|
||||
#undef OS_AIX
|
||||
|
||||
/* "" */
|
||||
#undef OS_LINUX
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* "" */
|
||||
#undef SWAPBIT
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
66
configure.ac
Normal file
66
configure.ac
Normal file
@@ -0,0 +1,66 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
AC_INIT([stenc],[2.0.0])
|
||||
AC_CONFIG_SRCDIR([src/main.cpp])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])]
|
||||
AC_CHECK_HEADERS
|
||||
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
|
||||
# Checks for programs
|
||||
AC_PROG_CXX
|
||||
|
||||
AC_MSG_CHECKING(whether to output raw SCSI messages)
|
||||
AC_ARG_WITH([scsi-debug],
|
||||
[AS_HELP_STRING([--with-scsi-debug],[enable scsi communication debug])],
|
||||
[AC_DEFINE([DEBUGSCSI],[1],[Define if you want to debug SCSI Communication])
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(your OS)
|
||||
system=`uname`
|
||||
case $system in
|
||||
Linux)
|
||||
AC_DEFINE(OS_LINUX,1,"")
|
||||
AC_MSG_RESULT(Linux)
|
||||
;;
|
||||
FreeBSD)
|
||||
AC_DEFINE(OS_FREEBSD,1,"")
|
||||
AC_MSG_RESULT(FreeBSD)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR(unknown OS type: $system)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING(whether to build with static libgcc)
|
||||
AC_ARG_WITH([static-libgcc],
|
||||
[AS_HELP_STRING([--with-static-libgcc],[build with static libgcc library])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
LDFLAGS="${LDFLAGS} -static-libgcc -Wl,-static -lstdc++ -lsupc++"
|
||||
],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_CHECK_PROG(PANDOC, [pandoc], [yes])
|
||||
AM_CONDITIONAL([FOUND_PANDOC], [test "x$PANDOC" = xyes])
|
||||
AM_COND_IF([FOUND_PANDOC],,[AC_MSG_ERROR([required program 'pandoc' not found.])])
|
||||
|
||||
if test "${system}" = "FreeBSD"; then
|
||||
LIBS="${LIBS} -lcam"
|
||||
fi
|
||||
|
||||
# BASH completion
|
||||
PKG_CHECK_VAR([BASH_COMPLETION_DIR], [bash-completion >= 2.0], [completionsdir],
|
||||
[
|
||||
with_bash_completion_dir=yes;
|
||||
AC_MSG_NOTICE(BASH_COMPLETION_DIR is $BASH_COMPLETION_DIR);
|
||||
AC_SUBST([BASH_COMPLETION_DIR])
|
||||
],
|
||||
[with_bash_completion_dir=no])
|
||||
|
||||
AM_CONDITIONAL([ENABLE_BASH_COMPLETION],[test "x$with_bash_completion_dir" != "xno"])
|
||||
|
||||
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile tests/Makefile bash-completion/Makefile])
|
||||
AC_OUTPUT
|
||||
115
configure.in
115
configure.in
@@ -1,115 +0,0 @@
|
||||
AC_INIT(src/main.cpp)
|
||||
|
||||
PACKAGE=stenc
|
||||
VERSION=1.0.6
|
||||
|
||||
|
||||
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
# Checks for programs
|
||||
AC_PROG_CXX
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
|
||||
AC_MSG_CHECKING(whether to output raw SCSI messages)
|
||||
AC_ARG_WITH([scsi-debug],
|
||||
[AS_HELP_STRING([--with-scsi-debug],[enable scsi communication debug])],
|
||||
[AC_DEFINE([DEBUGSCSI],[1],[Define if you want to debug SCSI Communication])
|
||||
AC_MSG_RESULT(yes)],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(max tape read blocks for volume status)
|
||||
AC_ARG_WITH([max-tape-read-blocks],
|
||||
[AS_HELP_STRING([--with-max-tape-read-blocks=<number>],[how many blocks the tape drive will seek to determine the encryption status on the volume. Defaults to 100])],
|
||||
[AC_DEFINE_UNQUOTED([MAX_TAPE_READ_BLOCKS],$withval,"") AC_MSG_RESULT($withval)],
|
||||
[AC_DEFINE([MAX_TAPE_READ_BLOCKS],100,"") AC_MSG_RESULT(100)])
|
||||
|
||||
AC_MSG_CHECKING(default encryption algorithm index to use)
|
||||
AC_ARG_WITH([default-algorithm],
|
||||
[AS_HELP_STRING([--with-default-algorithm=<number>],[the default algorithm index to set for encryption. Defaults to 0])],
|
||||
[AC_DEFINE_UNQUOTED([DEFAULT_ALGORITHM],$withval,"") AC_MSG_RESULT($withval)],
|
||||
[AC_DEFINE([DEFAULT_ALGORITHM],0,"") AC_MSG_RESULT(0)])
|
||||
|
||||
AC_MSG_CHECKING(default CEEM flag to use)
|
||||
AC_ARG_WITH([default-ceem],
|
||||
[AS_HELP_STRING([--with-default-ceem=<number>],[the default CEEM flag when setting options. Defaults to 0])],
|
||||
[AC_DEFINE_UNQUOTED([DEFAULT_CEEM],$withval,"") AC_MSG_RESULT($withval)],
|
||||
[AC_DEFINE([DEFAULT_CEEM],0,"") AC_MSG_RESULT(0)])
|
||||
AC_MSG_CHECKING(default key size to use)
|
||||
AC_ARG_WITH([default-key-size],
|
||||
[AS_HELP_STRING([--with-default-key-size=<bytes>],[the default key size for your drive. Only used when turning off encryption. Defaults to 32 (256 bit)])],
|
||||
[AC_DEFINE_UNQUOTED([DEFAULT_KEYSIZE],$withval,"") AC_MSG_RESULT($withval)],
|
||||
[AC_DEFINE([DEFAULT_KEYSIZE],32,"") AC_MSG_RESULT(32)])
|
||||
|
||||
|
||||
|
||||
|
||||
AC_MSG_CHECKING(your OS)
|
||||
system=`uname`
|
||||
case $system in
|
||||
Linux)
|
||||
AC_DEFINE(OS_LINUX,1,"")
|
||||
AC_MSG_RESULT(Linux)
|
||||
;;
|
||||
AIX)
|
||||
AC_DEFINE(OS_AIX,1,"")
|
||||
AC_MSG_RESULT(AIX)
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_MSG_CHECKING(whether to build with static libgcc)
|
||||
AC_ARG_WITH([static-libgcc],
|
||||
[AS_HELP_STRING([--with-static-libgcc],[build with static libgcc library])],
|
||||
[
|
||||
AC_MSG_RESULT(yes)
|
||||
if test "${system}" = "AIX"; then
|
||||
LDFLAGS="${LDFLAGS} -static-libgcc -Wl,-bstatic -lstdc++ -Wl,-bdynamic -lsupc++"
|
||||
else
|
||||
LDFLAGS="${LDFLAGS} -static-libgcc -Wl,-static -lstdc++ -lsupc++"
|
||||
|
||||
fi
|
||||
],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
AC_MSG_CHECKING(whether to swap bit order in SCSI structures)
|
||||
AC_ARG_ENABLE([swapbit],
|
||||
[AS_HELP_STRING([--enable-swapbit],[compiles with swapped bit order in structures. Default for AIX.])],
|
||||
[enable_swapbit=$enableval],
|
||||
[
|
||||
if test "${system}" = "AIX"; then
|
||||
enable_swapbit="yes"
|
||||
else
|
||||
enable_swapbit="no"
|
||||
fi
|
||||
|
||||
]
|
||||
)
|
||||
|
||||
if test "$enable_swapbit" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(SWAPBIT,1,"")
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING(whether to convert rewinding device names to non-rewinding device names)
|
||||
AC_ARG_ENABLE([device-name-conversion],
|
||||
[AS_HELP_STRING([--enable-device-name-conversion],[converts /dev/st* to /dev/st*.1 and /dev/rmt* to /dev/rmt*.1 to prevent rewinds. Enabled by default.])],
|
||||
[enable_dnc=$enableval],
|
||||
[enable_dnc="yes"]
|
||||
)
|
||||
|
||||
if test "$enable_dnc" = "yes"; then
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_DEFINE(DISABLE_DEVICE_NAME_CONVERSION,1,"")
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
|
||||
|
||||
AC_OUTPUT(Makefile src/Makefile man/Makefile)
|
||||
|
||||
526
depcomp
526
depcomp
@@ -1,526 +0,0 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2004-04-25.13
|
||||
|
||||
# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit 0
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
# `libtool' can also be set to `yes' or `no'.
|
||||
|
||||
if test -z "$depfile"; then
|
||||
base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
|
||||
dir=`echo "$object" | sed 's,/.*$,/,'`
|
||||
if test "$dir" = "$object"; then
|
||||
dir=
|
||||
fi
|
||||
# FIXME: should be _deps on DOS.
|
||||
depfile="$dir.deps/$base"
|
||||
fi
|
||||
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> $depfile
|
||||
echo >> $depfile
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> $depfile
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
||||
tmpdepfile="$stripped.u"
|
||||
if test "$libtool" = yes; then
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test -f "$tmpdepfile"; then :
|
||||
else
|
||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
||||
tmpdepfile="$stripped.u"
|
||||
fi
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile"; then
|
||||
outname="$stripped.o"
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using \ :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Dependencies are output in .lo.d with libtool 1.4.
|
||||
# They are output in .o.d with libtool 1.5.
|
||||
tmpdepfile1="$dir.libs/$base.lo.d"
|
||||
tmpdepfile2="$dir.libs/$base.o.d"
|
||||
tmpdepfile3="$dir.libs/$base.d"
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1="$dir$base.o.d"
|
||||
tmpdepfile2="$dir$base.d"
|
||||
tmpdepfile3="$dir$base.d"
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
if test -f "$tmpdepfile1"; then
|
||||
tmpdepfile="$tmpdepfile1"
|
||||
elif test -f "$tmpdepfile2"; then
|
||||
tmpdepfile="$tmpdepfile2"
|
||||
else
|
||||
tmpdepfile="$tmpdepfile3"
|
||||
fi
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for `:'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no
|
||||
for arg in "$@"; do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test $1 != '--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o,
|
||||
# because we must use -o when running libtool.
|
||||
"$@" || exit $?
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
325
install-sh
325
install-sh
@@ -1,325 +0,0 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2004-04-01.17
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# `make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch. It can only install one file at a time, a restriction
|
||||
# shared with many OS's install programs.
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
mkdirprog="${MKDIRPROG-mkdir}"
|
||||
|
||||
transformbasename=
|
||||
transform_arg=
|
||||
instcmd="$mvprog"
|
||||
chmodcmd="$chmodprog 0755"
|
||||
chowncmd=
|
||||
chgrpcmd=
|
||||
stripcmd=
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
|
||||
usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 -d DIRECTORIES...
|
||||
|
||||
In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
|
||||
In the second, create the directory path DIR.
|
||||
|
||||
Options:
|
||||
-b=TRANSFORMBASENAME
|
||||
-c copy source (using $cpprog) instead of moving (using $mvprog).
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrp installed files to GROUP.
|
||||
-m MODE $chmod installed files to MODE.
|
||||
-o USER $chown installed files to USER.
|
||||
-s strip installed files (using $stripprog).
|
||||
-t=TRANSFORM
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test -n "$1"; do
|
||||
case $1 in
|
||||
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-c) instcmd=$cpprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-d) dir_arg=true
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--help) echo "$usage"; exit 0;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd=$stripprog
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
|
||||
shift
|
||||
continue;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit 0;;
|
||||
|
||||
*) # When -d is used, all remaining arguments are directories to create.
|
||||
test -n "$dir_arg" && break
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dstarg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dstarg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dstarg=$arg
|
||||
done
|
||||
break;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test -z "$1"; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call `install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
case $src in
|
||||
-*) src=./$src ;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
src=
|
||||
|
||||
if test -d "$dst"; then
|
||||
instcmd=:
|
||||
chmodcmd=
|
||||
else
|
||||
instcmd=$mkdirprog
|
||||
fi
|
||||
else
|
||||
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dstarg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dstarg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst ;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
dst=$dst/`basename "$src"`
|
||||
fi
|
||||
fi
|
||||
|
||||
# This sed command emulates the dirname command.
|
||||
dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
|
||||
|
||||
# Make sure that the destination directory exists.
|
||||
|
||||
# Skip lots of stat calls in the usual case.
|
||||
if test ! -d "$dstdir"; then
|
||||
defaultIFS='
|
||||
'
|
||||
IFS="${IFS-$defaultIFS}"
|
||||
|
||||
oIFS=$IFS
|
||||
# Some sh's can't handle IFS=/ for some reason.
|
||||
IFS='%'
|
||||
set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
|
||||
IFS=$oIFS
|
||||
|
||||
pathcomp=
|
||||
|
||||
while test $# -ne 0 ; do
|
||||
pathcomp=$pathcomp$1
|
||||
shift
|
||||
if test ! -d "$pathcomp"; then
|
||||
$mkdirprog "$pathcomp" || lasterr=$?
|
||||
# mkdir can fail with a `File exist' error in case several
|
||||
# install-sh are creating the directory concurrently. This
|
||||
# is OK.
|
||||
test ! -d "$pathcomp" && { (exit ${lasterr-1}); exit; }
|
||||
fi
|
||||
pathcomp=$pathcomp/
|
||||
done
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
$doit $instcmd "$dst" \
|
||||
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
|
||||
|
||||
else
|
||||
# If we're going to rename the final executable, determine the name now.
|
||||
if test -z "$transformarg"; then
|
||||
dstfile=`basename "$dst"`
|
||||
else
|
||||
dstfile=`basename "$dst" $transformbasename \
|
||||
| sed $transformarg`$transformbasename
|
||||
fi
|
||||
|
||||
# don't allow the sed command to completely eliminate the filename.
|
||||
test -z "$dstfile" && dstfile=`basename "$dst"`
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=$dstdir/_inst.$$_
|
||||
rmtmp=$dstdir/_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
|
||||
trap '(exit $?); exit' 1 2 13 15
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
$doit $instcmd "$src" "$dsttmp" &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $instcmd $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
|
||||
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
|
||||
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
|
||||
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| {
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
if test -f "$dstdir/$dstfile"; then
|
||||
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|
||||
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|
||||
|| {
|
||||
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
|
||||
(exit 1); exit
|
||||
}
|
||||
else
|
||||
:
|
||||
fi
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
|
||||
}
|
||||
}
|
||||
fi || { (exit 1); exit; }
|
||||
done
|
||||
|
||||
# The final little trick to "correctly" pass the exit status to the exit trap.
|
||||
{
|
||||
(exit 0); exit
|
||||
}
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1 +1,19 @@
|
||||
dist_man_MANS = stenc.1
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
man1_MANS = stenc.1
|
||||
|
||||
EXTRA_DIST = stenc.rst
|
||||
|
||||
all: stenc.1
|
||||
|
||||
stenc.1: stenc.rst
|
||||
pandoc --standalone --to man $? -o $@
|
||||
|
||||
clean:
|
||||
rm -f stenc.1
|
||||
|
||||
distclean: clean
|
||||
rm -f Makefile
|
||||
|
||||
|
||||
401
man/Makefile.in
401
man/Makefile.in
@@ -1,401 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
subdir = man
|
||||
DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
man1dir = $(mandir)/man1
|
||||
am__installdirs = "$(DESTDIR)$(man1dir)"
|
||||
NROFF = nroff
|
||||
MANS = $(dist_man_MANS)
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
dist_man_MANS = stenc.1
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu man/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-man1: $(dist_man_MANS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | while read p; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
echo "$$d$$p"; echo "$$p"; \
|
||||
done | \
|
||||
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||
sed 'N;N;s,\n, ,g' | { \
|
||||
list=; while read file base inst; do \
|
||||
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
|
||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
|
||||
fi; \
|
||||
done; \
|
||||
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||
while read files; do \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
|
||||
$(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
|
||||
done; }
|
||||
|
||||
uninstall-man1:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list=''; test -n "$(man1dir)" || exit 0; \
|
||||
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||
sed -n '/\.1[a-z]*$$/p'; \
|
||||
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
|
||||
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||
test -z "$$files" || { \
|
||||
echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@list='$(MANS)'; if test -n "$$list"; then \
|
||||
list=`for p in $$list; do \
|
||||
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
|
||||
if test -n "$$list" && \
|
||||
grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
|
||||
echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
|
||||
grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
|
||||
echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
|
||||
echo " typically \`make maintainer-clean' will remove them" >&2; \
|
||||
exit 1; \
|
||||
else :; fi; \
|
||||
else :; fi
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(MANS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(man1dir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am: install-man
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am:
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man: install-man1
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-man
|
||||
|
||||
uninstall-man: uninstall-man1
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic distclean \
|
||||
distclean-generic distdir dvi dvi-am html html-am info info-am \
|
||||
install install-am install-data install-data-am install-dvi \
|
||||
install-dvi-am install-exec install-exec-am install-html \
|
||||
install-html-am install-info install-info-am install-man \
|
||||
install-man1 install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
|
||||
uninstall-am uninstall-man uninstall-man1
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
122
man/stenc.1
122
man/stenc.1
@@ -1,122 +0,0 @@
|
||||
.TH STENC 1
|
||||
|
||||
.SH NAME
|
||||
|
||||
stenc - SCSI Tape Hardware Encryption Manager
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBstenc\fR \fB\-g\fR \fIlength\fR
|
||||
.br
|
||||
\fBstenc\fR \fB\-f\fR \fIdevice\fR
|
||||
.br
|
||||
\fBstenc\fR \fB\-f\fR \fIdevice\fR \fB\-e\fR \fBon\fR|\fBmixed\fR|\fBrawread\fR [\fB\-a\fR \fIindex\fR] [\fB\-k\fR \fIfile\fR] [\fB\-\-ckod\fR] [\fB\-\-protect\fR | \fB\-\-unprotect\fR] ]
|
||||
.br
|
||||
\fBstenc\fR \fB\-f\fR \fIdevice\fR \fB\-e\fR \fBoff\fR
|
||||
|
||||
.SH AVAILABILITY
|
||||
|
||||
Linux, AIX 5.3
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
Allows you to manage hardware encryption on SSP enabled tape devices (LTO4, LTO5, etc).
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
\fB\-g \fIlength\fR
|
||||
Generates a key file of \fIlength\fR (in bits) containing a random hexadecimal key. After entering this option, you will be required to press random keys followed by the enter key. This will seed the random number generator so that your key is more secure. After that you will be asked for a location to save your key file to (you will need write permissions to that file location). Lastly you can enter an optional key description (see \fIKEY DESCRIPTORS\fR). This key file can then be used with the \fB\-k\fR option. You should not generate a key file over an unsecured remote session. Typically, key files should be set to 256 bits (32 hexadecimal bytes), however your device may only support 128 bits.
|
||||
|
||||
.TP
|
||||
\fB\-f\fR \fIdevice\fR
|
||||
|
||||
Specifies the device to use (i.e. \fI/dev/nst0\fR). Use the \fBlsscsi\fR command to determine the appropriate device to use. You should always use a device name that does not rewind (i.e. use /dev/nst0 instead of /dev/st0, /dev/rmt0.1 instead of /dev/rmt0).
|
||||
|
||||
If this is the only option specified, the status of the device will be displayed. If you are root and the status command fails, either the \fIdevice\fR is incorrect (try another link to the device: \fI/dev/rmt0.1\fR, \fI/dev/nst0\fR, \fI/dev/tape\fR, etc.), a tape may not be in the drive, or the device does not support SCSI Security Protocol. \fBstenc\fR may read up to 100 blocks of the tape, starting at the current position, in order to determine if the volume has been encrypted. For this reason, you should not run the status command while another process is accessing the drive. If the device returns \fIUnable to determine\fR for the volume encryption status, you may need to move to a section of the tape that contains data (i.e. \fBmt -f <device> fsr <count>\fR) or rewind the tape in order for \fBstenc\fR to output the volume status.
|
||||
|
||||
.TP
|
||||
\fB\-e\fR \fBon\fR | \fBmixed\fR | \fBrawread\fR | \fBoff\fR
|
||||
|
||||
Sets the encryption mode for the device specified with \fB\-f\fR option. Successful operations of this type will create an audit entry in the \fI/var/log/stenc\fR file. If \fBoff\fR is not specified and the \fB\-k\fR option is not specified, the program will require the user to enter a hexadecimal key (see \fIKEY INPUT SYNTAX\fR) and an optional key description (see \fIKEY DESCRIPTORS\fR).
|
||||
|
||||
\fBon\fR - The drive will encrypt all data sent to it and will only output data it is able to decrypt, ignoring unencrypted data on the drive.
|
||||
|
||||
\fBmixed\fR - The drive will encrypt all data sent to it and will output both encrypted data and unencrypted data, providing the drive is able to do so.
|
||||
|
||||
\fBrawread\fR - The drive will encrypt all data sent to it and will output unencrypted data and raw encrypted data. You will probably need to have specified \fB\-\-unprotect\fR when the data was written in order to read it with this option. Some drives do not support this option. See the \fB\-\-protect\fR option.
|
||||
|
||||
\fBoff\fR - The drive will neither encrypt data sent to it, or decrypt encrypted data found on the drive. If this command fails you may have switch your algorithm or specify a different default key size when you configure the program
|
||||
|
||||
\fBWARNING:\fR The SCSI device will revert all encryption settings if the device is power cycled (i.e. system is rebooted). You can modify you local startup script (/etc/rc.local, /etc/rc, etc.) to set encryption at reboot. If you do this, you will need to use the \fB\-k\fR option to prevent the system from waiting on the local console user to enter the encryption key.
|
||||
|
||||
.TP
|
||||
\fB\-a\fR \fIindex\fR
|
||||
|
||||
Only valid when turning encryption on (see the \fB\-e\fR option). Specifies the algorithm index to use for the device (defaults to 0). Some devices may fail if this option isn't set to 1 (i.e. HP drives).
|
||||
|
||||
.TP
|
||||
\fB\-\-ckod\fR
|
||||
|
||||
Only valid when turning encryption on (see the \fB\-e\fR option). Instructs the drive to clear its encryption keys when the volume is unmounted.
|
||||
|
||||
.TP
|
||||
\fB\-\-protect\fR | \fB\-\-unprotect\fR
|
||||
|
||||
Only valid when turning encryption on (see the \fB\-e\fR option). Instructs the drive to \fBprotect\fR or \fBunprotect\fR any encrypted data from being raw read. See the \fB\-e rawread\fR option.
|
||||
|
||||
.TP
|
||||
\fB\-k\fR \fIfile\fR
|
||||
|
||||
Only valid when turning encryption on (see the \fB\-e\fR option). Specifies the location of a file containing a hexadecimal key to use for encryption. The \fB\-g\fR option may be used to generate a random key file that can be used with this option. See \fIKEY INPUT SYNTAX\fR. If you are going to use a key file, it should be owned by root ('\fBchown root\fR') and only readable by root ('\fBchmod 600\fR'). \fBstenc\fR automatically chmods key files generated with the \fB\-g\fR option.
|
||||
.SH KEY INPUT SYNTAX
|
||||
.TP
|
||||
|
||||
All keys should be a maximum of 256 bits (32 bytes). \fBstenc\fR requires that all keys are entered using 2 digit hexadecimal bytes, with no delimiters in between bytes. Do not preceed your key input with '0x'. If you try to use a key size that the drive does not support, the command will error. When using a key file, the second line in the file can contain an optional key description that will be displayed with the device status (see the \fB\-f\fR option).
|
||||
|
||||
.TP
|
||||
\fBExample 128 bit Key:\fR
|
||||
000102030405060708090a0b0c0d0e0f
|
||||
|
||||
.TP
|
||||
\fBExample 256 bit Key:\fR
|
||||
000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f
|
||||
|
||||
.SH EXAMPLE
|
||||
.TP
|
||||
\fBstenc -g 256\fR
|
||||
Generate a random 256 bit key file.
|
||||
.TP
|
||||
\fBstenc -f /dev/st0 -e on -k /etc/stenc.key\fR
|
||||
Turns on encryption on /dev/st0 using the key contained in /etc/stenc.key
|
||||
.TP
|
||||
\fBstenc -f /dev/st0 -e on\fR
|
||||
Asks user to input a key in hexadecimal format and then turns on encryption for /dev/st0 using that key
|
||||
.TP
|
||||
\fBstenc -f /dev/st0 -e off\fR
|
||||
Turns off encryption for /dev/st0
|
||||
.TP
|
||||
\fBstenc -f /dev/st0\fR
|
||||
Outputs the encryption status of /dev/st0
|
||||
.TP
|
||||
\fBtail /var/log/stenc\fR
|
||||
Lists the last few key change audit entries
|
||||
|
||||
.SH KEY CHANGE AUDITING
|
||||
Each time a key is changed using this program, a corresponding entry will be entered into the \fI/var/log/stenc\fR file. These entries will have an \fIKey Instance Counter\fR corresponding to the counter listed in the device status (see the \fB\-f\fR option). Each time the key is set, a checksum of that key (or a key description) is also listed in this file. This allows you to know when keys were changed and if the key you are using is the same as a prior key. If an unauthorized party would compromise this log file, your key security would be decreased if checksums were present in the log. To prevent this, you should use key descriptors instead of checksums (see \fIKEY DESCRIPTORS\fR).
|
||||
|
||||
.SH KEY DESCRIPTORS
|
||||
Key descriptors are set when using the \fB\-g\fR option or the \fB\-e\fR option. They will be displayed when retrieving the drive status (see the \fB\-f\fR option). These descriptors will be written to the volume, so they should NEVER contain information that would reduce the security of the key (i.e. a checksum, bitlength, algorithm, a portion of the key). If \fBstenc\fR detects that the volume is encrypted but it cannot decrypt the data, the key descriptor on the volume will be displayed as part of the device status. This can be useful for determining which key goes to which volume.
|
||||
|
||||
.SH AUTHOR
|
||||
Written by \fBJohn Coleman\fR and \fBSamuel Martinez Jr.\fR of SunWest Educational Credit Union.
|
||||
|
||||
.SH REPORTING BUGS
|
||||
Report \fBstenc\fR bugs to \fIninthclowd@users.sourceforge.net\fR.
|
||||
|
||||
.SH COPYRIGHT
|
||||
Copyright 2012 contributing authors. License GPLv2: GNU GPL version 2 <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
|
||||
|
||||
.SH SEE ALSO
|
||||
\fBmt\fR(1L)
|
||||
.br
|
||||
\fBlsscsi\fR(8)
|
||||
|
||||
207
man/stenc.rst
Normal file
207
man/stenc.rst
Normal file
@@ -0,0 +1,207 @@
|
||||
.. SPDX-FileCopyrightText: 2022 stenc authors
|
||||
..
|
||||
.. SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
=================================
|
||||
STENC(1) |General Commands Manual
|
||||
=================================
|
||||
|
||||
NAME
|
||||
====
|
||||
|
||||
stenc - SCSI Tape Hardware Encryption Manager
|
||||
|
||||
SYNOPSIS
|
||||
========
|
||||
|
||||
| **stenc** [**-f** *DEVICE*]
|
||||
| **stenc** [**-f** *DEVICE*] [**-e** *ENC-MODE*] [**-d** *DEC-MODE*] [*OPTIONS*]
|
||||
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
**stenc** manages hardware data encryption on tape devices that support
|
||||
the SCSI security protocol.
|
||||
|
||||
Controlling device encryption
|
||||
-----------------------------
|
||||
|
||||
The encryption mode (what happens to data written to the
|
||||
device), and decryption mode (what happens to data read from the device)
|
||||
can be controlled independently. If only one of the following options is
|
||||
given, the other mode will be inferred to set the encryption and decryption
|
||||
modes in tandem.
|
||||
|
||||
**-e, --encrypt**=\ *ENC-MODE*
|
||||
Sets the encryption mode. *ENC-MODE* is either *off* or *on*.
|
||||
|
||||
**off**
|
||||
Data written to the device will be not encrypted.
|
||||
|
||||
**on**
|
||||
Data written to the device will be encrypted.
|
||||
|
||||
**-d, --decrypt**=\ *DEC-MODE*
|
||||
Sets the decryption mode. *DEC-MODE* is either *off*, *on*, or *mixed*.
|
||||
|
||||
**off**
|
||||
Data read from the device will not be decrypted and only unencrypted
|
||||
tape blocks can be read.
|
||||
|
||||
**on**
|
||||
Data read from the device will be decrypted and only encrypted tape blocks can
|
||||
be read. The drive will only read data it is able to decrypt, and will not
|
||||
read unencrypted data on the drive.
|
||||
|
||||
**mixed**
|
||||
Data read from the device will be decrypted, if needed. Both encrypted and
|
||||
unencrypted tape blocks can be read. The drive will read both encrypted
|
||||
data and unencrypted data, provided the drive is able to do so.
|
||||
|
||||
Viewing device status
|
||||
---------------------
|
||||
|
||||
When neither options to set encryption or decryption mode are given, **stenc**
|
||||
prints the encryption settings, the encryption status of the current block,
|
||||
and capabilities of the device, including a list of supported algorithm indexes.
|
||||
The device may display current block encryption status as *Unable to determine*
|
||||
if the tape is positioned at a filemark or end of tape, in which case it may be
|
||||
necessary to move the tape position using **mt**\ (1).
|
||||
|
||||
OPTIONS
|
||||
=======
|
||||
|
||||
**-f, --file**=\ *DEVICE*
|
||||
Specifies the device to use (e.g. */dev/nst0*, */dev/nsa0*, */dev/rmt0.1*).
|
||||
Use the **lsscsi**\ (8) command on Linux, or **camcontrol**\ (8) on FreeBSD
|
||||
to determine the appropriate device to use. It is recommended to the use a
|
||||
non-rewinding device (i.e. */dev/nst0* instead of */dev/st0*, */dev/rmt0.1*
|
||||
instead of */dev/rmt0*). Typically, only the superuser can access tape
|
||||
devices.
|
||||
|
||||
If this option is omitted, and the environment variable **TAPE** is
|
||||
set, it is used. Otherwise, a default device defined in the system header
|
||||
*mtio.h* is used.
|
||||
|
||||
**-a, --algorithm**=\ *index*
|
||||
Selects the encryption algorithm to use for the device.
|
||||
Changing encryption settings may fail on some devices if this is not a
|
||||
supported algorithm for the drive (e.g. HP drives use an algorithm
|
||||
index of 1). A list of supported algorithms can be obtained by requesting
|
||||
device status. If the device only
|
||||
supports one algorithm, this option may be omitted and **stenc** will use
|
||||
the only choice. Otherwise **stenc** will print the list of supported algorithms
|
||||
and exit if this option is omitted.
|
||||
|
||||
**-k, --key-file**=\ *FILE* \| *-*
|
||||
Read the encryption key and optional key descriptor from *FILE*, or
|
||||
standard input when *FILE* is *-*. If standard input is a terminal,
|
||||
this will prompt for the key and optional key
|
||||
descriptor. This option is required when *ENC-MODE* and *DEC-MODE*
|
||||
are not both *off*. See *KEY INPUT SYNTAX* for the expected format of the
|
||||
key file.
|
||||
|
||||
**--ckod**
|
||||
Clear key on demount. Instructs the device to clear its encryption keys when
|
||||
the tape is unloaded instead of keeping it until the drive is power cycled.
|
||||
This option may only be given if tape media is presently loaded in the
|
||||
device. Some devices may not support this option.
|
||||
|
||||
**--allow-raw-read** \| **--no-allow-raw-read**
|
||||
Instructs the device to mark encrypted blocks written to the tape to allow
|
||||
(or disallow) subsequent raw mode reads. If neither option is given, the
|
||||
device default is used, which can be found by requesting the device status.
|
||||
Some devices may not support these options.
|
||||
|
||||
**-h, --help**
|
||||
Print a usage message and exit.
|
||||
|
||||
**--version**
|
||||
Print version information and exit.
|
||||
|
||||
KEY INPUT SYNTAX
|
||||
================
|
||||
|
||||
**stenc** requires that all keys are entered as text hexadecimal strings,
|
||||
with no delimiters in between bytes. Do not precede your key input with *0x*.
|
||||
When using a key file, the second line in the file can contain an optional
|
||||
key descriptor that will be displayed with the device status (see
|
||||
*KEY DESCRIPTORS*).
|
||||
|
||||
Keys can be generated using any cryptographically secure entropy source,
|
||||
such as the **random**\ (4) device or the **openssl**\ (1SSL) suite of commands.
|
||||
A 256-bit key file can be created with the following command:
|
||||
|
||||
openssl rand -hex 32
|
||||
|
||||
**Example 128 bit key:**
|
||||
|
||||
000102030405060708090a0b0c0d0e0f
|
||||
|
||||
**Example 256 bit key:**
|
||||
|
||||
000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f
|
||||
|
||||
**Example 256 key file with key descriptor:**
|
||||
|
||||
| 000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f
|
||||
| April backup key
|
||||
|
||||
KEY DESCRIPTORS
|
||||
===============
|
||||
|
||||
A key file (see *KEY INPUT SYNTAX*) can optionally include a key descriptor.
|
||||
The descriptor will be written with each tape block, and will be displayed
|
||||
when retrieving the drive status, so it should *never* contain information
|
||||
that would reduce the security of the key (i.e. a checksum or any portion of
|
||||
the key). If **stenc** detects a tape block is encrypted but it cannot decrypt
|
||||
the data, the key descriptor of the current block, if any, will be displayed
|
||||
as part of the device status. This can be useful for determining which key
|
||||
is used.
|
||||
|
||||
KEY CHANGE AUDITING
|
||||
===================
|
||||
|
||||
Each time device encryption settings are changed, **stenc** will write an
|
||||
entry to the system log. These entries will have a *Key Instance Counter*
|
||||
corresponding to the counter listed in the device status. Each time the key
|
||||
is set, the key descriptor, if any, is also written to the log. This allows
|
||||
you to know when keys were changed and if the key you are using is the same
|
||||
as a prior key.
|
||||
|
||||
EXAMPLE
|
||||
=======
|
||||
|
||||
**stenc -f /dev/nst0 -e on -d on -k /etc/stenc.key**
|
||||
Turns on encryption and decryption for */dev/nst0* using the key
|
||||
in */etc/stenc.key*
|
||||
|
||||
**stenc -f /dev/nst0 -e on -d mixed -k -**
|
||||
Asks user to input a key in hexadecimal format and then turns on
|
||||
encryption, with mixed decryption mode, for */dev/nst0*
|
||||
|
||||
**stenc -f /dev/nst0 -e off -d off**
|
||||
Turns off encryption and decryption for */dev/nst0*
|
||||
|
||||
**stenc -f /dev/nst0**
|
||||
Prints the encryption status of */dev/nst0*
|
||||
|
||||
BUGS
|
||||
====
|
||||
|
||||
Report bugs to **https://github.com/scsitape/stenc/issues**
|
||||
|
||||
COPYRIGHT
|
||||
=========
|
||||
|
||||
Copyright 2012-2022 contributing authors. License GPLv2: GNU GPL version 2
|
||||
<http://gnu.org/licenses/gpl.html>. This is free software: you are free
|
||||
to change and redistribute it. There is NO WARRANTY, to the extent
|
||||
permitted by law.
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
|
||||
| **openssl**\ (1SSL)
|
||||
| **mt**\ (1)
|
||||
| **lsscsi**\ (8)
|
||||
360
missing
360
missing
@@ -1,360 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Common stub for a few missing GNU programs while installing.
|
||||
|
||||
scriptversion=2003-09-02.23
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
|
||||
# Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case "$1" in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case "$1" in
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aclocal*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case "$f" in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
|
||||
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison|yacc)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f y.tab.h ]; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if [ ! -f y.tab.c ]; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex|flex)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if [ $# -ne 1 ]; then
|
||||
eval LASTARG="\${$#}"
|
||||
case "$LASTARG" in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if [ -f "$SRCFILE" ]; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if [ ! -f lex.yy.c ]; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
|
||||
fi
|
||||
if [ -f "$file" ]; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo)
|
||||
if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
|
||||
# We have makeinfo, but it failed.
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
|
||||
if test -z "$file"; then
|
||||
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
|
||||
fi
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar)
|
||||
shift
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case "$firstarg" in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case "$firstarg" in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-end: "$"
|
||||
# End:
|
||||
@@ -1,4 +1,8 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
bin_PROGRAMS = stenc
|
||||
AM_CXXFLAGS = $(INTI_CFLAGS) $(DEPS_CFLAGS)
|
||||
stenc_SOURCES = main.cpp scsiencrypt.cpp scsiencrypt.h keyinfo.h keyinfo.cpp
|
||||
AM_CXXFLAGS = -std=c++17 $(INTI_CFLAGS) $(DEPS_CFLAGS)
|
||||
stenc_SOURCES = main.cpp scsiencrypt.cpp scsiencrypt.h
|
||||
#stenc_LDADD = $(INTI_LIBS)
|
||||
|
||||
463
src/Makefile.in
463
src/Makefile.in
@@ -1,463 +0,0 @@
|
||||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
bin_PROGRAMS = stenc$(EXEEXT)
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.in
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
PROGRAMS = $(bin_PROGRAMS)
|
||||
am_stenc_OBJECTS = main.$(OBJEXT) scsiencrypt.$(OBJEXT) \
|
||||
keyinfo.$(OBJEXT)
|
||||
stenc_OBJECTS = $(am_stenc_OBJECTS)
|
||||
stenc_LDADD = $(LDADD)
|
||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||
am__depfiles_maybe = depfiles
|
||||
am__mv = mv -f
|
||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
||||
CXXLD = $(CXX)
|
||||
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
|
||||
-o $@
|
||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||
CCLD = $(CC)
|
||||
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||
SOURCES = $(stenc_SOURCES)
|
||||
DIST_SOURCES = $(stenc_SOURCES)
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
AMTAR = @AMTAR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CXX = @CXX@
|
||||
CXXDEPMODE = @CXXDEPMODE@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
GREP = @GREP@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
OBJEXT = @OBJEXT@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_URL = @PACKAGE_URL@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
STRIP = @STRIP@
|
||||
VERSION = @VERSION@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_CXX = @ac_ct_CXX@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build_alias = @build_alias@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host_alias = @host_alias@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target_alias = @target_alias@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
AM_CXXFLAGS = $(INTI_CFLAGS) $(DEPS_CFLAGS)
|
||||
stenc_SOURCES = main.cpp scsiencrypt.cpp scsiencrypt.h keyinfo.h keyinfo.cpp
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .o .obj
|
||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu src/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-binPROGRAMS: $(bin_PROGRAMS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed 's/$(EXEEXT)$$//' | \
|
||||
while read p p1; do if test -f $$p; \
|
||||
then echo "$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
|
||||
sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) files[d] = files[d] " " $$1; \
|
||||
else { print "f", $$3 "/" $$4, $$1; } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-binPROGRAMS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
|
||||
-e 's/$$/$(EXEEXT)/' `; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
clean-binPROGRAMS:
|
||||
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
|
||||
stenc$(EXEEXT): $(stenc_OBJECTS) $(stenc_DEPENDENCIES)
|
||||
@rm -f stenc$(EXEEXT)
|
||||
$(CXXLINK) $(stenc_OBJECTS) $(stenc_LDADD) $(LIBS)
|
||||
|
||||
mostlyclean-compile:
|
||||
-rm -f *.$(OBJEXT)
|
||||
|
||||
distclean-compile:
|
||||
-rm -f *.tab.c
|
||||
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/keyinfo.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scsiencrypt.Po@am__quote@
|
||||
|
||||
.cpp.o:
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
|
||||
.cpp.obj:
|
||||
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||
|
||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
mkid -fID $$unique
|
||||
tags: TAGS
|
||||
|
||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
set x; \
|
||||
here=`pwd`; \
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
shift; \
|
||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||
test -n "$$unique" || unique=$$empty_fix; \
|
||||
if test $$# -gt 0; then \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
"$$@" $$unique; \
|
||||
else \
|
||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||
$$unique; \
|
||||
fi; \
|
||||
fi
|
||||
ctags: CTAGS
|
||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
||||
$(TAGS_FILES) $(LISP)
|
||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | \
|
||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
||||
test -z "$(CTAGS_ARGS)$$unique" \
|
||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(PROGRAMS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-tags
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-binPROGRAMS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -rf ./$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-binPROGRAMS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
|
||||
clean-generic ctags distclean distclean-compile \
|
||||
distclean-generic distclean-tags distdir dvi dvi-am html \
|
||||
html-am info info-am install install-am install-binPROGRAMS \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
install-exec install-exec-am install-html install-html-am \
|
||||
install-info install-info-am install-man install-pdf \
|
||||
install-pdf-am install-ps install-ps-am install-strip \
|
||||
installcheck installcheck-am installdirs maintainer-clean \
|
||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
|
||||
uninstall-am uninstall-binPROGRAMS
|
||||
|
||||
#stenc_LDADD = $(INTI_LIBS)
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
||||
123
src/keyinfo.cpp
123
src/keyinfo.cpp
@@ -1,123 +0,0 @@
|
||||
#include <config.h>
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include "keyinfo.h"
|
||||
#include "scsiencrypt.h"
|
||||
using namespace std;
|
||||
|
||||
Keyinfo::Keyinfo(){
|
||||
valid=false;
|
||||
check="";
|
||||
key=NULL;
|
||||
keySize=0;
|
||||
}
|
||||
void Keyinfo::load(string hexinput){
|
||||
valid=true;
|
||||
if(hexinput.size()<2){
|
||||
valid=false;
|
||||
cout<<"Key input too short!"<<endl;
|
||||
return;
|
||||
|
||||
}
|
||||
//parse for invalid characters
|
||||
for(unsigned int i=0;i<hexinput.size();i++){
|
||||
switch((unsigned char)hexinput.at(i)){
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
break;
|
||||
default:
|
||||
cout<<"Invalid character '"<<hexinput.at(i)<<"' found in key!"<<endl;
|
||||
valid=false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// delete the key if its already allocated
|
||||
if(key!=NULL)
|
||||
delete key;
|
||||
// check that the input size is divisible by 2
|
||||
if(hexinput.size()%2!=0){
|
||||
valid=false;
|
||||
cout<<"Each hexadecimal byte must consist of 2 digits!"<<endl;
|
||||
return;
|
||||
}
|
||||
//convert the hex input to a char*
|
||||
loadKey(hexinput);
|
||||
//load the check value
|
||||
loadCheck();
|
||||
//check for oversized key
|
||||
if(keySize==0 || keySize>SSP_KEY_LENGTH){
|
||||
cout<<"Key size cannot exceed "<<(SSP_KEY_LENGTH*8)<<" bits!"<<endl;
|
||||
cout<<"Provided key is "<<(keySize*8)<<" bits in length."<<endl;
|
||||
valid=false;
|
||||
return;
|
||||
}
|
||||
cout<<"Provided key length is "<<(keySize*8)<<" bits."<<endl;
|
||||
cout<<"Key checksum is "<<check<<"."<<endl;
|
||||
|
||||
|
||||
}
|
||||
void Keyinfo::loadCheck() {
|
||||
int i;
|
||||
int chk = 0;
|
||||
for (i = 0; i<keySize;i++) {
|
||||
chk += ((int)key[i]) * (i + 1);
|
||||
}
|
||||
stringstream retval;
|
||||
retval<<hex<<chk;
|
||||
check=retval.str();
|
||||
}
|
||||
Keyinfo::~Keyinfo(){
|
||||
delete key;
|
||||
}
|
||||
void Keyinfo::loadKey(string str)
|
||||
{
|
||||
int length = str.size();
|
||||
// make sure the input string has an even digit numbers
|
||||
if(length%2 == 1)
|
||||
{
|
||||
str = "0" + str;
|
||||
length++;
|
||||
}
|
||||
|
||||
// allocate memory for the output array
|
||||
key = new char[length/2];
|
||||
memset(key,0,(length/2)+1);
|
||||
keySize = length/2;
|
||||
|
||||
stringstream sstr(str);
|
||||
for(int i=0; i < keySize; i++)
|
||||
{
|
||||
char ch1, ch2;
|
||||
sstr >> ch1 >> ch2;
|
||||
int dig1=0, dig2=0;
|
||||
if(isdigit(ch1)) dig1 = ch1 - '0';
|
||||
else if(ch1>='A' && ch1<='F') dig1 = ch1 - 'A' + 10;
|
||||
else if(ch1>='a' && ch1<='f') dig1 = ch1 - 'a' + 10;
|
||||
if(isdigit(ch2)) dig2 = ch2 - '0';
|
||||
else if(ch2>='A' && ch2<='F') dig2 = ch2 - 'A' + 10;
|
||||
else if(ch2>='a' && ch2<='f') dig2 = ch2 - 'a' + 10;
|
||||
key[i] = dig1*16 + dig2;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef KEYINFO_H
|
||||
#define KEYINFO_H
|
||||
#include <string>
|
||||
|
||||
class Keyinfo{
|
||||
public:
|
||||
char* key;
|
||||
int keySize;
|
||||
bool valid;
|
||||
std::string check;
|
||||
void load(std::string hexinput);
|
||||
Keyinfo();
|
||||
~Keyinfo();
|
||||
private:
|
||||
void loadKey(std::string str);
|
||||
void loadCheck();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
1232
src/main.cpp
1232
src/main.cpp
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2022 stenc authors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*
|
||||
Header file to send and recieve SPIN/SPOUT commands to SCSI device
|
||||
|
||||
@@ -13,593 +17,433 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <string>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <type_traits>
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifdef OS_AIX //AIX
|
||||
#define _LINUX_SOURCE_COMPAT
|
||||
#include <sys/scsi.h>
|
||||
#include <sys/scsi_buf.h>
|
||||
#include <sys/tape.h>
|
||||
#include <sys/Atape.h>
|
||||
#define SCSI_TIMEOUT 5
|
||||
#else //Linux
|
||||
#include <scsi/sg.h>
|
||||
#include <scsi/scsi.h>
|
||||
#define SCSI_TIMEOUT 5000
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/mtio.h>
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include <scsi/sg.h>
|
||||
constexpr unsigned int SCSI_TIMEOUT {5000u};
|
||||
#elif defined(OS_FREEBSD)
|
||||
#include <cam/scsi/scsi_message.h>
|
||||
#include <camlib.h>
|
||||
constexpr unsigned int SCSI_TIMEOUT {5000u};
|
||||
constexpr unsigned int RETRYCOUNT {1u};
|
||||
#else
|
||||
#error "OS type is not set"
|
||||
#endif
|
||||
|
||||
#include "scsiencrypt.h"
|
||||
|
||||
constexpr std::uint8_t SSP_SPIN_OPCODE {0xa2};
|
||||
constexpr std::uint8_t SSP_SPOUT_OPCODE {0xb5};
|
||||
constexpr std::uint8_t SSP_SP_PROTOCOL_TDE {0x20};
|
||||
|
||||
#define SSP_SPIN_OPCODE 0XA2
|
||||
#define SSP_SPOUT_OPCODE 0XB5
|
||||
#define SSP_SP_CMD_LEN 12
|
||||
#define SSP_SP_PROTOCOL_TDE 0X20
|
||||
#define BSINTTOCHAR(x) \
|
||||
static_cast<std::uint8_t>((x) >> 24), static_cast<std::uint8_t>((x) >> 16), \
|
||||
static_cast<std::uint8_t>((x) >> 8), static_cast<std::uint8_t>((x))
|
||||
|
||||
// generic_deleter permits the use of std::unique_ptr for RAII on non-pointer
|
||||
// types like file descriptors.
|
||||
template <typename T, T null_value, typename Deleter, Deleter d>
|
||||
struct generic_deleter {
|
||||
class pointer {
|
||||
T t;
|
||||
|
||||
#define BSINTTOCHAR(x) (unsigned char)((x & 0xff000000)>>24), (unsigned char)((x & 0x00ff0000)>>16),(unsigned char)((x & 0x0000ff00)>>8),(unsigned char)(x & 0x000000ff)
|
||||
public:
|
||||
pointer() : t {null_value} {}
|
||||
pointer(T t) : t {t} {}
|
||||
pointer(std::nullptr_t) : t {null_value} {}
|
||||
explicit operator bool() const noexcept { return t != null_value; }
|
||||
friend bool operator==(pointer lhs, pointer rhs) noexcept
|
||||
{
|
||||
return lhs.t == rhs.t;
|
||||
}
|
||||
friend bool operator!=(pointer lhs, pointer rhs) noexcept
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
operator T() const noexcept { return t; }
|
||||
};
|
||||
|
||||
void operator()(pointer p) const noexcept { d(p); }
|
||||
};
|
||||
using unique_fd =
|
||||
std::unique_ptr<int, generic_deleter<int, -1, decltype(&close), &close>>;
|
||||
|
||||
using namespace std;
|
||||
enum class scsi_direction { to_device, from_device };
|
||||
|
||||
struct hex {
|
||||
std::uint8_t value;
|
||||
};
|
||||
|
||||
void byteswap(unsigned char* array,int size,int value);
|
||||
bool moveTape(std::string tapeDevice,int count,bool dirForward);
|
||||
void outputSense(SCSI_PAGE_SENSE* sd);
|
||||
void readIOError(int err);
|
||||
|
||||
bool SCSIExecute(string tapedevice, unsigned char* cmd_p,int cmd_len,unsigned char* dxfer_p,int dxfer_len, bool cmd_to_device, bool show_error);
|
||||
|
||||
typedef struct { //structure for setting data encryption
|
||||
unsigned char pageCode [2];
|
||||
unsigned char length [2];
|
||||
|
||||
#ifdef SWAPBIT
|
||||
unsigned char scope :3;
|
||||
unsigned char res_bits_1 :4;
|
||||
unsigned char lock :1;
|
||||
#else
|
||||
unsigned char lock :1;
|
||||
unsigned char res_bits_1 :4;
|
||||
unsigned char scope :3;
|
||||
#endif
|
||||
|
||||
#ifdef SWAPBIT
|
||||
unsigned char CEEM :2;
|
||||
unsigned char RDMC :2;
|
||||
unsigned char sdk :1;
|
||||
unsigned char ckod :1;
|
||||
unsigned char ckorp :1;
|
||||
unsigned char ckorl :1;
|
||||
#else
|
||||
unsigned char ckorl :1;
|
||||
unsigned char ckorp :1;
|
||||
unsigned char ckod :1;
|
||||
unsigned char sdk :1;
|
||||
unsigned char RDMC :2;
|
||||
unsigned char CEEM :2;
|
||||
#endif
|
||||
unsigned char encryptionMode;
|
||||
unsigned char decryptionMode;
|
||||
unsigned char algorithmIndex;
|
||||
unsigned char keyFormat;
|
||||
unsigned char res_bits_2 [8];
|
||||
unsigned char keyLength [2];
|
||||
unsigned char keyData [SSP_KEY_LENGTH];
|
||||
} SSP_PAGE_SDE;
|
||||
|
||||
unsigned char
|
||||
scsi_sense_command[6]={
|
||||
0x03,
|
||||
0,0,0,
|
||||
sizeof(SCSI_PAGE_SENSE),
|
||||
0
|
||||
},
|
||||
scsi_inq_command[6] = {
|
||||
0x12,
|
||||
0,0,0,
|
||||
sizeof(SCSI_PAGE_INQ),
|
||||
0
|
||||
},
|
||||
spin_des_command [SSP_SP_CMD_LEN] = {
|
||||
SSP_SPIN_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0,
|
||||
0X20,
|
||||
0,0,
|
||||
BSINTTOCHAR(sizeof(SSP_PAGE_BUFFER)),
|
||||
0,0
|
||||
},
|
||||
spin_nbes_command [SSP_SP_CMD_LEN] = {
|
||||
SSP_SPIN_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0,
|
||||
0X21,
|
||||
0,0,
|
||||
BSINTTOCHAR(sizeof(SSP_PAGE_BUFFER)),
|
||||
0,0
|
||||
};
|
||||
|
||||
//Gets encryption options on the tape drive
|
||||
SSP_DES* SSPGetDES(string tapeDevice){
|
||||
SSP_PAGE_BUFFER buffer;
|
||||
memset(&buffer,0,sizeof(SSP_PAGE_BUFFER));
|
||||
if(!SCSIExecute(tapeDevice,
|
||||
(unsigned char*)&spin_des_command,
|
||||
sizeof(spin_des_command),
|
||||
(unsigned char*)&buffer,
|
||||
sizeof(SSP_PAGE_BUFFER),
|
||||
false,true))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
SSP_DES* status=new SSP_DES(&buffer);
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
//Gets encryption options on the tape drive
|
||||
SSP_NBES* SSPGetNBES(string tapeDevice,bool retry){
|
||||
|
||||
SSP_PAGE_BUFFER buffer;
|
||||
memset(&buffer,0,sizeof(SSP_PAGE_BUFFER));
|
||||
if(!SCSIExecute(tapeDevice,
|
||||
(unsigned char*)&spin_nbes_command,
|
||||
sizeof(spin_nbes_command),
|
||||
(unsigned char*)&buffer,
|
||||
sizeof(SSP_PAGE_BUFFER),
|
||||
false,false))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
SSP_NBES* status=new SSP_NBES(&buffer);
|
||||
if(status->nbes.encryptionStatus==0x01 && retry){
|
||||
//move to the start of the tape and try again
|
||||
int moves=0;
|
||||
while(true){
|
||||
if(status==NULL)break;
|
||||
if(status->nbes.encryptionStatus!=0x01)break;
|
||||
if(moves>=MAX_TAPE_READ_BLOCKS)break;
|
||||
delete status;
|
||||
if(!moveTape(tapeDevice,1,true))break;
|
||||
moves++;
|
||||
status=SSPGetNBES(tapeDevice,false);
|
||||
}
|
||||
moveTape(tapeDevice,moves,false);
|
||||
}
|
||||
return status;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Sends and inquiry to the device
|
||||
SCSI_PAGE_INQ* SCSIGetInquiry(string tapeDevice){
|
||||
SCSI_PAGE_INQ* status=new SCSI_PAGE_INQ;
|
||||
memset(status,0,sizeof(SCSI_PAGE_INQ));
|
||||
if(!SCSIExecute(tapeDevice,
|
||||
(unsigned char*)&scsi_inq_command,
|
||||
sizeof(scsi_inq_command),
|
||||
(unsigned char*)status,
|
||||
sizeof(SCSI_PAGE_INQ),
|
||||
false,true))
|
||||
{
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//Writes encryption options to the tape drive
|
||||
bool SCSIWriteEncryptOptions(string tapeDevice, SCSIEncryptOptions* eOptions){
|
||||
|
||||
char buffer[1024];
|
||||
memset(&buffer,0,1024);
|
||||
|
||||
SSP_PAGE_SDE options;
|
||||
//copy the template over the options
|
||||
memset(&options,0, sizeof(SSP_PAGE_SDE));
|
||||
byteswap((unsigned char*)&options.pageCode,2,0x10);
|
||||
int pagelen=sizeof(SSP_PAGE_SDE);
|
||||
options.scope=2; //all IT nexus = 10b
|
||||
options.RDMC=eOptions->rdmc;
|
||||
options.ckod=(eOptions->CKOD)?1:0;
|
||||
options.CEEM=DEFAULT_CEEM;
|
||||
options.algorithmIndex=eOptions->algorithmIndex;
|
||||
//set the specific options
|
||||
switch(eOptions->cryptMode){
|
||||
case CRYPTMODE_ON: //encrypt, read only encrypted data
|
||||
options.encryptionMode=2;
|
||||
options.decryptionMode=2;
|
||||
break;
|
||||
case CRYPTMODE_MIXED: //encrypt, read all data
|
||||
options.encryptionMode=2;
|
||||
options.decryptionMode=3;
|
||||
break;
|
||||
case CRYPTMODE_RAWREAD:
|
||||
options.encryptionMode=2;
|
||||
options.decryptionMode=1;
|
||||
break;
|
||||
default:
|
||||
byteswap((unsigned char*)options.keyLength,2,DEFAULT_KEYSIZE);
|
||||
eOptions->cryptoKey=""; //blank the key
|
||||
eOptions->keyName=""; //blank the key name, not supported when turned off
|
||||
break;
|
||||
}
|
||||
|
||||
if(eOptions->cryptoKey!=""){
|
||||
//byte swap the keylength
|
||||
byteswap((unsigned char*)&options.keyLength,2,eOptions->cryptoKey.size());
|
||||
//copy the crypto key into the options
|
||||
eOptions->cryptoKey.copy((char*)&options.keyData, eOptions->cryptoKey.size(),0);
|
||||
}
|
||||
//create the key descriptor
|
||||
if(eOptions->keyName!=""){
|
||||
SSP_KAD kad;
|
||||
kad.type=0x00;
|
||||
kad.authenticated=0;
|
||||
//set the descriptor length to the length of the keyName
|
||||
byteswap((unsigned char*)&kad.descriptorLength,2,eOptions->keyName.size());
|
||||
|
||||
//get the size of the kad object
|
||||
int kadlen=eOptions->keyName.size()+SSP_KAD_HEAD_LENGTH;
|
||||
//increment the SPOUT page len
|
||||
pagelen+=kadlen;
|
||||
//increase the page size
|
||||
eOptions->keyName.copy((char*)&kad.descriptor,eOptions->keyName.size(),0);
|
||||
//copy the kad after the SDE command
|
||||
memcpy(&buffer[sizeof(SSP_PAGE_SDE)],&kad,kadlen);
|
||||
}
|
||||
//update the pagelen in options
|
||||
byteswap((unsigned char*)&options.length,2,pagelen-4); //set the page length, minus the length and pageCode
|
||||
|
||||
//copy the options to the beginning of the buffer
|
||||
memcpy(&buffer,&options,sizeof(SSP_PAGE_SDE));
|
||||
|
||||
unsigned char spout_sde_command [SSP_SP_CMD_LEN] = {
|
||||
SSP_SPOUT_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0,
|
||||
0X10,
|
||||
0,0,
|
||||
BSINTTOCHAR(pagelen),
|
||||
0,0
|
||||
};
|
||||
|
||||
|
||||
//return whether or not the command executed
|
||||
return SCSIExecute(
|
||||
tapeDevice,
|
||||
(unsigned char*)&spout_sde_command,
|
||||
sizeof(spout_sde_command),
|
||||
(unsigned char*)&buffer,
|
||||
pagelen,
|
||||
true,true
|
||||
);
|
||||
}
|
||||
|
||||
bool SCSIExecute(string tapedrive, unsigned char* cmd_p,int cmd_len,unsigned char* dxfer_p,int dxfer_len, bool cmd_to_device, bool show_error)
|
||||
inline std::ostream& operator<<(std::ostream& os, hex h)
|
||||
{
|
||||
const char* tapedevice=tapedrive.c_str();
|
||||
int sg_fd,eresult,sresult;
|
||||
SCSI_PAGE_SENSE* sd=new SCSI_PAGE_SENSE;
|
||||
memset(sd,0,sizeof(SCSI_PAGE_SENSE));
|
||||
|
||||
#ifdef OS_AIX //AIX System
|
||||
auto fill {os.fill('0')};
|
||||
auto flags {os.flags(std::ios_base::hex | std::ios_base::right)};
|
||||
|
||||
errno=0;
|
||||
sg_fd = openx((char*)tapedevice, O_RDONLY , NULL, SC_DIAGNOSTIC);
|
||||
if(!sg_fd || sg_fd==-1){
|
||||
cerr<<"Could not open device '"<<tapedevice<<"'"<<endl;
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
os << std::setw(2) << static_cast<unsigned int>(h.value);
|
||||
|
||||
|
||||
struct sc_iocmd cmdio;
|
||||
memset(&cmdio,0,sizeof (struct sc_iocmd));
|
||||
//copy the command bytes into the first part of the structure
|
||||
memcpy(&cmdio.scsi_cdb,cmd_p,cmd_len);
|
||||
cmdio.buffer=(char*)dxfer_p;
|
||||
cmdio.timeout_value=SCSI_TIMEOUT;
|
||||
cmdio.command_length=cmd_len;
|
||||
cmdio.data_length=dxfer_len;
|
||||
cmdio.status_validity=SC_SCSI_ERROR;
|
||||
cmdio.flags=(cmd_to_device)?B_WRITE:B_READ;
|
||||
os.flags(flags);
|
||||
os.fill(fill);
|
||||
return os;
|
||||
}
|
||||
|
||||
errno=0;
|
||||
eresult=ioctl(sg_fd, STIOCMD, &cmdio);
|
||||
sresult=(int)cmdio.scsi_bus_status;
|
||||
|
||||
if(eresult!=0 && show_error){
|
||||
readIOError(errno);
|
||||
}
|
||||
|
||||
|
||||
if(sresult==SC_CHECK_CONDITION){ //get the sense data
|
||||
|
||||
struct sc_iocmd scmdio;
|
||||
memset(&scmdio,0,sizeof (struct sc_iocmd));
|
||||
//copy the command bytes into the first part of the structure
|
||||
memcpy(&scmdio.scsi_cdb,&scsi_sense_command,sizeof(scsi_sense_command));
|
||||
scmdio.buffer=(char*)sd;
|
||||
scmdio.timeout_value=SCSI_TIMEOUT;
|
||||
scmdio.command_length=sizeof(scsi_sense_command);
|
||||
scmdio.data_length=sizeof(SCSI_PAGE_SENSE);
|
||||
scmdio.status_validity=SC_SCSI_ERROR;
|
||||
scmdio.flags=B_READ;
|
||||
void print_buffer(std::ostream& os, const std::uint8_t *begin,
|
||||
std::size_t length)
|
||||
{
|
||||
auto fill {os.fill('0')};
|
||||
auto flags {os.flags(std::ios_base::hex | std::ios_base::right)};
|
||||
|
||||
errno=0;
|
||||
if(!ioctl(sg_fd, STIOCMD, &scmdio)){
|
||||
if(show_error)
|
||||
outputSense(sd);
|
||||
}else{
|
||||
if(show_error){
|
||||
cout<<"Error retrieving sense: ";
|
||||
readIOError(errno);
|
||||
}
|
||||
}
|
||||
std::for_each(begin, begin + length, [&](auto b) {
|
||||
os << std::setw(2) << static_cast<unsigned int>(b) << ' ';
|
||||
});
|
||||
|
||||
}
|
||||
os.put('\n');
|
||||
|
||||
#else //Linux routine
|
||||
errno=0;
|
||||
sg_fd = open(tapedevice, O_RDONLY);
|
||||
if( sg_fd==-1){
|
||||
cerr<<"Could not open device '"<<tapedevice<<"': ";
|
||||
readIOError(errno);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
os.flags(flags);
|
||||
os.fill(fill);
|
||||
}
|
||||
|
||||
sg_io_hdr_t cmdio;
|
||||
memset(&cmdio,0,sizeof(sg_io_hdr_t));
|
||||
cmdio.cmd_len = cmd_len;
|
||||
cmdio.dxfer_direction =(cmd_to_device)?SG_DXFER_TO_DEV:SG_DXFER_FROM_DEV;
|
||||
cmdio.dxfer_len = dxfer_len;
|
||||
cmdio.dxferp = dxfer_p;
|
||||
cmdio.cmdp = cmd_p;
|
||||
cmdio.sbp = (unsigned char*)sd;
|
||||
cmdio.mx_sb_len=sizeof(SCSI_PAGE_SENSE);
|
||||
cmdio.timeout = SCSI_TIMEOUT;
|
||||
cmdio.interface_id = 'S';
|
||||
static void scsi_execute(const std::string& device, const std::uint8_t *cmd_p,
|
||||
std::size_t cmd_len, std::uint8_t *dxfer_p,
|
||||
std::size_t dxfer_len, scsi_direction direction)
|
||||
{
|
||||
#if defined(DEBUGSCSI)
|
||||
std::cerr << "SCSI Command: ";
|
||||
print_buffer(std::cerr, cmd_p, cmd_len);
|
||||
|
||||
errno=0;
|
||||
eresult=ioctl(sg_fd, SG_IO, &cmdio);
|
||||
|
||||
if(eresult!=0){
|
||||
readIOError(errno);
|
||||
}
|
||||
sresult=cmdio.status;
|
||||
if(sresult!=0 && show_error){
|
||||
outputSense(sd);
|
||||
|
||||
}
|
||||
if (direction == scsi_direction::to_device && dxfer_len > 0u) {
|
||||
std::cerr << "SCSI Data: ";
|
||||
print_buffer(std::cerr, dxfer_p, dxfer_len);
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUGSCSI
|
||||
cout<<"SCSI Command: ";
|
||||
for(int i=0;i<cmd_len;i++){
|
||||
cout<<HEX(cmd_p[i]);
|
||||
}
|
||||
cout<<endl;
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
unique_fd fd {open(device.c_str(), O_RDONLY | O_NDELAY)};
|
||||
if (!fd) {
|
||||
std::ostringstream oss;
|
||||
oss << "Cannot open device " << device;
|
||||
throw std::system_error {errno, std::generic_category(), oss.str()};
|
||||
}
|
||||
|
||||
cout<<"SCSI Data: ";
|
||||
for(int i=0;i<dxfer_len;i++){
|
||||
cout<<HEX(dxfer_p[i]);
|
||||
}
|
||||
cout<<endl;
|
||||
#endif
|
||||
close(sg_fd);
|
||||
sg_io_hdr cmdio {};
|
||||
auto sense_buf {std::make_unique<scsi::sense_buffer>()};
|
||||
|
||||
delete sd;
|
||||
cmdio.cmd_len = cmd_len;
|
||||
cmdio.dxfer_direction = (direction == scsi_direction::to_device)
|
||||
? SG_DXFER_TO_DEV
|
||||
: SG_DXFER_FROM_DEV;
|
||||
cmdio.dxfer_len = dxfer_len;
|
||||
cmdio.dxferp = dxfer_p;
|
||||
cmdio.cmdp = const_cast<unsigned char *>(cmd_p);
|
||||
cmdio.sbp = sense_buf->data();
|
||||
cmdio.mx_sb_len = sizeof(decltype(sense_buf)::element_type);
|
||||
cmdio.timeout = SCSI_TIMEOUT;
|
||||
cmdio.interface_id = 'S';
|
||||
|
||||
if(eresult!=0||sresult!=0){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void byteswap(unsigned char* array,int size,int value){
|
||||
switch(size){
|
||||
case 2:
|
||||
array[0]=(unsigned char)((value & 0xff00)>>8);
|
||||
array[1]=(unsigned char)(value & 0x00ff);
|
||||
break;
|
||||
case 4:
|
||||
array[0]=(unsigned char)((value & 0xff000000)>>24);
|
||||
array[1]=(unsigned char)((value & 0x00ff0000)>>16);
|
||||
array[2]=(unsigned char)((value & 0x0000ff00)>>8);
|
||||
array[3]=(unsigned char)(value & 0x000000ff);
|
||||
if (ioctl(fd.get(), SG_IO, &cmdio)) {
|
||||
throw std::system_error {errno, std::generic_category()};
|
||||
}
|
||||
if (cmdio.status) {
|
||||
throw scsi::scsi_error {std::move(sense_buf)};
|
||||
}
|
||||
#elif defined(OS_FREEBSD)
|
||||
auto dev = std::unique_ptr<struct cam_device, decltype(&cam_close_device)> {
|
||||
cam_open_device(device.c_str(), O_RDWR), &cam_close_device};
|
||||
if (dev == nullptr) {
|
||||
std::ostringstream oss;
|
||||
oss << "Cannot open device " << device << ": " << cam_errbuf;
|
||||
throw std::runtime_error {oss.str()};
|
||||
}
|
||||
auto ccb = std::unique_ptr<union ccb, decltype(&cam_freeccb)> {
|
||||
cam_getccb(dev.get()), &cam_freeccb};
|
||||
if (ccb == nullptr) {
|
||||
throw std::bad_alloc {};
|
||||
}
|
||||
CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio);
|
||||
|
||||
break;
|
||||
default:
|
||||
cout<<"Unhandled byte swap length of "<<size<<endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SCSIEncryptOptions::SCSIEncryptOptions(){
|
||||
cryptMode=CRYPTMODE_OFF;
|
||||
algorithmIndex=DEFAULT_ALGORITHM;
|
||||
cryptoKey="";
|
||||
CKOD=false;
|
||||
keyName="";
|
||||
rdmc=RDMC_DEFAULT;
|
||||
}
|
||||
|
||||
SSP_NBES::SSP_NBES(SSP_PAGE_BUFFER* buffer){
|
||||
memset(&nbes,0,sizeof(SSP_PAGE_NBES));
|
||||
memcpy(&nbes,buffer,sizeof(SSP_PAGE_NBES));
|
||||
loadKADs(buffer,sizeof(SSP_PAGE_NBES));
|
||||
|
||||
}
|
||||
SSP_DES::SSP_DES(SSP_PAGE_BUFFER* buffer){
|
||||
memset(&des,0,sizeof(SSP_PAGE_DES));
|
||||
memcpy(&des,buffer,sizeof(SSP_PAGE_DES));
|
||||
loadKADs(buffer,sizeof(SSP_PAGE_DES));
|
||||
}
|
||||
|
||||
void KAD_CLASS::loadKADs(SSP_PAGE_BUFFER* buffer, int start){
|
||||
char* rawbuff=(char*)buffer;
|
||||
int length=BSSHORT(buffer->length)+4;
|
||||
int pos=start;
|
||||
while(pos<length){
|
||||
SSP_KAD kad;
|
||||
memset(&kad,0,sizeof(SSP_KAD));
|
||||
memcpy(&kad,rawbuff+pos,SSP_KAD_HEAD_LENGTH);
|
||||
pos+=SSP_KAD_HEAD_LENGTH;
|
||||
if(pos>=length)break;
|
||||
unsigned short kadDesLen=BSSHORT(kad.descriptorLength);
|
||||
if(kadDesLen>0){
|
||||
memcpy(&kad.descriptor,rawbuff+pos,kadDesLen);
|
||||
pos+=kadDesLen;
|
||||
}else pos++;
|
||||
kads.push_back(kad);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
bool moveTape(std::string tapeDevice,int count,bool dirForward){
|
||||
struct mtop mt_command;
|
||||
int sg_fd = open(tapeDevice.c_str(), O_RDONLY);
|
||||
if(!sg_fd || sg_fd==-1){
|
||||
return false;
|
||||
}
|
||||
errno=0;
|
||||
bool retval=true;
|
||||
#ifdef OS_LINUX
|
||||
|
||||
mt_command.mt_op = (dirForward)?MTFSR:MTBSR;
|
||||
mt_command.mt_count = count;
|
||||
ioctl(sg_fd, MTIOCTOP, &mt_command);
|
||||
cam_fill_csio(
|
||||
&ccb->csio, RETRYCOUNT, nullptr,
|
||||
CAM_PASS_ERR_RECOVER | CAM_CDB_POINTER |
|
||||
(direction == scsi_direction::to_device ? CAM_DIR_OUT : CAM_DIR_IN),
|
||||
MSG_SIMPLE_Q_TAG, dxfer_p, dxfer_len, SSD_FULL_SIZE, cmd_len,
|
||||
SCSI_TIMEOUT);
|
||||
ccb->csio.cdb_io.cdb_ptr = const_cast<u_int8_t *>(cmd_p);
|
||||
if (cam_send_ccb(dev.get(), ccb.get())) {
|
||||
throw std::system_error {errno, std::generic_category()};
|
||||
}
|
||||
if (ccb->csio.scsi_status) {
|
||||
auto sense_buf {std::make_unique<scsi::sense_buffer>()};
|
||||
std::memcpy(sense_buf->data(), &ccb->csio.sense_data,
|
||||
sizeof(scsi::sense_buffer));
|
||||
throw scsi::scsi_error {std::move(sense_buf)};
|
||||
}
|
||||
#else
|
||||
mt_command.st_op = (dirForward)?MTFSR:MTBSR;
|
||||
mt_command.st_count = count;
|
||||
ioctl(sg_fd, STIOCTOP, &mt_command);
|
||||
|
||||
#endif
|
||||
if(errno!=0)retval=false;
|
||||
|
||||
close(sg_fd);
|
||||
errno=0;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void readIOError(int err){
|
||||
if(err==0)return;
|
||||
cerr<<"ERROR: ";
|
||||
switch(err){
|
||||
case EAGAIN:
|
||||
cerr<<"Device already open"<<endl;
|
||||
break;
|
||||
case EBUSY:
|
||||
cerr<<"Device Busy"<<endl;
|
||||
break;
|
||||
case ETIMEDOUT:
|
||||
cerr<<"Device operation timed out"<<endl;
|
||||
break;
|
||||
case EIO:
|
||||
cerr<<"Device I/O Error."<<endl;
|
||||
break;
|
||||
case EPERM:
|
||||
cerr<<"You do not have privileges to do this. Are you root?"<<endl;
|
||||
break;
|
||||
#ifdef OS_AIX
|
||||
case EBADF:
|
||||
cerr<<"EBADF"<<endl;
|
||||
break;
|
||||
case EFAULT:
|
||||
cerr<<"EFAULT"<<endl;
|
||||
break;
|
||||
case EINTR:
|
||||
cerr<<"EINTR"<<endl;
|
||||
break;
|
||||
case EINVAL:
|
||||
cerr<<"Invalid device"<<endl;
|
||||
break;
|
||||
|
||||
case ENOTTY:
|
||||
cerr<<"ENOTTY"<<endl;
|
||||
break;
|
||||
|
||||
case ENODEV:
|
||||
cerr<<"Device is not responding"<<endl;
|
||||
break;
|
||||
|
||||
case ENXIO:
|
||||
cerr<<"ENXIO"<<endl;
|
||||
break;
|
||||
|
||||
#endif
|
||||
default:
|
||||
if(errno!=0){
|
||||
cerr<<"0x"<<hex<<errno<<endl;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void outputSense(SCSI_PAGE_SENSE* sd){
|
||||
cerr<<left<<setw(25)<<"Sense Code: ";
|
||||
|
||||
switch((int)sd->senseKey){
|
||||
case 0:
|
||||
cerr<<"No specific error";
|
||||
break;
|
||||
case 2:
|
||||
cerr<<"Device not ready";
|
||||
break;
|
||||
case 3:
|
||||
cerr<<"Medium Error";
|
||||
break;
|
||||
case 4:
|
||||
cerr<<"Hardware Error";
|
||||
break;
|
||||
case 5:
|
||||
cerr<<"Illegal Request";
|
||||
break;
|
||||
case 6:
|
||||
cerr<<"Unit Attention";
|
||||
break;
|
||||
case 7:
|
||||
cerr<<"Data protect";
|
||||
break;
|
||||
case 8:
|
||||
cerr<<"Blank tape";
|
||||
break;
|
||||
|
||||
}
|
||||
cerr<<" (0x"<<HEX(sd->senseKey)<<")"<<endl;
|
||||
cerr<<left<<setw(25)<<" ASC:"<<"0x"<<HEX(sd->addSenseCode)<<endl;
|
||||
cerr<<left<<setw(25)<<" ASCQ:"<<"0x"<<HEX(sd->addSenseCodeQual)<<endl;
|
||||
if(sd->addSenseLen>0){
|
||||
cerr<<left<<setw(25)<<" Additional data:"<<"0x";
|
||||
|
||||
for(int i=0;i<sd->addSenseLen;i++){
|
||||
cerr<<HEX(sd->addSenseData[i]);
|
||||
}
|
||||
cerr<<endl;
|
||||
}
|
||||
#ifdef DEBUGSCSI
|
||||
cerr<<left<<setw(25)<<" Raw Sense:"<<"0x";
|
||||
char* rawsense=(char*)sd;
|
||||
|
||||
for(int i=0;i<sizeof(SCSI_PAGE_SENSE);i++){
|
||||
cerr<<HEX(rawsense[i]);
|
||||
}
|
||||
cerr<<endl;
|
||||
#error "OS type is not set"
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace scsi {
|
||||
|
||||
bool is_device_ready(const std::string& device)
|
||||
{
|
||||
const std::uint8_t test_unit_ready_cmd[6] {};
|
||||
|
||||
try {
|
||||
scsi_execute(device, test_unit_ready_cmd, sizeof(test_unit_ready_cmd),
|
||||
nullptr, 0u, scsi_direction::from_device);
|
||||
return true;
|
||||
} catch (const scsi::scsi_error& err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const page_des& get_des(const std::string& device, std::uint8_t *buffer,
|
||||
std::size_t length)
|
||||
{
|
||||
const std::uint8_t spin_des_command[] {
|
||||
SSP_SPIN_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0,
|
||||
0X20,
|
||||
0,
|
||||
0,
|
||||
BSINTTOCHAR(length),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
scsi_execute(device, spin_des_command, sizeof(spin_des_command), buffer,
|
||||
length, scsi_direction::from_device);
|
||||
auto& page {reinterpret_cast<const page_des&>(*buffer)};
|
||||
|
||||
#if defined(DEBUGSCSI)
|
||||
std::cerr << "SCSI Response: ";
|
||||
print_buffer(std::cerr, buffer,
|
||||
std::min(length, sizeof(page_header) + ntohs(page.length)));
|
||||
#endif
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
const page_nbes& get_nbes(const std::string& device, std::uint8_t *buffer,
|
||||
std::size_t length)
|
||||
{
|
||||
const std::uint8_t spin_nbes_command[] {
|
||||
SSP_SPIN_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0,
|
||||
0X21,
|
||||
0,
|
||||
0,
|
||||
BSINTTOCHAR(length),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
scsi_execute(device, spin_nbes_command, sizeof(spin_nbes_command), buffer,
|
||||
length, scsi_direction::from_device);
|
||||
auto& page {reinterpret_cast<const page_nbes&>(*buffer)};
|
||||
|
||||
#if defined(DEBUGSCSI)
|
||||
std::cerr << "SCSI Response: ";
|
||||
print_buffer(std::cerr, buffer,
|
||||
std::min(length, sizeof(page_header) + ntohs(page.length)));
|
||||
#endif
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
const page_dec& get_dec(const std::string& device, std::uint8_t *buffer,
|
||||
std::size_t length)
|
||||
{
|
||||
const std::uint8_t spin_dec_command[] {
|
||||
SSP_SPIN_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0x00,
|
||||
0x10,
|
||||
0,
|
||||
0,
|
||||
BSINTTOCHAR(length),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
scsi_execute(device, spin_dec_command, sizeof(spin_dec_command), buffer,
|
||||
length, scsi_direction::from_device);
|
||||
auto& page {reinterpret_cast<const page_dec&>(*buffer)};
|
||||
|
||||
#if defined(DEBUGSCSI)
|
||||
std::cerr << "SCSI Response: ";
|
||||
print_buffer(std::cerr, buffer,
|
||||
std::min(length, sizeof(page_header) + ntohs(page.length)));
|
||||
#endif
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
inquiry_data get_inquiry(const std::string& device)
|
||||
{
|
||||
const std::uint8_t scsi_inq_command[] {
|
||||
0x12, 0, 0, 0, sizeof(inquiry_data), 0,
|
||||
};
|
||||
inquiry_data inq {};
|
||||
scsi_execute(device, scsi_inq_command, sizeof(scsi_inq_command),
|
||||
reinterpret_cast<std::uint8_t *>(&inq), sizeof(inq),
|
||||
scsi_direction::from_device);
|
||||
|
||||
#if defined(DEBUGSCSI)
|
||||
std::cerr << "SCSI Response: ";
|
||||
print_buffer(std::cerr, reinterpret_cast<std::uint8_t *>(&inq),
|
||||
std::min(sizeof(inquiry_data),
|
||||
inquiry_data::header_size + inq.additional_length));
|
||||
#endif
|
||||
|
||||
return inq;
|
||||
}
|
||||
|
||||
std::unique_ptr<const std::uint8_t[]>
|
||||
make_sde(encrypt_mode enc_mode, decrypt_mode dec_mode,
|
||||
std::uint8_t algorithm_index, const std::vector<std::uint8_t>& key,
|
||||
const std::string& key_name, kadf kad_format, sde_rdmc rdmc, bool ckod)
|
||||
{
|
||||
std::size_t length {sizeof(page_sde) + key.size()};
|
||||
if (!key_name.empty()) {
|
||||
length += sizeof(kad) + key_name.size();
|
||||
}
|
||||
auto buffer {std::make_unique<std::uint8_t[]>(length)};
|
||||
auto& page {reinterpret_cast<page_sde&>(*buffer.get())};
|
||||
|
||||
page.page_code = htons(0x10);
|
||||
page.length = htons(length - sizeof(page_header));
|
||||
page.control = std::byte {2u}
|
||||
<< page_sde::control_scope_pos; // all IT nexus = 10b
|
||||
// no external encryption mode check for widest compatibility of reads
|
||||
page.flags |= std::byte {1u} << page_sde::flags_ceem_pos;
|
||||
page.flags |= std::byte {static_cast<std::underlying_type_t<sde_rdmc>>(rdmc)};
|
||||
if (ckod) {
|
||||
page.flags |= page_sde::flags_ckod_mask;
|
||||
}
|
||||
page.encryption_mode = enc_mode;
|
||||
page.decryption_mode = dec_mode;
|
||||
page.algorithm_index = algorithm_index;
|
||||
page.kad_format = kad_format;
|
||||
page.key_length = htons(key.size());
|
||||
std::memcpy(page.key, key.data(), key.size());
|
||||
|
||||
if (!key_name.empty()) {
|
||||
auto& ukad {reinterpret_cast<kad&>(
|
||||
*(buffer.get() + sizeof(page_sde) + key.size()))};
|
||||
ukad.length = htons(key_name.size());
|
||||
std::memcpy(ukad.descriptor, key_name.data(), key_name.size());
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
void write_sde(const std::string& device, const std::uint8_t *sde_buffer)
|
||||
{
|
||||
auto& page {reinterpret_cast<const page_sde&>(*sde_buffer)};
|
||||
std::size_t length {sizeof(page_header) + ntohs(page.length)};
|
||||
const std::uint8_t spout_sde_command[] {
|
||||
SSP_SPOUT_OPCODE,
|
||||
SSP_SP_PROTOCOL_TDE,
|
||||
0,
|
||||
0X10,
|
||||
0,
|
||||
0,
|
||||
BSINTTOCHAR(length),
|
||||
0,
|
||||
0,
|
||||
};
|
||||
|
||||
scsi_execute(device, spout_sde_command, sizeof(spout_sde_command),
|
||||
const_cast<std::uint8_t *>(sde_buffer), length,
|
||||
scsi_direction::to_device);
|
||||
}
|
||||
|
||||
void print_sense_data(std::ostream& os, const sense_data& sd)
|
||||
{
|
||||
os << std::left << std::setw(25) << "Sense Code: ";
|
||||
|
||||
auto sense_key {sd.flags & sense_data::flags_sense_key_mask};
|
||||
|
||||
switch (sense_key) {
|
||||
case sense_data::no_sense:
|
||||
os << "No specific error";
|
||||
break;
|
||||
case sense_data::recovered_error:
|
||||
os << "Recovered error";
|
||||
break;
|
||||
case sense_data::not_ready:
|
||||
os << "Device not ready";
|
||||
break;
|
||||
case sense_data::medium_error:
|
||||
os << "Medium Error";
|
||||
break;
|
||||
case sense_data::hardware_error:
|
||||
os << "Hardware Error";
|
||||
break;
|
||||
case sense_data::illegal_request:
|
||||
os << "Illegal Request";
|
||||
break;
|
||||
case sense_data::unit_attention:
|
||||
os << "Unit Attention";
|
||||
break;
|
||||
case sense_data::data_protect:
|
||||
os << "Data protect";
|
||||
break;
|
||||
case sense_data::blank_check:
|
||||
os << "Blank tape";
|
||||
break;
|
||||
}
|
||||
|
||||
os << " (0x" << hex {static_cast<std::uint8_t>(sense_key)} << ")\n";
|
||||
|
||||
os << std::left << std::setw(25) << " ASC:"
|
||||
<< "0x" << hex {sd.additional_sense_code} << '\n';
|
||||
|
||||
os << std::left << std::setw(25) << " ASCQ:"
|
||||
<< "0x" << hex {sd.additional_sense_qualifier} << '\n';
|
||||
|
||||
#if defined(DEBUGSCSI)
|
||||
auto sense_data_length {
|
||||
std::min(sense_data::maximum_size,
|
||||
sd.additional_sense_length + sense_data::header_size)};
|
||||
auto rawsense {reinterpret_cast<const std::uint8_t *>(&sd)};
|
||||
|
||||
os << std::left << std::setw(25) << " Raw sense data:";
|
||||
print_buffer(os, rawsense, sense_data_length);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<std::reference_wrapper<const algorithm_descriptor>>
|
||||
read_algorithms(const page_dec& page)
|
||||
{
|
||||
auto it {reinterpret_cast<const std::uint8_t *>(&page.ads[0])};
|
||||
const auto end {reinterpret_cast<const std::uint8_t *>(&page) +
|
||||
ntohs(page.length) + sizeof(page_header)};
|
||||
std::vector<std::reference_wrapper<const algorithm_descriptor>> v {};
|
||||
|
||||
while (it < end) {
|
||||
auto elem {reinterpret_cast<const algorithm_descriptor *>(it)};
|
||||
v.push_back(std::cref(*elem));
|
||||
it += ntohs(elem->length) + algorithm_descriptor::header_size;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace scsi
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// SPDX-FileCopyrightText: 2022 stenc authors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
/*
|
||||
Header file to send and recieve SPIN/SPOUT commands to SCSI device
|
||||
|
||||
@@ -15,315 +19,424 @@ GNU General Public License for more details.
|
||||
|
||||
#ifndef _SCSIENC_H
|
||||
#define _SCSIENC_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <bitset>
|
||||
#include <vector>
|
||||
#define SSP_KEY_LENGTH 0X20
|
||||
#define SSP_DESCRIPTOR_LENGTH 1024
|
||||
#define SSP_PAGE_DES_LENGTH 24
|
||||
#define SSP_PAGE_NBES_LENGTH 16
|
||||
#define SSP_KAD_HEAD_LENGTH 4
|
||||
#define SSP_PAGE_ALLOCATION 8192
|
||||
#define SSP_UKAD_LENGTH 0x1e
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#define KAD_TYPE_UKAD 0x00
|
||||
#define KAD_TYPE_AKAD 0x01
|
||||
#define KAD_TYPE_NONCE 0x02
|
||||
#define KAD_TYPE_META 0x03
|
||||
|
||||
#define RDMC_PROTECT 0x03
|
||||
#define RDMC_UNPROTECT 0x02
|
||||
#define RDMC_DEFAULT 0x00
|
||||
|
||||
//outputs hex in a 2 digit pair
|
||||
#define HEX( x ) right<<setw(2)<< setfill('0') << hex << (int)( x )<<setfill(' ')
|
||||
//macro for a byte swapped short
|
||||
#define BSSHORT( x ) ((unsigned short)( (x[0]<<8) + x[1] ))
|
||||
//macro for a byte swapped int
|
||||
#define BSLONG( x ) ((unsigned int)( (int)( x[0] << 24 ) + (int)( x[1] << 16 ) + (int)( x[2] << 8 ) + (int)( x[3] ) ))
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char pageCode [2];
|
||||
unsigned char length [2];
|
||||
#ifdef SWAPBIT
|
||||
unsigned char nexusScope :3;
|
||||
unsigned char res_bits_1 :2;
|
||||
unsigned char keyScope :3;
|
||||
#else
|
||||
unsigned char keyScope :3;
|
||||
unsigned char res_bits_1 :2;
|
||||
unsigned char nexusScope :3;
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
unsigned char encryptionMode;
|
||||
unsigned char decryptionMode;
|
||||
unsigned char algorithmIndex;
|
||||
unsigned char keyInstance [4];
|
||||
#ifdef SWAPBIT
|
||||
unsigned char res_bits_2 :1;
|
||||
unsigned char parametersControl :3;
|
||||
unsigned char VCELB :1;
|
||||
unsigned char CEEMS :2;
|
||||
unsigned char RDMD :1;
|
||||
#else
|
||||
|
||||
unsigned char RDMD :1;
|
||||
unsigned char CEEMS :2;
|
||||
unsigned char VCELB :1;
|
||||
unsigned char parametersControl :3;
|
||||
unsigned char res_bits_2 :1;
|
||||
#endif
|
||||
unsigned char res_bits_3;
|
||||
unsigned char ASDKCount [2];
|
||||
unsigned char res_bits_4 [8];
|
||||
|
||||
} SSP_PAGE_DES; //device encryption status page
|
||||
|
||||
typedef struct {
|
||||
unsigned char type;
|
||||
#ifdef SWAPBIT
|
||||
unsigned char res_bits_1 :5;
|
||||
unsigned char authenticated :3;
|
||||
#else
|
||||
unsigned char authenticated :3;
|
||||
unsigned char res_bits_1 :5;
|
||||
#endif
|
||||
unsigned char descriptorLength [2];
|
||||
unsigned char descriptor [SSP_DESCRIPTOR_LENGTH]; //will actually be the size of descriptorLength
|
||||
} SSP_KAD;
|
||||
|
||||
typedef struct{
|
||||
unsigned char pageCode [2];
|
||||
unsigned char length [2];
|
||||
unsigned char buffer [SSP_PAGE_ALLOCATION];
|
||||
} SSP_PAGE_BUFFER; //generic ssp page buffer
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned char pageCode [2];
|
||||
unsigned char length [2];
|
||||
unsigned char log_obj_num [8];
|
||||
#ifdef SWAPBIT
|
||||
unsigned char compressionStatus :4;
|
||||
unsigned char encryptionStatus :4;
|
||||
#else
|
||||
unsigned char encryptionStatus :4;
|
||||
unsigned char compressionStatus :4;
|
||||
#endif
|
||||
|
||||
unsigned char algorithmIndex;
|
||||
#ifdef SWAPBIT
|
||||
unsigned char res_bits_1 :6;
|
||||
unsigned char EMES :1;
|
||||
unsigned char RDMDS :1;
|
||||
#else
|
||||
unsigned char RDMDS :1;
|
||||
unsigned char EMES :1;
|
||||
unsigned char res_bits_1 :6;
|
||||
#endif
|
||||
|
||||
unsigned char res_bits_2;
|
||||
} SSP_PAGE_NBES; //next block encryption status page
|
||||
|
||||
|
||||
typedef struct{
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char peripheralQualifier :3;
|
||||
unsigned char periphrealDeviceType :5;
|
||||
#else
|
||||
unsigned char periphrealDeviceType :5;
|
||||
unsigned char peripheralQualifier :3;
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char RMB :1;
|
||||
unsigned char res_bits_1 :7;
|
||||
#else
|
||||
unsigned char res_bits_1 :7;
|
||||
unsigned char RMB :1;
|
||||
#endif
|
||||
unsigned char Version [1];
|
||||
namespace scsi {
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char obs_bits_1 :2;
|
||||
unsigned char NORMACA :1;
|
||||
unsigned char HISUP :1;
|
||||
unsigned char responseDataFormat :4;
|
||||
#else
|
||||
unsigned char responseDataFormat :4;
|
||||
unsigned char HISUP :1;
|
||||
unsigned char NORMACA :1;
|
||||
unsigned char obs_bits_1 :2;
|
||||
#endif
|
||||
|
||||
unsigned char additionalLength [1];
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char SCCS :1;
|
||||
unsigned char ACC :1;
|
||||
unsigned char TPGS :2;
|
||||
unsigned char threePC :1;
|
||||
unsigned char res_bits_2 :2;
|
||||
unsigned char protect :1;
|
||||
#else
|
||||
unsigned char protect :1;
|
||||
unsigned char res_bits_2 :2;
|
||||
unsigned char threePC :1;
|
||||
unsigned char TPGS :2;
|
||||
unsigned char ACC :1;
|
||||
unsigned char SCCS :1;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char obs_bits_2 :1;
|
||||
unsigned char ENCSERV :1;
|
||||
unsigned char VS :1;
|
||||
unsigned char MULTIP :1;
|
||||
unsigned char MCHNGR :1;
|
||||
unsigned char obs_bits_3 :2;
|
||||
unsigned char ADDR16 :1;
|
||||
#else
|
||||
unsigned char ADDR16 :1;
|
||||
unsigned char obs_bits_3 :2;
|
||||
unsigned char MCHNGR :1;
|
||||
unsigned char MULTIP :1;
|
||||
unsigned char VS :1;
|
||||
unsigned char ENCSERV :1;
|
||||
unsigned char obs_bits_2 :1;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char obs_bits_4 :2;
|
||||
unsigned char WBUS16 :1;
|
||||
unsigned char SYNC :1;
|
||||
unsigned char obs_bits_5 :2;
|
||||
unsigned char CMDQUE :1;
|
||||
unsigned char VS2 :1;
|
||||
#else
|
||||
unsigned char VS2 :1;
|
||||
unsigned char CMDQUE :1;
|
||||
unsigned char obs_bits_5 :2;
|
||||
unsigned char SYNC :1;
|
||||
unsigned char WBUS16 :1;
|
||||
unsigned char obs_bits_4 :2;
|
||||
#endif
|
||||
|
||||
unsigned char vender [8];
|
||||
unsigned char productID [16];
|
||||
unsigned char productRev [4];
|
||||
unsigned char SN [7];
|
||||
unsigned char venderUnique [12];
|
||||
|
||||
#ifndef SWAPBIT
|
||||
unsigned char res_bits_3 :4;
|
||||
unsigned char CLOCKING :2;
|
||||
unsigned char QAS :1;
|
||||
unsigned char IUS :1;
|
||||
#else
|
||||
unsigned char IUS :1;
|
||||
unsigned char QAS :1;
|
||||
unsigned char CLOCKING :2;
|
||||
unsigned char res_bits_3 :4;
|
||||
#endif
|
||||
|
||||
unsigned char res_bits_4 [1];
|
||||
unsigned char versionDescriptor [16];
|
||||
unsigned char res_bits_5 [22];
|
||||
unsigned char copyright [1];
|
||||
} SCSI_PAGE_INQ; //device inquiry response
|
||||
typedef struct{
|
||||
#ifdef SWAPBIT
|
||||
unsigned char valid :1;
|
||||
unsigned char responseCode :7;
|
||||
#else
|
||||
unsigned char responseCode :7;
|
||||
unsigned char valid :1;
|
||||
#endif
|
||||
unsigned char res_bits_1;
|
||||
|
||||
#ifdef SWAPBIT
|
||||
unsigned char filemark :1;
|
||||
unsigned char EOM :1;
|
||||
unsigned char ILI :1;
|
||||
unsigned char res_bits_2 :1;
|
||||
unsigned char senseKey :4;
|
||||
#else
|
||||
unsigned char senseKey :4;
|
||||
unsigned char res_bits_2 :1;
|
||||
unsigned char ILI :1;
|
||||
unsigned char EOM :1;
|
||||
unsigned char filemark :1;
|
||||
#endif
|
||||
unsigned char information [4];
|
||||
unsigned char addSenseLen;
|
||||
unsigned char cmdSpecificInfo [4];
|
||||
unsigned char addSenseCode;
|
||||
unsigned char addSenseCodeQual;
|
||||
unsigned char fieldRepUnitCode;
|
||||
#ifdef SWAPBIT
|
||||
unsigned char sim :3; // system information message
|
||||
unsigned char bpv :1; // bit pointer valid
|
||||
unsigned char resvd2 :2; // reserved
|
||||
unsigned char cd :1; // control/data
|
||||
unsigned char SKSV :1;
|
||||
|
||||
#else
|
||||
unsigned char SKSV :1;
|
||||
unsigned char cd :1; // control/data
|
||||
unsigned char resvd2 :2; // reserved
|
||||
unsigned char bpv :1; // bit pointer valid
|
||||
unsigned char sim :3; // system information message
|
||||
#endif
|
||||
unsigned char field [2]; // field pointer
|
||||
unsigned char addSenseData [109];
|
||||
} SCSI_PAGE_SENSE; //sense data response
|
||||
class KAD_CLASS{
|
||||
public:
|
||||
std::vector<SSP_KAD> kads;
|
||||
protected:
|
||||
void loadKADs(SSP_PAGE_BUFFER* buffer, int start);
|
||||
enum class encrypt_mode : std::uint8_t {
|
||||
off = 0u,
|
||||
external = 1u,
|
||||
on = 2u,
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, encrypt_mode m)
|
||||
{
|
||||
if (m == encrypt_mode::off) {
|
||||
os << "off";
|
||||
} else if (m == encrypt_mode::external) {
|
||||
os << "external";
|
||||
} else {
|
||||
os << "on";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
//class used to parse next block encryption status page
|
||||
class SSP_NBES: public KAD_CLASS{
|
||||
public:
|
||||
SSP_PAGE_NBES nbes;
|
||||
SSP_NBES(SSP_PAGE_BUFFER* buffer);
|
||||
};
|
||||
//class used to parse data encryption status page
|
||||
class SSP_DES: public KAD_CLASS{
|
||||
public:
|
||||
SSP_PAGE_DES des;
|
||||
SSP_DES(SSP_PAGE_BUFFER* buffer);
|
||||
enum class decrypt_mode : std::uint8_t {
|
||||
off = 0u,
|
||||
raw = 1u,
|
||||
on = 2u,
|
||||
mixed = 3u,
|
||||
};
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& os, decrypt_mode m)
|
||||
{
|
||||
if (m == decrypt_mode::off) {
|
||||
os << "off";
|
||||
} else if (m == decrypt_mode::raw) {
|
||||
os << "raw";
|
||||
} else if (m == decrypt_mode::on) {
|
||||
os << "on";
|
||||
} else {
|
||||
os << "mixed";
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
//enum for SCSIEncryptOptions.cryptMode
|
||||
enum { CRYPTMODE_OFF, CRYPTMODE_MIXED,CRYPTMODE_ON,CRYPTMODE_RAWREAD};
|
||||
|
||||
//used to pass parameters to SCSIWriteEncryptOptions
|
||||
class SCSIEncryptOptions {
|
||||
public:
|
||||
int rdmc;
|
||||
bool CKOD;
|
||||
int cryptMode;
|
||||
unsigned int algorithmIndex;
|
||||
std::string cryptoKey;
|
||||
std::string keyName;
|
||||
SCSIEncryptOptions();
|
||||
enum class kad_type : std::uint8_t {
|
||||
ukad = 0u, // unauthenticated key-associated data
|
||||
akad = 1u, // authenticated key-associated data
|
||||
nonce = 2u, // nonce value
|
||||
mkad = 3u, // metadata key-associated data
|
||||
wkkad = 4u, // wrapped key key-associated data
|
||||
};
|
||||
|
||||
//Gets encryption options on the tape drive
|
||||
SSP_DES* SSPGetDES(std::string tapeDevice);
|
||||
//Gets the encryption status from the tape volume
|
||||
SSP_NBES* SSPGetNBES(std::string tapeDevice,bool retry);
|
||||
//Writes encryption options to the tape drive
|
||||
bool SCSIWriteEncryptOptions(std::string tapeDevice, SCSIEncryptOptions* eOptions);
|
||||
//Gets device inquiry
|
||||
SCSI_PAGE_INQ* SCSIGetInquiry(std::string tapeDevice);
|
||||
enum class kadf : std::uint8_t {
|
||||
unspecified = 0u,
|
||||
binary_key_name = 1u,
|
||||
ascii_key_name = 2u,
|
||||
};
|
||||
|
||||
// key-associated data
|
||||
struct __attribute__((packed)) kad {
|
||||
kad_type type;
|
||||
std::byte flags;
|
||||
static constexpr auto flags_authenticated_pos {0u};
|
||||
static constexpr std::byte flags_authenticated_mask {
|
||||
7u << flags_authenticated_pos};
|
||||
std::uint16_t length;
|
||||
std::uint8_t descriptor[];
|
||||
};
|
||||
static_assert(sizeof(kad) == 4u);
|
||||
|
||||
// common 4-byte header of all SP-IN and SP-OUT pages
|
||||
struct __attribute__((packed)) page_header {
|
||||
std::uint16_t page_code;
|
||||
std::uint16_t length;
|
||||
};
|
||||
static_assert(sizeof(page_header) == 4u);
|
||||
|
||||
// device encryption status page
|
||||
struct __attribute__((packed)) page_des {
|
||||
std::uint16_t page_code;
|
||||
std::uint16_t length;
|
||||
std::byte scope;
|
||||
static constexpr auto scope_it_nexus_pos {5u};
|
||||
static constexpr std::byte scope_it_nexus_mask {7u << scope_it_nexus_pos};
|
||||
static constexpr auto scope_encryption_pos {0u};
|
||||
static constexpr std::byte scope_encryption_mask {7u << scope_encryption_pos};
|
||||
encrypt_mode encryption_mode;
|
||||
decrypt_mode decryption_mode;
|
||||
std::uint8_t algorithm_index;
|
||||
std::uint32_t key_instance_counter;
|
||||
std::byte flags;
|
||||
static constexpr auto flags_parameters_control_pos {4u};
|
||||
static constexpr std::byte flags_parameters_control_mask {
|
||||
7u << flags_parameters_control_pos};
|
||||
// volume contains encrypted logical blocks
|
||||
static constexpr auto flags_vcelb_pos {3u};
|
||||
static constexpr std::byte flags_vcelb_mask {1u << flags_vcelb_pos};
|
||||
// check external encryption mode status
|
||||
static constexpr auto flags_ceems_pos {1u};
|
||||
static constexpr std::byte flags_ceems_mask {3u << flags_ceems_pos};
|
||||
// raw decryption mode disabled
|
||||
static constexpr auto flags_rdmd_pos {0u};
|
||||
static constexpr std::byte flags_rdmd_mask {1u << flags_rdmd_pos};
|
||||
kadf kad_format;
|
||||
std::uint16_t asdk_count;
|
||||
std::byte reserved[8];
|
||||
kad kads[];
|
||||
};
|
||||
static_assert(sizeof(page_des) == 24u);
|
||||
|
||||
constexpr std::size_t SSP_PAGE_ALLOCATION = 8192;
|
||||
using page_buffer = std::uint8_t[SSP_PAGE_ALLOCATION];
|
||||
|
||||
// set data encryption page
|
||||
struct __attribute__((packed)) page_sde {
|
||||
std::uint16_t page_code;
|
||||
std::uint16_t length;
|
||||
std::byte control;
|
||||
static constexpr auto control_scope_pos {5u};
|
||||
static constexpr std::byte control_scope_mask {7u << control_scope_pos};
|
||||
static constexpr auto control_lock_pos {0u};
|
||||
static constexpr std::byte control_lock_mask {1u << control_lock_pos};
|
||||
std::byte flags;
|
||||
// check external encryption mode
|
||||
static constexpr auto flags_ceem_pos {6u};
|
||||
static constexpr std::byte flags_ceem_mask {3u << flags_ceem_pos};
|
||||
// raw decryption mode control
|
||||
static constexpr auto flags_rdmc_pos {4u};
|
||||
static constexpr std::byte flags_rdmc_mask {3u << flags_rdmc_pos};
|
||||
// supplemental decryption key
|
||||
static constexpr auto flags_sdk_pos {3u};
|
||||
static constexpr std::byte flags_sdk_mask {1u << flags_sdk_pos};
|
||||
// clear key on demount
|
||||
static constexpr auto flags_ckod_pos {2u};
|
||||
static constexpr std::byte flags_ckod_mask {1u << flags_ckod_pos};
|
||||
// clear key on reservation preempt
|
||||
static constexpr auto flags_ckorp_pos {1u};
|
||||
static constexpr std::byte flags_ckorp_mask {1u << flags_ckorp_pos};
|
||||
// clear key on reservation loss
|
||||
static constexpr auto flags_ckorl_pos {0u};
|
||||
static constexpr std::byte flags_ckorl_mask {1u << flags_ckorl_pos};
|
||||
encrypt_mode encryption_mode;
|
||||
decrypt_mode decryption_mode;
|
||||
std::uint8_t algorithm_index;
|
||||
std::uint8_t key_format;
|
||||
kadf kad_format;
|
||||
std::byte reserved[7];
|
||||
std::uint16_t key_length;
|
||||
std::uint8_t key[];
|
||||
};
|
||||
static_assert(sizeof(page_sde) == 20u);
|
||||
|
||||
enum class sde_rdmc : std::uint8_t {
|
||||
algorithm_default = 0u << page_sde::flags_rdmc_pos,
|
||||
enabled = 2u << page_sde::flags_rdmc_pos, // corresponds to --allow-raw-read
|
||||
// command line option
|
||||
disabled =
|
||||
3u << page_sde::flags_rdmc_pos, // corresponds to --no-allow-raw-read
|
||||
// command line option
|
||||
};
|
||||
|
||||
// next block encryption status page
|
||||
struct __attribute__((packed)) page_nbes {
|
||||
std::uint16_t page_code;
|
||||
std::uint16_t length;
|
||||
std::uint64_t logical_object_number;
|
||||
std::byte status;
|
||||
static constexpr auto status_compression_pos {4u};
|
||||
static constexpr std::byte status_compression_mask {
|
||||
15u << status_compression_pos};
|
||||
static constexpr auto status_encryption_pos {0u};
|
||||
static constexpr std::byte status_encryption_mask {15u
|
||||
<< status_encryption_pos};
|
||||
std::uint8_t algorithm_index;
|
||||
std::byte flags;
|
||||
// encryption mode external status
|
||||
static constexpr auto flags_emes_pos {1u};
|
||||
static constexpr std::byte flags_emes_mask {1u << flags_emes_pos};
|
||||
// raw decryption mode disabled status
|
||||
static constexpr auto flags_rdmds_pos {0u};
|
||||
static constexpr std::byte flags_rdmds_mask {1u << flags_rdmds_pos};
|
||||
kadf kad_format;
|
||||
kad kads[];
|
||||
};
|
||||
static_assert(sizeof(page_nbes) == 16u);
|
||||
|
||||
struct __attribute__((packed)) algorithm_descriptor {
|
||||
std::uint8_t algorithm_index;
|
||||
std::byte reserved1;
|
||||
std::uint16_t length;
|
||||
std::byte flags1;
|
||||
// algorithm valid for mounted volume
|
||||
static constexpr auto flags1_avfmv_pos {7u};
|
||||
static constexpr std::byte flags1_avfmv_mask {1u << flags1_avfmv_pos};
|
||||
// supplemental decryption key capable
|
||||
static constexpr auto flags1_sdk_c_pos {6u};
|
||||
static constexpr std::byte flags1_sdk_c_mask {1u << flags1_sdk_c_pos};
|
||||
// message authentication code capable
|
||||
static constexpr auto flags1_mac_c_pos {5u};
|
||||
static constexpr std::byte flags1_mac_c_mask {1u << flags1_mac_c_pos};
|
||||
// distinguish encrypted logical block capable
|
||||
static constexpr auto flags1_delb_c_pos {4u};
|
||||
static constexpr std::byte flags1_delb_c_mask {1u << flags1_delb_c_pos};
|
||||
// decryption capabilities
|
||||
static constexpr auto flags1_decrypt_c_pos {2u};
|
||||
static constexpr std::byte flags1_decrypt_c_mask {3u << flags1_decrypt_c_pos};
|
||||
// encryption capabilities
|
||||
static constexpr auto flags1_encrypt_c_pos {0u};
|
||||
static constexpr std::byte flags1_encrypt_c_mask {3u << flags1_encrypt_c_pos};
|
||||
std::byte flags2;
|
||||
// algorithm valid for current logical position
|
||||
static constexpr auto flags2_avfcp_pos {6u};
|
||||
static constexpr std::byte flags2_avfcp_mask {3u << flags2_avfcp_pos};
|
||||
// nonce capabilities
|
||||
static constexpr auto flags2_nonce_pos {4u};
|
||||
static constexpr std::byte flags2_nonce_mask {3u << flags2_nonce_pos};
|
||||
// KAD format capable
|
||||
static constexpr auto flags2_kadf_c_pos {3u};
|
||||
static constexpr std::byte flags2_kadf_c_mask {1u << flags2_kadf_c_pos};
|
||||
// volume contains encrypted logical blocks capable
|
||||
static constexpr auto flags2_vcelb_c_pos {2u};
|
||||
static constexpr std::byte flags2_vcelb_c_mask {1u << flags2_vcelb_c_pos};
|
||||
// U-KAD fixed
|
||||
static constexpr auto flags2_ukadf_pos {1u};
|
||||
static constexpr std::byte flags2_ukadf_mask {1u << flags2_ukadf_pos};
|
||||
// A-KAD fixed
|
||||
static constexpr auto flags2_akadf_pos {0u};
|
||||
static constexpr std::byte flags2_akadf_mask {1u << flags2_akadf_pos};
|
||||
std::uint16_t maximum_ukad_length;
|
||||
std::uint16_t maximum_akad_length;
|
||||
std::uint16_t key_length;
|
||||
std::byte flags3;
|
||||
// decryption capabilities
|
||||
static constexpr auto flags3_dkad_c_pos {6u};
|
||||
static constexpr std::byte flags3_dkad_c_mask {3u << flags3_dkad_c_pos};
|
||||
// external encryption mode control capabilities
|
||||
static constexpr auto flags3_eemc_c_pos {4u};
|
||||
static constexpr std::byte flags3_eemc_c_mask {3u << flags3_eemc_c_pos};
|
||||
// raw decryption mode control capabilities
|
||||
static constexpr auto flags3_rdmc_c_pos {1u};
|
||||
static constexpr std::byte flags3_rdmc_c_mask {7u << flags3_rdmc_c_pos};
|
||||
// encryption algorithm records encryption mode
|
||||
static constexpr auto flags3_earem_pos {0u};
|
||||
static constexpr std::byte flags3_earem_mask {1u << flags3_earem_pos};
|
||||
std::uint8_t maximum_eedk_count;
|
||||
static constexpr auto maximum_eedk_count_pos {0u};
|
||||
static constexpr std::uint8_t maximum_eedk_count_mask {
|
||||
15u << maximum_eedk_count_pos};
|
||||
std::uint16_t msdk_count;
|
||||
std::uint16_t maximum_eedk_size;
|
||||
std::byte reserved2[2];
|
||||
std::uint32_t security_algorithm_code;
|
||||
|
||||
static constexpr std::size_t header_size {4u};
|
||||
};
|
||||
static_assert(sizeof(algorithm_descriptor) == 24u);
|
||||
|
||||
// device encryption capabilities page
|
||||
struct __attribute__((packed)) page_dec {
|
||||
std::uint16_t page_code;
|
||||
std::uint16_t length;
|
||||
std::byte flags;
|
||||
// external data encryption control capable
|
||||
static constexpr auto flags_extdecc_pos {2u};
|
||||
static constexpr std::byte flags_extdecc_mask {3u << flags_extdecc_pos};
|
||||
// configuration prevented
|
||||
static constexpr auto flags_cfg_p_pos {0u};
|
||||
static constexpr std::byte flags_cfg_p_mask {3u << flags_cfg_p_pos};
|
||||
std::byte reserved[15];
|
||||
algorithm_descriptor ads[];
|
||||
};
|
||||
static_assert(sizeof(page_dec) == 20u);
|
||||
|
||||
struct __attribute__((packed)) inquiry_data {
|
||||
// bitfield definitions omitted since stenc only uses vendor and product info
|
||||
std::byte peripheral;
|
||||
std::byte flags1;
|
||||
std::uint8_t version;
|
||||
std::byte flags2;
|
||||
std::uint8_t additional_length;
|
||||
std::byte flags3;
|
||||
std::byte flags4;
|
||||
std::byte flags5;
|
||||
std::array<char, 8> vendor;
|
||||
std::array<char, 16> product_id;
|
||||
std::array<char, 4> product_rev;
|
||||
std::uint8_t vendor_specific[20];
|
||||
std::byte reserved1[2];
|
||||
std::uint16_t version_descriptor[8];
|
||||
std::byte reserved2[22];
|
||||
|
||||
static constexpr std::size_t header_size {5u};
|
||||
};
|
||||
static_assert(sizeof(inquiry_data) == 96u);
|
||||
|
||||
struct __attribute__((packed)) sense_data {
|
||||
std::byte response;
|
||||
static constexpr auto response_valid_pos {7u};
|
||||
static constexpr std::byte response_valid_mask {1u << response_valid_pos};
|
||||
static constexpr auto response_code_pos {0u};
|
||||
static constexpr std::byte response_code_mask {127u << response_code_pos};
|
||||
std::byte reserved;
|
||||
std::byte flags;
|
||||
static constexpr auto flags_filemark_pos {7u};
|
||||
static constexpr std::byte flags_filemark_mask {1u << flags_filemark_pos};
|
||||
static constexpr auto flags_eom_pos {6u}; // end of medium
|
||||
static constexpr std::byte flags_eom_mask {1u << flags_eom_pos};
|
||||
static constexpr auto flags_ili_pos {5u}; // incorrect length indicator
|
||||
static constexpr std::byte flags_ili_mask {1u << flags_ili_pos};
|
||||
static constexpr auto flags_sdat_ovfl_pos {4u}; // sense data overflow
|
||||
static constexpr std::byte flags_sdat_ovfl_mask {1u << flags_sdat_ovfl_pos};
|
||||
static constexpr auto flags_sense_key_pos {0u};
|
||||
static constexpr std::byte flags_sense_key_mask {15u << flags_sense_key_pos};
|
||||
std::uint8_t information[4];
|
||||
std::uint8_t additional_sense_length;
|
||||
std::uint8_t command_specific_information[4];
|
||||
std::uint8_t additional_sense_code;
|
||||
std::uint8_t additional_sense_qualifier;
|
||||
std::uint8_t field_replaceable_unit_code;
|
||||
std::uint8_t sense_key_specific[3];
|
||||
std::uint8_t additional_sense_bytes[];
|
||||
|
||||
static constexpr std::byte no_sense {0u};
|
||||
static constexpr std::byte recovered_error {1u};
|
||||
static constexpr std::byte not_ready {2u};
|
||||
static constexpr std::byte medium_error {3u};
|
||||
static constexpr std::byte hardware_error {4u};
|
||||
static constexpr std::byte illegal_request {5u};
|
||||
static constexpr std::byte unit_attention {6u};
|
||||
static constexpr std::byte data_protect {7u};
|
||||
static constexpr std::byte blank_check {8u};
|
||||
|
||||
static constexpr std::size_t header_size {8u};
|
||||
static constexpr std::size_t maximum_size {252u}; // per SPC-5
|
||||
};
|
||||
static_assert(sizeof(sense_data) == 18u);
|
||||
|
||||
// declared as std::array instead of std::uint8_t[] because
|
||||
// std::unique_ptr does not allow construction of fixed-sized arrays
|
||||
using sense_buffer = std::array<std::uint8_t, sense_data::maximum_size>;
|
||||
|
||||
class scsi_error : public std::runtime_error {
|
||||
public:
|
||||
explicit scsi_error(std::unique_ptr<sense_buffer>&& buf)
|
||||
: std::runtime_error {"SCSI I/O error"}, sense_buf {std::move(buf)}
|
||||
{}
|
||||
const sense_data& get_sense() const
|
||||
{
|
||||
return reinterpret_cast<sense_data&>(*sense_buf->data());
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<sense_buffer> sense_buf;
|
||||
};
|
||||
|
||||
// Extract pointers to kad structures within a variable-length page.
|
||||
// Page must have a page_header layout
|
||||
template <typename Page>
|
||||
std::vector<std::reference_wrapper<const kad>> read_page_kads(const Page& page)
|
||||
{
|
||||
const auto start {reinterpret_cast<const std::uint8_t *>(&page)};
|
||||
auto it {start + sizeof(Page)};
|
||||
const auto end {start + ntohs(page.length) + sizeof(page_header)};
|
||||
std::vector<std::reference_wrapper<const kad>> v {};
|
||||
|
||||
while (it < end) {
|
||||
auto elem {reinterpret_cast<const kad *>(it)};
|
||||
v.push_back(std::cref(*elem));
|
||||
it += ntohs(elem->length) + sizeof(kad);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
// Check if a tape is loaded
|
||||
bool is_device_ready(const std::string& device);
|
||||
// Get SCSI inquiry data from device
|
||||
inquiry_data get_inquiry(const std::string& device);
|
||||
// Get data encryption status page
|
||||
const page_des& get_des(const std::string& device, std::uint8_t *buffer,
|
||||
std::size_t length);
|
||||
// Get next block encryption status page
|
||||
const page_nbes& get_nbes(const std::string& device, std::uint8_t *buffer,
|
||||
std::size_t length);
|
||||
// Get device encryption capabilities
|
||||
const page_dec& get_dec(const std::string& device, std::uint8_t *buffer,
|
||||
std::size_t length);
|
||||
// Fill out a set data encryption page with parameters.
|
||||
// Result is allocated and returned as a std::unique_ptr and should
|
||||
// be sent to the device using scsi::write_sde
|
||||
std::unique_ptr<const std::uint8_t[]>
|
||||
make_sde(encrypt_mode enc_mode, decrypt_mode dec_mode,
|
||||
std::uint8_t algorithm_index, const std::vector<std::uint8_t>& key,
|
||||
const std::string& key_name, kadf key_format, sde_rdmc rdmc,
|
||||
bool ckod);
|
||||
// Write set data encryption parameters to device
|
||||
void write_sde(const std::string& device, const std::uint8_t *sde_buffer);
|
||||
void print_sense_data(std::ostream& os, const sense_data& sd);
|
||||
std::vector<std::reference_wrapper<const algorithm_descriptor>>
|
||||
read_algorithms(const page_dec& page);
|
||||
|
||||
} // namespace scsi
|
||||
|
||||
#endif
|
||||
|
||||
45
stenc.spec
Normal file
45
stenc.spec
Normal file
@@ -0,0 +1,45 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
Name: stenc
|
||||
Version: 2.x.x
|
||||
Release: 1%{?dist}
|
||||
Summary: SCSI Tape Encryption Manager
|
||||
|
||||
License: GPL-2.0-or-later
|
||||
URL: https://github.com/scsitape/stenc
|
||||
Source0: https://github.com/scsitape/stenc/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: make
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: bash-completion
|
||||
|
||||
%description
|
||||
SCSI Tape Encryption Manager - Manages encryption on LTO 4 and newer tape
|
||||
drives with hardware-based encryption
|
||||
|
||||
%prep
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
./autogen.sh
|
||||
%configure
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
make install DESTDIR=%{buildroot}
|
||||
|
||||
%files
|
||||
%license LICENSES/GPL-2.0-or-later.txt
|
||||
%doc README.md AUTHORS.md
|
||||
%{_bindir}/stenc
|
||||
%{_mandir}/man1/stenc.1*
|
||||
%{_datadir}/bash-completion/completions/stenc
|
||||
|
||||
%changelog
|
||||
* Sat Aug 27 2022 Paweł Marciniak <sunwire+repo@gmail.com> - 2.x.x-1
|
||||
- Version 2.0.0 Pre-release
|
||||
|
||||
43
stenc.xml
Normal file
43
stenc.xml
Normal file
@@ -0,0 +1,43 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<cpe-list xmlns:config="http://scap.nist.gov/schema/configuration/0.1" xmlns="http://cpe.mitre.org/dictionary/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlnsscap-core="http://scap.nist.gov/schema/scap-core/0.3" xmlns:cpe-23="http://scap.nist.gov/schema/cpe-extension/2.3" xmlns:ns6="http://scap.nist.gov/schema/scap-core/0.1" xmlns:meta="http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2" xsi:schemaLocation="http://scap.nist.gov/schema/cpe-extension/2.3 https://scap.nist.gov/schema/cpe/2.3/cpe-dictionary-extension_2.3.xsd http://cpe.mitre.org/dictionary/2.0 https://scap.nist.gov/schema/cpe/2.3/cpe-dictionary_2.3.xsd http://scap.nist.gov/schema/cpe-dictionary-metadata/0.2 https://scap.nist.gov/schema/cpe/2.1/cpe-dictionary-metadata_0.2.xsd http://scap.nist.gov/schema/scap-core/0.3 https://scap.nist.gov/schema/nvd/scap-core_0.3.xsd http://scap.nist.gov/schema/configuration/0.1 https://scap.nist.gov/schema/nvd/configuration_0.1.xsd http://scap.nist.gov/schema/scap-core/0.1 https://scap.nist.gov/schema/nvd/scap-core_0.1.xsd">
|
||||
<cpe-item name="cpe:/a:stencproject:stenc:1.0.7">
|
||||
<title xml:lang="en-US">stenc 1.0.7</title>
|
||||
<references>
|
||||
<reference href="https://github.com/scsitape/stenc/releases">VERSION</reference>
|
||||
<reference href="https://github.com/scsitape">VENDOR</reference>
|
||||
</references>
|
||||
<cpe-23:cpe23-item name="cpe:2.3:a:stencproject:stenc:1.0.7:*:*:*:*:*:*:*"/>
|
||||
</cpe-item>
|
||||
<cpe-item name="cpe:/a:stencproject:stenc:1.0.8">
|
||||
<title xml:lang="en-US">stenc 1.0.8</title>
|
||||
<references>
|
||||
<reference href="https://github.com/scsitape/stenc/releases">VERSION</reference>
|
||||
<reference href="https://github.com/scsitape">VENDOR</reference>
|
||||
</references>
|
||||
<cpe-23:cpe23-item name="cpe:2.3:a:stencproject:stenc:1.0.8:*:*:*:*:*:*:*"/>
|
||||
</cpe-item>
|
||||
<cpe-item name="cpe:/a:stencproject:stenc:1.1.0">
|
||||
<title xml:lang="en-US">stenc 1.1.0</title>
|
||||
<references>
|
||||
<reference href="https://github.com/scsitape/stenc/releases">VERSION</reference>
|
||||
<reference href="https://github.com/scsitape">VENDOR</reference>
|
||||
</references>
|
||||
<cpe-23:cpe23-item name="cpe:2.3:a:stencproject:stenc:1.1.0:*:*:*:*:*:*:*"/>
|
||||
</cpe-item>
|
||||
<cpe-item name="cpe:/a:stencproject:stenc:1.1.1">
|
||||
<title xml:lang="en-US">stenc 1.1.1</title>
|
||||
<references>
|
||||
<reference href="https://github.com/scsitape/stenc/releases">VERSION</reference>
|
||||
<reference href="https://github.com/scsitape">VENDOR</reference>
|
||||
</references>
|
||||
<cpe-23:cpe23-item name="cpe:2.3:a:stencproject:stenc:1.1.1:*:*:*:*:*:*:*"/>
|
||||
</cpe-item>
|
||||
<cpe-item name="cpe:/a:stencproject:stenc:2.0.0">
|
||||
<title xml:lang="en-US">stenc 2.0.0</title>
|
||||
<references>
|
||||
<reference href="https://github.com/scsitape/stenc/releases">VERSION</reference>
|
||||
<reference href="https://github.com/scsitape">VENDOR</reference>
|
||||
</references>
|
||||
<cpe-23:cpe23-item name="cpe:2.3:a:stencproject:stenc:2.0.0:*:*:*:*:*:*:*"/>
|
||||
</cpe-item>
|
||||
</cpe-list>
|
||||
3
stenc.xml.license
Normal file
3
stenc.xml.license
Normal file
@@ -0,0 +1,3 @@
|
||||
SPDX-FileCopyrightText: 2022 stenc authors
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
||||
9
tests/Makefile.am
Normal file
9
tests/Makefile.am
Normal file
@@ -0,0 +1,9 @@
|
||||
# SPDX-FileCopyrightText: 2022 stenc authors
|
||||
#
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
AM_CPPFLAGS=-std=c++17 -I${top_srcdir}/src
|
||||
TESTS=scsi output
|
||||
check_PROGRAMS=scsi output
|
||||
scsi_SOURCES=catch.hpp scsi.cpp ${top_srcdir}/src/scsiencrypt.cpp
|
||||
output_SOURCES=catch.hpp output.cpp ${top_srcdir}/src/scsiencrypt.cpp
|
||||
17976
tests/catch.hpp
Normal file
17976
tests/catch.hpp
Normal file
File diff suppressed because it is too large
Load Diff
178
tests/output.cpp
Normal file
178
tests/output.cpp
Normal file
@@ -0,0 +1,178 @@
|
||||
// SPDX-FileCopyrightText: 2022 stenc authors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "main.cpp"
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
TEST_CASE("Test key_from_hex_chars", "[output]")
|
||||
{
|
||||
REQUIRE(key_from_hex_chars(""s) == std::vector<std::uint8_t> {});
|
||||
REQUIRE(key_from_hex_chars("hello"s) == std::nullopt);
|
||||
REQUIRE(key_from_hex_chars("12z"s) == std::nullopt);
|
||||
REQUIRE(key_from_hex_chars("0xabcd"s) == std::nullopt);
|
||||
REQUIRE(key_from_hex_chars("ab cd"s) == std::nullopt);
|
||||
REQUIRE(key_from_hex_chars("a"s) == std::vector<std::uint8_t> {0x0a});
|
||||
REQUIRE(key_from_hex_chars("0123456789abcdef"s) ==
|
||||
std::vector<std::uint8_t> {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd,
|
||||
0xef});
|
||||
REQUIRE(key_from_hex_chars("0123456789ABCDEF"s) ==
|
||||
std::vector<std::uint8_t> {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd,
|
||||
0xef});
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the output of stenc given device responses
|
||||
*
|
||||
* These tests check the representation and interpretation of raw device data
|
||||
* and that the program output accurately reports the meaning of the data.
|
||||
*/
|
||||
TEST_CASE("Test SCSI inquiry output", "[output]")
|
||||
{
|
||||
const std::uint8_t response[] {
|
||||
0x01, 0x80, 0x00, 0x02, 0x5b, 0x00, 0x00, 0x02, 0x41, 0x43, 0x4d, 0x45,
|
||||
0x20, 0x20, 0x20, 0x20, 0x55, 0x6c, 0x74, 0x72, 0x69, 0x75, 0x6d, 0x2d,
|
||||
0x31, 0x30, 0x30, 0x30, 0x20, 0x20, 0x20, 0x20, 0x31, 0x32, 0x33, 0x34,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const std::string expected_output {"ACME Ultrium-1000 1234"s};
|
||||
std::ostringstream oss;
|
||||
print_device_inquiry(oss,
|
||||
reinterpret_cast<const scsi::inquiry_data&>(response));
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
|
||||
TEST_CASE("SCSI get device encryption status output 1", "[output]")
|
||||
{
|
||||
std::map<std::uint8_t, std::string> algorithms {
|
||||
{1, "AES-256-GCM-128"s},
|
||||
};
|
||||
const std::uint8_t page[] {
|
||||
0x00, 0x20, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const std::string expected_output {"\
|
||||
Reading: Not decrypting\n\
|
||||
Writing: Not encrypting\n\
|
||||
Key instance counter: 0\n"s};
|
||||
std::ostringstream oss;
|
||||
print_device_status(oss, reinterpret_cast<const scsi::page_des&>(page),
|
||||
algorithms);
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
|
||||
TEST_CASE("SCSI get device encryption status output 2", "[output]")
|
||||
{
|
||||
std::map<std::uint8_t, std::string> algorithms {
|
||||
{1, "AES-256-GCM-128"s},
|
||||
};
|
||||
const std::uint8_t page[] {
|
||||
0x00, 0x20, 0x00, 0x24, 0x42, 0x02, 0x02, 0x01, 0x00, 0x00,
|
||||
0x00, 0x01, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x48, 0x65,
|
||||
0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21,
|
||||
};
|
||||
const std::string expected_output {"\
|
||||
Reading: Decrypting (AES-256-GCM-128)\n\
|
||||
Unencrypted blocks not readable\n\
|
||||
Writing: Encrypting (AES-256-GCM-128)\n\
|
||||
Key instance counter: 1\n\
|
||||
Drive key desc. (U-KAD): Hello world!\n"s};
|
||||
std::ostringstream oss;
|
||||
print_device_status(oss, reinterpret_cast<const scsi::page_des&>(page),
|
||||
algorithms);
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SCSI get next block encryption status output 1", "[output]")
|
||||
{
|
||||
std::map<std::uint8_t, std::string> algorithms {
|
||||
{1, "AES-256-GCM-128"s},
|
||||
};
|
||||
const std::uint8_t page[] {
|
||||
0x00, 0x21, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
|
||||
};
|
||||
const std::string expected_output {"\
|
||||
Current block status: Not encrypted\n"s};
|
||||
std::ostringstream oss;
|
||||
print_block_status(oss, reinterpret_cast<const scsi::page_nbes&>(page),
|
||||
algorithms);
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SCSI get next block encryption status output 2", "[output]")
|
||||
{
|
||||
std::map<std::uint8_t, std::string> algorithms {
|
||||
{1, "AES-256-GCM-128"s},
|
||||
};
|
||||
const std::uint8_t page[] {
|
||||
0x00, 0x21, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0c, 0x48, 0x65,
|
||||
0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21,
|
||||
};
|
||||
const std::string expected_output {"\
|
||||
Current block status: Encrypted and able to decrypt (AES-256-GCM-128)\n"s};
|
||||
std::ostringstream oss;
|
||||
print_block_status(oss, reinterpret_cast<const scsi::page_nbes&>(page),
|
||||
algorithms);
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SCSI get next block encryption status output 3", "[output]")
|
||||
{
|
||||
std::map<std::uint8_t, std::string> algorithms {
|
||||
{1, "AES-256-GCM-128"s},
|
||||
};
|
||||
const std::uint8_t page[] {
|
||||
0x00, 0x21, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x06, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x0c, 0x48, 0x65,
|
||||
0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21,
|
||||
};
|
||||
const std::string expected_output {"\
|
||||
Current block status: Encrypted, key missing or invalid (AES-256-GCM-128)\n\
|
||||
Current block key desc. (U-KAD): Hello world!\n"s};
|
||||
std::ostringstream oss;
|
||||
print_block_status(oss, reinterpret_cast<const scsi::page_nbes&>(page),
|
||||
algorithms);
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
|
||||
TEST_CASE("Test SCSI get data encryption capabilities output", "[output]")
|
||||
{
|
||||
const std::uint8_t page[] {
|
||||
0x00, 0x10, 0x00, 0x3c, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x14,
|
||||
0x8a, 0x8c, 0x00, 0x20, 0x00, 0x3c, 0x00, 0x20, 0xed, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x14, 0x02, 0x00, 0x00, 0x14,
|
||||
0x8a, 0x8f, 0x00, 0x20, 0x00, 0x3c, 0x00, 0x20, 0xd9, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10,
|
||||
};
|
||||
const std::string expected_output {"\
|
||||
Supported algorithms:\n\
|
||||
1 AES-256-GCM-128\n\
|
||||
Key descriptors allowed, maximum 32 bytes\n\
|
||||
Raw decryption mode not allowed\n\
|
||||
2 AES-256-CCM-128\n\
|
||||
Key descriptors allowed, fixed 32 bytes\n\
|
||||
Raw decryption mode allowed, raw read disabled by default\n"s};
|
||||
std::ostringstream oss;
|
||||
print_algorithms(oss, scsi::read_algorithms(
|
||||
reinterpret_cast<const scsi::page_dec&>(page)));
|
||||
REQUIRE(oss.str() == expected_output);
|
||||
}
|
||||
427
tests/scsi.cpp
Normal file
427
tests/scsi.cpp
Normal file
@@ -0,0 +1,427 @@
|
||||
// SPDX-FileCopyrightText: 2022 stenc authors
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#if HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include "scsiencrypt.h"
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
/**
|
||||
* Compare the SPOUT Set Data Encryption pages generated by stenc to an
|
||||
* expected output buffer based on the SCSI command spec.
|
||||
*
|
||||
* This checks that the program can correctly format command buffers that
|
||||
* reflect available input and program options.
|
||||
*/
|
||||
TEST_CASE("Disable encryption command", "[scsi]")
|
||||
{
|
||||
const std::uint8_t expected[] {
|
||||
// clang-format off
|
||||
0x00, 0x10, // page code
|
||||
0x00, 0x10, // page length
|
||||
0x40, // scope
|
||||
0x40, // CEEM, CKOD, RDMC, et al.
|
||||
0x00, // encyption mode
|
||||
0x00, // decryption mode
|
||||
0x01, // algorithm index
|
||||
0x00, // key format
|
||||
0x00, // KAD format
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved [7]
|
||||
0x00, 0x00 // key length
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
std::vector<std::uint8_t> key {};
|
||||
std::string key_name {};
|
||||
|
||||
auto page_buffer {scsi::make_sde(
|
||||
scsi::encrypt_mode::off, scsi::decrypt_mode::off, 1u, key, key_name,
|
||||
scsi::kadf::unspecified, scsi::sde_rdmc::algorithm_default, false)};
|
||||
auto& page {reinterpret_cast<const scsi::page_sde&>(*page_buffer.get())};
|
||||
REQUIRE(sizeof(scsi::page_header) + ntohs(page.length) == sizeof(expected));
|
||||
REQUIRE(std::memcmp(&page, expected, sizeof(expected)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable encryption command", "[scsi]")
|
||||
{
|
||||
const std::uint8_t expected[] {
|
||||
// clang-format off
|
||||
0x00, 0x10, // page code
|
||||
0x00, 0x30, // page length
|
||||
0x40, // scope
|
||||
0x40, // CEEM, CKOD, RDMC, et al.
|
||||
0x02, // encyption mode
|
||||
0x02, // decryption mode
|
||||
0x01, // algorithm index
|
||||
0x00, // key format
|
||||
0x00, // KAD format
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved [7]
|
||||
0x00, 0x20, // key length
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
std::vector<std::uint8_t> key {
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA,
|
||||
0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
};
|
||||
std::string key_name {};
|
||||
|
||||
auto page_buffer {scsi::make_sde(
|
||||
scsi::encrypt_mode::on, scsi::decrypt_mode::on, 1u, key, key_name,
|
||||
scsi::kadf::unspecified, scsi::sde_rdmc::algorithm_default, false)};
|
||||
auto& page {reinterpret_cast<const scsi::page_sde&>(*page_buffer.get())};
|
||||
REQUIRE(sizeof(scsi::page_header) + ntohs(page.length) == sizeof(expected));
|
||||
REQUIRE(std::memcmp(&page, expected, sizeof(expected)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable encryption command with options", "[scsi]")
|
||||
{
|
||||
const std::uint8_t expected[] {
|
||||
// clang-format off
|
||||
0x00, 0x10, // page code
|
||||
0x00, 0x30, // page length
|
||||
0x40, // scope
|
||||
0x64, // CEEM, CKOD, RDMC, et al.
|
||||
0x02, // encyption mode
|
||||
0x02, // decryption mode
|
||||
0x01, // algorithm index
|
||||
0x00, // key format
|
||||
0x01, // KAD format
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved [7]
|
||||
0x00, 0x20, // key length
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
std::vector<std::uint8_t> key {
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA,
|
||||
0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
};
|
||||
std::string key_name {};
|
||||
|
||||
auto page_buffer {scsi::make_sde(
|
||||
scsi::encrypt_mode::on, scsi::decrypt_mode::on, 1u, key, key_name,
|
||||
scsi::kadf::binary_key_name, scsi::sde_rdmc::enabled, true)};
|
||||
auto& page {reinterpret_cast<const scsi::page_sde&>(*page_buffer.get())};
|
||||
REQUIRE(sizeof(scsi::page_header) + ntohs(page.length) == sizeof(expected));
|
||||
REQUIRE(std::memcmp(&page, expected, sizeof(expected)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Enable encryption command with key name", "[scsi]")
|
||||
{
|
||||
const std::uint8_t expected[] {
|
||||
// clang-format off
|
||||
0x00, 0x10, // page code
|
||||
0x00, 0x40, // page length
|
||||
0x40, // scope
|
||||
0x40, // CEEM, CKOD, RDMC, et al.
|
||||
0x02, // encyption mode
|
||||
0x02, // decryption mode
|
||||
0x01, // algorithm index
|
||||
0x00, // key format
|
||||
0x02, // KAD format
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved [7]
|
||||
0x00, 0x20, // key length
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
|
||||
0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
// KAD
|
||||
0x00, // type
|
||||
0x00, // authenticated
|
||||
0x00, 0x0c, // length
|
||||
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
std::vector<std::uint8_t> key {
|
||||
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA,
|
||||
0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
|
||||
0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF,
|
||||
};
|
||||
std::string key_name {"Hello world!"s};
|
||||
|
||||
auto page_buffer {scsi::make_sde(
|
||||
scsi::encrypt_mode::on, scsi::decrypt_mode::on, 1u, key, key_name,
|
||||
scsi::kadf::ascii_key_name, scsi::sde_rdmc::algorithm_default, false)};
|
||||
auto& page {reinterpret_cast<const scsi::page_sde&>(*page_buffer.get())};
|
||||
REQUIRE(sizeof(scsi::page_header) + ntohs(page.length) == sizeof(expected));
|
||||
REQUIRE(std::memcmp(&page, expected, sizeof(expected)) == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the representation of the SPIN Device Encryption Status page
|
||||
* matches the values from the raw buffer. Input buffers were observed
|
||||
* from device traffic.
|
||||
*
|
||||
* This checks the SSP_DES structure layout matches the spec, especially
|
||||
* with regard to byte ordering and bitfield positions.
|
||||
*/
|
||||
TEST_CASE("Interpret device encryption status page", "[scsi]")
|
||||
{
|
||||
const std::uint8_t buffer[] {
|
||||
// clang-format off
|
||||
0x00, 0x20, // page code
|
||||
0x00, 0x24, // length
|
||||
0x42, // nexus = 2h, key scope = 2h
|
||||
0x02, // encryption mode
|
||||
0x02, // decryption mode
|
||||
0x01, // algorithm index
|
||||
0x00, 0x00, 0x00, 0x01, // key instance counter
|
||||
0x18, // parameters control = 1, VCELB = 1, CEEMS = 0, RDMD = 0
|
||||
0x00, // KAD format
|
||||
0x00, 0x00, // ADSK count
|
||||
0x00, 0x00, 0x00, 0x00, // reserved[8]
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
// KAD descriptor
|
||||
0x00, // descriptor type
|
||||
0x01, // authenticated
|
||||
0x00, 0x0c, // length
|
||||
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
auto& page_des {reinterpret_cast<const scsi::page_des&>(buffer)};
|
||||
REQUIRE(ntohs(page_des.page_code) == 0x20u);
|
||||
REQUIRE(ntohs(page_des.length) == 36u);
|
||||
REQUIRE((page_des.scope & scsi::page_des::scope_it_nexus_mask) ==
|
||||
std::byte {2u} << scsi::page_des::scope_it_nexus_pos);
|
||||
REQUIRE((page_des.scope & scsi::page_des::scope_encryption_mask) ==
|
||||
std::byte {2u} << scsi::page_des::scope_encryption_pos);
|
||||
REQUIRE(page_des.encryption_mode == scsi::encrypt_mode::on);
|
||||
REQUIRE(page_des.decryption_mode == scsi::decrypt_mode::on);
|
||||
REQUIRE(page_des.algorithm_index == 1u);
|
||||
REQUIRE(ntohl(page_des.key_instance_counter) == 1u);
|
||||
REQUIRE((page_des.flags & scsi::page_des::flags_parameters_control_mask) ==
|
||||
std::byte {1u} << scsi::page_des::flags_parameters_control_pos);
|
||||
REQUIRE((page_des.flags & scsi::page_des::flags_vcelb_mask) ==
|
||||
scsi::page_des::flags_vcelb_mask);
|
||||
REQUIRE((page_des.flags & scsi::page_des::flags_ceems_mask) == std::byte {});
|
||||
REQUIRE((page_des.flags & scsi::page_des::flags_rdmd_mask) == std::byte {});
|
||||
|
||||
auto kads = read_page_kads(page_des);
|
||||
REQUIRE(kads.size() == 1u);
|
||||
const scsi::kad& kd = kads[0];
|
||||
REQUIRE((kd.flags & scsi::kad::flags_authenticated_mask) == std::byte {1u});
|
||||
REQUIRE(ntohs(kd.length) == std::strlen("Hello world!"));
|
||||
REQUIRE(std::memcmp(kd.descriptor, "Hello world!", ntohs(kd.length)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Interpret next block encryption status page", "[scsi]")
|
||||
{
|
||||
const std::uint8_t buffer[] {
|
||||
// clang-format off
|
||||
0x00, 0x21, // page code
|
||||
0x00, 0x1c, // length
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x05, // compression status = 0, encryption status = 5h
|
||||
0x01, // algorithm index
|
||||
0x00, // EMES = 0, RDMDS = 0
|
||||
0x00, // KAD format
|
||||
// KAD descriptor
|
||||
0x00, // descriptor type
|
||||
0x01, // authenticated
|
||||
0x00, 0x0c, // length
|
||||
0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x21,
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
auto& page_nbes {reinterpret_cast<const scsi::page_nbes&>(buffer)};
|
||||
REQUIRE(ntohs(page_nbes.page_code) == 0x21u);
|
||||
REQUIRE(ntohs(page_nbes.length) == 28u);
|
||||
REQUIRE((page_nbes.status & scsi::page_nbes::status_compression_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((page_nbes.status & scsi::page_nbes::status_encryption_mask) ==
|
||||
std::byte {5u} << scsi::page_nbes::status_encryption_pos);
|
||||
REQUIRE(page_nbes.algorithm_index == 1u);
|
||||
REQUIRE((page_nbes.flags & scsi::page_nbes::flags_emes_mask) == std::byte {});
|
||||
REQUIRE((page_nbes.flags & scsi::page_nbes::flags_rdmds_mask) ==
|
||||
std::byte {});
|
||||
|
||||
auto kads = read_page_kads(page_nbes);
|
||||
REQUIRE(kads.size() == 1u);
|
||||
const scsi::kad& kd = kads[0];
|
||||
REQUIRE((kd.flags & scsi::kad::flags_authenticated_mask) == std::byte {1u});
|
||||
REQUIRE(ntohs(kd.length) == std::strlen("Hello world!"));
|
||||
REQUIRE(std::memcmp(kd.descriptor, "Hello world!", ntohs(kd.length)) == 0);
|
||||
}
|
||||
|
||||
TEST_CASE("Interpret data encryption capabilties page", "[scsi]")
|
||||
{
|
||||
const std::uint8_t buffer[] {
|
||||
// clang-format off
|
||||
0x00, 0x10, // page code
|
||||
0x00, 0x3c, // length
|
||||
0x09, // EXTDECC and CFG_P
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
// algorithm 1
|
||||
0x01,
|
||||
0x00,
|
||||
0x00, 0x14,
|
||||
0x8a, // capabilties
|
||||
0x8c,
|
||||
0x00, 0x20,
|
||||
0x00, 0x3c,
|
||||
0x00, 0x20,
|
||||
0xed,
|
||||
0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x14,
|
||||
// algorithm 2
|
||||
0x02,
|
||||
0x00,
|
||||
0x00, 0x14,
|
||||
0x8a, // capabilties
|
||||
0x8f,
|
||||
0x00, 0x20,
|
||||
0x00, 0x3c,
|
||||
0x00, 0x20,
|
||||
0xd9,
|
||||
0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x01, 0x00, 0x10,
|
||||
// clang-format on
|
||||
};
|
||||
static_assert(sizeof(buffer) == sizeof(scsi::page_dec) +
|
||||
2 * sizeof(scsi::algorithm_descriptor));
|
||||
|
||||
auto& page_dec {reinterpret_cast<const scsi::page_dec&>(buffer)};
|
||||
REQUIRE(ntohs(page_dec.page_code) == 0x10u);
|
||||
REQUIRE(ntohs(page_dec.length) == 60u);
|
||||
|
||||
REQUIRE((page_dec.flags & scsi::page_dec::flags_extdecc_mask) ==
|
||||
std::byte {2u} << scsi::page_dec::flags_extdecc_pos);
|
||||
REQUIRE((page_dec.flags & scsi::page_dec::flags_cfg_p_mask) ==
|
||||
std::byte {1u} << scsi::page_dec::flags_cfg_p_pos);
|
||||
|
||||
auto algorithms {read_algorithms(page_dec)};
|
||||
REQUIRE(algorithms.size() == 2u);
|
||||
|
||||
const scsi::algorithm_descriptor& algo1 = algorithms[0];
|
||||
REQUIRE(algo1.algorithm_index == 1u);
|
||||
REQUIRE(ntohs(algo1.length) == 20u);
|
||||
REQUIRE((algo1.flags1 & scsi::algorithm_descriptor::flags1_avfmv_mask) ==
|
||||
scsi::algorithm_descriptor::flags1_avfmv_mask);
|
||||
REQUIRE((algo1.flags1 & scsi::algorithm_descriptor::flags1_sdk_c_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo1.flags1 & scsi::algorithm_descriptor::flags1_mac_c_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo1.flags1 & scsi::algorithm_descriptor::flags1_delb_c_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo1.flags1 & scsi::algorithm_descriptor::flags1_decrypt_c_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags1_decrypt_c_pos);
|
||||
REQUIRE((algo1.flags1 & scsi::algorithm_descriptor::flags1_encrypt_c_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags1_encrypt_c_pos);
|
||||
|
||||
REQUIRE((algo1.flags2 & scsi::algorithm_descriptor::flags2_avfcp_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags2_avfcp_pos);
|
||||
REQUIRE((algo1.flags2 & scsi::algorithm_descriptor::flags2_nonce_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo1.flags2 & scsi::algorithm_descriptor::flags2_kadf_c_mask) ==
|
||||
scsi::algorithm_descriptor::flags2_kadf_c_mask);
|
||||
REQUIRE((algo1.flags2 & scsi::algorithm_descriptor::flags2_vcelb_c_mask) ==
|
||||
scsi::algorithm_descriptor::flags2_vcelb_c_mask);
|
||||
REQUIRE((algo1.flags2 & scsi::algorithm_descriptor::flags2_ukadf_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo1.flags2 & scsi::algorithm_descriptor::flags2_akadf_mask) ==
|
||||
std::byte {});
|
||||
|
||||
REQUIRE(ntohs(algo1.maximum_ukad_length) == 32u);
|
||||
REQUIRE(ntohs(algo1.maximum_akad_length) == 60u);
|
||||
REQUIRE(ntohs(algo1.key_length) == 32u);
|
||||
|
||||
REQUIRE((algo1.flags3 & scsi::algorithm_descriptor::flags3_dkad_c_mask) ==
|
||||
std::byte {3u} << scsi::algorithm_descriptor::flags3_dkad_c_pos);
|
||||
REQUIRE((algo1.flags3 & scsi::algorithm_descriptor::flags3_eemc_c_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags3_eemc_c_pos);
|
||||
REQUIRE((algo1.flags3 & scsi::algorithm_descriptor::flags3_rdmc_c_mask) ==
|
||||
std::byte {6u} << scsi::algorithm_descriptor::flags3_rdmc_c_pos);
|
||||
REQUIRE((algo1.flags3 & scsi::algorithm_descriptor::flags3_earem_mask) ==
|
||||
scsi::algorithm_descriptor::flags3_earem_mask);
|
||||
|
||||
REQUIRE((algo1.maximum_eedk_count &
|
||||
scsi::algorithm_descriptor::maximum_eedk_count_mask) == 0u);
|
||||
REQUIRE(ntohs(algo1.msdk_count) == 0u);
|
||||
REQUIRE(ntohs(algo1.maximum_eedk_size) == 0u);
|
||||
REQUIRE(ntohl(algo1.security_algorithm_code) == 0x00010014u);
|
||||
|
||||
const scsi::algorithm_descriptor& algo2 = algorithms[1];
|
||||
REQUIRE(algo2.algorithm_index == 2u);
|
||||
REQUIRE(ntohs(algo2.length) == 20u);
|
||||
REQUIRE((algo2.flags1 & scsi::algorithm_descriptor::flags1_avfmv_mask) ==
|
||||
scsi::algorithm_descriptor::flags1_avfmv_mask);
|
||||
REQUIRE((algo2.flags1 & scsi::algorithm_descriptor::flags1_sdk_c_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo2.flags1 & scsi::algorithm_descriptor::flags1_mac_c_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo2.flags1 & scsi::algorithm_descriptor::flags1_delb_c_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo2.flags1 & scsi::algorithm_descriptor::flags1_decrypt_c_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags1_decrypt_c_pos);
|
||||
REQUIRE((algo2.flags1 & scsi::algorithm_descriptor::flags1_encrypt_c_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags1_encrypt_c_pos);
|
||||
|
||||
REQUIRE((algo2.flags2 & scsi::algorithm_descriptor::flags2_avfcp_mask) ==
|
||||
std::byte {2u} << scsi::algorithm_descriptor::flags2_avfcp_pos);
|
||||
REQUIRE((algo2.flags2 & scsi::algorithm_descriptor::flags2_nonce_mask) ==
|
||||
std::byte {});
|
||||
REQUIRE((algo2.flags2 & scsi::algorithm_descriptor::flags2_kadf_c_mask) ==
|
||||
scsi::algorithm_descriptor::flags2_kadf_c_mask);
|
||||
REQUIRE((algo2.flags2 & scsi::algorithm_descriptor::flags2_vcelb_c_mask) ==
|
||||
scsi::algorithm_descriptor::flags2_vcelb_c_mask);
|
||||
REQUIRE((algo2.flags2 & scsi::algorithm_descriptor::flags2_ukadf_mask) ==
|
||||
scsi::algorithm_descriptor::flags2_ukadf_mask);
|
||||
REQUIRE((algo2.flags2 & scsi::algorithm_descriptor::flags2_akadf_mask) ==
|
||||
scsi::algorithm_descriptor::flags2_akadf_mask);
|
||||
|
||||
REQUIRE(ntohs(algo2.maximum_ukad_length) == 32u);
|
||||
REQUIRE(ntohs(algo2.maximum_akad_length) == 60u);
|
||||
REQUIRE(ntohs(algo2.key_length) == 32u);
|
||||
|
||||
REQUIRE((algo2.flags3 & scsi::algorithm_descriptor::flags3_dkad_c_mask) ==
|
||||
std::byte {3u} << scsi::algorithm_descriptor::flags3_dkad_c_pos);
|
||||
REQUIRE((algo2.flags3 & scsi::algorithm_descriptor::flags3_eemc_c_mask) ==
|
||||
std::byte {1u} << scsi::algorithm_descriptor::flags3_eemc_c_pos);
|
||||
REQUIRE((algo2.flags3 & scsi::algorithm_descriptor::flags3_rdmc_c_mask) ==
|
||||
std::byte {4u} << scsi::algorithm_descriptor::flags3_rdmc_c_pos);
|
||||
REQUIRE((algo2.flags3 & scsi::algorithm_descriptor::flags3_earem_mask) ==
|
||||
scsi::algorithm_descriptor::flags3_earem_mask);
|
||||
|
||||
REQUIRE((algo2.maximum_eedk_count &
|
||||
scsi::algorithm_descriptor::maximum_eedk_count_mask) == 0u);
|
||||
REQUIRE(ntohs(algo2.msdk_count) == 0u);
|
||||
REQUIRE(ntohs(algo2.maximum_eedk_size) == 0u);
|
||||
REQUIRE(ntohl(algo2.security_algorithm_code) == 0x00010010u);
|
||||
}
|
||||
Reference in New Issue
Block a user