SILC Crypto Toolkit 1.2 Beta1 1.2.beta1
authorPekka Riikonen <priikone@silcnet.org>
Sun, 9 Mar 2008 18:51:52 +0000 (20:51 +0200)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 9 Mar 2008 18:51:52 +0000 (20:51 +0200)
32 files changed:
README
TODO
configure.ad
distdir/pre-dist-crypto
doc/crypto.in/building.html [new file with mode: 0644]
doc/crypto.in/crypto.css [new file with mode: 0644]
doc/crypto.in/crypto.rc [new file with mode: 0644]
doc/crypto.in/footer [new file with mode: 0644]
doc/crypto.in/header [new file with mode: 0644]
doc/crypto.in/index.html.in [new file with mode: 0644]
doc/crypto.in/intro.html [new file with mode: 0644]
doc/crypto.in/manual.html.in [new file with mode: 0644]
doc/crypto.in/platforms.html [new file with mode: 0644]
lib/Makefile.ad
lib/silcacc/silcacc.c
lib/silcacc/silcacc.h
lib/silcacc/softacc.c
lib/silcacc/softacc.h
lib/silcasn1/silcber.h
lib/silccrypt/silccipher.h
lib/silccrypt/silccrypto.h.in
lib/silccrypt/silchash.h
lib/silccrypt/silcmac.h
lib/silccrypt/silcpk.h
lib/silccrypt/silcpkcs.h
lib/silccrypt/silcpkcs1.h
lib/silccrypt/silcrng.h
lib/silcmath/silcmath.h
lib/silcmath/silcmp.h
lib/silcskr/silcskr.c
lib/silcskr/silcskr.h
lib/silcssh/silcssh.h

diff --git a/README b/README
index 4ed2fba46b2cbae88c5fb6a5382ed14b85d04192..a6121ea33cbe31bdd08a42ea2d70b03689d5a695 100644 (file)
--- a/README
+++ b/README
@@ -1,119 +1,5 @@
-SILC - Secure Internet Live Conferencing
-========================================
-
-SILC (Secure Internet Live Conferencing) is a protocol which provides
-secure conferencing services on the Internet over insecure channel.
-SILC is IRC-like software although internally they are very different.
-The biggest similarity between SILC and IRC is that they both provide
-conferencing services and that SILC has almost the same commands as IRC.  
-Other than that they are nothing alike.  Major differences are that SILC 
-is secure what IRC is not in any way.  The network model is also entirely
-different compared to IRC.
-
-
-Running SILC
-============
-
-After installing the SILC to the system the SILC client is started by
-giving command:
-
-       silc
-
-If you want to run with specific configuration file give -f option.
-
-To run the server you should configure the server first.  To run the
-server give the command:
-
-       silcd
-
-This will launch the server on to the background.
-
-
-Features
-========
-
-Features to be included into the final release of SILC.  [Note that the
-current Developer's Version does not include all of these features, read
-TODO file for more information.]
-
- o Normal conferencing services such as private messages, channels,
-   channel messages, etc.  All traffic is secured and authenticated.
-
- o No unique nicknames.  There can same nicknames in SILC without
-   collisions.  SILC has unique Client ID's, Server ID's and Channel ID's
-   to assure that there are no collisions.
-
- o Secure key exchange and authentication protocol.  SILC Key Exchange
-   protocol provides key material used in the SILC sessions in secure
-   manner.  The protocol is immune for example to man-in-the-middle 
-   attacks.  The SILC Authentication protocol provides strong 
-   authentication.  Authentication may be based on passphrase or public
-   key (RSA) authentication.  For clients there is an option not to
-   use authentication when connecting to servers.
-
- o All traffic is encrypted and authenticated using the best cryptographic
-   algorithms out there.  Command messages, private messages and channel
-   messages are all protected by encryption.  User can set private keys
-   for both private message and for channels so that even SILC servers do
-   not know the keys.  Cipher keys are, by default, 128 bits in length and
-   public keys, by default, 1024 bits in length.
-
- o Supports data compression with GZIP to improve performance.
-
- o Supports SOCKS4 and SOCKS5 firewall traversal protocols.
-
- o SIM (SILC Module) support.  Support for loading of shared objects at 
-   run-time that provides new and extended features to both SILC client
-   and server.  These can provide extra ciphers and extra features to
-   the software.
-
- o SILC client can be installed and used without root privileges.
-
- o SILC client can be configured by system wide configuration files but
-   with user specific configuration files as well.
-
-
-History
-=======
-
-SILC was released in the summer 2000 to the public, but the idea and the
-protocol itself is quite old. The SILC was designed by Pekka Riikonen in
-the year 1996 and first lines of codes were written in the early 1997. The
-SILC has been rewritten three times since its very first version in 1997.
-The first version included SILC client, very preliminary SILC server, RSA
-implementation and 3DES implementation. The server actually was not usable
-but the client looked pretty much the same as the first client released in
-the summer 2000. The first version had also random number generator which
-were based on the SSH's random number generator. The current RNG is based
-on the first RNG but has been rewritten twice since the first version. 
-
-The development of SILC was suspended in 1997 when Pekka got busy at
-school and in work. The pause laster several months. The development
-resumed in 1998 when Juha Räsänen and Pekka implemented the ElGamal
-algorithm. However, for the same reasons as previously the development
-stopped again, and was resumed again later in 1998 by doing rewrite of
-ther SILC in C++. This was obviously a mistake but at that time it seemed
-like a good idea. Again, in the winter 1999 the development suspended when
-Pekka got busy writing his thesis and was forced to stop the development. 
-
-Later, in 1999, it was decided that this time SILC will be rewritten from
-scratch in the right way. C++ was obviously a bad choice so plain C 
-language was selected again. The protocol itself faced some rework by
-redesigning some core parts of the protocol. The protocol was also fully
-documented and the protocol specifications were submitted to the IETF. The
-result of this development effort is the release now in public. Since the
-release in the summer 2000 several other people have contributed to the
-project as well. And, the development continues. 
-
-
-Contact
-=======
-
-Feedback and comments are welcome.  Bug reports should be sent to the
-development mailing list.
-
-Official SILC project web site      : http://silcnet.org/
-FTP archive for SILC project        : ftp://ftp.silcnet.org/
-Development mailing list address    : silc-devel@lists.silcnet.org
-SILC Server                         : /server silc.silcnet.org
+SILC Crypto Toolkit
+===================
 
+The SILC Crypto Toolkit (SCT) is a high performance multipurpose cryptographic
+toolkit.
diff --git a/TODO b/TODO
index f9600f6b31de97cb937e0c40371cad53f3a26575..81a3dcb857ada66d4770c2b130e800c49d96add5 100644 (file)
--- a/TODO
+++ b/TODO
@@ -29,6 +29,8 @@ Crypto Library, lib/silccrypt/
 
  o Global RNG must be changed to use SILC Global API.
 
+ o Global cipher, hash, mac, and pkcs tables must use SILC Global API.
+
  o Add FIPS compliant RNG.
 
  o Implement the defined SilcDH API.  The definition is in
@@ -36,12 +38,16 @@ Crypto Library, lib/silccrypt/
    be accelerated.  Also take into account that it could use elliptic
    curves.
 
+ o Add Elgamal.
+
  o Add ECDSA support.
 
  o Add ECDH support.
 
  o Add PKCS#1 RSAES-OAEP and RSASSA-PSS.
 
+ o Add GCM mode.
+
  o Do GCC vs ICC benchmarks of all key algorithms.
 
  o Add DSA support to SILC public key.
@@ -105,32 +111,16 @@ SKR Library, lib/silcskr/
    file.  Add support for exporting the repository (different formats for
    different key types?).
 
- o Change the entire silc_skr_find API.  Remove SilcSKRFind and just simply
-   add the find constraints as variable argument list to silc_skr_find, eg:
-
-  silc_skr_find(skr, schedule, callback, context,
-               SILC_SKR_FIND_PUBLIC_KEY, public_key,
-               SILC_SKR_FIND_COUNTRY, "FI",
-               SILC_SKR_FIND_USAGE, SILC_SKR_USAGE_AUTH,
-               SILC_SKR_FIND_END);
-
-   NULL argument would be ignored and skipped.
+ o Add find rule AND and OR.  The default is always AND.  Add
+   silc_skr_find_set_rule.
 
- o Add OR logical rule in addition of the current default AND, eg:
+ o Add silc_skr_find_add_search_file that can be used to add a file to
+   search for the public keys.  More than one can be set.  Add support
+   for searching keys from file.
 
-  // Found key(s) MUST have this public key AND this country.
-  silc_skr_find(skr, schedule, callback, context,
-               SILC_SKR_FIND_RULE_AND,
-               SILC_SKR_FIND_PUBLIC_KEY, public_key,
-               SILC_SKR_FIND_COUNTRY, "FI",
-               SILC_SKR_FIND_END);
-
-  // Found key(s) MUST have this public key OR this key context
-  silc_skr_find(skr, schedule, callback, context,
-               SILC_SKR_FIND_RULE_OR,
-               SILC_SKR_FIND_PUBLIC_KEY, public_key,
-               SILC_SKR_FIND_CONTEXT, key_context,
-               SILC_SKR_FIND_END);
+ o Add silc_skr_find_add_search_dir that can be used to add a directory to
+   search for the public keys.  More than one can be set.  Add support
+   for seraching keys from directory.
 
  o SilcStack to SKR API.
 
@@ -138,6 +128,8 @@ SKR Library, lib/silcskr/
 SILC Accelerator Library
 ========================
 
+ o Diffie-Hellman acceleration to SILC Accelerator API.
+
  o Diffie-Hellman software acceleration.
 
  o Hardware acceleration through OCF (OCF-Linux,
@@ -146,6 +138,10 @@ SILC Accelerator Library
  o VIA Padlock support. See http://www.logix.cz/michal/devel/padlock/ and
    Gladman's code.
 
+ o Implement GCM software acceleration.
+
+ o Add hash function acceleration to SILC Accelerator API.
+
  o SILC Accelerator API.  Provides generic way to use different kind of
    accelerators.  Basically implements SILC PKCS API so that SilcPublicKey
    and SilcPrivateKey can be used but they call the accelerators.
index 880e0dc35fb27a3d613b2f6ee2bfc2b39d5a89c8..48bf498bd43a8c3c8f2e153f9b44ccb9837f66bc 100644 (file)
@@ -636,6 +636,9 @@ AC_DEFINE_UNQUOTED([SILC_DOCDIR], "$DOCDIR", [SILC_DOCDIR])
 INCLUDE_DEFINES_INT="include \$(top_srcdir)/Makefile.defines_int"
 AC_SUBST(INCLUDE_DEFINES_INT)
 
+DATE=`date`
+AC_SUBST(DATE)
+
 
 #
 # Makefile outputs
@@ -643,6 +646,8 @@ AC_SUBST(INCLUDE_DEFINES_INT)
 AC_CONFIG_FILES(
 Makefile
 doc/Makefile
+doc/crypto.in/index.html
+doc/crypto.in/manual.html
 Makefile.defines
 Makefile.defines_int
 includes/Makefile
index fc3fd6a4b83b5e65a9cc5f1b6c63e15236bb6dcb..cfebacca134fae7373d64763ad44731c2e3f51f1 100644 (file)
@@ -18,3 +18,4 @@ sed -e "s/SILC_VERSION/$dist_version/" -e "s/SILC_RELEASE/$release/" \
 cd doc
 make toolkit-ref-html
 cd ..
+cp ChangeLog doc/runtime/ChangeLog
diff --git a/doc/crypto.in/building.html b/doc/crypto.in/building.html
new file mode 100644 (file)
index 0000000..375f3e5
--- /dev/null
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
+<link rel="stylesheet" href="./runtime.css" type="text/css" />
+<title>SILC Runtime Toolkit</title>
+</head>
+<body>
+
+<div id="logo">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silcnet.org">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Runtime Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+<div id="contentwrapper">
+<div id="navigation">
+</div> <!-- navigation -->
+<div id="content">
+
+<big><b>Building the Toolkit</b></big>
+
+<br />&nbsp;<br />
+SILC Runtime Toolkit works on various platforms, such as on several Unix
+systems and on Windows.  Building of the Toolkit on some platform may
+differ from the other.  This document describes how to build the Toolkit
+from the sources, to create linkable libraries and binaries, on all
+platforms the Toolkit support.
+
+<br />&nbsp;<br />
+The building instructions for all platforms are also included in the Toolkit
+package.  Please refer to the INSTALL file for general building instructions
+for Unix systems, README.WIN32 for building on Windows systems,
+README.MACOSX for building on Mac OS X, and README_SYMBIAN for building on
+Symbian OS.
+<br />
+
+<ul class="toc_entries">
+<li><a href="#unix">Building on Unix & Linux</a><br />
+<li><a href="#windows">Building on Windows</a><br />
+<li><a href="#macosx">Building on Mac OS X</a>
+<li><a href="#symbian">Building on Symbian OS</a>
+</ul>
+
+<b><a name="unix"></a>Building on Unix & Linux</b>
+
+<br />&nbsp;<br />
+On Unix systems both statically and dynamically linkable libraries are
+built by default.
+
+<br />&nbsp;<br />
+To build Toolkit on Unix systems, give commands:
+
+<br />&nbsp;<br />
+<tt>
+./configure<br />
+make
+</tt>
+
+<br />&nbsp;<br />
+On some systems you may need to give "gmake" command instead of "make".  The
+./configure can take several options as arguments.  To see them all give
+command:
+
+<br />&nbsp;<br />
+<tt>./configure --help</tt>
+
+<br />&nbsp;<br />
+The most important configuration options you may consider to use are:
+
+<br />&nbsp;<br />
+<tt>--enable-debug</tt>
+
+<br />&nbsp;<br />
+If you would like to enable the debugging for the compiled binaries
+you can give this option to the `configure'.  It is recommended to use
+this option when you are doing development with Toolkit.  It is helpful
+to enable run-time debugging.
+
+<br />&nbsp;<br />
+<tt>--with-iconv[=DIR]</tt>
+
+<br />&nbsp;<br />
+If your system doesn't provide iconv() function in its native libraries
+(usually libc) or if this function is broken (e.g. older Solaris systems),
+you may want to use libiconv instead.  The DIR is the upper path in your
+system which contains lib/ and include/ for libiconv (e.g. /usr/local).
+
+<br />&nbsp;<br />
+<tt>--without-pthreads</tt>
+
+<br />&nbsp;<br />
+If you do not want to compile the programs with POSIX multi-threads support
+you can give --without-pthreads option.  This will disable the SILC Thread
+API and SILC Mutex API.  Furthermore if SILC Thread API is used when this
+option is used, the routines work, but do not work in threads (are run
+in the calling process and can block the process).
+
+<br />&nbsp;<br />
+<tt>--disable-asm</tt>
+
+<br />&nbsp;<br />
+If you have trouble compiling the assembler optimized code in the
+package or does not want to use them, you can give the --disable-asm
+option to the `configure' script.  This will assure that assembler
+optimized code is not compiled in.
+
+<br />&nbsp;<br />
+<tt>--enable-ipv6</tt>
+
+<br />&nbsp;<br />
+The `configure' will attempt to check for IPv6 support in your system.
+However, if it fails, but you still want to compile in the IPv6 support
+you can give --enable-ipv6 option to force the IPv6 support.
+
+<br />&nbsp;<br />
+<tt>--disable-cpu-optimizations</tt>
+
+<br />&nbsp;<br />
+By default the configure script will attempt to detect the type of your
+CPU and enable any features specific to your CPU that could optimize the
+performance of the Toolkit.  If you are creating binary package that
+should work on any CPU (and not only your CPU) you should diable these
+optimizations.  If you compile it for yourself only, keeping the
+optimizations enabled is recommended.
+
+<br />&nbsp;<br />
+After compilation you can install the Toolkit into your system by giving
+the command:
+
+<br />&nbsp;<br />
+<tt>make install</tt>
+
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="windows"></a>Building on Windows</b>
+
+<br />&nbsp;<br />
+The Toolkit can be compiled several different ways on Windows.  However,
+this document describes the method to build the Toolkit to produce native
+Win32 binaries.  The Toolkit package can also be compiled on Cygwin and
+MinGW.  For these systems please refer to the README.WIN32 file in the
+Toolkit package.
+
+<br />&nbsp;<br />
+The Toolkit package includes ready MSVC++ Workspace files, that will
+automatically compile the Toolkit.  The MSVC++ workspace and project files
+resides in the win32/ subdirectory of the Toolkit package.  The `srt.dsw'
+file is the workspace file that automatically supports compiling the Toolkit
+and to generate the SILC Runtime DLL (libsrt.dll).  You may also compile
+debug version by selecteing the Debug compilation method.
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="macosx"></a>Building on Mac OS X</b>
+
+<br />&nbsp;<br />
+Building the Toolkit on Mac OS X is almost identical on compiling on Unix
+system.  The reason for this is that the Mac OS X is Unix based operating
+system.  To build the Toolkit on Mac OS X, give the following commands:
+
+<br />&nbsp;<br />
+<tt>
+setenv CFLAGS -no-cpp-precomp<br />
+./configure powerpc<br />
+make
+</tt>
+
+<br />&nbsp;<br />
+The ./configure can take several options as arguments.  To see them all give
+command:
+
+<br />&nbsp;<br />
+<tt>./configure --help</tt>
+
+<br />&nbsp;<br />
+To compile, give:
+
+<br />&nbsp;<br />
+<tt>
+make
+</tt>
+
+<br />&nbsp;<br />
+After compilation you can install the Toolkit into your system by giving
+the command:
+
+<br />&nbsp;<br />
+<tt>make install</tt>
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="symbian"></a>Building on Symbian OS</b>
+
+<br />&nbsp;<br />
+The build environment for Symbian OS requires Carbide.c++ and MS Windows.
+
+<br />&nbsp;<br />
+Download the freely available Carbide.c++ from Nokia at
+<a href="http://forum.nokia.com">http://forum.nokia.com</a>.  The exact
+hyperlink location changes often, so it is not referenced here.  It is
+usually under "Tools and SDKs" link.
+
+<br />&nbsp;<br />
+After installation a web browser is opened automatically by the
+Carbide.c++ installer.  Follow its instructions by installing the Perl,
+CTags and the SDK.  Perl and the SDK are required, but CTags is
+optional and if necessary can be omitted.
+
+<br />&nbsp;<br />
+The Toolkit is generic C and C++ code and should work with any
+SDK.  If you don't have SDK already installed, install the latest
+version you can find.  The links to SDKs are found in the Carbide.c++
+instructions after installation.  If you already have SDK in your
+system, you should use that.
+
+<br />&nbsp;<br />
+After installation import the Toolkit project to Carbide.c++ from the
+symbian/ subdirectory in the Toolkit package.
+
+<br />&nbsp;<br />
+Please read the README.SYMBIAN from the SILC Runtime Toolkit package for
+complete building instructions.
+
+<br />&nbsp;<br />
+</div> <!-- content -->
+
+</div> <!-- contentwrapper -->
+<div id="footer">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silcnet.org">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Runtime Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+</body>
+</html>
diff --git a/doc/crypto.in/crypto.css b/doc/crypto.in/crypto.css
new file mode 100644 (file)
index 0000000..ecb2b70
--- /dev/null
@@ -0,0 +1,218 @@
+body {
+       width: 100%;
+       background-color: #fff;
+       font: normal 90% Arial, Helvetica, Verdana;
+       color: #454545;
+       margin-top: 0;
+       margin-left: 0;
+       margin-right: 0;
+}
+
+#logo {
+       font-size: 100%;
+       background-color: #eeeeee;
+       height: 46px;
+       margin-top: 0;
+       border-bottom: 1px solid #cacaca;
+}
+
+#logo a {
+       color: #9f7e40;
+       text-decoration: none;
+}
+
+#logo a:hover, #logo a:active {
+       color: #afaf77;
+}
+
+#contentwrapper {
+       float: left;
+       width: 100%;
+}
+
+#content {
+       font-size: 100%;
+       padding: 5px 5px 2px 10px;
+       margin-right: 245px;
+       border-right: 1px dotted #cacaca;
+}
+
+/* The content margin-right is 245 px.  To get navigation's dotted border
+   to same position as contents dotted border we have width 231 + right
+   border padding 4 + left border padding 10 == 245 px. */
+#navigation {
+       border-left: 1px dotted #cacaca;
+       width: 231px;
+       min-height: 590px;
+       position: relative;
+       float: right;
+       padding: 5px 4px 2px 10px;
+}
+
+#footer {
+       background-color: #eeeeee;
+       clear: left;
+       width: 100%;
+       font-size: 100%;
+       border-top: 1px solid #cacaca;
+}
+
+#footer a {
+       color: #9f7e40;
+       text-decoration: none;
+}
+
+#footer a:hover, #footer a:active {
+       color: #afaf77;
+}
+
+pre {
+       font-family: monospace;
+       margin: 12px;
+       padding: 5px;
+       white-space: pre;
+       color: #000;
+}
+
+pre.source {
+       background-color: #ffe;
+       border: dashed #aa9 1px;
+}
+
+p {
+       margin: 15px;
+}
+
+p.item_name  {
+       font-weight: bolder;
+       margin: 5px;
+       font-size: 110%;
+}
+
+ul.toc_entries {
+       list-style-image: url(./arrow.png);
+}
+
+a.menuitem {
+       font-size: 90%;
+       color: #9f7e40;
+       padding: 4px 1px 1px 5px;
+       background: url(./arrow.png) no-repeat center left;
+       text-align: left;
+       padding-left: 20px;
+}
+
+
+#extra, #extra a
+{
+}
+
+#content a {
+       color: #9f7e40;
+       text-decoration: none;
+}
+
+#content a:hover, #content a:active {
+       color: #afaf77;
+}
+
+a.indexitem {
+       display: block;
+}
+
+h1
+{
+       font-size: 220%;
+       margin-top: 0px;
+}
+
+h2
+{
+       font-size: 180%;
+       margin-top: 0px;
+}
+
+h3
+{
+       font-size: 133%;
+       margin-top: 0px;
+}
+
+h4
+{
+       font-size: 124%;
+       margin-top: 0px;
+}
+
+h5
+{
+       font-size: 115%;
+       margin-top: 0px;
+}
+
+h6
+{
+       font-size: 106%;
+       margin-top: 0px;
+}
+
+#navigation a {
+       text-decoration: none;
+}
+
+.menuitem:hover {
+       color: #afaf77;
+       text-decoration: none;
+}
+
+#extra a
+{
+    text-decoration: none;
+}
+
+#logo a
+{
+    text-decoration: none;
+}
+
+#extra a:hover
+{
+}
+
+
+.menuitem       {width: auto;}
+#content        {width: auto;}
+.menuitem       {display: block;}
+
+span.keyword
+{
+    color: #00F;
+}
+
+span.comment
+{
+    color: #080;
+}
+
+span.quote
+{
+    color: #F00;
+}
+
+span.squote
+{
+    color: #F0F;
+}
+
+span.sign
+{
+    color: #008B8B;
+}
+
+
+@media print
+{
+    #navigation {display: none;}
+    #content    {padding: 0px;}
+    #content a  {text-decoration: underline;}
+}
diff --git a/doc/crypto.in/crypto.rc b/doc/crypto.in/crypto.rc
new file mode 100644 (file)
index 0000000..6ceea16
--- /dev/null
@@ -0,0 +1,34 @@
+options:
+       --src ../../lib
+       --doc .
+       --html
+       --sectionnameonly
+       --syntaxcolors
+       --nopre
+       --no_subdirectories
+       --nosort
+       --index
+       --documenttitle "SILC Crypto Toolkit"
+       --multidoc
+       --one_file_per_header
+       --header_toc
+       --module_index_menu
+       --document_header header
+       --document_footer footer
+       --css crypto.css
+
+preformatted items:
+       EXAMPLE
+       SYNOPSIS
+       NAME
+
+ignore files:
+       Makefile*
+       tests
+       win32
+       symbian
+       *.h~
+       *.c
+       *.in
+       silcdh.h
+       silcdn.h
diff --git a/doc/crypto.in/footer b/doc/crypto.in/footer
new file mode 100644 (file)
index 0000000..aaeb067
--- /dev/null
@@ -0,0 +1,13 @@
+</div> <!-- contentwrapper -->
+<div id="footer">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Crypto Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+  </td>
+ </tr>
+</table>
+</div>
diff --git a/doc/crypto.in/header b/doc/crypto.in/header
new file mode 100644 (file)
index 0000000..46c7565
--- /dev/null
@@ -0,0 +1,14 @@
+<div id="logo">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Crypto Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+  </td>
+ </tr>
+</table>
+</div>
+
+<div id="contentwrapper">
diff --git a/doc/crypto.in/index.html.in b/doc/crypto.in/index.html.in
new file mode 100644 (file)
index 0000000..54a1702
--- /dev/null
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
+<link rel="stylesheet" href="./crypto.css" type="text/css" />
+<title>SILC Crypto Toolkit</title>
+</head>
+<body>
+
+<div id="logo">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+ </tr>
+</table>
+</div>
+
+<div id="contentwrapper">
+<div id="navigation">
+</div> <!-- navigation -->
+<div id="content">
+<h2>SILC Crypto Toolkit @VERSION@</h2>
+<p>
+SILC Crypto Toolkit (SCT) is a high performance multipurpose cryptographic
+toolkit for application programmers.  It provides ciphers, hash
+functions, public key cryptosystems, MAC algorithms, multi-precision
+integers, cryptographic accelerators, ASN.1 encoder and decoder, and many
+many other features.
+</p>
+<p>
+SCT supports multiple platforms; Unix/Linux, Windows, Mac OS X and Symbian
+OS.  SCT and all of its APIs are entirely reentrant and thread safe.
+</p>
+<p>
+SCT is free software and is licensed with GNU GPL.
+</p>
+
+<p class="item_name">DOWNLOAD</p>
+<ul class="toc_entries">
+<li class="toc_entries"><a href="http://silcnet.org/download/sct/sources/">Download SCT sources</a>
+<li class="toc_entries"><a href="http://silcnet.org/download/sct/rpm/">Download SCT RPM binaries</a>
+<li class="toc_entries"><a href="http://silcnet.org/download/sct/win32/">Download SCT Windows binaries</a>
+<li class="toc_entries"><a href="http://silcnet.org/download/sct/symbian/">Download SCT Symbian OS binaries</a>
+<li class="toc_entries"><a href="ChangeLog">Release Notes</a>
+</ul>
+
+<p class="item_name">DOCUMENTATION</p>
+<ul class="toc_entries">
+<li class="toc_entries"><a href="manual.html">Toolkit Reference Manual</a>
+</ul>
+
+<p class="item_name">DEVELOPMENT</p>
+<ul class="toc_entries">
+<li class="toc_entries"><a href="https://lists.silcnet.org/mailman/listinfo/silc-devel">Mailing List</a>
+<li class="toc_entries"><a href="http://git.silc.fi/gitweb/?p=crypto.git">SCT GIT Version Control</a> </ul>
+
+<p>
+To clone SCT repository give one of the following commands:
+<pre>
+ git clone git://git.silc.fi/crypto
+ git clone http://git.silc.fi/crypto
+</pre>
+</p>
+
+</div> <!-- content -->
+
+</div> <!-- contentwrapper -->
+<div id="footer">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+ </tr>
+</table>
+</div>
+
+</body>
+</html>
diff --git a/doc/crypto.in/intro.html b/doc/crypto.in/intro.html
new file mode 100644 (file)
index 0000000..9ca8ba9
--- /dev/null
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
+<link rel="stylesheet" href="./runtime.css" type="text/css" />
+<title>SILC Runtime Toolkit</title>
+</head>
+<body>
+
+<div id="logo">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Runtime Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+<div id="contentwrapper">
+<div id="navigation">
+</div> <!-- navigation -->
+<div id="content">
+<h3>Introduction</h3>
+<p>
+SILC Runtime Toolkit (SRT) provides useful utility functions for
+application programmers.  SRT can be used as the sole and main runtime
+in any application.  It provides application main loop, hash table, lists,
+atomic operations, threads, locks, queues, file descriptor stream, socket
+stream, network routines, a finite state machine, memory pool, random
+number generator, buffers, regular expressions, and many many other
+features.
+</p>
+
+<p>
+SRT natively supports multiple platforms; Unix/Linux, Windows, Mac OS X
+and Symbian OS, and all APIs work identically or nearly identically on all
+support platforms.  The SRT does not have any special third party
+dependencies.  On most Unix/Linux platforms only external dependency is
+POSIX threads library.  On Windows and Symbian OS no special dependencies
+exist.
+ </p>
+
+<p>
+SRT and all of its APIs are entirely reentrant as long as different
+context is used in each thread.  None of the APIs use global or static
+variables, or access shared data without locking.  Some APIs are also
+completely thread safe and can be freely used in multithreaded environment
+without restrictions.  The Toolkit Reference Manual will always specify
+which API is thread safe.
+</p>
+
+</div> <!-- content -->
+
+</div> <!-- contentwrapper -->
+<div id="footer">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Runtime Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+</body>
+</html>
diff --git a/doc/crypto.in/manual.html.in b/doc/crypto.in/manual.html.in
new file mode 100644 (file)
index 0000000..8a3f536
--- /dev/null
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
+<link rel="stylesheet" href="./crypto.css" type="text/css" />
+<title>SILC Crypto Toolkit</title>
+</head>
+<body>
+
+<div id="logo">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Crypto Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+<div id="contentwrapper">
+<div id="navigation">
+</div> <!-- navigation -->
+<div id="content">
+<h2>SILC Crypto Toolkit Reference Manual</h2>
+<p>
+Version: @VERSION@<br />
+Copyright &copy; 1997 - 2008 The SILC Project<br />
+Updated: @DATE@
+</p>
+<p>
+Welcome to the SILC Crypto Toolkit Reference Manual.  The manual is a
+complete developer guide and reference for the application programmer.
+The manual is intended for programmers who would like to use the SILC
+Crypto Toolkit as their primary cryptographic library in their application.</p>
+<p>
+The application programming interfaces are automatically generated from the
+Toolkit sources, and the documentation is constantly evolving.  New versions
+of the Toolkit always delivers the latest version of this reference manual.
+</p>
+
+<p class="item_name">GUIDES</p>
+<ul class="toc_entries">
+
+<li class="toc_entries"><a href="intro.html">Introduction</a><br />
+<li class="toc_entries"><a href="platforms.html">Supported Platforms</a>
+<li class="toc_entries"><a href="building.html">Building the Toolkit</a>
+</ul>
+
+<p class="item_name">TOOLKIT REFERENCE</p>
+<ul class="toc_entries">
+
+<li class="toc_entries"><a href="./silccrypto_hsilccrypt2FCrypto20Toolkit20Interface.html">Crypto Toolkit Interface</a>
+<li class="toc_entries"><a href="./silcasn1_hsilcasn12FASN2E120Interface.html">ASN.1 Interface</a>
+<li class="toc_entries"><a href="./silcber_hsilcasn12FBER20Interface.html#robo60"  >BER Interface</a>
+<li class="toc_entries"><a href="./silccipher_hsilccrypt2FCipher20Interface.html">Cipher Interface</a>
+<li class="toc_entries"><a href="./silcacc_hsilcacc2FCrypto20Accelerator20Interface.html">Crypto Accelerator Interface</a>
+<li class="toc_entries"><a href="./silchash_hsilccrypt2FHash20Function20Interface.html">Hash Function Interface</a>
+<li class="toc_entries"><a href="./silcskr_hsilcskr2FKey20Manager20and20Repository.html">Key Manager and Repository</a>
+<li class="toc_entries"><a href="./silcmac_hsilccrypt2FMAC20Interface.html">MAC Interface</a>
+<li class="toc_entries"><a href="./silcmath_hsilcmath2FMath20Interface.html">Math Interface</a>
+<li class="toc_entries"><a href="./silcmp_hsilcmath2FMP20Integer20Interface.html">MP Integer Interface</a>
+<li class="toc_entries"><a href="./silcpgp_hsilcpgp2FOpenPGP20Interface.html">OpenPGP Interface</a>
+<li class="toc_entries"><a href="./silcpkcs_hsilccrypt2FPKCS20Interface.html">PKCS Interface</a>
+<li class="toc_entries"><a href="./silcpkcs1_hsilccrypt2FPKCS23120Interface.html">PKCS#1 Interface</a>
+<li class="toc_entries"><a href="./silcrng_hsilccrypt2FRNG20Interface.html">RNG Interface</a>
+<li class="toc_entries"><a href="./silcpk_hsilccrypt2FSILC20Interface.html">SILC Interface</a>
+<li class="toc_entries"><a href="./softacc_hsilcacc2FSoftware20Accelerator.html">Software Accelerator</a>
+<li class="toc_entries"><a href="./silcssh_hsilcssh2FSSH20Interface.html">SSH Interface</a>
+
+<li class="toc_entries"><a href="masterindex.html">Toolkit Index</a><br />
+</ul>
+
+</div> <!-- content -->
+
+</div> <!-- contentwrapper -->
+<div id="footer">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silc.fi">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Crypto Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+</body>
+</html>
diff --git a/doc/crypto.in/platforms.html b/doc/crypto.in/platforms.html
new file mode 100644 (file)
index 0000000..de0dcaa
--- /dev/null
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html  xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Style-Type" content="text/css" />
+<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
+<link rel="stylesheet" href="./runtime.css" type="text/css" />
+<title>SILC Runtime Toolkit</title>
+</head>
+<body>
+
+<div id="logo">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silcnet.org">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Runtime Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+<div id="contentwrapper">
+<div id="navigation">
+</div> <!-- navigation -->
+<div id="content">
+
+<big><b>Platform Implementations</b></big>
+
+<br />&nbsp;<br />
+This document describes the implementation issues with different platforms
+that the SILC Runtime Toolkit support.  Some of the supported platforms
+does not support all the features delivered with the Toolkit or they may
+behave differently from other platforms.
+<br />
+
+<ul class="toc_entries">
+<li><a href="#unix">Unix & Linux Implementation</a><br />
+<li><a href="#windows">Windows Implementation</a><br />
+<li><a href="#macosx">Mac OS X Implementation</a>
+<li><a href="#symbian">Symbian OS Implementation</a>
+</ul>
+
+<b>Supported Platforms</b>
+
+<br />&nbsp;<br />
+The Toolkit supports by default all Unix and Linux platforms, Windows
+platforms from Windows 2000 and newer, Mac OS X and Symbian OS.
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="unix"></a>Unix Implementation</b>
+
+<br />&nbsp;<br />
+All features and components delivered with the Toolkit work on all
+Unix and Linux platforms.  There are no special Unix platform related
+implementation issues with current version of Toolkit.
+
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="windows"></a>Windows Implementation</b>
+
+<br />&nbsp;<br />
+By default all features and components delivered with Toolkit are
+supported on Windows.  However, there are some certain issues with the
+Windows version of the Toolkit.
+
+<br />&nbsp;<br />
+<ul>
+<li>Some of the network routines do not support IPv6.
+</ul>
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="macosx"></a>Mac OS X Implementation</b>
+
+<br />&nbsp;<br />
+All features and components delivered with the Toolkit work on Mac
+OS X platform.  There are no special Mac OS X platform related
+implementation issues with current version of Toolkit.
+
+
+<br />&nbsp;<br />&nbsp;<br />
+<b><a name="symbian"></a>Symbian OS Implementation</b>
+
+<br />&nbsp;<br />
+Symbian OS support in Toolkit is still experimental.  By default all
+features and components delivered with the Toolkit are supported and
+should work on Symbian.  However, there are some issues with the Symbian
+version of the Toolkit of what Symbian developers need to be aware.
+
+<ul>
+<li>The function <tt>silc_schedule</tt> on Symbian will allocate new Active
+Scheduler Waiter and will block the calling thread.  The caller should
+allocate Active Scheduler before calling <tt>silc_schedule</tt>.
+
+<li>When adding timeout tasks to SILC Scheduler the SILC Scheduler is woken
+up after the timeout task has been added.  This allows adding of the
+timeout tasks from Symbian active objects outside the SILC Scheduler loop.
+On other platforms this wakeup operation is not performed.
+
+<li>Adding fd task to SILC Scheduler will not schedule the fd for any
+operation.  Instead, programmer should use SILC Socket Stream API and SILC
+Fd Stream API on Symbian when dealing with file descriptors and sockets.
+These APIs provide asynchronous notification when data is available and can
+be written.
+
+<li>The function <tt>silc_thread_create</tt> on Symbian will install Active
+Scheduler and allocate Cleanup Stack for the new thread.  The created
+thread always shares heap with the parent thread.
+</ul>
+
+<br />&nbsp;<br />
+</div> <!-- content -->
+
+</div> <!-- contentwrapper -->
+<div id="footer">
+<table border="0" cellspacing="0" cellpadding="6" width="100%">
+ <tr valign="top">
+  <td>Copyright &copy; 2001 - 2008 SILC Project<br />
+    <a href="http://silcnet.org">SILC Project Website</a></td>
+  <td align="right">
+   <a href="index.html">SILC Runtime Toolkit Manual</a><br />
+   <a href="masterindex.html">Index</a></small></td>
+ </tr>
+</table>
+</div>
+
+</body>
+</html>
index 286f821391d5259760ad47f4669536758d1290e2..02538fac4748be25dcdf2df0477544ad2e9cef8c 100644 (file)
@@ -42,7 +42,8 @@ else
 LIBTOOL_OPTS= -release $(CRYPTO_BASE_VERSION) -rpath $(DESTDIR)$(libdir)
 endif
 LIBTOOL_CRYPTO_VERSION = \
-   -version-info $(CRYPTO_CURRENT):$(CRYPTO_REVISION):$(CRYPTO_AGE)
+   -version-info $(CRYPTO_CURRENT):$(CRYPTO_REVISION):$(CRYPTO_AGE) \
+   -export-symbols-regex '^silc_'
 else
 LIBTOOL_OPTS=
 LIBTOOL_CRYPTO_VERSION =
index 5e3dd5cae5a62368bf8252c24d6900b8439560d4..4f54308c79720d5fb4f3924ffd11de4ff112331c 100644 (file)
@@ -27,7 +27,7 @@ const SilcAcceleratorStruct *silc_default_accs[] =
 {
 #ifndef SILC_SYMBIAN
   /* Software accelerator */
-  &softacc,
+  &silc_softacc,
 #endif /* SILC_SYMBIAN */
   NULL
 };
index 040f1c692a8999ffde8e73679d9c92fc32ea1863..eebcf8db7f8f494cb93efb10f50a8c203b018614 100644 (file)
@@ -133,7 +133,8 @@ SilcAccelerator silc_acc_find(const char *name);
  *
  * EXAMPLE
  *
- *    silc_acc_init(softacc, "min_threads", 2, "max_threads", 16, NULL);
+ *    silc_acc_init(softacc, schedule,
+ *                  "min_threads", 2, "max_threads", 16, NULL);
  *
  ***/
 SilcBool silc_acc_init(SilcAccelerator acc, SilcSchedule schedule, ...);
index 11e37fdee7e5d410766639e6306b78b0e334da2b..69943804ea3bfbddd27800bc5ba62d5b322c8ebe 100644 (file)
@@ -28,7 +28,7 @@
 /************************** Types and definitions ***************************/
 
 /* Software accelerator operations */
-const SilcAcceleratorStruct softacc =
+const SilcAcceleratorStruct silc_softacc =
 {
   "softacc", silc_softacc_init, silc_softacc_uninit,
 #ifdef SILC_DIST_SOFTACC_PKCS
index 1439321bc797d0df4bb4883635eb00d0b4a15775..96c887b2f81b8fc7b96fd35f64de42d154deea1b 100644 (file)
  *
  * "min_threads"
  *
- *  The minimum amount of threads that the softacc will always run.  If
- *  this isn't given the default number is 0 (does not start any threads
- *  when initialized).
+ * The minimum amount of threads that the softacc will always run.  If
+ * this isn't given the default number is 0 (does not start any threads
+ * when initialized).
  *
  * "max_threads"
  *
- *  The maximum amount of threads the software accelerator can use.  If
- *  you are using the softacc only for accelerating public key and private
- *  key operations this number should be the number of CPU cores in your
- *  machine.  If you are using it also for accelerating ciphers this number
- *  may need to be fairly large.  Each acclerated cipher will reserve
- *  "cipher_threads" many threads from the softacc.  Always leave some
- *  threads free for the public key and private key acceleration to work.
- *  If this option is not given the default number is 4.
+ * The maximum amount of threads the software accelerator can use.  If
+ * you are using the softacc only for accelerating public key and private
+ * key operations this number should be the number of CPU cores in your
+ * machine.  If you are using it also for accelerating ciphers this number
+ * may need to be fairly large.  Each acclerated cipher will reserve
+ * "cipher_threads" many threads from the softacc.  Always leave some
+ * threads free for the public key and private key acceleration to work.
+ * If this option is not given the default number is 4.
  *
  * "cipher_threads"
  *
- *  The number of threads each accelerated cipher will use.  Note that,
- *  each accelerated cipher will reserve this many threads from the softacc.
- *  The "max_threads" will determine the final maximum number of threads
- *  the softacc can use.  If the "max_threads" limit is reached no more
- *  ciphers can be accelerated (also note that if this happens, public key
- *  and private key acceleration does not work anymore).  The threads are
- *  reserved as long as the cipher is accelerated.  If this option is not
- *  given the default number is 2.
+ * The number of threads each accelerated cipher will use.  Note that,
+ * each accelerated cipher will reserve this many threads from the softacc.
+ * The "max_threads" will determine the final maximum number of threads
+ * the softacc can use.  If the "max_threads" limit is reached no more
+ * ciphers can be accelerated (also note that if this happens, public key
+ * and private key acceleration does not work anymore).  The threads are
+ * reserved as long as the cipher is accelerated.  If this option is not
+ * given the default number is 2.
  *
  * "cipher_blocks"
  *
- *  The number of cipher blocks the softacc will pre-compute.  Each cipher
- *  block consumes 16 or 8 bytes of memory, depending on the size of the
- *  actual cipher block size.  This value can be used to tweak the
- *  performance of the softacc.  If this option is not given the default
- *  number is 4096.  The number must be multiple of 16.
+ * The number of cipher blocks the softacc will pre-compute.  Each cipher
+ * block consumes 16 or 8 bytes of memory, depending on the size of the
+ * actual cipher block size.  This value can be used to tweak the
+ * performance of the softacc.  If this option is not given the default
+ * number is 4096.  The number must be multiple of 16.
  *
  * "cipher_streams"
  *
- *  The number of pre-computation streams each accelerated cipher will use.
- *  Each stream will use "cipher_blocks" many blocks in the stream.  This
- *  number can be used to tweak the performance of the softacc.  If this
- *  option is not given the default number is 2 * "cipher_threads".
+ * The number of pre-computation streams each accelerated cipher will use.
+ * Each stream will use "cipher_blocks" many blocks in the stream.  This
+ * number can be used to tweak the performance of the softacc.  If this
+ * option is not given the default number is 2 * "cipher_threads".
  *
  * EXAMPLE
  *
  * // Initialize the software accelerator.
- * silc_acc_init(SILC_SOFTACC, "min_threads", 2, "max_threads", 8, NULL);
+ * silc_acc_init(SILC_SOFTACC, NULL, "min_threads", 2, "max_threads", 8, NULL);
+ *
+ * // Accelerate cipher
+ * SilcCipher acc_cipher;
+ *
+ * acc_cipher = silc_acc_cipher(SILC_SOFTACC, cipher);
+ * silc_cipher_set_key(acc_cipher, key, key_len, TRUE);
+ * silc_cipher_set_iv(acc_cipher, iv);
+ *
+ * // Encrypt with the accelerated cipher
+ * silc_cipher_encrypt(acc_cipher, src, dst, len, NULL);
+ *
+ * // Free accelerated cipher
+ * silc_cipher_free(acc_cipher);
+ *
+ * // Free the original associated cipher
+ * silc_cipher_free(cipher);
  *
  ***/
 
  *
  * NAME
  *
- *    SILC_SOFTACC
+ *    silc_softacc
  *
  * DESCRIPTION
  *
  *    silc_acc_init(SILC_SOFTACC, "min_threads", 2, "max_threads", 8, NULL);
  *
  ***/
-extern DLLAPI const SilcAcceleratorStruct softacc;
+extern DLLAPI const SilcAcceleratorStruct silc_softacc;
 
 /****d* silcacc/SILC_SOFTACC
  *
@@ -176,10 +192,10 @@ extern DLLAPI const SilcAcceleratorStruct softacc;
  *
  * DESCRIPTION
  *
- *    The name of the software accelerator.
+ *    Softacc context macro that can be used with silc_acc_init.
  *
  ***/
-#define SILC_SOFTACC (SilcAccelerator)&softacc
+#define SILC_SOFTACC (SilcAccelerator)&silc_softacc
 
 /****d* silcacc/SILC_SOFTACC_NAME
  *
index d4df8974ac35f5b8c5460008d95e8ad53dbcdf31..b8280d8448503c519ee9985947de8c97b73a0740 100644 (file)
@@ -45,7 +45,8 @@
  *
  *    Defines the BER classes.
  *
- ***/
+ * SOURCE
+ */
 typedef enum {
   SILC_BER_CLASS_UNIVERSAL       = 0x00,   /* Universal */
   SILC_BER_CLASS_APPLICATION     = 0x01,   /* Application */
@@ -64,7 +65,8 @@ typedef enum {
  *
  *    Defines the BER encoding type.
  *
- ***/
+ * SOURCE
+ */
 typedef enum {
   SILC_BER_ENC_PRIMITIVE         = 0x00,
   SILC_BER_ENC_CONSTRUCTED       = 0x01,
index d86de0ebb82becae19e663af2b6b49f58d05637d..77475fde69cc58c47f6cc6c7cb9da4ac82df45ac 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC Cipher Interface
+/****h* silccrypt/Cipher Interface
  *
  * DESCRIPTION
  *
  * registering and unregistering routines, encryption and decryption
  * routines.
  *
+ * EXAMPLE
+ *
+ * // Allocate AES-128 cipher in CBC mode
+ * SilcCipher aes;
+ *
+ * silc_cipher_alloc(SILC_CIPHER_AES_128_CBC, &aes);
+ *
+ * // Set key for encryption, key length must in bits
+ * silc_cipher_set_key(aes, key, key_len * 8, TRUE);
+ *
+ * // Set IV
+ * silc_cipher_set_iv(aes, iv);
+ *
+ * // Encrypt data
+ * silc_cipher_encrypt(aes, src, dst, len, NULL);
+ *
  ***/
 
 #ifndef SILCCIPHER_H
@@ -125,7 +141,7 @@ typedef struct SilcCipherStruct *SilcCipher;
 #define SILC_CIPHER_NONE                 "none"
 /***/
 
-/****d* silccrypt/Cipher Algorithms
+/****d* silccrypt/Cipher-Algorithms
  *
  * NAME
  *
@@ -292,10 +308,12 @@ SilcBool silc_cipher_unregister_all(void);
  *    argument. The caller must set the key to the cipher after this
  *    function has returned by calling the silc_cipher_set_key.
  *
+ *    See Ciphers for supported ciphers.
+ *
  ***/
 SilcBool silc_cipher_alloc(const char *name, SilcCipher *new_cipher);
 
-/****f* silccrypt/silc_cipher_alloc
+/****f* silccrypt/silc_cipher_alloc_full
  *
  * SYNOPSIS
  *
@@ -308,6 +326,8 @@ SilcBool silc_cipher_alloc(const char *name, SilcCipher *new_cipher);
  *    Same as silc_cipher_alloc but takes the cipher algorithm name,
  *    key length and mode as separate arguments.
  *
+ *    See Cipher-Algorithms for supported algorithms.
+ *
  ***/
 SilcBool silc_cipher_alloc_full(const char *alg_name, SilcUInt32 key_len,
                                SilcCipherMode mode, SilcCipher *new_cipher);
index f7aa3b5fd461e7f4c18678f42b5cef9cf20c8026..43ec915693fd756d987291e4017fa5fdf66505cc 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC Crypto Toolkit API
+/****h* silccrypt/Crypto Toolkit Interface
  *
  * DESCRIPTION
  *
index 9f6602a494e8afd5c7fd250a7bb3e316857b0b59..f5663b6387d80c9c58d85e6bbd26027f3b4af9a9 100644 (file)
 #ifndef SILCHASH_H
 #define SILCHASH_H
 
-/****h* silccrypt/SILC Hash Interface
+/****h* silccrypt/Hash Function Interface
  *
  * DESCRIPTION
  *
- *    This is the interface for hash functions which are used to create
- *    message digests.  The routines are used in various cryptographic
- *    operations.  SILC Hash Interface is used for example by the
- *    SILC HMAC Interface (SilcHmac).
+ * This is the interface for hash functions which are used to create message
+ * digests.  The routines are used in various cryptographic operations.
+ *
+ * EXAMPLE
+ *
+ * SilcHash sha1hash;
+ *
+ * // Allocate SHA-1 hash function
+ * silc_hash_alloc(SILC_HASH_SHA1, &sha1hash);
+ *
+ * // Hash some data
+ * unsigned char digest[SILC_HASH_MAXLEN];
+ *
+ * silc_hash_init(sha1hash);
+ * silc_hash_update(sha1hash, "foobar", 6);
+ * silc_hash_final(sha1hash, digest);
+ *
+ * // Same can be done in one call also
+ * silc_hash_make(sha1hash, "foobar", 6, digest);
+ *
+ * // Free hash
+ * silc_hash_free(sha1hash);
  *
  ***/
 
@@ -66,6 +84,46 @@ typedef struct SilcHashStruct *SilcHash;
 #define SILC_HASH_MD5             "md5"                 /* MD5 */
 /***/
 
+/****d* silccrypt/Hash-OIDs
+ *
+ * NAME
+ *
+ *    Hash functions
+ *
+ * DESCRIPTION
+ *
+ *    Supported hash function OIDs.  These names can be given as argument
+ *    to silc_hash_alloc_by_oid.
+ *
+ * SOURCE
+ */
+#define SILC_HASH_OID_SHA256    "2.16.840.1.101.3.4.2.1"
+#define SILC_HASH_OID_SHA512    "2.16.840.1.101.3.4.2.3"
+#define SILC_HASH_OID_SHA1      "1.3.14.3.2.26"
+#define SILC_HASH_OID_MD5       "1.2.840.113549.2.5"
+/***/
+
+/****d* silccrypt/SILC_HASH_MAXLEN
+ *
+ * NAME
+ *
+ *    #define SILC_HASH_MAXLEN 64
+ *
+ * DESCRIPTION
+ *
+ *    Maximum size of digest any algorithm supported by SILC Crypto Toolkit
+ *    would produce.  You can use this to define static digest buffers and
+ *    safely use it with any hash function.
+ *
+ * EXAMPLE
+ *
+ *   unsigned char digest[SILC_HASH_MAXLEN];
+ *
+ *   silc_hash_make(hash, data, data_len, digest);
+ *
+ ***/
+#define SILC_HASH_MAXLEN 64
+
 /* Hash implementation object */
 typedef struct {
   char *name;
@@ -87,9 +145,6 @@ typedef struct {
 /* Default hash functions for silc_hash_register_default(). */
 extern DLLAPI const SilcHashObject silc_default_hash[];
 
-/* Max hash length */
-#define SILC_HASH_MAXLEN 64
-
 /* Macros */
 
 /* Following macros are used to implement the SILC Hash API. These
@@ -186,6 +241,8 @@ SilcBool silc_hash_unregister_all(void);
  *    hash function is returned into `new_hash' pointer.  This function
  *    returns FALSE if such hash function does not exist.
  *
+ *    See Hashes for supported hash functions.
+ *
  ***/
 SilcBool silc_hash_alloc(const char *name, SilcHash *new_hash);
 
@@ -201,6 +258,8 @@ SilcBool silc_hash_alloc(const char *name, SilcHash *new_hash);
  *    hash algorithm OID string indicated by `oid'. Returns FALSE if such
  *    hash function does not exist.
  *
+ *    See Hash-OIDs for supported hash function OIDs.
+ *
  ***/
 SilcBool silc_hash_alloc_by_oid(const char *oid, SilcHash *new_hash);
 
index d04d8c100a84629ab6699d32acc82a504720c2b3..ad6548c628f001151fb59146b515862f2a9a4e10 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef SILCMAC_H
 #define SILCMAC_H
 
-/****h* silccrypt/SILC MAC Interface
+/****h* silccrypt/MAC Interface
  *
  * DESCRIPTION
  *
  * authentication purposes.  The MAC is usually used in combination with
  * encryption to provide authentication.
  *
+ * EXAMPLE
+ *
+ * SilcMac hmac;
+ *
+ * // Allocate HMAC
+ * silc_mac_alloc(SILC_MAC_HMAC_SHA256, &hmac);
+ *
+ * // Set secret key to the MAC
+ * silc_mac_set_key(hmac, key, key_len);
+ *
+ * // Compute MAC
+ * unsigned char mac[SILC_MAC_MAXLEN];
+ * SilcUInt32 mac_len;
+ *
+ * silc_mac_make(hmac, data, data_len, digest, &mac_len);
+ *
+ * // Free MAC
+ * silc_mac_free(hmac);
+ *
  ***/
 
 /****s* silccrypt/SilcMac
@@ -85,6 +104,21 @@ typedef struct SilcMacStruct *SilcMac;
 #define SILC_MAC_HMAC_MD5         "hmac-md5"
 /***/
 
+/****d* silccrypt/SILC_MAC_MAXLEN
+ *
+ * NAME
+ *
+ *    #define SILC_MAC_MAXLEN 64
+ *
+ * DESCRIPTION
+ *
+ *    Maximum size of digest any algorithm supported by SILC Crypto Toolkit
+ *    would produce.  You can use this to define static digest buffers and
+ *    safely use it with any hash function.
+ *
+ ***/
+#define SILC_MAC_MAXLEN 64
+
 /* MAC implementation object */
 typedef struct {
   char *name;
@@ -175,6 +209,8 @@ SilcBool silc_mac_unregister_all(void);
  *    such MAC does not exist.  After the MAC is allocated a key must be
  *    set for it by calling silc_mac_set_key.
  *
+ *    See MACs for supported MAC algorithms.
+ *
  ***/
 SilcBool silc_mac_alloc(const char *name, SilcMac *new_mac);
 
index 93a4bc66aa0bd60afda8bc0420de1d66a589ddc0..2622aef16721a26ae1eeff03dba588efca509c97 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2007 Pekka Riikonen
+  Copyright (C) 1997 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC Public Key Interface
+/****h* silccrypt/SILC Interface
  *
  * DESCRIPTION
  *
@@ -29,7 +29,7 @@
 #ifndef SILCPK_H
 #define SILCPK_H
 
-/****s* silccrypt/SilcPubkeyAPI/SilcPublicKeyIdentifier
+/****s* silccrypt/SilcPublicKeyIdentifier
  *
  * NAME
  *
@@ -54,7 +54,7 @@ typedef struct SilcPublicKeyIdentifierObject {
 } *SilcPublicKeyIdentifier, SilcPublicKeyIdentifierStruct;
 /***/
 
-/****s* silccrypt/SilcPubkeyAPI/SilcSILCPublicKey
+/****s* silccrypt/SilcSILCPublicKey
  *
  * NAME
  *
@@ -76,7 +76,7 @@ typedef struct SilcSILCPublicKeyStruct {
 } *SilcSILCPublicKey;
 /***/
 
-/****s* silccrypt/SilcPubkeyAPI/SilcSILCPrivateKey
+/****s* silccrypt/SilcSILCPrivateKey
  *
  * NAME
  *
@@ -95,7 +95,7 @@ typedef struct SilcSILCPrivateKeyStruct {
 } *SilcSILCPrivateKey;
 /***/
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_generate_key
+/****f* silccrypt/silc_pkcs_silc_generate_key
  *
  * SYNOPSIS
  *
@@ -109,8 +109,8 @@ typedef struct SilcSILCPrivateKeyStruct {
  * DESCRIPTION
  *
  *    Generate a new SILC key pair of the algorithm type `algorithm' with
- *    the key length in bits of `bits_key_len'.  The `scheme' may be NULL.
- *    Returns FALSE if key generation failed.
+ *    the key length in bits of `bits_key_len'.  Returns FALSE if key
+ *    generation failed.
  *
  * EXAMPLE
  *
@@ -126,7 +126,7 @@ SilcBool silc_pkcs_silc_generate_key(const char *algorithm,
                                     SilcPublicKey *ret_public_key,
                                     SilcPrivateKey *ret_private_key);
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_encode_identifier
+/****f* silccrypt/silc_pkcs_silc_encode_identifier
  *
  * SYNOPSIS
  *
@@ -151,7 +151,7 @@ char *silc_pkcs_silc_encode_identifier(SilcStack stack,
                                       char *org, char *country,
                                       char *version);
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_decode_identifier
+/****f* silccrypt/silc_pkcs_silc_decode_identifier
  *
  * SYNOPSIS
  *
@@ -168,7 +168,7 @@ char *silc_pkcs_silc_encode_identifier(SilcStack stack,
 SilcBool silc_pkcs_silc_decode_identifier(const char *identifier,
                                          SilcPublicKeyIdentifier ident);
 
-/****f* silccrypt/SilcPubkeyAPI/silc_pkcs_silc_public_key_version
+/****f* silccrypt/silc_pkcs_silc_public_key_version
  *
  * SYNOPSIS
  *
index d97d9c603870764af8617a99ff804beb169c8648..4355ce53c37c64189939cd8078a0f2819c4c0cc2 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC PKCS Interface
+/****h* silccrypt/PKCS Interface
  *
  * DESCRIPTION
  *
  * public and private keys.  Support for loading and saving of different
  * types of public key and private keys are also provided.
  *
+ * This interface is used to perform operations with public keys and private
+ * keys but the interface cannot be used to generate new key pairs.  Instead,
+ * PKCS implementations provide functions to generate key pairs.  Call
+ * silc_pkcs_silc_generate_key to generate SILC protocol key pair.  Call
+ * silc_ssh_generate_key to generate SSH2 protocol key pair.  Call
+ * silc_pgp_generate_key to generate OpenPGP key pair.
+ *
+ * EXAMPLE
+ *
+ * // Load public and private keys
+ * SilcPublicKey public_key;
+ * SilcPrivateKey private_key;
+ *
+ * silc_pkcs_load_public_key("pubkey.pub", SILC_PKCS_ANY, &public_key);
+ * silc_pkcs_load_private_key("privkey, prv", passphrase, passphrase_len,
+ *                            SILC_PKCS_ANY, &public_key);
+ *
+ * // Compute signature
+ * unsigned char dst[2048];
+ * SilcUInt32 sig_len;
+ *
+ * silc_pkcs_sign(private_key, src, src_len, dst, sizeof(dst), &sig_len,
+ *               TRUE, NULL, rng);
+ *
+ * // Free keys
+ * silc_pkcs_public_key_free(public_key);
+ * silc_pkcs_private_key_free(private_key);
+ *
  ***/
 
 #ifndef SILCPKCS_H
@@ -57,7 +85,7 @@ typedef enum {
 } SilcPKCSType;
 /***/
 
-/****d* silccrypt/SilcPKCSAlgorithms
+/****d* silccrypt/PKCS-Algorithms
  *
  * NAME
  *
@@ -74,7 +102,7 @@ typedef enum {
 #define SILC_PKCS_ALG_DSA    "dsa"        /* DSA algorithm */
 /***/
 
-/****d* silccrypt/SilcPKCSSchemes
+/****d* silccrypt/PKCS-Schemes
  *
  * NAME
  *
@@ -205,9 +233,9 @@ typedef enum {
  * DESCRIPTION
  *
  *    Encryption callback.  This callback is given as argument to the
- *    silc_pkcs_encrypt and the encrypted data is delivered to the caller
- *    in this callback.  The `encrypted' is the encrypted data.  If the
- *    `success' is FALSE the encryption operation failed.
+ *    silc_pkcs_encrypt_async and the encrypted data is delivered to the
+ *    caller in this callback.  The `encrypted' is the encrypted data.  If
+ *    the `success' is FALSE the encryption operation failed.
  *
  ***/
 typedef void (*SilcPKCSEncryptCb)(SilcBool success,
@@ -227,9 +255,9 @@ typedef void (*SilcPKCSEncryptCb)(SilcBool success,
  * DESCRIPTION
  *
  *    Decryption callback.  This callback is given as argument to the
- *    silc_pkcs_decrypt and the decrypted data is delivered to the caller
- *    in this callback.  The `decrypted' is the decrypted data.  If the
- *    `success' is FALSE the decryption operation failed.
+ *    silc_pkcs_decrypt_async and the decrypted data is delivered to the
+ *    caller in this callback.  The `decrypted' is the decrypted data.  If
+ *    the `success' is FALSE the decryption operation failed.
  *
  ***/
 typedef void (*SilcPKCSDecryptCb)(SilcBool success,
@@ -249,9 +277,9 @@ typedef void (*SilcPKCSDecryptCb)(SilcBool success,
  * DESCRIPTION
  *
  *    Signature callback.  This callback is given as argument to the
- *    silc_pkcs_sign and the digitally signed data is delivered to the caller
- *    in this callback.  The `signature' is the signature data.  If the
- *    `success' is FALSE the signature operation failed.
+ *    silc_pkcs_sign_async and the digitally signed data is delivered to
+ *    the caller in this callback.  The `signature' is the signature data.
+ *    If the `success' is FALSE the signature operation failed.
  *
  ***/
 typedef void (*SilcPKCSSignCb)(SilcBool success,
@@ -268,7 +296,7 @@ typedef void (*SilcPKCSSignCb)(SilcBool success,
  * DESCRIPTION
  *
  *    Verification callback.  This callback is given as argument to the
- *    silc_pkcs_verify and the result of the signature verification is
+ *    silc_pkcs_verify_async and the result of the signature verification is
  *    deliver to the caller in this callback.  If the `success' is FALSE
  *    the signature verification failed.
  *
@@ -378,146 +406,94 @@ SilcBool silc_pkcs_register_default(void);
  ***/
 SilcBool silc_pkcs_unregister_all(void);
 
-/****f* silccrypt/silc_pkcs_get_supported
- *
- * SYNOPSIS
- *
- *    char *silc_pkcs_get_supported(void);
- *
- * DESCRIPTION
- *
- *    Returns comma separated list of supported PKCS algorithms.
- *
- ***/
-char *silc_pkcs_get_supported(void);
-
-/****f* silccrypt/silc_pkcs_find_pkcs
- *
- * SYNOPSIS
- *
- *    const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPKCSType type);
- *
- * DESCRIPTION
- *
- *    Finds PKCS context by the PKCS type.
- *
- ***/
-const SilcPKCSObject *silc_pkcs_find_pkcs(SilcPKCSType type);
-
-/****f* silccrypt/silc_pkcs_find_algorithm
- *
- * SYNOPSIS
- *
- *    const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
- *                                                      const char *scheme);
- *
- * DESCRIPTION
- *
- *    Finds PKCS algorithm context by the algorithm name `algorithm' and
- *    the algorithm scheme `scheme'.  The `scheme' may be NULL.  Usually
- *    this function is not needed unless you need low level access to the
- *    algorithm implementations.  Usually this is used when implementing
- *    support to new PKCS type.
- *
- ***/
-const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
-                                                 const char *scheme);
-
-/****f* silccrypt/silc_pkcs_get_pkcs
- *
- * SYNOPSIS
- *
- *    const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
- *
- * DESCRIPTION
- *
- *    Returns the PKCS object from `key', which may be SilcPublicKey or
- *    SilcPrivateKey pointer.
- *
- ***/
-const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
-
-/****f* silccrypt/silc_pkcs_get_algorithm
- *
- * SYNOPSIS
- *
- *    const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
- *
- * DESCRIPTION
- *
- *    Returns the PKCS algorithm object from `key', which may be SilcPublicKey
- *    or SilcPrivateKey pointer.
- *
- ***/
-const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
-
-/****f* silccrypt/silc_pkcs_get_name
+/****f* silccrypt/silc_pkcs_load_public_key
  *
  * SYNOPSIS
  *
- *    const char *silc_pkcs_get_name(void *key);
+ *    SilcBool silc_pkcs_load_public_key(const char *filename,
+ *                                       SilcPKCSType type,
+ *                                       SilcPublicKey *ret_public_key);
  *
  * DESCRIPTION
  *
- *    Returns PKCS algorithm name from the `key', which may be SilcPublicKey
- *    or SilcPrivateKey pointer.
+ *    Loads public key from file and allocates new public key.  Returns TRUE
+ *    if loading was successful.  If `type' is SILC_PKCS_ANY this attempts
+ *    to automatically detect the public key type.  If `type' is some other
+ *    PKCS type, the key is expected to be of that type.
  *
  ***/
-const char *silc_pkcs_get_name(void *key);
+SilcBool silc_pkcs_load_public_key(const char *filename,
+                                  SilcPKCSType type,
+                                  SilcPublicKey *ret_public_key);
 
-/****f* silccrypt/silc_pkcs_get_type
+/****f* silccrypt/silc_pkcs_save_public_key
  *
  * SYNOPSIS
  *
- *    SilcPKCSType silc_pkcs_get_type(void *key);
+ *    SilcBool silc_pkcs_save_public_key(const char *filename,
+ *                                       SilcPublicKey public_key,
+ *                                       SilcPKCSFileEncoding encoding);
  *
  * DESCRIPTION
  *
- *    Returns PKCS type from the `key', which may be SilcPublicKey or
- *    SilcPrivateKey pointer.
+ *    Saves public key into file with specified encoding.  Returns FALSE
+ *    on error.
  *
  ***/
-SilcPKCSType silc_pkcs_get_type(void *key);
+SilcBool silc_pkcs_save_public_key(const char *filename,
+                                  SilcPublicKey public_key,
+                                  SilcPKCSFileEncoding encoding);
 
-/****f* silccrypt/silc_pkcs_public_key_get_pkcs
+/****f* silccrypt/silc_pkcs_load_private_key
  *
  * SYNOPSIS
  *
- *    void *silc_pkcs_public_key_get_pkcs(SilcPKCSType type,
- *                                        SilcPublicKey public_key);
+ *    SilcBool silc_pkcs_load_private_key(const char *filename,
+ *                                        const unsigned char *passphrase,
+ *                                        SilcUInt32 passphrase_len,
+ *                                        SilcPKCSType type,
+ *                                        SilcPrivateKey *ret_private_key);
  *
  * DESCRIPTION
  *
- *    Returns the internal PKCS `type' specific public key context from the
- *    `public_key'.  The caller needs to explicitly type cast it to correct
- *    type.  Returns NULL on error.
- *
- *    For SILC_PKCS_SILC the returned context is SilcSILCPublicKey.
- *    For SILC_PKCS_SSH2 the returned context is SilcSshPublicKey.
+ *    Loads private key from file and allocates new private key.  Returns TRUE
+ *    if loading was successful.  The `passphrase' is used as decryption
+ *    key of the private key file, in case it is encrypted.  If `type' is
+ *    SILC_PKCS_ANY this attempts to automatically detect the private key type.
+ *    If `type' is some other PKCS type, the key is expected to be of that
+ *    type.
  *
  ***/
-void *silc_pkcs_public_key_get_pkcs(SilcPKCSType type,
-                                   SilcPublicKey public_key);
+SilcBool silc_pkcs_load_private_key(const char *filename,
+                                   const unsigned char *passphrase,
+                                   SilcUInt32 passphrase_len,
+                                   SilcPKCSType type,
+                                   SilcPrivateKey *ret_private_key);
 
-/****f* silccrypt/silc_pkcs_private_key_get_pkcs
+/****f* silccrypt/silc_pkcs_save_private_key
  *
  * SYNOPSIS
  *
- *    void *silc_pkcs_private_key_get_pkcs(SilcPKCSType type,
- *                                        SilcPublicKey public_key);
+ *    SilcBool silc_pkcs_save_private_key(const char *filename,
+ *                                        SilcPrivateKey private_key,
+ *                                        const unsigned char *passphrase,
+ *                                        SilcUInt32 passphrase_len,
+ *                                        SilcPKCSFileEncoding encoding,
+ *                                        SilcRng rng);
  *
  * DESCRIPTION
  *
- *    Returns the internal PKCS `type' specific private key context from the
- *    `private_key'.  The caller needs to explicitly type cast it to correct
- *    type.  Returns NULL on error.
- *
- *    For SILC_PKCS_SILC the returned context is SilcSILCPrivateKey.
- *    For SILC_PKCS_SSH2 the returned context is SilcSshPrivateKey.
+ *    Saves private key into file.  The private key is encrypted into
+ *    the file with the `passphrase' as a key, if PKCS supports encrypted
+ *    private keys.  Returns FALSE on error.
  *
  ***/
-void *silc_pkcs_private_key_get_pkcs(SilcPKCSType type,
-                                    SilcPrivateKey private_key);
+SilcBool silc_pkcs_save_private_key(const char *filename,
+                                   SilcPrivateKey private_key,
+                                   const unsigned char *passphrase,
+                                   SilcUInt32 passphrase_len,
+                                   SilcPKCSFileEncoding encoding,
+                                   SilcRng rng);
 
 /****f* silccrypt/silc_pkcs_public_key_alloc
  *
@@ -557,7 +533,7 @@ SilcBool silc_pkcs_public_key_alloc(SilcPKCSType type,
  ***/
 void silc_pkcs_public_key_free(SilcPublicKey public_key);
 
-/****f* silccrypt/silc_pkcs_public_key_export
+/****f* silccrypt/silc_pkcs_public_key_encode
  *
  * SYNOPSIS
  *
@@ -906,94 +882,146 @@ SilcAsyncOperation silc_pkcs_verify_async(SilcPublicKey public_key,
                                          SilcPKCSVerifyCb verify_cb,
                                          void *context);
 
-/****f* silccrypt/silc_pkcs_load_public_key
+/****f* silccrypt/silc_pkcs_public_key_get_pkcs
  *
  * SYNOPSIS
  *
- *    SilcBool silc_pkcs_load_public_key(const char *filename,
- *                                       SilcPKCSType type,
- *                                       SilcPublicKey *ret_public_key);
+ *    void *silc_pkcs_public_key_get_pkcs(SilcPKCSType type,
+ *                                        SilcPublicKey public_key);
  *
  * DESCRIPTION
  *
- *    Loads public key from file and allocates new public key.  Returns TRUE
- *    if loading was successful.  If `type' is SILC_PKSC_ANY this attempts
- *    to automatically detect the public key type.  If `type' is some other
- *    PKCS type, the key is expected to be of that type.
+ *    Returns the internal PKCS `type' specific public key context from the
+ *    `public_key'.  The caller needs to explicitly type cast it to correct
+ *    type.  Returns NULL on error.
+ *
+ *    For SILC_PKCS_SILC the returned context is SilcSILCPublicKey.
+ *    For SILC_PKCS_SSH2 the returned context is SilcSshPublicKey.
  *
  ***/
-SilcBool silc_pkcs_load_public_key(const char *filename,
-                                  SilcPKCSType type,
-                                  SilcPublicKey *ret_public_key);
+void *silc_pkcs_public_key_get_pkcs(SilcPKCSType type,
+                                   SilcPublicKey public_key);
 
-/****f* silccrypt/silc_pkcs_save_public_key
+/****f* silccrypt/silc_pkcs_private_key_get_pkcs
  *
  * SYNOPSIS
  *
- *    SilcBool silc_pkcs_save_public_key(const char *filename,
- *                                       SilcPublicKey public_key,
- *                                       SilcPKCSFileEncoding encoding);
+ *    void *silc_pkcs_private_key_get_pkcs(SilcPKCSType type,
+ *                                        SilcPublicKey public_key);
  *
  * DESCRIPTION
  *
- *    Saves public key into file with specified encoding.  Returns FALSE
- *    on error.
+ *    Returns the internal PKCS `type' specific private key context from the
+ *    `private_key'.  The caller needs to explicitly type cast it to correct
+ *    type.  Returns NULL on error.
+ *
+ *    For SILC_PKCS_SILC the returned context is SilcSILCPrivateKey.
+ *    For SILC_PKCS_SSH2 the returned context is SilcSshPrivateKey.
  *
  ***/
-SilcBool silc_pkcs_save_public_key(const char *filename,
-                                  SilcPublicKey public_key,
-                                  SilcPKCSFileEncoding encoding);
+void *silc_pkcs_private_key_get_pkcs(SilcPKCSType type,
+                                    SilcPrivateKey private_key);
 
-/****f* silccrypt/silc_pkcs_load_private_key
+/****f* silccrypt/silc_pkcs_find_pkcs
  *
  * SYNOPSIS
  *
- *    SilcBool silc_pkcs_load_private_key(const char *filename,
- *                                        const unsigned char *passphrase,
- *                                        SilcUInt32 passphrase_len,
- *                                        SilcPKCSType type,
- *                                        SilcPrivateKey *ret_private_key);
+ *    const SilcPKCSObject *silc_pkcs_get_pkcs(SilcPKCSType type);
  *
  * DESCRIPTION
  *
- *    Loads private key from file and allocates new private key.  Returns TRUE
- *    if loading was successful.  The `passphrase' is used as decryption
- *    key of the private key file, in case it is encrypted.  If `type' is
- *    SILC_PKSC_ANY this attempts to automatically detect the private key type.
- *    If `type' is some other PKCS type, the key is expected to be of that
- *    type.
+ *    Finds PKCS context by the PKCS type.
  *
  ***/
-SilcBool silc_pkcs_load_private_key(const char *filename,
-                                   const unsigned char *passphrase,
-                                   SilcUInt32 passphrase_len,
-                                   SilcPKCSType type,
-                                   SilcPrivateKey *ret_private_key);
+const SilcPKCSObject *silc_pkcs_find_pkcs(SilcPKCSType type);
 
-/****f* silccrypt/silc_pkcs_save_private_key
+/****f* silccrypt/silc_pkcs_find_algorithm
  *
  * SYNOPSIS
  *
- *    SilcBool silc_pkcs_save_private_key(const char *filename,
- *                                        SilcPrivateKey private_key,
- *                                        const unsigned char *passphrase,
- *                                        SilcUInt32 passphrase_len,
- *                                        SilcPKCSFileEncoding encoding,
- *                                        SilcRng rng);
+ *    const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
+ *                                                      const char *scheme);
  *
  * DESCRIPTION
  *
- *    Saves private key into file.  The private key is encrypted into
- *    the file with the `passphrase' as a key, if PKCS supports encrypted
- *    private keys.  Returns FALSE on error.
+ *    Finds PKCS algorithm context by the algorithm name `algorithm' and
+ *    the algorithm scheme `scheme'.  The `scheme' may be NULL.  Usually
+ *    this function is not needed unless you need low level access to the
+ *    algorithm implementations.  Usually this is used when implementing
+ *    support to new PKCS type.
  *
  ***/
-SilcBool silc_pkcs_save_private_key(const char *filename,
-                                   SilcPrivateKey private_key,
-                                   const unsigned char *passphrase,
-                                   SilcUInt32 passphrase_len,
-                                   SilcPKCSFileEncoding encoding,
-                                   SilcRng rng);
+const SilcPKCSAlgorithm *silc_pkcs_find_algorithm(const char *algorithm,
+                                                 const char *scheme);
+
+/****f* silccrypt/silc_pkcs_get_pkcs
+ *
+ * SYNOPSIS
+ *
+ *    const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
+ *
+ * DESCRIPTION
+ *
+ *    Returns the PKCS object from `key', which may be SilcPublicKey or
+ *    SilcPrivateKey pointer.
+ *
+ ***/
+const SilcPKCSObject *silc_pkcs_get_pkcs(void *key);
+
+/****f* silccrypt/silc_pkcs_get_algorithm
+ *
+ * SYNOPSIS
+ *
+ *    const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
+ *
+ * DESCRIPTION
+ *
+ *    Returns the PKCS algorithm object from `key', which may be SilcPublicKey
+ *    or SilcPrivateKey pointer.
+ *
+ ***/
+const SilcPKCSAlgorithm *silc_pkcs_get_algorithm(void *key);
+
+/****f* silccrypt/silc_pkcs_get_name
+ *
+ * SYNOPSIS
+ *
+ *    const char *silc_pkcs_get_name(void *key);
+ *
+ * DESCRIPTION
+ *
+ *    Returns PKCS algorithm name from the `key', which may be SilcPublicKey
+ *    or SilcPrivateKey pointer.
+ *
+ ***/
+const char *silc_pkcs_get_name(void *key);
+
+/****f* silccrypt/silc_pkcs_get_type
+ *
+ * SYNOPSIS
+ *
+ *    SilcPKCSType silc_pkcs_get_type(void *key);
+ *
+ * DESCRIPTION
+ *
+ *    Returns PKCS type from the `key', which may be SilcPublicKey or
+ *    SilcPrivateKey pointer.
+ *
+ ***/
+SilcPKCSType silc_pkcs_get_type(void *key);
+
+/****f* silccrypt/silc_pkcs_get_supported
+ *
+ * SYNOPSIS
+ *
+ *    char *silc_pkcs_get_supported(void);
+ *
+ * DESCRIPTION
+ *
+ *    Returns comma separated list of supported PKCS algorithms.
+ *
+ ***/
+char *silc_pkcs_get_supported(void);
 
 /****f* silccrypt/silc_hash_public_key
  *
index bd366633d522c2aa828b2791a845cec7453ac2fe..6b2d134cf67f39c68f29d31953c0485206707822 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC PKCS1 Interface
+/****h* silccrypt/PKCS#1 Interface
  *
  * DESCRIPTION
  *
index 4348fb2ace77e6abfff0c402a25c7f32a89ffa39..ec98e1ba84e258ac4dd7d90de859154590747340 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silccrypt/SILC RNG Interface
+/****h* silccrypt/RNG Interface
  *
  * DESCRIPTION
  *
index 966cd6d9f5ce0e5fca025283993e7ac2225c3de4..79554f53a16fd3d7073c8a8e334badeecbd6fa8e 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silcmath/SILC Math Interface
+/****h* silcmath/Math Interface
  *
  * DESCRIPTION
  *
index da9f5c7803825495a7b2dc32923b86a7a98de213..2d3c4019932c2ef8b9c4edd832945fbf532f2ff5 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silcmath/SILC MP Interface
+/****h* silcmath/MP Integer Interface
  *
  * DESCRIPTION
  *
index f720d34584d7b7157f7c6d8f876311f5a05ee25b..6fb72b4eaadbc48742e25b41e7dedc469237b28d 100644 (file)
@@ -238,7 +238,7 @@ static SilcBool silc_skr_find_entry(SilcSKR skr,
 
   f.list = silc_dlist_init();
   if (!f.list) {
-    *status |= SILC_SKR_NO_MEMORY;
+    *status |= SILC_ERR_OUT_OF_MEMORY;
     return FALSE;
   }
   f.key_context = key_context;
@@ -251,7 +251,7 @@ static SilcBool silc_skr_find_entry(SilcSKR skr,
                               silc_skr_find_foreach, &f);
 
   if (!silc_dlist_count(f.list)) {
-    *status |= SILC_SKR_NOT_FOUND;
+    *status |= SILC_ERR_NOT_FOUND;
     silc_dlist_uninit(f.list);
     return FALSE;
   }
@@ -315,7 +315,7 @@ static SilcBool silc_skr_results_and(SilcDList list, SilcResult *status,
   if (*results == NULL) {
     *results = silc_dlist_init();
     if (*results == NULL) {
-      *status |= SILC_SKR_NO_MEMORY;
+      *status |= SILC_ERR_OUT_OF_MEMORY;
       return FALSE;
     }
   }
@@ -348,7 +348,7 @@ static SilcBool silc_skr_results_and(SilcDList list, SilcResult *status,
   /* If results became empty, we did not find any key */
   if (!silc_dlist_count(*results)) {
     SILC_LOG_DEBUG(("Not all search constraints found"));
-    *status |= SILC_SKR_NOT_FOUND;
+    *status |= SILC_ERR_NOT_FOUND;
     return FALSE;
   }
 
@@ -1165,19 +1165,17 @@ SilcAsyncOperation silc_skr_find(SilcSKR skr, SilcSchedule schedule,
   while (silc_hash_table_get(&htl, &type, &ctx)) {
 
     /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
-    if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
+    if (SILC_PTR_TO_32(type) == SILC_SKR_FIND_USAGE)
       continue;
 
 #if defined(SILC_DEBUG)
     memset(tmp, 0, sizeof(tmp));
-    silc_skr_type_string((SilcSKRFindType)SILC_32_TO_PTR(type),
-                        ctx, tmp, sizeof(tmp) - 1);
+    silc_skr_type_string(SILC_PTR_TO_32(type), ctx, tmp, sizeof(tmp) - 1);
     SILC_LOG_DEBUG(("Finding key by %s", tmp));
 #endif /* SILC_DEBUG */
 
     /* Find entries by this search constraint */
-    if (!silc_skr_find_entry(skr, &status,
-                            (SilcSKRFindType)SILC_32_TO_PTR(type),
+    if (!silc_skr_find_entry(skr, &status, SILC_PTR_TO_32(type),
                             ctx, &list, NULL, SILC_PTR_TO_32(usage))) {
       SILC_LOG_DEBUG(("Not found"));
       if (results) {
index ba36bc3c3de9b70445be6a38e71598d0fea58b5c..385b902cf190e464b89d816473da80dbef009eaf 100644 (file)
@@ -92,7 +92,7 @@ typedef enum {
   SILC_SKR_USAGE_IDENTIFICATION        = 0x0008,  /* Identifying key owner */
   SILC_SKR_USAGE_SERVICE_AUTHORIZATION = 0x0010,  /* Service authorization */
 
-  /* From 0x0100 reserved for private/application use. */
+  /* 0x0200 - 0x8000 reserved for private/application use. */
 } SilcSKRKeyUsage;
 /***/
 
@@ -427,8 +427,8 @@ SilcBool silc_skr_find_set_realname(SilcSKRFind find, const char *realname);
  *
  * DESCRIPTION
  *
- *    Sets email address as search constraint.  This specific address must be
- *    present in the key.
+ *    Sets email address (user FQDN) as search constraint.  This specific
+ *    address must be present in the key.
  *
  *    This may be used with SILC_PKCS_SILC PKCS type only.
  *
index f07b7cb11b0aaa45543289e342a2fd997db7425e..6ebbe764cb4e3331acb24424e8d6b57fa1ee9b96 100644 (file)
@@ -17,7 +17,7 @@
 
 */
 
-/****h* silcssh/SILC SSH Interface
+/****h* silcssh/SSH Interface
  *
  * DESCRIPTION
  *
@@ -87,6 +87,7 @@ typedef enum {
   SILC_SSH_KEY_OPENSSH   = 1,     /* OpenSSH public/private key (default) */
   SILC_SSH_KEY_SSH2      = 2,     /* SSH2 public key, RFC 4716 */
 } SilcSshKeyType;
+/***/
 
 /****s* silcssh/SilcSshPublicKey
  *