From 393ae4859a9d3df3c5aee304b4c65121b657f613 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 22 Jul 2004 00:51:57 +0000 Subject: [PATCH] fix documentation, fix PanamaMAC, fix algorithm names --- 3way.h | 1 + Doxyfile | 556 ++++++++++++++++++++++++++++++++++----------------- Readme.txt | 32 +-- aes.h | 12 +- arc4.h | 16 +- asn.h | 4 +- basecode.h | 3 + blowfish.h | 1 + camellia.h | 1 + cast.h | 4 +- cbcmac.h | 3 +- cryptest.dsp | 6 +- cryptlib.cpp | 1 + cryptlib.dsp | 24 ++- cryptlib.h | 41 ++-- des.h | 4 + dh.h | 8 +- dmac.h | 3 +- ec2n.h | 2 +- eccrypto.h | 13 +- ecp.h | 2 +- esign.h | 6 +- factory.h | 26 ++- files.h | 6 +- filters.h | 18 +- gfpcrypt.h | 30 +-- gost.h | 1 + hmac.h | 1 + hrtimer.h | 1 + idea.h | 1 + iterhash.h | 11 +- lubyrack.h | 2 +- luc.h | 14 +- mars.h | 1 + md5mac.h | 3 +- mdc.h | 1 + misc.h | 9 +- modarith.h | 4 +- modes.h | 15 +- mqv.h | 2 +- oaep.h | 3 +- panama.h | 62 ++++-- pkcspad.h | 31 +-- pssr.h | 3 +- pubkey.h | 124 ++++++------ rabin.h | 10 +- rc2.h | 1 + rc5.h | 1 + rc6.h | 1 + regtest.cpp | 43 ++-- rijndael.h | 1 + rsa.h | 6 +- rw.h | 16 +- safer.h | 2 + seal.h | 1 + seckey.h | 35 ++-- serpent.h | 1 + shacal2.h | 1 + shark.h | 1 + simple.h | 18 +- skipjack.h | 1 + socketft.h | 4 +- square.h | 1 + strciphr.h | 3 +- tea.h | 3 + test.cpp | 3 - ttmac.h | 6 +- twofish.h | 1 + validat3.cpp | 128 +----------- validate.h | 1 + wake.h | 24 ++- whrlpool.h | 2 +- winpipes.h | 4 +- zdeflate.h | 2 +- zinflate.h | 2 +- 75 files changed, 826 insertions(+), 609 deletions(-) diff --git a/3way.h b/3way.h index 6c6a128a..026af1c0 100644 --- a/3way.h +++ b/3way.h @@ -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";} diff --git a/Doxyfile b/Doxyfile index fbe685a5..635f5a07 100644 --- a/Doxyfile +++ b/Doxyfile @@ -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 = diff --git a/Readme.txt b/Readme.txt index fdc0aee2..37fa8b7d 100644 --- a/Readme.txt +++ b/Readme.txt @@ -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 diff --git a/aes.h b/aes.h index 8ec4b8bd..7c825668 100644 --- a/aes.h +++ b/aes.h @@ -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; diff --git a/arc4.h b/arc4.h index 0072a78a..73260394 100644 --- a/arc4.h +++ b/arc4.h @@ -5,9 +5,8 @@ NAMESPACE_BEGIN(CryptoPP) -//! Alleged RC4 -/*! 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; +//! Alleged RC4 +DOCUMENTED_TYPEDEF(SymmetricCipherFinal, 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; +//! Modified ARC4: it discards the first 256 bytes of keystream which may be weaker than the rest +DOCUMENTED_TYPEDEF(SymmetricCipherFinal, MARC4) NAMESPACE_END diff --git a/asn.h b/asn.h index b833d248..28927055 100644 --- a/asn.h +++ b/asn.h @@ -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) diff --git a/basecode.h b/basecode.h index a70e9caa..f252d567 100644 --- a/basecode.h +++ b/basecode.h @@ -7,6 +7,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! base n encoder, where n is a power of 2 class CRYPTOPP_DLL BaseN_Encoder : public Unflushable { 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 { 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 { public: diff --git a/blowfish.h b/blowfish.h index f5f1c0ac..9dae7865 100644 --- a/blowfish.h +++ b/blowfish.h @@ -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";} diff --git a/camellia.h b/camellia.h index 9d902d91..02a18783 100644 --- a/camellia.h +++ b/camellia.h @@ -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";} diff --git a/cast.h b/cast.h index e463bd2c..36c74654 100644 --- a/cast.h +++ b/cast.h @@ -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; }; -//! . +//! algorithm info struct CAST256_Info : public FixedBlockSize<16>, public VariableKeyLength<16, 16, 32> { static const char *StaticAlgorithmName() {return "CAST-256";} diff --git a/cbcmac.h b/cbcmac.h index a05d5c6d..35a48c19 100644 --- a/cbcmac.h +++ b/cbcmac.h @@ -6,6 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE CBC_MAC_Base : public MessageAuthenticationCode { public: @@ -26,7 +27,7 @@ private: }; //! CBC-MAC -/*! 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. */ diff --git a/cryptest.dsp b/cryptest.dsp index acaaef66..9c01f61d 100644 --- a/cryptest.dsp +++ b/cryptest.dsp @@ -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 diff --git a/cryptlib.cpp b/cryptlib.cpp index 8cf68fbb..4f2692fe 100644 --- a/cryptlib.cpp +++ b/cryptlib.cpp @@ -145,6 +145,7 @@ void RandomNumberGenerator::DiscardBytes(unsigned int n) GenerateByte(); } +//! see NullRNG() class ClassNullRNG : public RandomNumberGenerator { public: diff --git a/cryptlib.dsp b/cryptlib.dsp index a3d28efb..e62f09a0 100644 --- a/cryptlib.dsp +++ b/cryptlib.dsp @@ -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 diff --git a/cryptlib.h b/cryptlib.h index 401b50e8..763b5de2 100644 --- a/cryptlib.h +++ b/cryptlib.h @@ -4,20 +4,22 @@ classes that provide a uniform interface to this library. */ -/*! \mainpage Crypto++TM Library 5.2 Reference Manual +/*! \mainpage Crypto++TM Library 5.2.1 Reference Manual
Abstract Base Classes
cryptlib.h
Symmetric Ciphers
SymmetricCipherDocumentation
Hash Functions
- 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
Non-Cryptographic Checksums
CRC32, Adler32
Message Authentication Codes
- #MD5MAC, XMACC, HMAC, CBC_MAC, DMAC, PanamaMAC + #MD5MAC, XMACC, HMAC, CBC_MAC, DMAC, PanamaMAC, TTMAC
Random Number Generators
NullRNG(), LC_RNG, RandomPool, BlockingRng, NonblockingRng, AutoSeededRandomPool, AutoSeededX917RNG +
Password-based Cryptography
+ PasswordBasedKeyDerivationFunction
Public Key Cryptosystems
DLIES, ECIES, LUCES, RSAES, RabinES, LUC_IES
Public Key Signature Schemes
@@ -39,9 +41,9 @@
Filter Wrappers
StreamTransformationFilter, HashFilter, HashVerificationFilter, SignerFilter, SignatureVerificationFilter
Binary to Text Encoders and Decoders
- HexEncoder, HexDecoder, Base64Encoder, Base64Decoder + HexEncoder, HexDecoder, Base64Encoder, Base64Decoder, Base32Encoder, Base32Decoder
Wrappers for OS features
- Timer, Socket, WindowsHandle, ThreadLocalStorage + Timer, Socket, WindowsHandle, ThreadLocalStorage, ThreadUserTimer
FIPS 140 related
fips140.h
@@ -51,19 +53,19 @@ In the FIPS 140-2 validated DLL version of Crypto++, only the following implemen
Block Ciphers
AES, DES_EDE2, DES_EDE3, SKIPJACK
Cipher Modes (replace template parameter BC with one of the block ciphers above)
- ECB_Mode , CTR_Mode , CBC_Mode , CFB_Mode , OFB_Mode + ECB_Mode\, CTR_Mode\, CBC_Mode\, CFB_Mode\, OFB_Mode\
Hash Functions
SHA
Public Key Signature Schemes
- RSASSA , DSA, ECDSA , ECDSA + RSASS\, DSA, ECDSA\, ECDSA\
Message Authentication Codes
- HMAC , CBC_MAC , CBC_MAC + HMAC\, CBC_MAC\, CBC_MAC\
Random Number Generators
- AutoSeededX917RNG + AutoSeededX917RNG\
Key Agreement
#DH
Public Key Cryptosystems
- RSAES > + RSAES\ \>

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 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 BlockCipher; typedef SimpleKeyedTransformation SymmetricCipher; typedef SimpleKeyedTransformation MessageAuthenticationCode; +#endif CRYPTOPP_DLL_TEMPLATE_CLASS SimpleKeyedTransformation; CRYPTOPP_DLL_TEMPLATE_CLASS SimpleKeyedTransformation; CRYPTOPP_DLL_TEMPLATE_CLASS SimpleKeyedTransformation; -#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: diff --git a/des.h b/des.h index e39b1619..9c218af9 100644 --- a/des.h +++ b/des.h @@ -21,6 +21,7 @@ protected: FixedSizeSecBlock 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; }; +//! _ 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; }; +//! _ 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; }; +//! _ struct DES_XEX3_Info : public FixedBlockSize<8>, public FixedKeyLength<24> { static const char *StaticAlgorithmName() {return "DES-XEX3";} diff --git a/dh.h b/dh.h index 86bf6076..fd95a4ad 100644 --- a/dh.h +++ b/dh.h @@ -17,7 +17,7 @@ class DH_Domain : public DL_SimpleKeyAgreementDomainBase KeyAgreementAlgorithm; + typedef DL_KeyAgreementAlgorithm_DH DH_Algorithm; typedef DH_Domain 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 & GetKeyAgreementAlgorithm() const - {return Singleton().Ref();} + {return Singleton().Ref();} DL_GroupParameters & AccessAbstractGroupParameters() {return m_groupParameters;} diff --git a/dmac.h b/dmac.h index f10d34fd..ad30fb11 100644 --- a/dmac.h +++ b/dmac.h @@ -5,6 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template class CRYPTOPP_NO_VTABLE DMAC_Base : public SameKeyLengthAs, 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 DMAC : public MessageAuthenticationCodeFinal > diff --git a/ec2n.h b/ec2n.h index 3cb42460..1c3863a4 100644 --- a/ec2n.h +++ b/ec2n.h @@ -89,7 +89,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation; template class EcPrecomputation; -//! . +//! EC2N precomputation template<> class EcPrecomputation : public DL_GroupPrecomputation { public: diff --git a/eccrypto.h b/eccrypto.h index 3005fafa..b20fa3cd 100644 --- a/eccrypto.h +++ b/eccrypto.h @@ -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; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKeyImpl >; -//! . +//! EC public key template class DL_PublicKey_EC : public DL_PublicKeyImpl > { @@ -163,7 +164,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_PublicKey_EC; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKeyImpl >; -//! . +//! EC private key template class DL_PrivateKey_EC : public DL_PrivateKeyImpl > { @@ -201,7 +202,7 @@ struct ECMQV typedef MQV_Domain, COFACTOR_OPTION> Domain; }; -//! . +//! EC keys template struct DL_Keys_EC { @@ -212,7 +213,7 @@ struct DL_Keys_EC template struct ECDSA; -//! . +//! ECDSA keys template struct DL_Keys_ECDSA { @@ -223,7 +224,7 @@ struct DL_Keys_ECDSA CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; -//! . +//! ECDSA algorithm template class DL_Algorithm_ECDSA : public DL_Algorithm_GDSA { @@ -231,7 +232,7 @@ public: static const char * StaticAlgorithmName() {return "ECDSA";} }; -//! . +//! ECNR algorithm template class DL_Algorithm_ECNR : public DL_Algorithm_NR { diff --git a/ecp.h b/ecp.h index bc7303d1..8ac98e06 100644 --- a/ecp.h +++ b/ecp.h @@ -93,7 +93,7 @@ CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupPrecomputation; template class EcPrecomputation; -//! . +//! ECP precomputation template<> class EcPrecomputation : public DL_GroupPrecomputation { public: diff --git a/esign.h b/esign.h index e930e88c..dd44e0c5 100644 --- a/esign.h +++ b/esign.h @@ -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 EMSA5Pad : public PK_DeterministicSignatureMessageEncodingMethod { diff --git a/factory.h b/factory.h index b9c96e6a..67c97688 100644 --- a/factory.h +++ b/factory.h @@ -6,6 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template class ObjectFactory { @@ -13,6 +14,7 @@ public: virtual AbstractClass * CreateObject() const =0; }; +//! _ template class DefaultObjectFactory : public ObjectFactory { @@ -24,10 +26,17 @@ public: }; +//! _ template 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 *factory) + void RegisterFactory(const std::string &name, ObjectFactory *factory) { m_map[name] = factory; } @@ -51,7 +60,9 @@ public: AbstractClass *CreateObject(const char *name) const { const ObjectFactory *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 & ObjectFactoryRegistry struct RegisterDefaultFactoryFor { -RegisterDefaultFactoryFor(const char *name) +RegisterDefaultFactoryFor(const char *name=NULL) { - ObjectFactoryRegistry::Registry().RegisterFactory(name, new DefaultObjectFactory); + ObjectFactoryRegistry::Registry(). + RegisterFactory(name ? name : ConcreteClass::StaticAlgorithmName(), new DefaultObjectFactory); }}; template -void RegisterAsymmetricCipherDefaultFactories(const char *name, SchemeClass *dummy=NULL) +void RegisterAsymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) { RegisterDefaultFactoryFor((const char *)name); RegisterDefaultFactoryFor((const char *)name); } template -void RegisterSignatureSchemeDefaultFactories(const char *name, SchemeClass *dummy=NULL) +void RegisterSignatureSchemeDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) { RegisterDefaultFactoryFor((const char *)name); RegisterDefaultFactoryFor((const char *)name); } template -void RegisterSymmetricCipherDefaultFactories(const char *name, SchemeClass *dummy=NULL) +void RegisterSymmetricCipherDefaultFactories(const char *name=NULL, SchemeClass *dummy=NULL) { RegisterDefaultFactoryFor((const char *)name); RegisterDefaultFactoryFor((const char *)name); diff --git a/files.h b/files.h index e54d8902..baa57a3e 100644 --- a/files.h +++ b/files.h @@ -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 { 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: diff --git a/filters.h b/filters.h index 8b26d669..1827c90a 100644 --- a/filters.h +++ b/filters.h @@ -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 { 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 { public: @@ -700,7 +700,7 @@ public: : SourceTemplate(attachment) {SourceInitialize(pumpAll, MakeParameters("InputBuffer", ConstByteArrayParameter(string)));} }; -//! . +//! RNG-based implementation of Source interface class CRYPTOPP_DLL RandomNumberSource : public SourceTemplate { public: diff --git a/gfpcrypt.h b/gfpcrypt.h index 206c0bf6..056e2fab 100644 --- a/gfpcrypt.h +++ b/gfpcrypt.h @@ -19,7 +19,7 @@ NAMESPACE_BEGIN(CryptoPP) CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters; -//! . +//! _ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBased : public DL_GroupParameters, 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 CRYPTOPP_NO_VTABLE DL_GroupParameters_IntegerBasedImpl : public DL_GroupParametersImpl { @@ -114,7 +115,7 @@ public: CRYPTOPP_DLL_TEMPLATE_CLASS DL_GroupParameters_IntegerBasedImpl; -//! . +//! GF(p) group parameters class CRYPTOPP_DLL DL_GroupParameters_GFP : public DL_GroupParameters_IntegerBasedImpl { 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 DL_Algorithm_GDSA : public DL_ElgamalLikeSignatureAlgorithm { @@ -178,7 +179,7 @@ public: CRYPTOPP_DLL_TEMPLATE_CLASS DL_Algorithm_GDSA; -//! . +//! NR algorithm template class DL_Algorithm_NR : public DL_ElgamalLikeSignatureAlgorithm { @@ -224,7 +225,7 @@ public: {this->GetPublicElement().DEREncode(bt);} }; -//! . +//! DL private key (in GF(p) groups) template class DL_PrivateKey_GFP : public DL_PrivateKeyImpl { @@ -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 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 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; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_GFP; CRYPTOPP_DLL_TEMPLATE_CLASS DL_PrivateKey_WithSignaturePairwiseConsistencyTest, DSA>; -//! . +//! the XOR encryption method, for use with DL-based cryptosystems template class DL_EncryptionAlgorithm_Xor : public DL_SymmetricEncryptionAlgorithm { @@ -489,7 +491,7 @@ public: } }; -//! . +//! _ template class DL_KeyDerivationAlgorithm_P1363 : public DL_KeyDerivationAlgorithm { diff --git a/gost.h b/gost.h index 2bfe4c00..8b513d37 100644 --- a/gost.h +++ b/gost.h @@ -9,6 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ struct GOST_Info : public FixedBlockSize<8>, public FixedKeyLength<32> { static const char *StaticAlgorithmName() {return "GOST";} diff --git a/hmac.h b/hmac.h index e121e676..64670bac 100644 --- a/hmac.h +++ b/hmac.h @@ -8,6 +8,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE HMAC_Base : public VariableKeyLength<16, 0, UINT_MAX>, public MessageAuthenticationCode { public: diff --git a/hrtimer.h b/hrtimer.h index 4c7402c4..659b7344 100644 --- a/hrtimer.h +++ b/hrtimer.h @@ -5,6 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ class TimerBase { public: diff --git a/idea.h b/idea.h index b33be628..4baa3144 100644 --- a/idea.h +++ b/idea.h @@ -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";} diff --git a/iterhash.h b/iterhash.h index b4e2682a..7e825912 100644 --- a/iterhash.h +++ b/iterhash.h @@ -8,6 +8,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template 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; CRYPTOPP_STATIC_TEMPLATE_CLASS IteratedHashBase; -//! . +//! _ template class CRYPTOPP_NO_VTABLE IteratedHashBase2 : public IteratedHashBase { @@ -68,7 +70,7 @@ protected: virtual void HashEndianCorrectedBlock(const HashWordType *data) =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE IteratedHash : public IteratedHashBase2 { @@ -80,6 +82,7 @@ protected: IteratedHash() {this->SetBlockSize(T_BlockSize);} }; +//! _ template class CRYPTOPP_NO_VTABLE IteratedHashWithStaticTransform : public ClonableImpl, T_Transform> > diff --git a/lubyrack.h b/lubyrack.h index 36b47c9e..c04fd914 100644 --- a/lubyrack.h +++ b/lubyrack.h @@ -12,7 +12,7 @@ NAMESPACE_BEGIN(CryptoPP) template struct DigestSizeDoubleWorkaround {enum {RESULT = 2*T::DIGESTSIZE};}; // VC60 workaround -//! . +//! algorithm info template struct LR_Info : public VariableKeyLength<16, 0, 2*(UINT_MAX/2), 2>, public FixedBlockSize::RESULT> { diff --git a/luc.h b/luc.h index e88d0251..93ab51df 100644 --- a/luc.h +++ b/luc.h @@ -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 { public: @@ -146,7 +146,7 @@ private: Integer m_g; }; -//! . +//! _ class DL_GroupParameters_LUC : public DL_GroupParameters_IntegerBasedImpl { 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 { 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, public VariableKeyLength<16, 16, 56, 4> { static const char *StaticAlgorithmName() {return "MARS";} diff --git a/md5mac.h b/md5mac.h index 92750066..de4d3fc7 100644 --- a/md5mac.h +++ b/md5mac.h @@ -9,7 +9,6 @@ NAMESPACE_BEGIN(CryptoPP) -//! . class CRYPTOPP_NO_VTABLE MD5MAC_Base : public FixedKeyLength<16>, public IteratedHash { public: @@ -32,7 +31,7 @@ protected: }; //! MD5-MAC -typedef MessageAuthenticationCodeFinal MD5MAC; +DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal, MD5MAC) NAMESPACE_END diff --git a/mdc.h b/mdc.h index ce12ca5b..a9bb430c 100644 --- a/mdc.h +++ b/mdc.h @@ -11,6 +11,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template struct MDC_Info : public FixedBlockSize, public FixedKeyLength { diff --git a/misc.h b/misc.h index a3ba0b75..fc020fdb 100644 --- a/misc.h +++ b/misc.h @@ -33,11 +33,13 @@ class CRYPTOPP_DLL Empty { }; +//! _ template class CRYPTOPP_NO_VTABLE TwoBases : public BASE1, public BASE2 { }; +//! _ template 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 , int instance=0> class Singleton { diff --git a/modarith.h b/modarith.h index 365f4c5e..f7cb6be7 100644 --- a/modarith.h +++ b/modarith.h @@ -14,7 +14,8 @@ CRYPTOPP_DLL_TEMPLATE_CLASS AbstractGroup; CRYPTOPP_DLL_TEMPLATE_CLASS AbstractRing; CRYPTOPP_DLL_TEMPLATE_CLASS AbstractEuclideanDomain; -//! . +//! 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 { 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: diff --git a/modes.h b/modes.h index a657eb02..4fe17724 100644 --- a/modes.h +++ b/modes.h @@ -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 ¶ms, 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 CipherModeFinalTemplate_CipherHolder : public ObjectHolder, public BASE +class CipherModeFinalTemplate_CipherHolder : protected ObjectHolder, public AlgorithmImpl > { 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 CipherModeFinalTemplate_ExternalCipher : public BASE { diff --git a/mqv.h b/mqv.h index 3e258863..2683817b 100644 --- a/mqv.h +++ b/mqv.h @@ -8,7 +8,7 @@ NAMESPACE_BEGIN(CryptoPP) -//! . +//! _ template class MQV_Domain : public AuthenticatedKeyAgreementDomain { diff --git a/oaep.h b/oaep.h index cda1a9e2..6b3ef676 100644 --- a/oaep.h +++ b/oaep.h @@ -6,7 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) -//! EME-OAEP, for use with RSAES +//! _ class CRYPTOPP_DLL OAEP_Base : public PK_EncryptionMessageEncodingMethod { public: @@ -21,6 +21,7 @@ protected: virtual MaskGeneratingFunction * NewMGF() const =0; }; +//! EME-OAEP, for use with classes derived from TF_ES template class OAEP : public OAEP_Base, public EncryptionStandard { diff --git a/panama.h b/panama.h index 6bbe9b17..25b64191 100644 --- a/panama.h +++ b/panama.h @@ -33,7 +33,7 @@ public: PanamaHash() {Panama::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::Reset();} @@ -41,47 +41,77 @@ protected: unsigned int HashMultipleBlocks(const word32 *input, unsigned int length); }; -//! . -template -class CRYPTOPP_NO_VTABLE PanamaMAC_Base : public PanamaHash, public VariableKeyLength<32, 0, UINT_MAX>, public MessageAuthenticationCode +//! MAC construction using a hermetic hash function +template +class HermeticHashFunctionMAC : public AlgorithmImpl > >, T_Info> { public: - void UncheckedSetKey(const byte *userKey, unsigned int keylength) + void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms = 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::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 PanamaMAC : public MessageAuthenticationCodeImpl > +class PanamaMAC : public HermeticHashFunctionMAC > { public: PanamaMAC() {} - PanamaMAC(const byte *key, unsigned int length=PanamaMAC_Base::DEFAULT_KEYLENGTH) + PanamaMAC(const byte *key, unsigned int length) {this->SetKey(key, length);} }; -//! . +//! algorithm info template 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 PanamaCipherPolicy : public AdditiveCipherConcretePolicy, public PanamaCipherInfo, diff --git a/pkcspad.h b/pkcspad.h index ed93a934..93bc3f17 100644 --- a/pkcspad.h +++ b/pkcspad.h @@ -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 + //! EMSA-PKCS1-v1_5 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; #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 diff --git a/pssr.h b/pssr.h index 0bdf3156..9e12e90d 100644 --- a/pssr.h +++ b/pssr.h @@ -33,7 +33,7 @@ template 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 EMSA2HashIdLookup : public BASE diff --git a/pubkey.h b/pubkey.h index cf3b0e18..9bd31d3d 100644 --- a/pubkey.h +++ b/pubkey.h @@ -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 CRYPTOPP_NO_VTABLE TF_Base { @@ -134,6 +134,7 @@ protected: // ******************************************************** +//! _ template class CRYPTOPP_NO_VTABLE PK_FixedLengthCryptoSystemImpl : public BASE { @@ -147,7 +148,7 @@ public: virtual unsigned int FixedCiphertextLength() const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE TF_CryptoSystemBase : public PK_FixedLengthCryptoSystemImpl, 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 > { public: DecodingResult Decrypt(RandomNumberGenerator &rng, const byte *ciphertext, unsigned int ciphertextLength, byte *plaintext, const NameValuePairs ¶meters = g_nullNameValuePairs) const; }; -//! . +//! _ class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE TF_EncryptorBase : public TF_CryptoSystemBase > { public: @@ -179,7 +180,7 @@ public: typedef std::pair 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 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 > { 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 > { public: @@ -347,7 +348,7 @@ public: // ******************************************************** -//! . +//! _ template struct TF_CryptoSchemeOptions { @@ -358,14 +359,14 @@ struct TF_CryptoSchemeOptions typedef T3 MessageEncodingMethod; }; -//! . +//! _ template struct TF_SignatureSchemeOptions : public TF_CryptoSchemeOptions { typedef T4 HashFunction; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE PublicKeyCopier { @@ -374,7 +375,7 @@ public: virtual void CopyKeyInto(typename KEYS::PublicKey &key) const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE PrivateKeyCopier { @@ -384,7 +385,7 @@ public: virtual void CopyKeyInto(typename KEYS::PrivateKey &key) const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE TF_ObjectImplBase : public AlgorithmImpl { @@ -433,7 +434,7 @@ protected: } }; -//! . +//! _ template class TF_ObjectImplExtRef : public TF_ObjectImplBase { @@ -448,7 +449,7 @@ private: const KEY * m_pKey; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE TF_ObjectImpl : public TF_ObjectImplBase, SCHEME_OPTIONS, typename KEY_COPIER::KeyClass> { @@ -465,25 +466,25 @@ private: KeyClass m_trapdoorFunction; }; -//! . +//! _ template class TF_DecryptorImpl : public TF_ObjectImpl > { }; -//! . +//! _ template class TF_EncryptorImpl : public TF_ObjectImpl > { }; -//! . +//! _ template class TF_SignerImpl : public TF_ObjectImpl > { }; -//! . +//! _ template class TF_VerifierImpl : public TF_ObjectImpl > { @@ -491,6 +492,7 @@ class TF_VerifierImpl : public TF_ObjectImpl 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 CRYPTOPP_NO_VTABLE DL_GroupParameters : public CryptoParameters { @@ -626,7 +628,7 @@ private: mutable unsigned int m_validationLevel; }; -//! . +//! _ template , class BASE = DL_GroupParameters > class DL_GroupParametersImpl : public BASE { @@ -644,7 +646,7 @@ protected: BASE_PRECOMP m_gpc; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_Key { @@ -653,7 +655,7 @@ public: virtual DL_GroupParameters & AccessAbstractGroupParameters() =0; }; -//! . +//! interface for DL public keys template class CRYPTOPP_NO_VTABLE DL_PublicKey : public DL_Key { @@ -688,7 +690,7 @@ public: virtual DL_FixedBasePrecomputation & AccessPublicPrecomputation() =0; }; -//! . +//! interface for DL private keys template class CRYPTOPP_NO_VTABLE DL_PrivateKey : public DL_Key { @@ -736,7 +738,7 @@ void DL_PublicKey::AssignFrom(const NameValuePairs &source) class OID; -//! . +//! _ template class DL_KeyImpl : public PK { @@ -763,7 +765,7 @@ private: class X509PublicKey; class PKCS8PrivateKey; -//! . +//! _ template class DL_PrivateKeyImpl : public DL_PrivateKey, public DL_KeyImpl { @@ -834,7 +836,7 @@ private: Integer m_x; }; -//! . +//! _ template class DL_PrivateKey_WithSignaturePairwiseConsistencyTest : public BASE { @@ -852,7 +854,7 @@ public: } }; -//! . +//! _ template class DL_PublicKeyImpl : public DL_PublicKey, public DL_KeyImpl { @@ -913,7 +915,7 @@ private: typename GP::BasePrecomputation m_ypc; }; -//! . +//! interface for Elgamal-like signature algorithms template class CRYPTOPP_NO_VTABLE DL_ElgamalLikeSignatureAlgorithm { @@ -928,7 +930,7 @@ public: {return params.GetSubgroupOrder().ByteCount();} }; -//! . +//! interface for DL key agreement algorithms template class CRYPTOPP_NO_VTABLE DL_KeyAgreementAlgorithm { @@ -939,7 +941,7 @@ public: virtual Element AgreeWithStaticPrivateKey(const DL_GroupParameters ¶ms, const Element &publicElement, bool validateOtherPublicKey, const Integer &privateExponent) const =0; }; -//! . +//! interface for key derivation algorithms used in DL cryptosystems template class CRYPTOPP_NO_VTABLE DL_KeyDerivationAlgorithm { @@ -948,7 +950,7 @@ public: virtual void Derive(const DL_GroupParameters &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 ¶meters) const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_Base { @@ -975,7 +977,7 @@ protected: virtual const KeyInterface & GetKeyInterface() const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_SignatureSchemeBase : public INTERFACE, public DL_Base { @@ -1007,7 +1009,7 @@ protected: virtual unsigned int GetDigestSize() const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_SignerBase : public DL_SignatureSchemeBase > { @@ -1080,7 +1082,7 @@ protected: } }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_VerifierBase : public DL_SignatureSchemeBase > { @@ -1148,7 +1150,7 @@ public: } }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_CryptoSystemBase : public PK, public DL_Base { @@ -1176,7 +1178,7 @@ protected: virtual const DL_SymmetricEncryptionAlgorithm & GetSymmetricEncryptionAlgorithm() const =0; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_DecryptorBase : public DL_CryptoSystemBase > { @@ -1212,7 +1214,7 @@ public: } }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_EncryptorBase : public DL_CryptoSystemBase > { @@ -1242,7 +1244,7 @@ public: } }; -//! . +//! _ template struct DL_SchemeOptionsBase { @@ -1251,7 +1253,7 @@ struct DL_SchemeOptionsBase typedef typename GroupParameters::Element Element; }; -//! . +//! _ template struct DL_KeyedSchemeOptions : public DL_SchemeOptionsBase { @@ -1260,7 +1262,7 @@ struct DL_KeyedSchemeOptions : public DL_SchemeOptionsBase struct DL_SignatureSchemeOptions : public DL_KeyedSchemeOptions { @@ -1269,7 +1271,7 @@ struct DL_SignatureSchemeOptions : public DL_KeyedSchemeOptions typedef T5 HashFunction; }; -//! . +//! _ template struct DL_CryptoSchemeOptions : public DL_KeyedSchemeOptions { @@ -1278,7 +1280,7 @@ struct DL_CryptoSchemeOptions : public DL_KeyedSchemeOptions typedef T5 SymmetricEncryptionAlgorithm; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_ObjectImplBase : public AlgorithmImpl { @@ -1313,7 +1315,7 @@ private: KEY m_key; }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_ObjectImpl : public DL_ObjectImplBase { @@ -1335,7 +1337,7 @@ protected: {return Singleton().Ref();} }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_PublicObjectImpl : public DL_ObjectImpl, public PublicKeyCopier { @@ -1344,7 +1346,7 @@ public: {key = this->GetKey();} }; -//! . +//! _ template class CRYPTOPP_NO_VTABLE DL_PrivateObjectImpl : public DL_ObjectImpl, public PrivateKeyCopier { @@ -1355,7 +1357,7 @@ public: {key = this->GetKey();} }; -//! . +//! _ template class DL_SignerImpl : public DL_PrivateObjectImpl, SCHEME_OPTIONS> { @@ -1368,7 +1370,7 @@ public: } }; -//! . +//! _ template class DL_VerifierImpl : public DL_PublicObjectImpl, SCHEME_OPTIONS> { @@ -1379,13 +1381,13 @@ public: } }; -//! . +//! _ template class DL_EncryptorImpl : public DL_PublicObjectImpl, SCHEME_OPTIONS> { }; -//! . +//! _ template class DL_DecryptorImpl : public DL_PrivateObjectImpl, SCHEME_OPTIONS> { @@ -1393,7 +1395,7 @@ class DL_DecryptorImpl : public DL_PrivateObjectImpl 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 ¶ms, const DL_FixedBasePrecomputation &publicPrecomputation, const Integer &privateExponent) const { diff --git a/rabin.h b/rabin.h index f3212715..7e74025d 100644 --- a/rabin.h +++ b/rabin.h @@ -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 struct RabinES : public TF_ES { }; -//! . +//! Rabin signature template struct RabinSS : public TF_SS { diff --git a/rc2.h b/rc2.h index 20b5ac1b..241c0936 100644 --- a/rc2.h +++ b/rc2.h @@ -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}; diff --git a/rc5.h b/rc5.h index d594dc70..5dcc1aaf 100644 --- a/rc5.h +++ b/rc5.h @@ -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";} diff --git a/rc6.h b/rc6.h index 3037765d..2059a0ce 100644 --- a/rc6.h +++ b/rc6.h @@ -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";} diff --git a/regtest.cpp b/regtest.cpp index 5fce9606..f91bb670 100644 --- a/regtest.cpp +++ b/regtest.cpp @@ -16,23 +16,32 @@ #include "camellia.h" #include "shacal2.h" #include "tea.h" +#include "panama.h" USING_NAMESPACE(CryptoPP) void RegisterFactories() { - RegisterDefaultFactoryFor("DH"); - RegisterDefaultFactoryFor("SHA-1"); - RegisterDefaultFactoryFor("SHA-256"); + static bool s_registered = false; + if (s_registered) + return; + + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); #ifdef WORD64_AVAILABLE - RegisterDefaultFactoryFor("SHA-384"); - RegisterDefaultFactoryFor("SHA-512"); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor(); #endif - RegisterDefaultFactoryFor("Whirlpool"); - RegisterDefaultFactoryFor >("HMAC(MD5)"); - RegisterDefaultFactoryFor >("HMAC(SHA-1)"); - RegisterDefaultFactoryFor >("HMAC(RIPEMD-160)"); - RegisterDefaultFactoryFor("Two-Track-MAC"); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor(); + RegisterDefaultFactoryFor >(); + RegisterDefaultFactoryFor >(); RegisterAsymmetricCipherDefaultFactories > >("RSA/OAEP-MGF1(SHA-1)"); RegisterAsymmetricCipherDefaultFactories >("DLIES(NoCofactorMultiplication, KDF2(SHA-1), XOR, HMAC(SHA-1), DHAES)"); RegisterSignatureSchemeDefaultFactories("DSA(1363)"); @@ -43,11 +52,15 @@ void RegisterFactories() RegisterSignatureSchemeDefaultFactories >("ESIGN/EMSA5-MGF1(SHA-1)"); RegisterSignatureSchemeDefaultFactories >("RW/EMSA2(SHA-1)"); RegisterSignatureSchemeDefaultFactories >("RSA/PSS-MGF1(SHA-1)"); - RegisterSymmetricCipherDefaultFactories >("SEAL-3.0-BE"); - RegisterSymmetricCipherDefaultFactories >("SHACAL-2(ECB)"); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); #ifdef WORD64_AVAILABLE - RegisterSymmetricCipherDefaultFactories >("Camellia(ECB)"); + RegisterSymmetricCipherDefaultFactories >(); #endif - RegisterSymmetricCipherDefaultFactories >("TEA(ECB)"); - RegisterSymmetricCipherDefaultFactories >("XTEA(ECB)"); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + RegisterSymmetricCipherDefaultFactories >(); + + s_registered = true; } diff --git a/rijndael.h b/rijndael.h index efa788a3..a32a5642 100644 --- a/rijndael.h +++ b/rijndael.h @@ -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";} diff --git a/rsa.h b/rsa.h index 903d69ab..ec09b0d9 100644 --- a/rsa.h +++ b/rsa.h @@ -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";} diff --git a/rw.h b/rw.h index f341d5f6..5ba75f88 100644 --- a/rw.h +++ b/rw.h @@ -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 { 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";} diff --git a/safer.h b/safer.h index d9a477cf..f551b4fd 100644 --- a/safer.h +++ b/safer.h @@ -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; }; +//! _ 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";} diff --git a/seal.h b/seal.h index 9157720a..aab793d3 100644 --- a/seal.h +++ b/seal.h @@ -5,6 +5,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template struct SEAL_Info : public FixedKeyLength<20, SimpleKeyingInterface::INTERNALLY_GENERATED_IV> { diff --git a/seckey.h b/seckey.h index aa315a3b..7fcfe863 100644 --- a/seckey.h +++ b/seckey.h @@ -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 class FixedBlockSize { @@ -26,7 +26,7 @@ public: // ************** rounds *************** -//! . +//! to be inherited by ciphers with fixed number of rounds template class FixedRounds { @@ -45,7 +45,7 @@ protected: } }; -//! . +//! to be inherited by ciphers with variable number of rounds template // 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 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 CRYPTOPP_NO_VTABLE SimpleKeyingInterfaceImpl : public BASE { @@ -153,13 +153,13 @@ protected: }; template -class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl, INFO>, public INFO +class CRYPTOPP_NO_VTABLE BlockCipherImpl : public AlgorithmImpl > > { public: unsigned int BlockSize() const {return this->BLOCKSIZE;} }; -//! . +//! _ template class BlockCipherFinal : public ClonableImpl, BASE> { @@ -180,23 +180,18 @@ public: } }; -//! . +//! _ template -class MessageAuthenticationCodeImpl : public -#ifdef CRYPTOPP_DOXYGEN_PROCESSING - MessageAuthenticationCode -#else - AlgorithmImpl, INFO> -#endif +class MessageAuthenticationCodeImpl : public AlgorithmImpl, INFO> { public: - void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶m = g_nullNameValuePairs) + void SetKey(const byte *key, unsigned int length, const NameValuePairs ¶ms = g_nullNameValuePairs) { - CheckedSetKey(this, Empty(), key, length, param); + CheckedSetKey(this, Empty(), key, length, params); } }; -//! . +//! _ template class MessageAuthenticationCodeFinal : public ClonableImpl, MessageAuthenticationCodeImpl > { @@ -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 diff --git a/serpent.h b/serpent.h index 0d245114..c24d2025 100644 --- a/serpent.h +++ b/serpent.h @@ -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";} diff --git a/shacal2.h b/shacal2.h index 554c925a..552dafca 100644 --- a/shacal2.h +++ b/shacal2.h @@ -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";} diff --git a/shark.h b/shark.h index 513eb897..ec483f8a 100644 --- a/shark.h +++ b/shark.h @@ -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";} diff --git a/simple.h b/simple.h index 0c0adc44..7ab21340 100644 --- a/simple.h +++ b/simple.h @@ -11,6 +11,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template class CRYPTOPP_NO_VTABLE ClonableImpl : public BASE { @@ -18,28 +19,30 @@ public: Clonable * Clone() const {return new DERIVED(*static_cast(this));} }; -template +//! _ +template 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 CRYPTOPP_NO_VTABLE Bufferless : public T { @@ -59,6 +63,7 @@ public: bool IsolatedFlush(bool hardFlush, bool blocking) {return false;} }; +//! _ template class CRYPTOPP_NO_VTABLE Unflushable : public T { @@ -82,6 +87,7 @@ protected: virtual bool InputBufferIsEmpty() const {return false;} }; +//! _ template class CRYPTOPP_NO_VTABLE InputRejecting : public T { @@ -100,6 +106,7 @@ public: bool ChannelMessageSeriesEnd(const std::string &, int, bool) {throw InputRejected();} }; +//! _ template class CRYPTOPP_NO_VTABLE CustomFlushPropagation : public T { @@ -110,6 +117,7 @@ private: bool IsolatedFlush(bool hardFlush, bool blocking) {assert(false); return false;} }; +//! _ template class CRYPTOPP_NO_VTABLE CustomSignalPropagation : public CustomFlushPropagation { @@ -120,6 +128,7 @@ private: void IsolatedInitialize(const NameValuePairs ¶meters) {assert(false);} }; +//! _ template class CRYPTOPP_NO_VTABLE Multichannel : public CustomFlushPropagation { @@ -149,6 +158,7 @@ public: virtual bool ChannelFlush(const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true) =0; }; +//! _ template class CRYPTOPP_NO_VTABLE AutoSignaling : public T { diff --git a/skipjack.h b/skipjack.h index fbec2df1..e463dd9b 100644 --- a/skipjack.h +++ b/skipjack.h @@ -9,6 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ struct SKIPJACK_Info : public FixedBlockSize<8>, public FixedKeyLength<10> { CRYPTOPP_DLL static const char * StaticAlgorithmName() {return "SKIPJACK";} diff --git a/socketft.h b/socketft.h index 96f54124..a51fb7be 100644 --- a/socketft.h +++ b/socketft.h @@ -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: diff --git a/square.h b/square.h index 8746059a..a1da1cf5 100644 --- a/square.h +++ b/square.h @@ -9,6 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ struct Square_Info : public FixedBlockSize<16>, public FixedKeyLength<16>, FixedRounds<8> { static const char *StaticAlgorithmName() {return "Square";} diff --git a/strciphr.h b/strciphr.h index 4cc4f15e..4fb1808a 100644 --- a/strciphr.h +++ b/strciphr.h @@ -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, AdditiveCipherTemplate<> > > Encryption; + typedef SymmetricCipherFinal\, 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; CRYPTOPP_DLL_TEMPLATE_CLASS CFB_DecryptionTemplate<>; +//! _ template class SymmetricCipherFinal : public AlgorithmImpl, INFO> { diff --git a/tea.h b/tea.h index 6dd8592b..dc1f2153 100644 --- a/tea.h +++ b/tea.h @@ -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; }; +//! _ struct BTEA_Info : public FixedKeyLength<16> { static const char *StaticAlgorithmName() {return "BTEA";} diff --git a/test.cpp b/test.cpp index fcb7b250..6e603265 100644 --- a/test.cpp +++ b/test.cpp @@ -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__ diff --git a/ttmac.h b/ttmac.h index 9065b65d..8555fbb9 100644 --- a/ttmac.h +++ b/ttmac.h @@ -7,9 +7,8 @@ #include "iterhash.h" NAMESPACE_BEGIN(CryptoPP) -//! Two-Track-MAC -/*! 160 Bit MAC with 160 Bit Key */ +//! _ class CRYPTOPP_NO_VTABLE TTMAC_Base : public FixedKeyLength<20>, public IteratedHash { public: @@ -31,7 +30,8 @@ protected: }; //! Two-Track-MAC -typedef MessageAuthenticationCodeFinal TTMAC; +/*! 160 Bit MAC with 160 Bit Key */ +DOCUMENTED_TYPEDEF(MessageAuthenticationCodeFinal, TTMAC) NAMESPACE_END diff --git a/twofish.h b/twofish.h index cd2c2a68..2ba283da 100644 --- a/twofish.h +++ b/twofish.h @@ -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";} diff --git a/validat3.cpp b/validat3.cpp index 2e538cb4..dc92398c 100644 --- a/validat3.cpp +++ b/validat3.cpp @@ -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 panamaLE; - pass = HashModuleTest(panamaLE, testSet1, sizeof(testSet1)/sizeof(testSet1[0])) && pass; - - cout << "\nPanama Hash Function (big endian) validation suite running...\n\n"; - PanamaHash 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 cipher; - bool fail; - - cout << "\nPanama Cipher (little endian) validation suite running...\n\n"; - - cipher.reset(new PanamaCipher::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::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; diff --git a/validate.h b/validate.h index 4790f1ac..f77c67bc 100644 --- a/validate.h +++ b/validate.h @@ -74,5 +74,6 @@ bool ValidateECDSA(); bool ValidateESIGN(); CryptoPP::RandomPool & GlobalRNG(); +bool RunTestDataFile(const char *filename); #endif diff --git a/wake.h b/wake.h index d6b15765..56a266dd 100644 --- a/wake.h +++ b/wake.h @@ -7,12 +7,20 @@ NAMESPACE_BEGIN(CryptoPP) +//! _ template -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 +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 CRYPTOPP_NO_VTABLE WAKE_Policy : public WAKE_Info - , public CFB_CipherConcretePolicy +class CRYPTOPP_NO_VTABLE WAKE_Policy + : public CFB_CipherConcretePolicy , public AdditiveCipherConcretePolicy , protected WAKE_Base { @@ -41,17 +49,17 @@ protected: //! WAKE-CFB-BE template -struct WAKE_CFB : public WAKE_Info, public SymmetricCipherDocumentation +struct WAKE_CFB : public WAKE_CFB_Info, public SymmetricCipherDocumentation { - typedef SymmetricCipherFinal, CFB_EncryptionTemplate<> > > Encryption; - typedef SymmetricCipherFinal, CFB_DecryptionTemplate<> > > Decryption; + typedef SymmetricCipherFinal, CFB_EncryptionTemplate<> >, WAKE_CFB_Info > Encryption; + typedef SymmetricCipherFinal, CFB_DecryptionTemplate<> >, WAKE_CFB_Info > Decryption; }; //! WAKE-OFB template -struct WAKE_OFB : public WAKE_Info, public SymmetricCipherDocumentation +struct WAKE_OFB : public WAKE_OFB_Info, public SymmetricCipherDocumentation { - typedef SymmetricCipherFinal, AdditiveCipherTemplate<> > > Encryption; + typedef SymmetricCipherFinal, AdditiveCipherTemplate<> >, WAKE_OFB_Info > Encryption; typedef Encryption Decryption; }; diff --git a/whrlpool.h b/whrlpool.h index fbec1b64..108bfd6c 100644 --- a/whrlpool.h +++ b/whrlpool.h @@ -9,7 +9,7 @@ NAMESPACE_BEGIN(CryptoPP) -//! Whirlpool +//! Whirlpool /*! 512 Bit Hash */ class Whirlpool : public IteratedHashWithStaticTransform { diff --git a/winpipes.h b/winpipes.h index a02005b9..78eee6af 100644 --- a/winpipes.h +++ b/winpipes.h @@ -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: diff --git a/zdeflate.h b/zdeflate.h index 03fcbaca..e53a3df6 100644 --- a/zdeflate.h +++ b/zdeflate.h @@ -6,7 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) -//! . +//! _ class LowFirstBitWriter : public Filter { public: diff --git a/zinflate.h b/zinflate.h index 9aa112b4..1b3f1423 100644 --- a/zinflate.h +++ b/zinflate.h @@ -6,7 +6,7 @@ NAMESPACE_BEGIN(CryptoPP) -//! . +//! _ class LowFirstBitReader { public: