fix documentation, fix PanamaMAC, fix algorithm names

This commit is contained in:
weidai 2004-07-22 00:51:57 +00:00
parent ad8043d50c
commit 393ae4859a
75 changed files with 826 additions and 609 deletions

1
3way.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct ThreeWay_Info : public FixedBlockSize<12>, public FixedKeyLength<12>, public VariableRounds<11>
{
static const char *StaticAlgorithmName() {return "3-Way";}

556
Doxyfile
View File

@ -1,4 +1,4 @@
# Doxyfile 1.2.15-20020512
# Doxyfile 1.3.7
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
@ -11,7 +11,7 @@
# Values that contain spaces should be placed between quotes (" ")
#---------------------------------------------------------------------------
# General configuration options
# Project related configuration options
#---------------------------------------------------------------------------
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
@ -32,17 +32,180 @@ PROJECT_NUMBER =
OUTPUT_DIRECTORY = doc
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 2 levels of 10 sub-directories under the output directory of each output
# format and will distribute the generated files over these directories.
# Enabling this option can be useful when feeding doxygen a huge amount of source
# files, where putting all generated files in the same directory would otherwise
# cause performance problems for the file system.
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Brazilian, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Korean,
# Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovene,
# Spanish, Swedish and Ukrainian.
# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch,
# Finnish, French, German, Greek, Hungarian, Italian, Japanese, Japanese-en
# (Japanese with English messages), Korean, Korean-en, Norwegian, Polish, Portuguese,
# Romanian, Russian, Serbian, Slovak, Slovene, Spanish, Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English
# This tag can be used to specify the encoding used in the generated output.
# The encoding is not always determined by the language that is chosen,
# but also whether or not the output is meant for Windows or non-Windows users.
# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
# forces the Windows encoding (this is the default for the Windows binary),
# whereas setting the tag to NO uses a Unix-style encoding (the default for
# all platforms other than Windows).
USE_WINDOWS_ENCODING = YES
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator
# that is used to form the text in various listings. Each string
# in this list, if found as the leading text of the brief description, will be
# stripped from the text and the result after processing the whole list, is used
# as the annotated text. Otherwise, the brief description is used as-is. If left
# blank, the following values are used ("$name" is automatically replaced with the
# name of the entity): "The $name class" "The $name widget" "The $name file"
# "is" "provides" "specifies" "contains" "represents" "a" "an" "the"
ABBREVIATE_BRIEF =
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
# members of a class in the documentation of that class as if those members were
# ordinary class members. Constructors, destructors and assignment operators of
# the base classes will not be shown.
INLINE_INHERITED_MEMB = YES
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
# the reader which header file to include in order to use a class.
# If left blank only the name of the header file containing the class
# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like the Qt-style comments (thus requiring an
# explicit @brief command for a brief description.
JAVADOC_AUTOBRIEF = YES
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
# will output the detailed description near the top, like JavaDoc.
# If set to NO, the detailed description appears after the member
# documentation.
DETAILS_AT_TOP = Yes
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 8
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
# only. Doxygen will then generate output that is more tailored for Java.
# For instance, namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
@ -66,6 +229,13 @@ EXTRACT_STATIC = NO
EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
@ -76,50 +246,24 @@ HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these class will be included in the various
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = No
HIDE_UNDOC_CLASSES = NO
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
BRIEF_MEMBER_DESC = YES
HIDE_FRIEND_COMPOUNDS = NO
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
REPEAT_BRIEF = YES
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
# members of a class in the documentation of that class as if those members were
# ordinary class members. Constructors, destructors and assignment operators of
# the base classes will not be shown.
INLINE_INHERITED_MEMB = YES
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = NO
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. It is allowed to use relative paths in the argument list.
STRIP_FROM_PATH =
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
@ -128,65 +272,26 @@ STRIP_FROM_PATH =
INTERNAL_DOCS = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = NO
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower case letters. If set to YES upper case letters are also
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# users are adviced to set this option to NO.
# users are advised to set this option to NO.
CASE_SENSE_NAMES = NO
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put list of the files that are included by a file in the documentation
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like the Qt-style comments (thus requiring an
# explict @brief command for a brief description.
JAVADOC_AUTOBRIEF = YES
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
# will output the detailed description near the top, like JavaDoc.
# If set to NO, the detailed description appears after the member
# documentation.
DETAILS_AT_TOP = Yes
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# reimplements.
INHERIT_DOCS = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
@ -199,17 +304,22 @@ INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
DISTRIBUTE_GROUP_DOC = NO
SORT_BRIEF_DOCS = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name,
# not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the
# alphabetical list.
TAB_SIZE = 8
SORT_BY_SCOPE_NAME = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
@ -229,14 +339,11 @@ GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
ALIASES =
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
@ -244,28 +351,14 @@ ALIASES =
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or define consist of for it to appear in
# the initial value of a variable or define consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and defines in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C.
# For instance some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources
# only. Doxygen will then generate output that is more tailored for Java.
# For instance namespaces will be presented as packages, qualified scopes
# will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
MAX_INITIALIZER_LINES = 30
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
@ -294,6 +387,13 @@ WARNINGS = No
WARN_IF_UNDOCUMENTED = No
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
@ -323,7 +423,7 @@ INPUT = .
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
# *.h++ *.idl *.odl
# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm
FILE_PATTERNS = *.h \
*.cpp
@ -338,7 +438,7 @@ RECURSIVE = NO
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE =
EXCLUDE = adhoc.cpp
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories
# that are symbolic links (a Unix filesystem feature) are excluded from the input.
@ -355,7 +455,7 @@ EXCLUDE_PATTERNS =
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
EXAMPLE_PATH = .
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
@ -388,7 +488,7 @@ INPUT_FILTER =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse.
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
@ -397,7 +497,9 @@ FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = YES
@ -406,6 +508,12 @@ SOURCE_BROWSER = YES
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = NO
# If the REFERENCED_BY_RELATION tag is set to YES (the default)
# then for each documented function all documented
# functions referencing it will be listed.
@ -418,6 +526,12 @@ REFERENCED_BY_RELATION = YES
REFERENCES_RELATION = YES
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@ -474,10 +588,12 @@ HTML_HEADER =
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user defined cascading
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
@ -494,6 +610,20 @@ HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = YES
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
@ -507,7 +637,7 @@ GENERATE_CHI = NO
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the Html help documentation and to the tree view.
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
@ -525,10 +655,9 @@ ENUM_VALUES_PER_LINE = 4
# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
# generated containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
# or Internet explorer 4.0+). Note that for large projects the tree generation
# can take a very long time. In such cases it is better to disable this feature.
# Windows users are probably better off using the HTML help feature.
# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
# probably better off using the HTML help feature.
GENERATE_TREEVIEW = NO
@ -553,7 +682,8 @@ GENERATE_LATEX = NO
LATEX_OUTPUT =
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be invoked. If left blank `latex' will be used as the default command name.
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
LATEX_CMD_NAME = latex
@ -607,12 +737,18 @@ USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimised for Word 97 and may not look very pretty with
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
@ -639,7 +775,7 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assigments. You only have to provide
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
@ -683,12 +819,35 @@ MAN_LINKS = NO
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
# the code including all documentation.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@ -701,6 +860,39 @@ GENERATE_XML = NO
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader. This is useful
# if you want to understand what is going on. On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
@ -754,7 +946,7 @@ PREDEFINED = _WIN32 \
__FreeBSD__ \
CRYPTOPP_DOXYGEN_PROCESSING
# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
@ -763,16 +955,30 @@ EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
# on a line and do not end with a semicolon. Such function macros are typically
# used for boiler-plate code, and will confuse the parser if not removed.
# on a line, have an all uppercase name, and do not end with a semicolon. Such
# function macros are typically used for boiler-plate code, and will confuse the
# parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES tag can be used to specify one or more tagfiles.
# The TAGFILES option can be used to specify one or more tagfiles.
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
# Note that each tag file must have a unique name
# (where the name does NOT include the path)
# If a tag file is not located in the directory in which doxygen
# is run, you must also specify the path to the tagfile here.
TAGFILES =
@ -803,10 +1009,10 @@ PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or
# super classes. Setting the tag to NO turns the diagrams off. Note that this
# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
# recommended to install and use dot, since it yield more powerful graphs.
# option is superseded by the HAVE_DOT option below. This is only a fallback. It is
# recommended to install and use dot, since it yields more powerful graphs.
CLASS_DIAGRAMS = YES
@ -837,6 +1043,12 @@ CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
@ -856,6 +1068,14 @@ INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
# generate a call dependency graph for every global function or class method.
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command.
CALL_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
@ -894,6 +1114,17 @@ MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1024
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes that
# lay further from the root node will be omitted. Note that setting this option to
# 1 or 2 may greatly reduce the computation time needed for large code bases. Also
# note that a graph may be further truncated if the graph's image dimensions are
# not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH and MAX_DOT_GRAPH_HEIGHT).
# If 0 is used for the depth value (the default), the graph is not depth-constrained.
MAX_DOT_GRAPH_DEPTH = 0
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
@ -901,51 +1132,16 @@ MAX_DOT_GRAPH_HEIGHT = 1024
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermedate dot files that are used to generate
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
# The CGI_NAME tag should be the name of the CGI script that
# starts the search engine (doxysearch) with the correct parameters.
# A script with this name will be generated by doxygen.
CGI_NAME = search.cgi
# The CGI_URL tag should be the absolute URL to the directory where the
# cgi binaries are located. See the documentation of your http daemon for
# details.
CGI_URL =
# The DOC_URL tag should be the absolute URL to the directory where the
# documentation is located. If left blank the absolute path to the
# documentation, with file:// prepended to it, will be used.
DOC_URL =
# The DOC_ABSPATH tag should be the absolute path to the directory where the
# documentation is located. If left blank the directory on the local machine
# will be used.
DOC_ABSPATH =
# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
# is installed.
BIN_ABSPATH = /usr/local/bin/
# The EXT_DOC_PATHS tag can be used to specify one or more paths to
# documentation generated for other projects. This allows doxysearch to search
# the documentation for these projects as well.
EXT_DOC_PATHS =

View File

@ -1,5 +1,5 @@
Crypto++: a C++ Class Library of Cryptographic Schemes
Version 5.2 6/29/2004
Version 5.2.1 (in development)
This library includes:
@ -61,6 +61,18 @@ and .NET 2003 on Windows XP, GCC 2.95.4 on FreeBSD 4.6, GCC 2.95.3 on
Linux 2.4 and SunOS 5.8, GCC 3.4 on Cygwin 1.5.10, and Metrowerks
CodeWarrior 8.3 for Windows and MacOS.
*** Important Usage Notes ***
1. If a constructor for A takes a pointer to an object B (except primitive
types such as int and char), then A owns B and will delete B at A's
destruction. If a constructor for A takes a reference to an object B,
then the caller retains ownership of B and should not destroy it until
A no longer needs it.
2. Crypto++ is thread safe at the class level. This means you can use
Crypto++ safely in a multithreaded application, but you must provide
synchronization when multiple threads access a common Crypto++ object.
*** MSVC-Specific Information ***
On Windows, Crypto++ can be compiled into 3 forms: a static library
@ -141,18 +153,6 @@ http://www.cryptopp.com. You can also email me directly at
cryptopp@weidai.com, but you will probably get a faster response through
the mailing list.
*** Important Usage Notes ***
1. If a constructor for A takes a pointer to an object B (except primitive
types such as int and char), then A owns B and will delete B at A's
destruction. If a constructor for A takes a reference to an object B,
then the caller retains ownership of B and should not destroy it until
A no longer needs it.
2. Crypto++ is thread safe at the class level. This means you can use
Crypto++ safely in a multithreaded application, but you must provide
synchronization when multiple threads access a common Crypto++ object.
*** History ***
1.0 - First public release. Withdrawn at the request of RSA DSI.
@ -337,4 +337,10 @@ synchronization when multiple threads access a common Crypto++ object.
- fixed encoding/decoding of PKCS #8 privateKeyInfo to properly
handle optional attributes
5.2.1 - fixed bug in the "dlltest" DLL testing program
- fixed compiling with STLport using VC .NET
- fixed compiling with -fPIC using GCC
- fixed compiling with -msse2 on systems without memalign()
- fixed problems with inline documentation
Written by Wei Dai

12
aes.h
View File

@ -1,20 +1,12 @@
#ifndef CRYPTOPP_AES_H
#define CRYPTOPP_AES_H
/** \file
AES winner announced on 10/2/2000
*/
#include "rijndael.h"
NAMESPACE_BEGIN(CryptoPP)
#ifdef CRYPTOPP_DOXYGEN_PROCESSING // Use inheritance instead of typedef to get a seperate API reference page for AES
//! AES
class AES : public Rijndael {};
#else
typedef Rijndael AES;
#endif
//! AES winner, announced on 10/2/2000
DOCUMENTED_TYPEDEF(Rijndael, AES);
typedef RijndaelEncryption AESEncryption;
typedef RijndaelDecryption AESDecryption;

16
arc4.h
View File

@ -5,9 +5,8 @@
NAMESPACE_BEGIN(CryptoPP)
//! <a href="http://www.weidai.com/scan-mirror/cs.html#RC4">Alleged RC4</a>
/*! Use #ARC4 typedef rather than this class directly. */
class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher
//! _
class CRYPTOPP_NO_VTABLE ARC4_Base : public VariableKeyLength<16, 1, 256>, public RandomNumberGenerator, public SymmetricCipher, public SymmetricCipherDocumentation
{
public:
~ARC4_Base();
@ -34,11 +33,10 @@ protected:
byte m_x, m_y;
};
//! .
typedef SymmetricCipherFinal<ARC4_Base> ARC4;
//! <a href="http://www.weidai.com/scan-mirror/cs.html#RC4">Alleged RC4</a>
DOCUMENTED_TYPEDEF(SymmetricCipherFinal<ARC4_Base>, ARC4)
//! Modified ARC4: it discards the first 256 bytes of keystream which may be weaker than the rest
/*! Use #MARC4 typedef rather than this class directly. */
//! _
class CRYPTOPP_NO_VTABLE MARC4_Base : public ARC4_Base
{
public:
@ -51,8 +49,8 @@ protected:
unsigned int GetDefaultDiscardBytes() const {return 256;}
};
//! .
typedef SymmetricCipherFinal<MARC4_Base> MARC4;
//! Modified ARC4: it discards the first 256 bytes of keystream which may be weaker than the rest
DOCUMENTED_TYPEDEF(SymmetricCipherFinal<MARC4_Base>, MARC4)
NAMESPACE_END

4
asn.h
View File

@ -230,7 +230,8 @@ public:
}
};
//! .
//! key that can be ASN.1 encoded
/** derived class should override either BERDecodeKey or BERDecodeKey2 */
class CRYPTOPP_DLL ASN1Key : public ASN1CryptoMaterial
{
public:
@ -239,7 +240,6 @@ public:
{BERDecodeNull(bt); return false;}
virtual bool DEREncodeAlgorithmParameters(BufferedTransformation &bt) const
{DEREncodeNull(bt); return false;} // see RFC 2459, section 7.3.1
// one of the following two should be overriden
//! decode subjectPublicKey part of subjectPublicKeyInfo, or privateKey part of privateKeyInfo, without the BIT STRING or OCTET STRING header
virtual void BERDecodeKey(BufferedTransformation &bt) {assert(false);}
virtual void BERDecodeKey2(BufferedTransformation &bt, bool parametersPresent, unsigned int size)

View File

@ -7,6 +7,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! base n encoder, where n is a power of 2
class CRYPTOPP_DLL BaseN_Encoder : public Unflushable<Filter>
{
public:
@ -32,6 +33,7 @@ private:
SecByteBlock m_outBuf;
};
//! base n decoder, where n is a power of 2
class CRYPTOPP_DLL BaseN_Decoder : public Unflushable<Filter>
{
public:
@ -56,6 +58,7 @@ private:
SecByteBlock m_outBuf;
};
//! filter that breaks input stream into groups of fixed size
class CRYPTOPP_DLL Grouper : public Bufferless<Filter>
{
public:

View File

@ -8,6 +8,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct Blowfish_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 56>, public FixedRounds<16>
{
static const char *StaticAlgorithmName() {return "Blowfish";}

View File

@ -13,6 +13,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct Camellia_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
{
static const char *StaticAlgorithmName() {return "Camellia";}

4
cast.h
View File

@ -15,7 +15,7 @@ protected:
static const word32 S[8][256];
};
//! .
//! algorithm info
struct CAST128_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 5, 16>
{
static const char *StaticAlgorithmName() {return "CAST-128";}
@ -51,7 +51,7 @@ public:
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
};
//! .
//! algorithm info
struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32>
{
static const char *StaticAlgorithmName() {return "CAST-256";}

View File

@ -6,6 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_MAC_Base : public MessageAuthenticationCode
{
public:
@ -26,7 +27,7 @@ private:
};
//! <a href="http://www.weidai.com/scan-mirror/mac.html#CBC-MAC">CBC-MAC</a>
/*! Compatible with FIPS 113. T should be an encryption class.
/*! Compatible with FIPS 113. T should be a class derived from BlockCipherDocumentation.
Secure only for fixed length messages. For variable length
messages use DMAC.
*/

View File

@ -25,6 +25,8 @@ CFG=cryptest - Win32 Debug
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
@ -398,10 +400,6 @@ SOURCE=.\dlltest.cpp
# End Source File
# Begin Source File
SOURCE=.\factory.h
# End Source File
# Begin Source File
SOURCE=.\fipsalgt.cpp
# End Source File
# Begin Source File

View File

@ -145,6 +145,7 @@ void RandomNumberGenerator::DiscardBytes(unsigned int n)
GenerateByte();
}
//! see NullRNG()
class ClassNullRNG : public RandomNumberGenerator
{
public:

View File

@ -25,7 +25,9 @@ CFG=cryptlib - Win32 Debug
# Begin Project
# PROP AllowPerConfigDependencies 0
CPP=cl.exe
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=xicl6.exe
RSC=rc.exe
!IF "$(CFG)" == "cryptlib - Win32 DLL-Import Release"
@ -41,13 +43,13 @@ RSC=rc.exe
# PROP Intermediate_Dir "DLL_Import_Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /FD /c
# ADD CPP /nologo /G5 /Gz /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /FD /Zm400 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
@ -64,13 +66,13 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "DLL_Import_Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /Yu"pch.h" /FD /c
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /FD /c
# ADD CPP /nologo /G5 /Gz /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /D "CRYPTOPP_IMPORTS" /Yu"pch.h" /FD /Zm400 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
@ -87,13 +89,13 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /Zi /O1 /Ob2 /D "NDEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /Zm400 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
@ -110,13 +112,13 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /c
# ADD CPP /nologo /MTd /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "USE_PRECOMPILED_HEADERS" /D "WIN32" /Yu"pch.h" /FD /Zm400 /c
# ADD BASE RSC /l 0x409
# ADD RSC /l 0x409
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
LIB32=xilink6.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
@ -774,6 +776,10 @@ SOURCE=.\esign.h
# End Source File
# Begin Source File
SOURCE=.\factory.h
# End Source File
# Begin Source File
SOURCE=.\files.h
# End Source File
# Begin Source File

View File

@ -4,20 +4,22 @@
classes that provide a uniform interface to this library.
*/
/*! \mainpage <a href="http://www.cryptopp.com">Crypto++</a><sup><small>TM</small></sup> Library 5.2 Reference Manual
/*! \mainpage <a href="http://www.cryptopp.com">Crypto++</a><sup><small>TM</small></sup> Library 5.2.1 Reference Manual
<dl>
<dt>Abstract Base Classes<dd>
cryptlib.h
<dt>Symmetric Ciphers<dd>
SymmetricCipherDocumentation
<dt>Hash Functions<dd>
HAVAL, MD2, MD4, MD5, PanamaHash, RIPEMD160, SHA, SHA256, SHA384, SHA512, Tiger
HAVAL, MD2, MD4, MD5, PanamaHash, RIPEMD160, RIPEMD320, RIPEMD128, RIPEMD256, SHA, SHA256, SHA384, SHA512, Tiger, Whirlpool
<dt>Non-Cryptographic Checksums<dd>
CRC32, Adler32
<dt>Message Authentication Codes<dd>
#MD5MAC, XMACC, HMAC, CBC_MAC, DMAC, PanamaMAC
#MD5MAC, XMACC, HMAC, CBC_MAC, DMAC, PanamaMAC, TTMAC
<dt>Random Number Generators<dd>
NullRNG(), LC_RNG, RandomPool, BlockingRng, NonblockingRng, AutoSeededRandomPool, AutoSeededX917RNG
<dt>Password-based Cryptography<dd>
PasswordBasedKeyDerivationFunction
<dt>Public Key Cryptosystems<dd>
DLIES, ECIES, LUCES, RSAES, RabinES, LUC_IES
<dt>Public Key Signature Schemes<dd>
@ -39,9 +41,9 @@
<dt>Filter Wrappers<dd>
StreamTransformationFilter, HashFilter, HashVerificationFilter, SignerFilter, SignatureVerificationFilter
<dt>Binary to Text Encoders and Decoders<dd>
HexEncoder, HexDecoder, Base64Encoder, Base64Decoder
HexEncoder, HexDecoder, Base64Encoder, Base64Decoder, Base32Encoder, Base32Decoder
<dt>Wrappers for OS features<dd>
Timer, Socket, WindowsHandle, ThreadLocalStorage
Timer, Socket, WindowsHandle, ThreadLocalStorage, ThreadUserTimer
<dt>FIPS 140 related<dd>
fips140.h
</dl>
@ -51,19 +53,19 @@ In the FIPS 140-2 validated DLL version of Crypto++, only the following implemen
<dt>Block Ciphers<dd>
AES, DES_EDE2, DES_EDE3, SKIPJACK
<dt>Cipher Modes (replace template parameter BC with one of the block ciphers above)<dd>
ECB_Mode <BC>, CTR_Mode <BC>, CBC_Mode <BC>, CFB_Mode <BC>, OFB_Mode <BC>
ECB_Mode\<BC\>, CTR_Mode\<BC\>, CBC_Mode\<BC\>, CFB_Mode\<BC\>, OFB_Mode\<BC\>
<dt>Hash Functions<dd>
SHA
<dt>Public Key Signature Schemes<dd>
RSASSA <PKCS1v15, SHA>, DSA, ECDSA <ECP, SHA>, ECDSA <EC2N, SHA>
RSASS\<PKCS1v15, SHA\>, DSA, ECDSA\<ECP, SHA\>, ECDSA\<EC2N, SHA\>
<dt>Message Authentication Codes<dd>
HMAC <SHA>, CBC_MAC <DES_EDE2>, CBC_MAC <DES_EDE3>
HMAC\<SHA\>, CBC_MAC\<DES_EDE2\>, CBC_MAC\<DES_EDE3\>
<dt>Random Number Generators<dd>
AutoSeededX917RNG <DES_EDE3>
AutoSeededX917RNG\<DES_EDE3\>
<dt>Key Agreement<dd>
#DH
<dt>Public Key Cryptosystems<dd>
RSAES <OAEP<SHA> >
RSAES\<OAEP\<SHA\> \>
</dl>
<p>This reference manual is a work in progress. Some classes are still lacking detailed descriptions.
@ -311,14 +313,14 @@ DOCUMENTED_NAMESPACE_BEGIN(Name)
// more names defined in argnames.h
DOCUMENTED_NAMESPACE_END
//! .
//! empty set of name-value pairs
class CRYPTOPP_DLL NullNameValuePairs : public NameValuePairs
{
public:
bool GetVoidValue(const char *name, const std::type_info &valueType, void *pValue) const {return false;}
};
//! .
//! _
extern CRYPTOPP_DLL const NullNameValuePairs g_nullNameValuePairs;
// ********************************************************
@ -578,7 +580,8 @@ protected:
void ThrowIfInvalidTruncatedSize(unsigned int size) const;
};
//! .
typedef HashTransformation HashFunction;
template <class T>
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE SimpleKeyedTransformation : public T, public SimpleKeyingInterface
{
@ -587,12 +590,11 @@ public:
{SimpleKeyingInterface::ThrowIfInvalidKeyLength(*this, length);}
};
//! .
typedef HashTransformation HashFunction;
#ifdef CRYPTOPP_DOXYGEN_PROCESSING
//! These objects usually should not be used directly. See BlockTransformation for more details.
//! interface for one direction (encryption or decryption) of a block cipher
/*! \note These objects usually should not be used directly. See BlockTransformation for more details. */
class BlockCipher : public BlockTransformation, public SimpleKeyingInterface {};
//! interface for stream ciphers
//! interface for one direction (encryption or decryption) of a stream cipher or cipher mode
class SymmetricCipher : public StreamTransformation, public SimpleKeyingInterface {};
//! interface for message authentication codes
class MessageAuthenticationCode : public HashTransformation, public SimpleKeyingInterface {};
@ -600,11 +602,11 @@ class MessageAuthenticationCode : public HashTransformation, public SimpleKeying
typedef SimpleKeyedTransformation<BlockTransformation> BlockCipher;
typedef SimpleKeyedTransformation<StreamTransformation> SymmetricCipher;
typedef SimpleKeyedTransformation<HashTransformation> MessageAuthenticationCode;
#endif
CRYPTOPP_DLL_TEMPLATE_CLASS SimpleKeyedTransformation<BlockTransformation>;
CRYPTOPP_DLL_TEMPLATE_CLASS SimpleKeyedTransformation<StreamTransformation>;
CRYPTOPP_DLL_TEMPLATE_CLASS SimpleKeyedTransformation<HashTransformation>;
#endif
#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY
typedef SymmetricCipher StreamCipher;
@ -882,7 +884,6 @@ public:
//! \name NON-BLOCKING TRANSFER OF OUTPUT
//@{
//! .
virtual unsigned int TransferTo2(BufferedTransformation &target, unsigned long &byteCount, const std::string &channel=NULL_CHANNEL, bool blocking=true) =0;
virtual unsigned int CopyRangeTo2(BufferedTransformation &target, unsigned long &begin, unsigned long end=ULONG_MAX, const std::string &channel=NULL_CHANNEL, bool blocking=true) const =0;
unsigned int TransferMessagesTo2(BufferedTransformation &target, unsigned int &messageCount, const std::string &channel=NULL_CHANNEL, bool blocking=true);
@ -1140,7 +1141,7 @@ public:
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE PK_Encryptor : virtual public PK_CryptoSystem, public PublicKeyAlgorithm
{
public:
//! .
//! exception thrown when trying to encrypt plaintext of invalid length
class CRYPTOPP_DLL InvalidPlaintextLength : public Exception
{
public:

4
des.h
View File

@ -21,6 +21,7 @@ protected:
FixedSizeSecBlock<word32, 32> k;
};
//! _
struct DES_Info : public FixedBlockSize<8>, public FixedKeyLength<8>
{
// disable DES in DLL version by not exporting this function
@ -50,6 +51,7 @@ public:
typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
};
//! _
struct DES_EDE2_Info : public FixedBlockSize<8>, public FixedKeyLength<16>
{
CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "DES-EDE2";}
@ -73,6 +75,7 @@ public:
typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
};
//! _
struct DES_EDE3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
{
CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "DES-EDE3";}
@ -96,6 +99,7 @@ public:
typedef BlockCipherFinal<DECRYPTION, Base> Decryption;
};
//! _
struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24>
{
static const char *StaticAlgorithmName() {return "DES-XEX3";}

8
dh.h
View File

@ -17,7 +17,7 @@ class DH_Domain : public DL_SimpleKeyAgreementDomainBase<typename GROUP_PARAMETE
public:
typedef GROUP_PARAMETERS GroupParameters;
typedef typename GroupParameters::Element Element;
typedef DL_KeyAgreementAlgorithm_DH<Element, COFACTOR_OPTION> KeyAgreementAlgorithm;
typedef DL_KeyAgreementAlgorithm_DH<Element, COFACTOR_OPTION> DH_Algorithm;
typedef DH_Domain<GROUP_PARAMETERS, COFACTOR_OPTION> Domain;
DH_Domain() {}
@ -76,9 +76,13 @@ public:
}
}
static std::string StaticAlgorithmName()
{return GroupParameters::StaticAlgorithmNamePrefix() + DH_Algorithm::StaticAlgorithmName();}
std::string AlgorithmName() const {return StaticAlgorithmName();}
private:
const DL_KeyAgreementAlgorithm<Element> & GetKeyAgreementAlgorithm() const
{return Singleton<KeyAgreementAlgorithm>().Ref();}
{return Singleton<DH_Algorithm>().Ref();}
DL_GroupParameters<Element> & AccessAbstractGroupParameters()
{return m_groupParameters;}

3
dmac.h
View File

@ -5,6 +5,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DMAC_Base : public SameKeyLengthAs<T>, public MessageAuthenticationCode
{
@ -32,7 +33,7 @@ private:
//! DMAC
/*! Based on "CBC MAC for Real-Time Data Sources" by Erez Petrank
and Charles Rackoff. T should be BlockTransformation class.
and Charles Rackoff. T should be a class derived from BlockCipherDocumentation.
*/
template <class T>
class DMAC : public MessageAuthenticationCodeFinal<DMAC_Base<T> >

2
ec2n.h
View File

@ -89,7 +89,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation<EC2N::Point>;
template <class T> class EcPrecomputation;
//! .
//! EC2N precomputation
template<> class EcPrecomputation<EC2N> : public DL_GroupPrecomputation<EC2N::Point>
{
public:

View File

@ -93,6 +93,7 @@ public:
Integer GetMaxExponent() const {return GetSubgroupOrder()-1;}
bool IsIdentity(const Element &element) const {return element.identity;}
void SimultaneousExponentiate(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const;
static std::string StaticAlgorithmNamePrefix() {return "EC";}
// ASN1Key
OID GetAlgorithmID() const;
@ -141,7 +142,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_EC<EC2N>;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<ECP> >;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl<DL_GroupParameters_EC<EC2N> >;
//! .
//! EC public key
template <class EC>
class DL_PublicKey_EC : public DL_PublicKeyImpl<DL_GroupParameters_EC<EC> >
{
@ -163,7 +164,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC<EC2N>;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<ECP> >;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl<DL_GroupParameters_EC<EC2N> >;
//! .
//! EC private key
template <class EC>
class DL_PrivateKey_EC : public DL_PrivateKeyImpl<DL_GroupParameters_EC<EC> >
{
@ -201,7 +202,7 @@ struct ECMQV
typedef MQV_Domain<DL_GroupParameters_EC<EC>, COFACTOR_OPTION> Domain;
};
//! .
//! EC keys
template <class EC>
struct DL_Keys_EC
{
@ -212,7 +213,7 @@ struct DL_Keys_EC
template <class EC, class H = SHA>
struct ECDSA;
//! .
//! ECDSA keys
template <class EC>
struct DL_Keys_ECDSA
{
@ -223,7 +224,7 @@ struct DL_Keys_ECDSA
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<ECP::Point>;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<EC2N::Point>;
//! .
//! ECDSA algorithm
template <class EC>
class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA<typename EC::Point>
{
@ -231,7 +232,7 @@ public:
static const char * StaticAlgorithmName() {return "ECDSA";}
};
//! .
//! ECNR algorithm
template <class EC>
class DL_Algorithm_ECNR : public DL_Algorithm_NR<typename EC::Point>
{

2
ecp.h
View File

@ -93,7 +93,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation<ECP::Point>;
template <class T> class EcPrecomputation;
//! .
//! ECP precomputation
template<> class EcPrecomputation<ECP> : public DL_GroupPrecomputation<ECP::Point>
{
public:

View File

@ -11,7 +11,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
class ESIGNFunction : public TrapdoorFunction, public PublicKey, public ASN1CryptoMaterial
{
typedef ESIGNFunction ThisClass;
@ -47,7 +47,7 @@ protected:
Integer m_n, m_e;
};
//! .
//! _
class InvertibleESIGNFunction : public ESIGNFunction, public RandomizedTrapdoorFunctionInverse, public PrivateKey
{
typedef InvertibleESIGNFunction ThisClass;
@ -81,7 +81,7 @@ protected:
Integer m_p, m_q;
};
//! .
//! _
template <class T>
class EMSA5Pad : public PK_DeterministicSignatureMessageEncodingMethod
{

View File

@ -6,6 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class AbstractClass>
class ObjectFactory
{
@ -13,6 +14,7 @@ public:
virtual AbstractClass * CreateObject() const =0;
};
//! _
template <class AbstractClass, class ConcreteClass>
class DefaultObjectFactory : public ObjectFactory<AbstractClass>
{
@ -24,10 +26,17 @@ public:
};
//! _
template <class AbstractClass, int instance=0>
class ObjectFactoryRegistry
{
public:
class FactoryNotFound : public Exception
{
public:
FactoryNotFound(const char *name) : Exception(OTHER_ERROR, std::string("ObjectFactoryRegistry: could not find factory for algorithm ") + name) {}
};
~ObjectFactoryRegistry()
{
for (CPP_TYPENAME Map::iterator i = m_map.begin(); i != m_map.end(); ++i)
@ -37,7 +46,7 @@ public:
}
}
void RegisterFactory(const char *name, ObjectFactory<AbstractClass> *factory)
void RegisterFactory(const std::string &name, ObjectFactory<AbstractClass> *factory)
{
m_map[name] = factory;
}
@ -51,7 +60,9 @@ public:
AbstractClass *CreateObject(const char *name) const
{
const ObjectFactory<AbstractClass> *factory = GetFactory(name);
return factory ? factory->CreateObject() : NULL;
if (!factory)
throw FactoryNotFound(name);
return factory->CreateObject();
}
// VC60 workaround: use "..." to prevent this function from being inlined
@ -72,27 +83,28 @@ ObjectFactoryRegistry<AbstractClass, instance> & ObjectFactoryRegistry<AbstractC
template <class AbstractClass, class ConcreteClass, int instance = 0>
struct RegisterDefaultFactoryFor {
RegisterDefaultFactoryFor(const char *name)
RegisterDefaultFactoryFor(const char *name=NULL)
{
ObjectFactoryRegistry<AbstractClass, instance>::Registry().RegisterFactory(name, new DefaultObjectFactory<AbstractClass, ConcreteClass>);
ObjectFactoryRegistry<AbstractClass, instance>::Registry().
RegisterFactory(name ? name : ConcreteClass::StaticAlgorithmName(), new DefaultObjectFactory<AbstractClass, ConcreteClass>);
}};
template <class SchemeClass>
void RegisterAsymmetricCipherDefaultFactories(const char *name, SchemeClass *dummy=NULL)
void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
RegisterDefaultFactoryFor<PK_Encryptor, CPP_TYPENAME SchemeClass::Encryptor>((const char *)name);
RegisterDefaultFactoryFor<PK_Decryptor, CPP_TYPENAME SchemeClass::Decryptor>((const char *)name);
}
template <class SchemeClass>
void RegisterSignatureSchemeDefaultFactories(const char *name, SchemeClass *dummy=NULL)
void RegisterSignatureSchemeDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
RegisterDefaultFactoryFor<PK_Signer, CPP_TYPENAME SchemeClass::Signer>((const char *)name);
RegisterDefaultFactoryFor<PK_Verifier, CPP_TYPENAME SchemeClass::Verifier>((const char *)name);
}
template <class SchemeClass>
void RegisterSymmetricCipherDefaultFactories(const char *name, SchemeClass *dummy=NULL)
void RegisterSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL)
{
RegisterDefaultFactoryFor<SymmetricCipher, CPP_TYPENAME SchemeClass::Encryption, ENCRYPTION>((const char *)name);
RegisterDefaultFactoryFor<SymmetricCipher, CPP_TYPENAME SchemeClass::Decryption, DECRYPTION>((const char *)name);

View File

@ -10,7 +10,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! file-based implementation of Store interface
class CRYPTOPP_DLL FileStore : public Store, private FilterPutSpaceHelper, public NotCopyable
{
public:
@ -45,7 +45,7 @@ private:
bool m_waiting;
};
//! .
//! file-based implementation of Source interface
class CRYPTOPP_DLL FileSource : public SourceTemplate<FileStore>
{
public:
@ -63,7 +63,7 @@ public:
std::istream* GetStream() {return m_store.GetStream();}
};
//! .
//! file-based implementation of Sink interface
class CRYPTOPP_DLL FileSink : public Sink, public NotCopyable
{
public:

View File

@ -109,14 +109,14 @@ private:
unsigned int m_currentSeriesMessages, m_totalMessages, m_totalMessageSeries;
};
//! .
//! _
class CRYPTOPP_DLL TransparentFilter : public MeterFilter
{
public:
TransparentFilter(BufferedTransformation *attachment=NULL) : MeterFilter(attachment, true) {}
};
//! .
//! _
class CRYPTOPP_DLL OpaqueFilter : public MeterFilter
{
public:
@ -210,7 +210,7 @@ private:
BlockQueue m_queue;
};
//! .
//! _
class CRYPTOPP_DLL FilterWithInputQueue : public Filter
{
public:
@ -571,7 +571,7 @@ public:
byte * CreatePutSpace(unsigned int &size) {return BufferedTransformation::CreatePutSpace(size);}
};
//! .
//! string-based implementation of Store interface
class StringStore : public Store
{
public:
@ -592,7 +592,7 @@ private:
unsigned int m_length, m_count;
};
//! .
//! RNG-based implementation of Source interface
class CRYPTOPP_DLL RandomNumberStore : public Store
{
public:
@ -619,7 +619,7 @@ private:
unsigned long m_count;
};
//! .
//! empty store
class CRYPTOPP_DLL NullStore : public Store
{
public:
@ -638,7 +638,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE Source : public InputRejecting<Filter>
{
public:
Source(BufferedTransformation *attachment = NULL)
{Detach(attachment);}
{Source::Detach(attachment);}
unsigned long Pump(unsigned long pumpMax=ULONG_MAX)
{Pump2(pumpMax); return pumpMax;}
@ -686,7 +686,7 @@ protected:
T m_store;
};
//! .
//! string-based implementation of Source interface
class CRYPTOPP_DLL StringSource : public SourceTemplate<StringStore>
{
public:
@ -700,7 +700,7 @@ public:
: SourceTemplate<StringStore>(attachment) {SourceInitialize(pumpAll, MakeParameters("InputBuffer", ConstByteArrayParameter(string)));}
};
//! .
//! RNG-based implementation of Source interface
class CRYPTOPP_DLL RandomNumberSource : public SourceTemplate<RandomNumberStore>
{
public:

View File

@ -19,7 +19,7 @@ NAMESPACE_BEGIN(CryptoPP)
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters<Integer>;
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public DL_GroupParameters<Integer>, public ASN1CryptoMaterial
{
typedef DL_GroupParameters_IntegerBased ThisClass;
@ -57,6 +57,7 @@ public:
Integer ConvertElementToInteger(const Element &element) const
{return element;}
Integer GetMaxExponent() const;
static std::string StaticAlgorithmNamePrefix() {return "";}
OID GetAlgorithmID() const;
@ -78,7 +79,7 @@ private:
Integer m_q;
};
//! .
//! _
template <class GROUP_PRECOMP, class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<CPP_TYPENAME GROUP_PRECOMP::Element> >
class CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBasedImpl : public DL_GroupParametersImpl<GROUP_PRECOMP, BASE_PRECOMP, DL_GroupParameters_IntegerBased>
{
@ -114,7 +115,7 @@ public:
CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_IntegerBasedImpl<ModExpPrecomputation>;
//! .
//! GF(p) group parameters
class CRYPTOPP_DLL DL_GroupParameters_GFP : public DL_GroupParameters_IntegerBasedImpl<ModExpPrecomputation>
{
public:
@ -136,7 +137,7 @@ protected:
int GetFieldType() const {return 1;}
};
//! .
//! GF(p) group parameters that default to same primes
class CRYPTOPP_DLL DL_GroupParameters_GFP_DefaultSafePrime : public DL_GroupParameters_GFP
{
public:
@ -146,7 +147,7 @@ protected:
unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;}
};
//! .
//! GDSA algorithm
template <class T>
class DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm<T>
{
@ -178,7 +179,7 @@ public:
CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA<Integer>;
//! .
//! NR algorithm
template <class T>
class DL_Algorithm_NR : public DL_ElgamalLikeSignatureAlgorithm<T>
{
@ -224,7 +225,7 @@ public:
{this->GetPublicElement().DEREncode(bt);}
};
//! .
//! DL private key (in GF(p) groups)
template <class GP>
class DL_PrivateKey_GFP : public DL_PrivateKeyImpl<GP>
{
@ -243,7 +244,7 @@ public:
{this->AccessGroupParameters().Initialize(p, q, g); this->SetPrivateExponent(x);}
};
//! .
//! DL signing/verification keys (in GF(p) groups)
struct DL_SignatureKeys_GFP
{
typedef DL_GroupParameters_GFP GroupParameters;
@ -251,7 +252,7 @@ struct DL_SignatureKeys_GFP
typedef DL_PrivateKey_GFP<GroupParameters> PrivateKey;
};
//! .
//! DL encryption/decryption keys (in GF(p) groups)
struct DL_CryptoKeys_GFP
{
typedef DL_GroupParameters_GFP_DefaultSafePrime GroupParameters;
@ -359,20 +360,20 @@ struct NR : public DL_SS<
{
};
//! .
//! DSA group parameters, these are GF(p) group parameters that are allowed by the DSA standard
class CRYPTOPP_DLL DL_GroupParameters_DSA : public DL_GroupParameters_GFP
{
public:
/*! also checks that the lengths of p and q are allowed by the DSA standard */
bool ValidateGroup(RandomNumberGenerator &rng, unsigned int level) const;
/*! parameters: (ModulusSize), or (Modulus, SubgroupOrder, SubgroupGenerator) */
/*! ModulusSize must be between 512 and 1024, and divisible by 64 */
/*! ModulusSize must be between DSA::MIN_PRIME_LENGTH and DSA::MAX_PRIME_LENGTH, and divisible by DSA::PRIME_LENGTH_MULTIPLE */
void GenerateRandom(RandomNumberGenerator &rng, const NameValuePairs &alg);
};
struct DSA;
//! .
//! DSA keys
struct DL_Keys_DSA
{
typedef DL_PublicKey_GFP<DL_GroupParameters_DSA> PublicKey;
@ -400,6 +401,7 @@ struct CRYPTOPP_DLL DSA : public DL_SS<
static bool IsValidPrimeLength(unsigned int pbits)
{return pbits >= MIN_PRIME_LENGTH && pbits <= MAX_PRIME_LENGTH && pbits % PRIME_LENGTH_MULTIPLE == 0;}
//! FIPS 186-2 Change Notice 1 changed the minimum modulus length to 1024
enum {
#if (DSA_1024_BIT_MODULUS_ONLY)
MIN_PRIME_LENGTH = 1024,
@ -413,7 +415,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_GFP<DL_GroupParameters_DSA>;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_GFP<DL_GroupParameters_DSA>;
CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest<DL_PrivateKey_GFP<DL_GroupParameters_DSA>, DSA>;
//! .
//! the XOR encryption method, for use with DL-based cryptosystems
template <class MAC, bool DHAES_MODE>
class DL_EncryptionAlgorithm_Xor : public DL_SymmetricEncryptionAlgorithm
{
@ -489,7 +491,7 @@ public:
}
};
//! .
//! _
template <class T, bool DHAES_MODE, class KDF>
class DL_KeyDerivationAlgorithm_P1363 : public DL_KeyDerivationAlgorithm<T>
{

1
gost.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32>
{
static const char *StaticAlgorithmName() {return "GOST";}

1
hmac.h
View File

@ -8,6 +8,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, UINT_MAX>, public MessageAuthenticationCode
{
public:

View File

@ -5,6 +5,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
class TimerBase
{
public:

1
idea.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct IDEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public FixedRounds<8>
{
static const char *StaticAlgorithmName() {return "IDEA";}

View File

@ -8,6 +8,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class T, class BASE>
class CRYPTOPP_NO_VTABLE IteratedHashBase : public BASE
{
@ -15,8 +16,6 @@ public:
typedef T HashWordType;
IteratedHashBase() : m_countHi(0), m_countLo(0) {}
void SetBlockSize(unsigned int blockSize) {m_data.resize(blockSize / sizeof(HashWordType));}
void SetStateSize(unsigned int stateSize) {m_digest.resize(stateSize / sizeof(HashWordType));}
unsigned int BlockSize() const {return m_data.size() * sizeof(T);}
unsigned int OptimalBlockSize() const {return BlockSize();}
unsigned int OptimalDataAlignment() const {return sizeof(T);}
@ -25,6 +24,9 @@ public:
void Restart();
protected:
void SetBlockSize(unsigned int blockSize) {m_data.resize(blockSize / sizeof(HashWordType));}
void SetStateSize(unsigned int stateSize) {m_digest.resize(stateSize / sizeof(HashWordType));}
T GetBitCountHi() const {return (m_countLo >> (8*sizeof(T)-3)) + (m_countHi << 3);}
T GetBitCountLo() const {return m_countLo << 3;}
@ -48,7 +50,7 @@ CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word64, MessageAuthenticationCod
CRYPTOPP_DLL_TEMPLATE_CLASS IteratedHashBase<word32, HashTransformation>;
CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase<word32, MessageAuthenticationCode>;
//! .
//! _
template <class T, class B, class BASE>
class CRYPTOPP_NO_VTABLE IteratedHashBase2 : public IteratedHashBase<T, BASE>
{
@ -68,7 +70,7 @@ protected:
virtual void HashEndianCorrectedBlock(const HashWordType *data) =0;
};
//! .
//! _
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, class T_Base = HashTransformation>
class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase2<T_HashWordType, T_Endianness, T_Base>
{
@ -80,6 +82,7 @@ protected:
IteratedHash() {this->SetBlockSize(T_BlockSize);}
};
//! _
template <class T_HashWordType, class T_Endianness, unsigned int T_BlockSize, unsigned int T_StateSize, class T_Transform, unsigned int T_DigestSize = T_StateSize>
class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform
: public ClonableImpl<T_Transform, AlgorithmImpl<IteratedHash<T_HashWordType, T_Endianness, T_BlockSize>, T_Transform> >

View File

@ -12,7 +12,7 @@ NAMESPACE_BEGIN(CryptoPP)
template <class T> struct DigestSizeDoubleWorkaround {enum {RESULT = 2*T::DIGESTSIZE};}; // VC60 workaround
//! .
//! algorithm info
template <class T>
struct LR_Info : public VariableKeyLength<16, 0, 2*(UINT_MAX/2), 2>, public FixedBlockSize<DigestSizeDoubleWorkaround<T>::RESULT>
{

14
luc.h
View File

@ -49,7 +49,7 @@ protected:
Integer m_n, m_e;
};
//! .
//! _
class InvertibleLUCFunction : public LUCFunction, public TrapdoorFunctionInverse, public PrivateKey
{
typedef InvertibleLUCFunction ThisClass;
@ -127,7 +127,7 @@ private:
Integer m_p;
};
//! .
//! _
class DL_BasePrecomputation_LUC : public DL_FixedBasePrecomputation<Integer>
{
public:
@ -146,7 +146,7 @@ private:
Integer m_g;
};
//! .
//! _
class DL_GroupParameters_LUC : public DL_GroupParameters_IntegerBasedImpl<DL_GroupPrecomputation_LUC, DL_BasePrecomputation_LUC>
{
public:
@ -168,7 +168,7 @@ private:
int GetFieldType() const {return 2;}
};
//! .
//! _
class DL_GroupParameters_LUC_DefaultSafePrime : public DL_GroupParameters_LUC
{
public:
@ -178,7 +178,7 @@ protected:
unsigned int GetDefaultSubgroupOrderSize(unsigned int modulusSize) const {return modulusSize-1;}
};
//! .
//! _
class DL_Algorithm_LUC_HMP : public DL_ElgamalLikeSignatureAlgorithm<Integer>
{
public:
@ -191,7 +191,7 @@ public:
{return params.GetGroupOrder().ByteCount();}
};
//! .
//! _
struct DL_SignatureKeys_LUC
{
typedef DL_GroupParameters_LUC GroupParameters;
@ -205,7 +205,7 @@ struct LUC_HMP : public DL_SS<DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_Sig
{
};
//! .
//! _
struct DL_CryptoKeys_LUC
{
typedef DL_GroupParameters_LUC_DefaultSafePrime GroupParameters;

1
mars.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct MARS_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 56, 4>
{
static const char *StaticAlgorithmName() {return "MARS";}

View File

@ -9,7 +9,6 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
{
public:
@ -32,7 +31,7 @@ protected:
};
//! <a href="http://www.weidai.com/scan-mirror/mac.html#MD5-MAC">MD5-MAC</a>
typedef MessageAuthenticationCodeFinal<MD5MAC_Base> MD5MAC;
DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<MD5MAC_Base>, MD5MAC)
NAMESPACE_END

1
mdc.h
View File

@ -11,6 +11,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class T>
struct MDC_Info : public FixedBlockSize<T::DIGESTSIZE>, public FixedKeyLength<T::BLOCKSIZE>
{

9
misc.h
View File

@ -33,11 +33,13 @@ class CRYPTOPP_DLL Empty
{
};
//! _
template <class BASE1, class BASE2>
class CRYPTOPP_NO_VTABLE TwoBases : public BASE1, public BASE2
{
};
//! _
template <class BASE1, class BASE2, class BASE3>
class CRYPTOPP_NO_VTABLE ThreeBases : public BASE1, public BASE2, public BASE3
{
@ -65,9 +67,10 @@ struct NewObject
T* operator()() const {return new T;}
};
// This function safely initializes a static object in a multithreaded environment without using locks.
// It may leak memory when two threads try to initialize the static object at the same time
// but this should be acceptable since each static object is only initialized once per session.
/*! This function safely initializes a static object in a multithreaded environment without using locks.
It may leak memory when two threads try to initialize the static object at the same time
but this should be acceptable since each static object is only initialized once per session.
*/
template <class T, class F = NewObject<T>, int instance=0>
class Singleton
{

View File

@ -14,7 +14,8 @@ CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup<Integer>;
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractRing<Integer>;
CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain<Integer>;
//! .
//! ring of congruence classes modulo n
/*! \note this implementation represents each congruence class as the smallest non-negative integer in that class */
class CRYPTOPP_DLL ModularArithmetic : public AbstractRing<Integer>
{
public:
@ -117,6 +118,7 @@ protected:
// const ModularArithmetic::RandomizationParameter ModularArithmetic::DefaultRandomizationParameter = 0 ;
//! do modular arithmetics in Montgomery representation for increased speed
/*! \note the Montgomery representation represents each congruence class [a] as a*r%n, where r is a convenient power of 2 */
class CRYPTOPP_DLL MontgomeryRepresentation : public ModularArithmetic
{
public:

15
modes.h
View File

@ -82,6 +82,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CFB_ModePolicy : public ModePolicyCommonTe
{
public:
IV_Requirement IVRequirement() const {return RANDOM_IV;}
static const char *StaticAlgorithmName() {return "CFB";}
protected:
unsigned int GetBytesPerIteration() const {return m_feedbackSize;}
@ -126,6 +127,7 @@ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE OFB_ModePolicy : public ModePolicyCommonTe
public:
bool IsRandomAccess() const {return false;}
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
static const char *StaticAlgorithmName() {return "OFB";}
private:
unsigned int GetBytesPerIteration() const {return BlockSize();}
@ -148,6 +150,7 @@ public:
bool IsRandomAccess() const {return true;}
IV_Requirement IVRequirement() const {return STRUCTURED_IV;}
void GetNextIV(byte *IV);
static const char *StaticAlgorithmName() {return "Counter-BE";}
private:
unsigned int GetBytesPerIteration() const {return BlockSize();}
@ -194,6 +197,7 @@ public:
unsigned int OptimalBlockSize() const {return BlockSize() * m_cipher->OptimalNumberOfParallelBlocks();}
void ProcessBlocks(byte *outString, const byte *inString, unsigned int numberOfBlocks)
{m_cipher->ProcessAndXorMultipleBlocks(inString, NULL, outString, numberOfBlocks);}
static const char *StaticAlgorithmName() {return "ECB";}
};
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_ModeBase : public BlockOrientedCipherModeBase
@ -202,6 +206,7 @@ public:
IV_Requirement IVRequirement() const {return UNPREDICTABLE_RANDOM_IV;}
bool RequireAlignedInput() const {return false;}
unsigned int MinLastBlockSize() const {return 0;}
static const char *StaticAlgorithmName() {return "CBC";}
};
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_Encryption : public CBC_ModeBase
@ -216,6 +221,7 @@ public:
void SetStolenIV(byte *iv) {m_stolenIV = iv;}
unsigned int MinLastBlockSize() const {return BlockSize()+1;}
void ProcessLastBlock(byte *outString, const byte *inString, unsigned int length);
static const char *StaticAlgorithmName() {return "CBC/CTS";}
protected:
void UncheckedSetKey(const NameValuePairs &params, const byte *key, unsigned int length, const byte *iv)
@ -248,9 +254,9 @@ public:
void ProcessLastBlock(byte *outString, const byte *inString, unsigned int length);
};
//! .
//! _
template <class CIPHER, class BASE>
class CipherModeFinalTemplate_CipherHolder : public ObjectHolder<CIPHER>, public BASE
class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder<CIPHER>, public AlgorithmImpl<BASE, CipherModeFinalTemplate_CipherHolder<CIPHER, BASE> >
{
public:
CipherModeFinalTemplate_CipherHolder()
@ -273,9 +279,12 @@ public:
this->m_cipher = &this->m_object;
this->SetKey(key, length, MakeParameters(Name::IV(), iv)(Name::FeedbackSize(), feedbackSize));
}
static std::string StaticAlgorithmName()
{return CIPHER::StaticAlgorithmName() + "/" + BASE::StaticAlgorithmName();}
};
//! .
//! _
template <class BASE>
class CipherModeFinalTemplate_ExternalCipher : public BASE
{

2
mqv.h
View File

@ -8,7 +8,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
template <class GROUP_PARAMETERS, class COFACTOR_OPTION = CPP_TYPENAME GROUP_PARAMETERS::DefaultCofactorOption>
class MQV_Domain : public AuthenticatedKeyAgreementDomain
{

3
oaep.h
View File

@ -6,7 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! <a href="http://www.weidai.com/scan-mirror/ca.html#cem_OAEP-MGF1">EME-OAEP</a>, for use with RSAES
//! _
class CRYPTOPP_DLL OAEP_Base : public PK_EncryptionMessageEncodingMethod
{
public:
@ -21,6 +21,7 @@ protected:
virtual MaskGeneratingFunction * NewMGF() const =0;
};
//! <a href="http://www.weidai.com/scan-mirror/ca.html#cem_OAEP-MGF1">EME-OAEP</a>, for use with classes derived from TF_ES
template <class H, class MGF=P1363_MGF1>
class OAEP : public OAEP_Base, public EncryptionStandard
{

View File

@ -33,7 +33,7 @@ public:
PanamaHash() {Panama<B>::Reset();}
unsigned int DigestSize() const {return DIGESTSIZE;}
void TruncatedFinal(byte *hash, unsigned int size);
static const char * StaticAlgorithmName() {return "Panama";}
static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
protected:
void Init() {Panama<B>::Reset();}
@ -41,47 +41,77 @@ protected:
unsigned int HashMultipleBlocks(const word32 *input, unsigned int length);
};
//! .
template <class B = LittleEndian>
class CRYPTOPP_NO_VTABLE PanamaMAC_Base : public PanamaHash<B>, public VariableKeyLength<32, 0, UINT_MAX>, public MessageAuthenticationCode
//! MAC construction using a hermetic hash function
template <class T_Hash, class T_Info = T_Hash>
class HermeticHashFunctionMAC : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<MessageAuthenticationCode, VariableKeyLength<32, 0, UINT_MAX> > >, T_Info>
{
public:
void UncheckedSetKey(const byte *userKey, unsigned int keylength)
void SetKey(const byte *key, unsigned int length, const NameValuePairs &params = g_nullNameValuePairs)
{
m_key.Assign(userKey, keylength);
m_key.Assign(key, length);
Restart();
}
static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
protected:
void Init()
void Restart()
{
PanamaHash<B>::Init();
Update(m_key, m_key.size());
m_hash.Restart();
m_keyed = false;
}
void Update(const byte *input, unsigned int length)
{
if (!m_keyed)
KeyHash();
m_hash.Update(input, length);
}
void TruncatedFinal(byte *digest, unsigned int digestSize)
{
if (!m_keyed)
KeyHash();
m_hash.TruncatedFinal(digest, digestSize);
m_keyed = false;
}
unsigned int DigestSize() const
{return m_hash.DigestSize();}
unsigned int BlockSize() const
{return m_hash.BlockSize();}
unsigned int OptimalBlockSize() const
{return m_hash.OptimalBlockSize();}
unsigned int OptimalDataAlignment() const
{return m_hash.OptimalDataAlignment();}
protected:
void KeyHash()
{
m_hash.Update(m_key, m_key.size());
m_keyed = true;
}
T_Hash m_hash;
bool m_keyed;
SecByteBlock m_key;
};
/// Panama MAC
template <class B = LittleEndian>
class PanamaMAC : public MessageAuthenticationCodeImpl<PanamaMAC_Base<B> >
class PanamaMAC : public HermeticHashFunctionMAC<PanamaHash<B> >
{
public:
PanamaMAC() {}
PanamaMAC(const byte *key, unsigned int length=PanamaMAC_Base<B>::DEFAULT_KEYLENGTH)
PanamaMAC(const byte *key, unsigned int length)
{this->SetKey(key, length);}
};
//! .
//! algorithm info
template <class B>
struct PanamaCipherInfo : public VariableKeyLength<32, 32, 64, 32, SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
{
static const char * StaticAlgorithmName() {return B::ToEnum() == BIG_ENDIAN_ORDER ? "Panama-BE" : "Panama-LE";}
};
//! .
//! _
template <class B>
class PanamaCipherPolicy : public AdditiveCipherConcretePolicy<word32, 8>,
public PanamaCipherInfo<B>,

View File

@ -28,6 +28,18 @@ public:
static const unsigned int length;
};
// PKCS_DigestDecoration can be instantiated with the following
// classes as specified in PKCS#1 v2.0 and P1363a
class SHA;
class MD2;
class MD5;
class RIPEMD160;
class Tiger;
class SHA256;
class SHA384;
class SHA512;
// end of list
//! <a href="http://www.weidai.com/scan-mirror/sig.html#sem_PKCS1-1.5">EMSA-PKCS1-v1_5</a>
class CRYPTOPP_DLL PKCS1v15_SignatureMessageEncodingMethod : public PK_DeterministicSignatureMessageEncodingMethod
{
@ -51,8 +63,12 @@ public:
};
};
//! PKCS #1 version 1.5, for use with RSAES and RSASSA
/*! The following hash functions are supported for signature: SHA, MD2, MD5, RIPEMD160, SHA256, SHA384, SHA512. */
//! PKCS #1 version 1.5, for use with RSAES and RSASS
/*! Only the following hash functions are supported by this signature standard:
\dontinclude pkcspad.h
\skip can be instantiated
\until end of list
*/
struct PKCS1v15 : public SignatureStandard, public EncryptionStandard
{
typedef PKCS_EncryptionPaddingScheme EncryptionMessageEncodingMethod;
@ -63,17 +79,6 @@ struct PKCS1v15 : public SignatureStandard, public EncryptionStandard
CRYPTOPP_DLL_TEMPLATE_CLASS PKCS_DigestDecoration<SHA>;
#endif
// PKCS_DecoratedHashModule can be instantiated with the following
// classes as specified in PKCS#1 v2.0 and P1363a
class SHA;
class MD2;
class MD5;
class RIPEMD160;
class Tiger;
class SHA256;
class SHA384;
class SHA512;
NAMESPACE_END
#endif

3
pssr.h
View File

@ -33,7 +33,7 @@ template <class H> struct EMSA2HashId
static const byte id;
};
// EMSA2HashId can be instantiated with the following two classes.
// EMSA2HashId can be instantiated with the following classes.
class SHA;
class RIPEMD160;
class RIPEMD128;
@ -41,6 +41,7 @@ class SHA256;
class SHA384;
class SHA512;
class Whirlpool;
// end of list
template <class BASE>
class EMSA2HashIdLookup : public BASE

124
pubkey.h
View File

@ -44,7 +44,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionBounds
{
public:
@ -56,7 +56,7 @@ public:
virtual Integer MaxImage() const {return --ImageBound();}
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunction : public TrapdoorFunctionBounds
{
public:
@ -64,7 +64,7 @@ public:
virtual bool IsRandomized() const {return true;}
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunction : public RandomizedTrapdoorFunction
{
public:
@ -75,7 +75,7 @@ public:
virtual Integer ApplyFunction(const Integer &x) const =0;
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE RandomizedTrapdoorFunctionInverse
{
public:
@ -85,7 +85,7 @@ public:
virtual bool IsRandomized() const {return true;}
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TrapdoorFunctionInverse : public RandomizedTrapdoorFunctionInverse
{
public:
@ -118,7 +118,7 @@ public:
// ********************************************************
//! .
//! _
template <class TFI, class MEI>
class CRYPTOPP_NO_VTABLE TF_Base
{
@ -134,6 +134,7 @@ protected:
// ********************************************************
//! _
template <class BASE>
class CRYPTOPP_NO_VTABLE PK_FixedLengthCryptoSystemImpl : public BASE
{
@ -147,7 +148,7 @@ public:
virtual unsigned int FixedCiphertextLength() const =0;
};
//! .
//! _
template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl<INTERFACE>, protected BASE
{
@ -161,14 +162,14 @@ protected:
unsigned int PaddedBlockBitLength() const {return this->GetTrapdoorFunctionBounds().PreimageBound().BitCount()-1;}
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_DecryptorBase : public TF_CryptoSystemBase<PK_Decryptor, TF_Base<TrapdoorFunctionInverse, PK_EncryptionMessageEncodingMethod> >
{
public:
DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, unsigned int ciphertextLength, byte *plaintext, const NameValuePairs &parameters = g_nullNameValuePairs) const;
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_EncryptorBase : public TF_CryptoSystemBase<PK_Encryptor, TF_Base<RandomizedTrapdoorFunction, PK_EncryptionMessageEncodingMethod> >
{
public:
@ -179,7 +180,7 @@ public:
typedef std::pair<const byte *, unsigned int> HashIdentifier;
//! .
//! interface for message encoding method for public key signature schemes
class CRYPTOPP_NO_VTABLE PK_SignatureMessageEncodingMethod
{
public:
@ -302,7 +303,7 @@ public:
HashTransformation & AccessHash() {return this->m_object;}
};
//! .
//! _
template <class INTERFACE, class BASE>
class CRYPTOPP_NO_VTABLE TF_SignatureSchemeBase : public INTERFACE, protected BASE
{
@ -328,7 +329,7 @@ protected:
virtual unsigned int GetDigestSize() const =0;
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_SignerBase : public TF_SignatureSchemeBase<PK_Signer, TF_Base<RandomizedTrapdoorFunctionInverse, PK_SignatureMessageEncodingMethod> >
{
public:
@ -336,7 +337,7 @@ public:
unsigned int SignAndRestart(RandomNumberGenerator &rng, PK_MessageAccumulator &messageAccumulator, byte *signature, bool restart=true) const;
};
//! .
//! _
class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_VerifierBase : public TF_SignatureSchemeBase<PK_Verifier, TF_Base<TrapdoorFunction, PK_SignatureMessageEncodingMethod> >
{
public:
@ -347,7 +348,7 @@ public:
// ********************************************************
//! .
//! _
template <class T1, class T2, class T3>
struct TF_CryptoSchemeOptions
{
@ -358,14 +359,14 @@ struct TF_CryptoSchemeOptions
typedef T3 MessageEncodingMethod;
};
//! .
//! _
template <class T1, class T2, class T3, class T4>
struct TF_SignatureSchemeOptions : public TF_CryptoSchemeOptions<T1, T2, T3>
{
typedef T4 HashFunction;
};
//! .
//! _
template <class KEYS>
class CRYPTOPP_NO_VTABLE PublicKeyCopier
{
@ -374,7 +375,7 @@ public:
virtual void CopyKeyInto(typename KEYS::PublicKey &key) const =0;
};
//! .
//! _
template <class KEYS>
class CRYPTOPP_NO_VTABLE PrivateKeyCopier
{
@ -384,7 +385,7 @@ public:
virtual void CopyKeyInto(typename KEYS::PrivateKey &key) const =0;
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS, class KEY>
class CRYPTOPP_NO_VTABLE TF_ObjectImplBase : public AlgorithmImpl<BASE, typename SCHEME_OPTIONS::AlgorithmInfo>
{
@ -433,7 +434,7 @@ protected:
}
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS, class KEY>
class TF_ObjectImplExtRef : public TF_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>
{
@ -448,7 +449,7 @@ private:
const KEY * m_pKey;
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS, class KEY_COPIER>
class CRYPTOPP_NO_VTABLE TF_ObjectImpl : public TF_ObjectImplBase<TwoBases<BASE, KEY_COPIER>, SCHEME_OPTIONS, typename KEY_COPIER::KeyClass>
{
@ -465,25 +466,25 @@ private:
KeyClass m_trapdoorFunction;
};
//! .
//! _
template <class SCHEME_OPTIONS>
class TF_DecryptorImpl : public TF_ObjectImpl<TF_DecryptorBase, SCHEME_OPTIONS, PrivateKeyCopier<typename SCHEME_OPTIONS::Keys> >
{
};
//! .
//! _
template <class SCHEME_OPTIONS>
class TF_EncryptorImpl : public TF_ObjectImpl<TF_EncryptorBase, SCHEME_OPTIONS, PublicKeyCopier<typename SCHEME_OPTIONS::Keys> >
{
};
//! .
//! _
template <class SCHEME_OPTIONS>
class TF_SignerImpl : public TF_ObjectImpl<TF_SignerBase, SCHEME_OPTIONS, PrivateKeyCopier<typename SCHEME_OPTIONS::Keys> >
{
};
//! .
//! _
template <class SCHEME_OPTIONS>
class TF_VerifierImpl : public TF_ObjectImpl<TF_VerifierBase, SCHEME_OPTIONS, PublicKeyCopier<typename SCHEME_OPTIONS::Keys> >
{
@ -491,6 +492,7 @@ class TF_VerifierImpl : public TF_ObjectImpl<TF_VerifierBase, SCHEME_OPTIONS, Pu
// ********************************************************
//! _
class CRYPTOPP_NO_VTABLE MaskGeneratingFunction
{
public:
@ -500,7 +502,7 @@ public:
CRYPTOPP_DLL void P1363_MGF1KDF2_Common(HashTransformation &hash, byte *output, unsigned int outputLength, const byte *input, unsigned int inputLength, const byte *derivationParams, unsigned int derivationParamsLength, bool mask, unsigned int counterStart);
//! .
//! _
class P1363_MGF1 : public MaskGeneratingFunction
{
public:
@ -513,7 +515,7 @@ public:
// ********************************************************
//! .
//! _
template <class H>
class P1363_KDF2
{
@ -527,14 +529,14 @@ public:
// ********************************************************
// to be thrown by DecodeElement and AgreeWithStaticPrivateKey
//! to be thrown by DecodeElement and AgreeWithStaticPrivateKey
class DL_BadElement : public InvalidDataFormat
{
public:
DL_BadElement() : InvalidDataFormat("CryptoPP: invalid group element") {}
};
//! .
//! interface for DL group parameters
template <class T>
class CRYPTOPP_NO_VTABLE DL_GroupParameters : public CryptoParameters
{
@ -626,7 +628,7 @@ private:
mutable unsigned int m_validationLevel;
};
//! .
//! _
template <class GROUP_PRECOMP, class BASE_PRECOMP = DL_FixedBasePrecomputationImpl<CPP_TYPENAME GROUP_PRECOMP::Element>, class BASE = DL_GroupParameters<CPP_TYPENAME GROUP_PRECOMP::Element> >
class DL_GroupParametersImpl : public BASE
{
@ -644,7 +646,7 @@ protected:
BASE_PRECOMP m_gpc;
};
//! .
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DL_Key
{
@ -653,7 +655,7 @@ public:
virtual DL_GroupParameters<T> & AccessAbstractGroupParameters() =0;
};
//! .
//! interface for DL public keys
template <class T>
class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key<T>
{
@ -688,7 +690,7 @@ public:
virtual DL_FixedBasePrecomputation<T> & AccessPublicPrecomputation() =0;
};
//! .
//! interface for DL private keys
template <class T>
class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key<T>
{
@ -736,7 +738,7 @@ void DL_PublicKey<T>::AssignFrom(const NameValuePairs &source)
class OID;
//! .
//! _
template <class PK, class GP, class O = OID>
class DL_KeyImpl : public PK
{
@ -763,7 +765,7 @@ private:
class X509PublicKey;
class PKCS8PrivateKey;
//! .
//! _
template <class GP>
class DL_PrivateKeyImpl : public DL_PrivateKey<CPP_TYPENAME GP::Element>, public DL_KeyImpl<PKCS8PrivateKey, GP>
{
@ -834,7 +836,7 @@ private:
Integer m_x;
};
//! .
//! _
template <class BASE, class SIGNATURE_SCHEME>
class DL_PrivateKey_WithSignaturePairwiseConsistencyTest : public BASE
{
@ -852,7 +854,7 @@ public:
}
};
//! .
//! _
template <class GP>
class DL_PublicKeyImpl : public DL_PublicKey<typename GP::Element>, public DL_KeyImpl<X509PublicKey, GP>
{
@ -913,7 +915,7 @@ private:
typename GP::BasePrecomputation m_ypc;
};
//! .
//! interface for Elgamal-like signature algorithms
template <class T>
class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm
{
@ -928,7 +930,7 @@ public:
{return params.GetSubgroupOrder().ByteCount();}
};
//! .
//! interface for DL key agreement algorithms
template <class T>
class CRYPTOPP_NO_VTABLE DL_KeyAgreementAlgorithm
{
@ -939,7 +941,7 @@ public:
virtual Element AgreeWithStaticPrivateKey(const DL_GroupParameters<Element> &params, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const =0;
};
//! .
//! interface for key derivation algorithms used in DL cryptosystems
template <class T>
class CRYPTOPP_NO_VTABLE DL_KeyDerivationAlgorithm
{
@ -948,7 +950,7 @@ public:
virtual void Derive(const DL_GroupParameters<T> &groupParams, byte *derivedKey, unsigned int derivedLength, const T &agreedElement, const T &ephemeralPublicKey, const NameValuePairs &derivationParams) const =0;
};
//! .
//! interface for symmetric encryption algorithms used in DL cryptosystems
class CRYPTOPP_NO_VTABLE DL_SymmetricEncryptionAlgorithm
{
public:
@ -960,7 +962,7 @@ public:
virtual DecodingResult SymmetricDecrypt(const byte *key, const byte *ciphertext, unsigned int ciphertextLength, byte *plaintext, const NameValuePairs &parameters) const =0;
};
//! .
//! _
template <class KI>
class CRYPTOPP_NO_VTABLE DL_Base
{
@ -975,7 +977,7 @@ protected:
virtual const KeyInterface & GetKeyInterface() const =0;
};
//! .
//! _
template <class INTERFACE, class KEY_INTERFACE>
class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Base<KEY_INTERFACE>
{
@ -1007,7 +1009,7 @@ protected:
virtual unsigned int GetDigestSize() const =0;
};
//! .
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DL_SignerBase : public DL_SignatureSchemeBase<PK_Signer, DL_PrivateKey<T> >
{
@ -1080,7 +1082,7 @@ protected:
}
};
//! .
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DL_VerifierBase : public DL_SignatureSchemeBase<PK_Verifier, DL_PublicKey<T> >
{
@ -1148,7 +1150,7 @@ public:
}
};
//! .
//! _
template <class PK, class KI>
class CRYPTOPP_NO_VTABLE DL_CryptoSystemBase : public PK, public DL_Base<KI>
{
@ -1176,7 +1178,7 @@ protected:
virtual const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const =0;
};
//! .
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DL_DecryptorBase : public DL_CryptoSystemBase<PK_Decryptor, DL_PrivateKey<T> >
{
@ -1212,7 +1214,7 @@ public:
}
};
//! .
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DL_EncryptorBase : public DL_CryptoSystemBase<PK_Encryptor, DL_PublicKey<T> >
{
@ -1242,7 +1244,7 @@ public:
}
};
//! .
//! _
template <class T1, class T2>
struct DL_SchemeOptionsBase
{
@ -1251,7 +1253,7 @@ struct DL_SchemeOptionsBase
typedef typename GroupParameters::Element Element;
};
//! .
//! _
template <class T1, class T2>
struct DL_KeyedSchemeOptions : public DL_SchemeOptionsBase<T1, typename T2::PublicKey::GroupParameters>
{
@ -1260,7 +1262,7 @@ struct DL_KeyedSchemeOptions : public DL_SchemeOptionsBase<T1, typename T2::Publ
typedef typename Keys::PublicKey PublicKey;
};
//! .
//! _
template <class T1, class T2, class T3, class T4, class T5>
struct DL_SignatureSchemeOptions : public DL_KeyedSchemeOptions<T1, T2>
{
@ -1269,7 +1271,7 @@ struct DL_SignatureSchemeOptions : public DL_KeyedSchemeOptions<T1, T2>
typedef T5 HashFunction;
};
//! .
//! _
template <class T1, class T2, class T3, class T4, class T5>
struct DL_CryptoSchemeOptions : public DL_KeyedSchemeOptions<T1, T2>
{
@ -1278,7 +1280,7 @@ struct DL_CryptoSchemeOptions : public DL_KeyedSchemeOptions<T1, T2>
typedef T5 SymmetricEncryptionAlgorithm;
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS, class KEY>
class CRYPTOPP_NO_VTABLE DL_ObjectImplBase : public AlgorithmImpl<BASE, typename SCHEME_OPTIONS::AlgorithmInfo>
{
@ -1313,7 +1315,7 @@ private:
KEY m_key;
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS, class KEY>
class CRYPTOPP_NO_VTABLE DL_ObjectImpl : public DL_ObjectImplBase<BASE, SCHEME_OPTIONS, KEY>
{
@ -1335,7 +1337,7 @@ protected:
{return Singleton<CPP_TYPENAME SCHEME_OPTIONS::MessageEncodingMethod>().Ref();}
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS>
class CRYPTOPP_NO_VTABLE DL_PublicObjectImpl : public DL_ObjectImpl<BASE, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey>, public PublicKeyCopier<SCHEME_OPTIONS>
{
@ -1344,7 +1346,7 @@ public:
{key = this->GetKey();}
};
//! .
//! _
template <class BASE, class SCHEME_OPTIONS>
class CRYPTOPP_NO_VTABLE DL_PrivateObjectImpl : public DL_ObjectImpl<BASE, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey>, public PrivateKeyCopier<SCHEME_OPTIONS>
{
@ -1355,7 +1357,7 @@ public:
{key = this->GetKey();}
};
//! .
//! _
template <class SCHEME_OPTIONS>
class DL_SignerImpl : public DL_PrivateObjectImpl<DL_SignerBase<typename SCHEME_OPTIONS::Element>, SCHEME_OPTIONS>
{
@ -1368,7 +1370,7 @@ public:
}
};
//! .
//! _
template <class SCHEME_OPTIONS>
class DL_VerifierImpl : public DL_PublicObjectImpl<DL_VerifierBase<typename SCHEME_OPTIONS::Element>, SCHEME_OPTIONS>
{
@ -1379,13 +1381,13 @@ public:
}
};
//! .
//! _
template <class SCHEME_OPTIONS>
class DL_EncryptorImpl : public DL_PublicObjectImpl<DL_EncryptorBase<typename SCHEME_OPTIONS::Element>, SCHEME_OPTIONS>
{
};
//! .
//! _
template <class SCHEME_OPTIONS>
class DL_DecryptorImpl : public DL_PrivateObjectImpl<DL_DecryptorBase<typename SCHEME_OPTIONS::Element>, SCHEME_OPTIONS>
{
@ -1393,7 +1395,7 @@ class DL_DecryptorImpl : public DL_PrivateObjectImpl<DL_DecryptorBase<typename S
// ********************************************************
//! .
//! _
template <class T>
class CRYPTOPP_NO_VTABLE DL_SimpleKeyAgreementDomainBase : public SimpleKeyAgreementDomain
{
@ -1459,7 +1461,7 @@ public:
typedef ELEMENT Element;
static const char *StaticAlgorithmName()
{return COFACTOR_OPTION::ToEnum() == NO_COFACTOR_MULTIPLICTION ? "DH" : "DHC";}
{return COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? "DHC" : "DH";}
Element AgreeWithEphemeralPrivateKey(const DL_GroupParameters<Element> &params, const DL_FixedBasePrecomputation<Element> &publicPrecomputation, const Integer &privateExponent) const
{

10
rabin.h
View File

@ -10,7 +10,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! Rabin
//! _
class RabinFunction : public TrapdoorFunction, public PublicKey
{
typedef RabinFunction ThisClass;
@ -42,7 +42,7 @@ protected:
Integer m_n, m_r, m_s;
};
//! Invertible Rabin
//! _
class InvertibleRabinFunction : public RabinFunction, public TrapdoorFunctionInverse, public PrivateKey
{
typedef InvertibleRabinFunction ThisClass;
@ -77,7 +77,7 @@ protected:
Integer m_p, m_q, m_u;
};
//! .
//! Rabin
struct Rabin
{
static std::string StaticAlgorithmName() {return "Rabin-Crypto++Variant";}
@ -85,13 +85,13 @@ struct Rabin
typedef InvertibleRabinFunction PrivateKey;
};
//! .
//! Rabin encryption
template <class STANDARD>
struct RabinES : public TF_ES<STANDARD, Rabin>
{
};
//! .
//! Rabin signature
template <class STANDARD, class H>
struct RabinSS : public TF_SS<STANDARD, H, Rabin>
{

1
rc2.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct RC2_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 128>
{
enum {DEFAULT_EFFECTIVE_KEYLENGTH = 1024, MAX_EFFECTIVE_KEYLENGTH = 1024};

1
rc5.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct RC5_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 0, 255>, public VariableRounds<16>
{
static const char *StaticAlgorithmName() {return "RC5";}

1
rc6.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct RC6_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 255>, public VariableRounds<20>
{
static const char *StaticAlgorithmName() {return "RC6";}

View File

@ -16,23 +16,32 @@
#include "camellia.h"
#include "shacal2.h"
#include "tea.h"
#include "panama.h"
USING_NAMESPACE(CryptoPP)
void RegisterFactories()
{
RegisterDefaultFactoryFor<SimpleKeyAgreementDomain, DH>("DH");
RegisterDefaultFactoryFor<HashTransformation, SHA1>("SHA-1");
RegisterDefaultFactoryFor<HashTransformation, SHA256>("SHA-256");
static bool s_registered = false;
if (s_registered)
return;
RegisterDefaultFactoryFor<SimpleKeyAgreementDomain, DH>();
RegisterDefaultFactoryFor<HashTransformation, SHA1>();
RegisterDefaultFactoryFor<HashTransformation, SHA256>();
#ifdef WORD64_AVAILABLE
RegisterDefaultFactoryFor<HashTransformation, SHA384>("SHA-384");
RegisterDefaultFactoryFor<HashTransformation, SHA512>("SHA-512");
RegisterDefaultFactoryFor<HashTransformation, SHA384>();
RegisterDefaultFactoryFor<HashTransformation, SHA512>();
RegisterDefaultFactoryFor<HashTransformation, Whirlpool>();
#endif
RegisterDefaultFactoryFor<HashTransformation, Whirlpool>("Whirlpool");
RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<MD5> >("HMAC(MD5)");
RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA1> >("HMAC(SHA-1)");
RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<RIPEMD160> >("HMAC(RIPEMD-160)");
RegisterDefaultFactoryFor<MessageAuthenticationCode, TTMAC >("Two-Track-MAC");
RegisterDefaultFactoryFor<HashTransformation, PanamaHash<LittleEndian> >();
RegisterDefaultFactoryFor<HashTransformation, PanamaHash<BigEndian> >();
RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<MD5> >();
RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<SHA1> >();
RegisterDefaultFactoryFor<MessageAuthenticationCode, HMAC<RIPEMD160> >();
RegisterDefaultFactoryFor<MessageAuthenticationCode, TTMAC>();
RegisterDefaultFactoryFor<MessageAuthenticationCode, PanamaMAC<LittleEndian> >();
RegisterDefaultFactoryFor<MessageAuthenticationCode, PanamaMAC<BigEndian> >();
RegisterAsymmetricCipherDefaultFactories<RSAES<OAEP<SHA1> > >("RSA/OAEP-MGF1(SHA-1)");
RegisterAsymmetricCipherDefaultFactories<DLIES<> >("DLIES(NoCofactorMultiplication, KDF2(SHA-1), XOR, HMAC(SHA-1), DHAES)");
RegisterSignatureSchemeDefaultFactories<DSA>("DSA(1363)");
@ -43,11 +52,15 @@ void RegisterFactories()
RegisterSignatureSchemeDefaultFactories<ESIGN<SHA1> >("ESIGN/EMSA5-MGF1(SHA-1)");
RegisterSignatureSchemeDefaultFactories<RWSS<P1363_EMSA2, SHA1> >("RW/EMSA2(SHA-1)");
RegisterSignatureSchemeDefaultFactories<RSASS<PSS, SHA1> >("RSA/PSS-MGF1(SHA-1)");
RegisterSymmetricCipherDefaultFactories<SEAL<> >("SEAL-3.0-BE");
RegisterSymmetricCipherDefaultFactories<ECB_Mode<SHACAL2> >("SHACAL-2(ECB)");
RegisterSymmetricCipherDefaultFactories<SEAL<> >();
RegisterSymmetricCipherDefaultFactories<ECB_Mode<SHACAL2> >();
#ifdef WORD64_AVAILABLE
RegisterSymmetricCipherDefaultFactories<ECB_Mode<Camellia> >("Camellia(ECB)");
RegisterSymmetricCipherDefaultFactories<ECB_Mode<Camellia> >();
#endif
RegisterSymmetricCipherDefaultFactories<ECB_Mode<TEA> >("TEA(ECB)");
RegisterSymmetricCipherDefaultFactories<ECB_Mode<XTEA> >("XTEA(ECB)");
RegisterSymmetricCipherDefaultFactories<ECB_Mode<TEA> >();
RegisterSymmetricCipherDefaultFactories<ECB_Mode<XTEA> >();
RegisterSymmetricCipherDefaultFactories<PanamaCipher<LittleEndian> >();
RegisterSymmetricCipherDefaultFactories<PanamaCipher<BigEndian> >();
s_registered = true;
}

View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct Rijndael_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32, 8>
{
CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "Rijndael";}

6
rsa.h
View File

@ -13,7 +13,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
class CRYPTOPP_DLL RSAFunction : public TrapdoorFunction, public X509PublicKey
{
typedef RSAFunction ThisClass;
@ -48,7 +48,7 @@ protected:
Integer m_n, m_e;
};
//! .
//! _
class CRYPTOPP_DLL InvertibleRSAFunction : public RSAFunction, public TrapdoorFunctionInverse, public PKCS8PrivateKey
{
typedef InvertibleRSAFunction ThisClass;
@ -97,7 +97,7 @@ protected:
Integer m_d, m_p, m_q, m_dp, m_dq, m_u;
};
//! .
//! RSA
struct CRYPTOPP_DLL RSA
{
static std::string StaticAlgorithmName() {return "RSA";}

16
rw.h
View File

@ -11,7 +11,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
class RWFunction : virtual public TrapdoorFunction, public PublicKey
{
typedef RWFunction ThisClass;
@ -38,7 +38,7 @@ protected:
Integer m_n;
};
//! .
//! _
class InvertibleRWFunction : public RWFunction, public TrapdoorFunctionInverse, public PrivateKey
{
typedef InvertibleRWFunction ThisClass;
@ -74,7 +74,7 @@ protected:
Integer m_p, m_q, m_u;
};
//! .
//! _
class EMSA2Pad : public EMSA2HashIdLookup<PK_DeterministicSignatureMessageEncodingMethod>
{
public:
@ -88,14 +88,18 @@ public:
byte *representative, unsigned int representativeBitLength) const;
};
//! EMSA2, for use with RW
/*! See pssr.h for a list of hash functions supported by this signature standard. */
//! EMSA2, for use with RWSS
/*! Only the following hash functions are supported by this signature standard:
\dontinclude pssr.h
\skip can be instantiated
\until end of list
*/
struct P1363_EMSA2 : public SignatureStandard
{
typedef EMSA2Pad SignatureMessageEncodingMethod;
};
//! .
//! RW
struct RW
{
static std::string StaticAlgorithmName() {return "RW";}

View File

@ -38,6 +38,7 @@ public:
};
};
//! _
struct SAFER_K_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13>
{
static const char *StaticAlgorithmName() {return "SAFER-K";}
@ -64,6 +65,7 @@ public:
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
};
//! _
struct SAFER_SK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 8, 16, 8>, public VariableRounds<10, 1, 13>
{
static const char *StaticAlgorithmName() {return "SAFER-SK";}

1
seal.h
View File

@ -5,6 +5,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class B = BigEndian>
struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV>
{

View File

@ -16,7 +16,7 @@ inline CipherDir ReverseCipherDir(CipherDir dir)
return (dir == ENCRYPTION) ? DECRYPTION : ENCRYPTION;
}
//! .
//! to be inherited by block ciphers with fixed block size
template <unsigned int N>
class FixedBlockSize
{
@ -26,7 +26,7 @@ public:
// ************** rounds ***************
//! .
//! to be inherited by ciphers with fixed number of rounds
template <unsigned int R>
class FixedRounds
{
@ -45,7 +45,7 @@ protected:
}
};
//! .
//! to be inherited by ciphers with variable number of rounds
template <unsigned int D, unsigned int N=1, unsigned int M=INT_MAX> // use INT_MAX here because enums are treated as signed ints
class VariableRounds
{
@ -72,7 +72,7 @@ protected:
// ************** key length ***************
//! .
//! to be inherited by keyed algorithms with fixed key length
template <unsigned int N, unsigned int IV_REQ = SimpleKeyingInterface::NOT_RESYNCHRONIZABLE>
class FixedKeyLength
{
@ -137,7 +137,7 @@ static inline void CheckedSetKey(T *obj, CipherDir dir, const byte *key, unsigne
obj->UncheckedSetKey(dir, key, length);
}
//! .
//! _
template <class BASE, class INFO = BASE>
class CRYPTOPP_NO_VTABLE SimpleKeyingInterfaceImpl : public BASE
{
@ -153,13 +153,13 @@ protected:
};
template <class INFO, class BASE = BlockCipher>
class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>, public INFO
class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<TwoBases<BASE, INFO> > >
{
public:
unsigned int BlockSize() const {return this->BLOCKSIZE;}
};
//! .
//! _
template <CipherDir DIR, class BASE>
class BlockCipherFinal : public ClonableImpl<BlockCipherFinal<DIR, BASE>, BASE>
{
@ -180,23 +180,18 @@ public:
}
};
//! .
//! _
template <class BASE, class INFO = BASE>
class MessageAuthenticationCodeImpl : public
#ifdef CRYPTOPP_DOXYGEN_PROCESSING
MessageAuthenticationCode
#else
AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
#endif
class MessageAuthenticationCodeImpl : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
{
public:
void SetKey(const byte *key, unsigned int length, const NameValuePairs &param = g_nullNameValuePairs)
void SetKey(const byte *key, unsigned int length, const NameValuePairs &params = g_nullNameValuePairs)
{
CheckedSetKey(this, Empty(), key, length, param);
CheckedSetKey(this, Empty(), key, length, params);
}
};
//! .
//! _
template <class BASE>
class MessageAuthenticationCodeFinal : public ClonableImpl<MessageAuthenticationCodeFinal<BASE>, MessageAuthenticationCodeImpl<BASE> >
{
@ -222,8 +217,10 @@ struct BlockCipherDocumentation
};
/*! \brief Each class derived from this one defines two types, Encryption and Decryption,
both of which implement the SymmetricCipher interface. See CipherModeDocumentation
for information about using block ciphers. */
both of which implement the SymmetricCipher interface. Two types of classes derive
from this class: stream ciphers and block cipher modes. Stream ciphers can be used
alone, cipher mode classes need to be used with a block cipher. See CipherModeDocumentation
for more for information about using cipher modes and block ciphers. */
struct SymmetricCipherDocumentation
{
//! implements the SymmetricCipher interface

View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct Serpent_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 1, 32>, public FixedRounds<32>
{
static const char *StaticAlgorithmName() {return "Serpent";}

View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct SHACAL2_Info : public FixedBlockSize<32>, public VariableKeyLength<16, 16, 64>
{
static const char *StaticAlgorithmName() {return "SHACAL-2";}

View File

@ -13,6 +13,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct SHARK_Info : public FixedBlockSize<8>, public VariableKeyLength<16, 1, 16>, public VariableRounds<6, 2>
{
static const char *StaticAlgorithmName() {return "SHARK-E";}

View File

@ -11,6 +11,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class DERIVED, class BASE>
class CRYPTOPP_NO_VTABLE ClonableImpl : public BASE
{
@ -18,28 +19,30 @@ public:
Clonable * Clone() const {return new DERIVED(*static_cast<const DERIVED *>(this));}
};
template <class BASE, class ALGORITHM_INFO = BASE>
//! _
template <class BASE, class ALGORITHM_INFO=BASE>
class CRYPTOPP_NO_VTABLE AlgorithmImpl : public BASE
{
public:
static std::string StaticAlgorithmName() {return ALGORITHM_INFO::StaticAlgorithmName();}
std::string AlgorithmName() const {return ALGORITHM_INFO::StaticAlgorithmName();}
};
//! .
//! _
class CRYPTOPP_DLL InvalidKeyLength : public InvalidArgument
{
public:
explicit InvalidKeyLength(const std::string &algorithm, unsigned int length) : InvalidArgument(algorithm + ": " + IntToString(length) + " is not a valid key length") {}
};
//! .
//! _
class CRYPTOPP_DLL InvalidRounds : public InvalidArgument
{
public:
explicit InvalidRounds(const std::string &algorithm, unsigned int rounds) : InvalidArgument(algorithm + ": " + IntToString(rounds) + " is not a valid number of rounds") {}
};
//! .
//! _
// TODO: look into this virtual inheritance
class CRYPTOPP_DLL ASN1CryptoMaterial : virtual public ASN1Object, virtual public CryptoMaterial
{
@ -52,6 +55,7 @@ public:
// *****************************
//! _
template <class T>
class CRYPTOPP_NO_VTABLE Bufferless : public T
{
@ -59,6 +63,7 @@ public:
bool IsolatedFlush(bool hardFlush, bool blocking) {return false;}
};
//! _
template <class T>
class CRYPTOPP_NO_VTABLE Unflushable : public T
{
@ -82,6 +87,7 @@ protected:
virtual bool InputBufferIsEmpty() const {return false;}
};
//! _
template <class T>
class CRYPTOPP_NO_VTABLE InputRejecting : public T
{
@ -100,6 +106,7 @@ public:
bool ChannelMessageSeriesEnd(const std::string &, int, bool) {throw InputRejected();}
};
//! _
template <class T>
class CRYPTOPP_NO_VTABLE CustomFlushPropagation : public T
{
@ -110,6 +117,7 @@ private:
bool IsolatedFlush(bool hardFlush, bool blocking) {assert(false); return false;}
};
//! _
template <class T>
class CRYPTOPP_NO_VTABLE CustomSignalPropagation : public CustomFlushPropagation<T>
{
@ -120,6 +128,7 @@ private:
void IsolatedInitialize(const NameValuePairs &parameters) {assert(false);}
};
//! _
template <class T>
class CRYPTOPP_NO_VTABLE Multichannel : public CustomFlushPropagation<T>
{
@ -149,6 +158,7 @@ public:
virtual bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true) =0;
};
//! _
template <class T>
class CRYPTOPP_NO_VTABLE AutoSignaling : public T
{

View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10>
{
CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "SKIPJACK";}

View File

@ -180,7 +180,7 @@ private:
#endif
};
//! .
//! socket-based implementation of NetworkSource
class SocketSource : public NetworkSource, public Socket
{
public:
@ -196,7 +196,7 @@ private:
SocketReceiver m_receiver;
};
//! .
//! socket-based implementation of NetworkSink
class SocketSink : public NetworkSink, public Socket
{
public:

View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct Square_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, FixedRounds<8>
{
static const char *StaticAlgorithmName() {return "Square";}

View File

@ -14,7 +14,7 @@
(since it's an additive cipher, i.e., it xors a keystream into the plaintext).
See this line in seal.h:
typedef SymmetricCipherFinal<ConcretePolicyHolder<SEAL_Policy<B>, AdditiveCipherTemplate<> > > Encryption;
typedef SymmetricCipherFinal\<ConcretePolicyHolder\<SEAL_Policy\<B\>, AdditiveCipherTemplate\<\> \> \> Encryption;
AdditiveCipherTemplate and CFB_CipherTemplate are designed so that they don't need
to take a policy class as a template parameter (although this is allowed), so that
@ -263,6 +263,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS CFB_CipherTemplate<AbstractPolicyHolder<CFB_CipherAb
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_EncryptionTemplate<>;
CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>;
//! _
template <class BASE, class INFO = BASE>
class SymmetricCipherFinal : public AlgorithmImpl<SimpleKeyingInterfaceImpl<BASE, INFO>, INFO>
{

3
tea.h
View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct TEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32>
{
static const char *StaticAlgorithmName() {return "TEA";}
@ -47,6 +48,7 @@ public:
typedef TEA::Encryption TEAEncryption;
typedef TEA::Decryption TEADecryption;
//! _
struct XTEA_Info : public FixedBlockSize<8>, public FixedKeyLength<16>, public VariableRounds<32>
{
static const char *StaticAlgorithmName() {return "XTEA";}
@ -82,6 +84,7 @@ public:
typedef BlockCipherFinal<DECRYPTION, Dec> Decryption;
};
//! _
struct BTEA_Info : public FixedKeyLength<16>
{
static const char *StaticAlgorithmName() {return "BTEA";}

View File

@ -80,9 +80,6 @@ void FIPS140_GenerateRandomFiles();
bool Validate(int, bool, const char *);
void RegisterFactories();
bool RunTestDataFile(const char *filename);
int (*AdhocTest)(int argc, char *argv[]) = NULL;
#ifdef __BCPLUSPLUS__

View File

@ -7,9 +7,8 @@
#include "iterhash.h"
NAMESPACE_BEGIN(CryptoPP)
//! <a href="http://www.eskimo.com/~weidai/scan-mirror/mac.html#Two-Track-MAC">Two-Track-MAC</a>
/*! 160 Bit MAC with 160 Bit Key */
//! _
class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash<word32, LittleEndian, 64, MessageAuthenticationCode>
{
public:
@ -31,7 +30,8 @@ protected:
};
//! <a href="http://www.weidai.com/scan-mirror/mac.html#TTMAC">Two-Track-MAC</a>
typedef MessageAuthenticationCodeFinal<TTMAC_Base> TTMAC;
/*! 160 Bit MAC with 160 Bit Key */
DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal<TTMAC_Base>, TTMAC)
NAMESPACE_END

View File

@ -9,6 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
struct Twofish_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 0, 32>, FixedRounds<16>
{
static const char *StaticAlgorithmName() {return "Twofish";}

View File

@ -13,8 +13,6 @@
#include "tiger.h"
#include "ripemd.h"
#include "haval.h"
#include "panama.h"
#include "whrlpool.h"
#include "xormac.h"
#include "md5mac.h"
@ -377,135 +375,17 @@ bool ValidateHAVAL()
bool ValidatePanama()
{
bool pass=true;
cout << "\nPanama validation suite running...\n";
// the first two test vectors are from the reference implementation
// the rest were generated by Crypto++
HashTestTuple testSet1[] =
{
HashTestTuple("", "\xaa\x0c\xc9\x54\xd7\x57\xd7\xac\x77\x79\xca\x33\x42\x33\x4c\xa4\x71\xab\xd4\x7d\x59\x52\xac\x91\xed\x83\x7e\xcd\x5b\x16\x92\x2b"),
HashTestTuple("The quick brown fox jumps over the lazy dog", "\x5f\x5c\xa3\x55\xb9\x0a\xc6\x22\xb0\xaa\x7e\x65\x4e\xf5\xf2\x7e\x9e\x75\x11\x14\x15\xb4\x8b\x8a\xfe\x3a\xdd\x1c\x6b\x89\xcb\xa1"),
HashTestTuple("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "\xaf\x9c\x66\xfb\x60\x58\xe2\x23\x2a\x5d\xfb\xa0\x63\xee\x14\xb0\xf8\x6f\x0e\x33\x4e\x16\x58\x12\x55\x94\x35\x46\x4d\xd9\xbb\x60", 15625)
};
HashTestTuple testSet2[] =
{
HashTestTuple("", "\xe8\x1a\xa0\x45\x23\x53\x2d\xd7\x26\x7e\x5c\x5b\xc3\xba\x0e\x28\x98\x37\xa6\x2b\xa0\x32\x35\x03\x51\x98\x0e\x96\x0a\x84\xb0\xaf"),
HashTestTuple("The quick brown fox jumps over the lazy dog", "\x8f\xa7\xda\xdc\xe0\x11\x0f\x97\x9a\x0b\x79\x5e\x76\xb2\xc2\x56\x28\xd8\xbd\xa8\x87\x47\x75\x81\x49\xc4\x2e\x3b\xc1\x3f\x85\xbc"),
HashTestTuple("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "\xcb\x34\xf0\x93\x7e\x8d\x87\x0d\x3b\xd7\xff\x63\x11\x76\x5f\x2c\x22\x9a\x6c\x21\x54\xe4\xdb\x11\x95\x38\xdb\x51\x59\x43\x7c\xab", 15625)
};
cout << "\nPanama Hash Function (little endian) validation suite running...\n\n";
PanamaHash<LittleEndian> panamaLE;
pass = HashModuleTest(panamaLE, testSet1, sizeof(testSet1)/sizeof(testSet1[0])) && pass;
cout << "\nPanama Hash Function (big endian) validation suite running...\n\n";
PanamaHash<BigEndian> panamaBE;
pass = HashModuleTest(panamaBE, testSet2, sizeof(testSet2)/sizeof(testSet2[0])) && pass;
// these were generated by Crypto++
unsigned char Key0[] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f};
unsigned char Input0l[] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f};
unsigned char Output0l[] = {
0xF0,0x7F,0x5F,0xF2,0xCC,0xD0,0x1A,0x0A,
0x7D,0x44,0xAC,0xD6,0xD2,0x39,0xC2,0xAF,
0x0D,0xA1,0xFF,0x35,0x27,0x5B,0xAF,0x5D,
0xFA,0x6E,0x09,0x41,0x1B,0x79,0xD8,0xB9};
unsigned char Input0b[] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,
0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f};
unsigned char Output0b[] = {
0xE1,0x2E,0x2F,0x6B,0xA4,0x1A,0xE8,0x32,
0xD8,0x88,0xDA,0x9F,0xA6,0x86,0x3B,0xC3,
0x7C,0x0E,0x99,0x6F,0x19,0x0A,0x17,0x11,
0x33,0x03,0x22,0xD3,0x7B,0xD9,0x8C,0xA4};
// VC60 workaround: auto_ptr lacks reset()
member_ptr<StreamTransformation> cipher;
bool fail;
cout << "\nPanama Cipher (little endian) validation suite running...\n\n";
cipher.reset(new PanamaCipher<LittleEndian>::Encryption(Key0, 64));
cipher->ProcessString(Input0l, sizeof(Input0l));
fail = memcmp(Input0l, Output0l, sizeof(Input0l)) != 0;
cout << (fail ? "FAILED" : "passed") << " Test 0" << endl;
pass = pass && !fail;
cout << "\nPanama Cipher (big endian) validation suite running...\n\n";
cipher.reset(new PanamaCipher<BigEndian>::Encryption(Key0, 64));
cipher->ProcessString(Input0b, sizeof(Input0b));
fail = memcmp(Input0b, Output0b, sizeof(Input0b)) != 0;
cout << (fail ? "FAILED" : "passed") << " Test 0" << endl;
pass = pass && !fail;
return pass;
return RunTestDataFile("TestVectors/panama.txt");
}
bool ValidateWhirlpool()
{
cout << "\nWhirlpool Hash Function validation suite running...\n\n";
cout << "\nWhirlpool Hash Function validation suite running...\n";
#ifdef WORD64_AVAILABLE
// Selected test vectors from the Whirlpool NESSIE submission.
const char Output0[] =
"\x47\x0F\x04\x09\xAB\xAA\x44\x6E\x49\x66\x7D\x4E\xBE\x12\xA1\x43"
"\x87\xCE\xDB\xD1\x0D\xD1\x7B\x82\x43\xCA\xD5\x50\xA0\x89\xDC\x0F"
"\xEE\xA7\xAA\x40\xF6\xC2\xAA\xAB\x71\xC6\xEB\xD0\x76\xE4\x3C\x7C"
"\xFC\xA0\xAD\x32\x56\x78\x97\xDC\xB5\x96\x98\x61\x04\x9A\x0F\x5A";
const char Output1[] =
"\xEB\xAA\x1D\xF2\xE9\x71\x13\xBE\x18\x7E\xB0\x30\x3C\x66\x0F\x6E"
"\x64\x3E\x2C\x09\x0E\xF2\xCD\xA9\xA2\xEA\x6D\xCF\x50\x02\x14\x7D"
"\x1D\x0E\x1E\x9D\x99\x6E\x87\x9C\xEF\x9D\x26\x89\x66\x30\xA5\xDB"
"\x33\x08\xD5\xA0\xDC\x23\x5B\x19\x9C\x38\x92\x3B\xE2\x25\x9E\x03";
const char Output16[] =
"\x40\x23\x8F\x57\xB2\x7D\x07\x4F\x9C\x8D\x04\x3D\xBD\x27\x07\xC7"
"\x18\xFC\x34\x49\xCC\x1F\x49\x0C\xA2\xF3\x24\xDF\xEC\x48\xB0\x5A"
"\xE7\x2D\x02\x6D\x89\x1C\xC0\x80\xE6\x31\x1F\xC3\x2E\xCF\xFC\x30"
"\xF4\x23\xDA\x7E\x63\xE3\x98\x7C\xA0\xCD\x37\xBF\xFD\x97\xCA\x56";
const char Output32[] =
"\x48\xCC\xE9\x1F\x62\xB6\xD9\x35\x13\x38\x30\x1D\xF1\x82\xF4\x6A"
"\xD0\x7B\xB7\xB2\x33\xC1\x19\xCA\x2C\x1F\xC2\x19\xFF\xF9\x49\x85"
"\x8D\x47\xE5\x0D\x69\x18\xEB\xDC\xDF\x5F\x82\x98\x05\xFB\x86\x07"
"\x22\x76\x35\x69\xE6\xAB\x73\x41\x05\x4C\x38\x9C\xE9\xD6\xEB\xAC";
const char Output33[] =
"\x60\x4B\x8B\x59\x15\xA7\xD6\x21\x42\x78\xDF\x08\x13\x53\x1F\xF2"
"\x60\xE1\x46\x51\xEC\xAC\xEC\x57\x6F\x01\xC4\x05\x42\x8F\x8D\x55"
"\x45\xB7\xEA\x6E\x65\x75\x8E\x5E\x83\xA4\x29\xD8\x52\xF4\x8C\x16"
"\x50\x6B\xBF\x00\xB5\x28\x51\x9B\x14\x2A\x77\x45\xF8\x31\x84\xD4";
const char Output64[] =
"\xA0\x72\x51\x3B\x2A\xA9\xE0\x72\x26\xBA\x01\xE7\xD5\xB2\xB6\x26"
"\xE3\x62\xB1\x40\x1E\x1A\xEC\xF1\x68\xB9\x53\x32\x42\xC0\x18\xFF"
"\xEA\x81\x83\x7F\x7B\xD1\x60\xD1\xD0\xA9\x64\x4C\x8E\xD6\x41\x50"
"\xE6\x40\x6D\x2C\x1B\x74\x56\x02\x4F\x10\x98\x53\x90\x81\xFC\x77";
HashTestTuple testSet[] =
{
HashTestTuple("", 0, Output0, 1),
HashTestTuple("\0", 1, Output1, 1),
HashTestTuple("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16, Output16, 1),
HashTestTuple("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16, Output32, 2),
HashTestTuple("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 33, Output33, 1),
HashTestTuple("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16, Output64, 4),
};
Whirlpool whirlpool;
return HashModuleTest(whirlpool, testSet, sizeof(testSet)/sizeof(testSet[0]));
return RunTestDataFile("TestVectors/whrlpool.txt");
#else
cout << "word64 not available, skipping Whirlpool validation." << endl;
return true;

View File

@ -74,5 +74,6 @@ bool ValidateECDSA();
bool ValidateESIGN();
CryptoPP::RandomPool & GlobalRNG();
bool RunTestDataFile(const char *filename);
#endif

24
wake.h
View File

@ -7,12 +7,20 @@
NAMESPACE_BEGIN(CryptoPP)
//! _
template <class B = BigEndian>
struct WAKE_Info : public FixedKeyLength<32>
struct WAKE_CFB_Info : public FixedKeyLength<32>
{
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-CFB-LE" : "WAKE-CFB-BE";}
};
//! _
template <class B = BigEndian>
struct WAKE_OFB_Info : public FixedKeyLength<32>
{
static const char *StaticAlgorithmName() {return B::ToEnum() == LITTLE_ENDIAN_ORDER ? "WAKE-OFB-LE" : "WAKE-OFB-BE";}
};
class CRYPTOPP_NO_VTABLE WAKE_Base
{
protected:
@ -24,8 +32,8 @@ protected:
};
template <class B = BigEndian>
class CRYPTOPP_NO_VTABLE WAKE_Policy : public WAKE_Info<B>
, public CFB_CipherConcretePolicy<word32, 1>
class CRYPTOPP_NO_VTABLE WAKE_Policy
: public CFB_CipherConcretePolicy<word32, 1>
, public AdditiveCipherConcretePolicy<word32, 1, 64>
, protected WAKE_Base
{
@ -41,17 +49,17 @@ protected:
//! <a href="http://www.weidai.com/scan-mirror/cs.html#WAKE-CFB-BE">WAKE-CFB-BE</a>
template <class B = BigEndian>
struct WAKE_CFB : public WAKE_Info<B>, public SymmetricCipherDocumentation
struct WAKE_CFB : public WAKE_CFB_Info<B>, public SymmetricCipherDocumentation
{
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, CFB_EncryptionTemplate<> > > Encryption;
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, CFB_DecryptionTemplate<> > > Decryption;
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, CFB_EncryptionTemplate<> >, WAKE_CFB_Info<B> > Encryption;
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, CFB_DecryptionTemplate<> >, WAKE_CFB_Info<B> > Decryption;
};
//! WAKE-OFB
template <class B = BigEndian>
struct WAKE_OFB : public WAKE_Info<B>, public SymmetricCipherDocumentation
struct WAKE_OFB : public WAKE_OFB_Info<B>, public SymmetricCipherDocumentation
{
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> > > Encryption;
typedef SymmetricCipherFinal<ConcretePolicyHolder<WAKE_Policy<B>, AdditiveCipherTemplate<> >, WAKE_OFB_Info<B> > Encryption;
typedef Encryption Decryption;
};

View File

@ -9,7 +9,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! <a href="http://www.eskimo.com/~weidai/scan-mirror/md.html#Whirlpool">Whirlpool</a>
//! <a href="http://www.weidai.com/scan-mirror/md.html#Whirlpool">Whirlpool</a>
/*! 512 Bit Hash */
class Whirlpool : public IteratedHashWithStaticTransform<word64, BigEndian, 64, 64, Whirlpool>
{

View File

@ -57,7 +57,7 @@ protected:
{assert(result==TRUE || result==FALSE); if (!result) HandleError(operation);}
};
//! .
//! pipe-based implementation of NetworkReceiver
class WindowsPipeReceiver : public WindowsPipe, public NetworkReceiver
{
public:
@ -79,7 +79,7 @@ private:
bool m_eofReceived;
};
//! .
//! pipe-based implementation of NetworkSender
class WindowsPipeSender : public WindowsPipe, public NetworkSender
{
public:

View File

@ -6,7 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
class LowFirstBitWriter : public Filter
{
public:

View File

@ -6,7 +6,7 @@
NAMESPACE_BEGIN(CryptoPP)
//! .
//! _
class LowFirstBitReader
{
public: