diff --git a/annotated.html b/annotated.html index ce9ddbe..9715b3f 100644 --- a/annotated.html +++ b/annotated.html @@ -3,44 +3,35 @@ + post quantum cryptography: Data Structures - - - - + + - + -
- - +
- - - - -
post quantum cryptography -
Highly optimized implementation of the NTRUEncrypt algorithm
- - + + @@ -74,24 +65,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Data Fields
  • -
    -
    -
    -
    Data Structures
    -
    -
    -
    Here are the data structures with brief descriptions:
    - - - -
    keypair
    ntru_params
    string
    -
    +
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -100,13 +80,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - +
    +
    +
    Data Structures
    +
    +
    +
    Here are the data structures with brief descriptions:
    + + + + +
     Ckeypair
     Cntru_params
     Cstring
    +
    +
    + - diff --git a/bc_s.png b/bc_s.png index e401862..224b29a 100644 Binary files a/bc_s.png and b/bc_s.png differ diff --git a/bdwn.png b/bdwn.png new file mode 100644 index 0000000..940a0b9 Binary files /dev/null and b/bdwn.png differ diff --git a/classes.html b/classes.html index 9f907f9..7d94b0c 100644 --- a/classes.html +++ b/classes.html @@ -3,44 +3,35 @@ + post quantum cryptography: Data Structure Index - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -74,30 +65,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Data Fields
  • -
    -
    -
    -
    Data Structure Index
    -
    -
    -
    K | N | S
    - - - - - -
      K  
    -
      N  
    -
      S  
    -
    keypair   ntru_params   string   
    -
    K | N | S
    -
    +
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -106,13 +80,28 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - +
    +
    +
    Data Structure Index
    +
    +
    +
    K | N | S
    + + + + + +
      k  
    +
      n  
    +
      s  
    +
    keypair   ntru_params   string   
    +
    K | N | S
    +
    + - diff --git a/closed.png b/closed.png index b7d4bd9..98cc2c9 100644 Binary files a/closed.png and b/closed.png differ diff --git a/decrypt_8h.html b/decrypt_8h.html index 7e4f515..fd288a5 100644 --- a/decrypt_8h.html +++ b/decrypt_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/decrypt.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,46 +64,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    + + +
    Functions
    -
    /home/travis/build/hasufell/pqc/include/decrypt.h File Reference
    +
    decrypt.h File Reference

    public API, decryption More...

    -
    #include "ntru.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for decrypt.h:
    - +

    Go to the source code of this file.

    - - + +

    +

    Functions

    stringntru_decrypt_string (const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
    stringntru_decrypt_string (const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    public API, decryption

    This file holds the public API of decryption of the pqc NTRU implementation and is meant to be installed on the client system.

    Definition in file decrypt.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -141,10 +151,9 @@ Functions
    string* ntru_decrypt_string string* ntru_decrypt_string ( const string encr_msg,
    -
    -
    +

    Decryption of a given encrypted string.

    -
    Parameters:
    +
    Parameters
    @@ -153,9 +162,9 @@ Functions
    encr_msgthe encrypted message in the form of a string
    priv_keythe polynom containing the private key to decrypt the message
    -
    Returns:
    the decrypted string or NULL on failure
    +
    Returns
    the decrypted string or NULL on failure

    Decryption of a given encrypted string.

    -
    Parameters:
    +
    Parameters
    @@ -164,34 +173,18 @@ Functions
    encr_msgthe encrypted message in the form of a string
    priv_keythe polynom containing the private key to decrypt the message
    -
    Returns:
    the decrypted string
    +
    Returns
    the decrypted string

    Definition at line 92 of file ntru_decrypt.c.

    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/decrypt_8h__incl.dot b/decrypt_8h__incl.dot deleted file mode 100644 index 477a69a..0000000 --- a/decrypt_8h__incl.dot +++ /dev/null @@ -1,16 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/include/decrypt.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru_8h.html",tooltip="public API, basic data types"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/decrypt_8h__incl.map b/decrypt_8h__incl.map new file mode 100644 index 0000000..1131961 --- /dev/null +++ b/decrypt_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/decrypt_8h__incl.md5 b/decrypt_8h__incl.md5 index 44e10bd..2f3f458 100644 --- a/decrypt_8h__incl.md5 +++ b/decrypt_8h__incl.md5 @@ -1 +1 @@ -ec7cb992a1c085002004ee39f7a320d8 \ No newline at end of file +fb24b66731f4f649376520135129d066 \ No newline at end of file diff --git a/decrypt_8h__incl.png b/decrypt_8h__incl.png new file mode 100644 index 0000000..f496123 Binary files /dev/null and b/decrypt_8h__incl.png differ diff --git a/decrypt_8h_source.html b/decrypt_8h_source.html index bcc4e34..e4e2dc4 100644 --- a/decrypt_8h_source.html +++ b/decrypt_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/decrypt.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,59 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/include/decrypt.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00030 #ifndef PUBLIC_NTRU_DECRYPT_H_
    -00031 #define PUBLIC_NTRU_DECRYPT_H_
    -00032 
    -00033 
    -00034 #include "ntru.h"
    -00035 
    -00036 #include <fmpz_poly.h>
    -00037 #include <fmpz.h>
    -00038 
    -00039 
    -00050 string *
    -00051 ntru_decrypt_string(
    -00052         const string *encr_msg,
    -00053         const fmpz_poly_t priv_key,
    -00054         const fmpz_poly_t priv_key_inv,
    -00055         const ntru_params *params);
    -00056 
    -00057 
    -00058 #endif /* PUBLIC_NTRU_DECRYPT_H_ */
    -
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -134,13 +78,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    decrypt.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    30 #ifndef PUBLIC_NTRU_DECRYPT_H_
    +
    31 #define PUBLIC_NTRU_DECRYPT_H_
    +
    32 
    +
    33 
    +
    34 #include "ntru.h"
    +
    35 
    +
    36 #include <fmpz_poly.h>
    +
    37 #include <fmpz.h>
    +
    38 
    +
    39 
    +
    50 string *
    + +
    52  const string *encr_msg,
    +
    53  const fmpz_poly_t priv_key,
    +
    54  const fmpz_poly_t priv_key_inv,
    +
    55  const ntru_params *params);
    +
    56 
    +
    57 
    +
    58 #endif /* PUBLIC_NTRU_DECRYPT_H_ */
    +
    public API, basic data types
    +
    string * ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
    Definition: ntru_decrypt.c:92
    + +
    + - diff --git a/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/dir_68267d1309a1af8e8297ef4c3efbcdba.html new file mode 100644 index 0000000..8c4caab --- /dev/null +++ b/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -0,0 +1,173 @@ + + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src Directory Reference + + + + + + + + + +
    +
    + + + + + + +
    +
    post quantum cryptography +
    +
    Highly optimized implementation of the NTRUEncrypt algorithm
    +
    +
    + + + + + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    + +
    + + +
    +
    +
    +
    src Directory Reference
    +
    +
    +
    +Directory dependency graph for src:
    +
    +
    /home/travis/build/hasufell/pqc/src
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Files

    file  ntru_ascii_poly.c [code]
     ascii to polynomials
     
    file  ntru_ascii_poly.h [code]
     header for ntru_ascii_poly.c
     
    file  ntru_common.h [code]
     common macros/functions
     
    file  ntru_decrypt.c [code]
     NTRU decryption.
     
    file  ntru_decrypt.h [code]
     header for ntru_decrypt.c
     
    file  ntru_encrypt.c [code]
     NTRU encryption.
     
    file  ntru_encrypt.h [code]
     header for encrypt.c
     
    file  ntru_err.h [code]
     error handling
     
    file  ntru_file.c [code]
     file operations
     
    file  ntru_file.h [code]
     header for ntru_file.c
     
    file  ntru_keypair.c [code]
     key creation and operations
     
    file  ntru_keypair.h [code]
     header for ntru_keypair.c
     
    file  ntru_mem.c [code]
     memory management
     
    file  ntru_mem.h [code]
     header for ntru_mem.c
     
    file  ntru_params.h [code]
     NTRU parameters.
     
    file  ntru_poly.c [code]
     operations on polynomials
     
    file  ntru_poly.h [code]
     header for ntru_poly.c
     
    file  ntru_poly_ascii.c [code]
     polynomials to acii
     
    file  ntru_poly_ascii.h [code]
     header for ntru_poly_ascii.c
     
    file  ntru_rnd.c [code]
     random polynomials
     
    file  ntru_rnd.h [code]
     header for ntru_rnd.c
     
    file  ntru_string.c [code]
     string type and operations
     
    file  ntru_string.h [code]
     header for ntru_string.c
     
    +
    + + + + diff --git a/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map b/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map new file mode 100644 index 0000000..d8bb682 --- /dev/null +++ b/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.map @@ -0,0 +1,3 @@ + + + diff --git a/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 b/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 new file mode 100644 index 0000000..0e72bc2 --- /dev/null +++ b/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.md5 @@ -0,0 +1 @@ +ecc0aab54f5ba6a2126063459d871bbe \ No newline at end of file diff --git a/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png b/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png new file mode 100644 index 0000000..256aacc Binary files /dev/null and b/dir_68267d1309a1af8e8297ef4c3efbcdba_dep.png differ diff --git a/dir_d44c64559bbebec7f509842c48db8b23.html b/dir_d44c64559bbebec7f509842c48db8b23.html new file mode 100644 index 0000000..018ca5f --- /dev/null +++ b/dir_d44c64559bbebec7f509842c48db8b23.html @@ -0,0 +1,119 @@ + + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include Directory Reference + + + + + + + + + +
    +
    + + + + + + +
    +
    post quantum cryptography +
    +
    Highly optimized implementation of the NTRUEncrypt algorithm
    +
    +
    + + + + + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    + +
    + + +
    +
    +
    +
    include Directory Reference
    +
    +
    +
    +Directory dependency graph for include:
    +
    +
    /home/travis/build/hasufell/pqc/include
    + + +
    + + + + + + + + + + + + + + + + + +

    +Files

    file  decrypt.h [code]
     public API, decryption
     
    file  encrypt.h [code]
     public API, encryption
     
    file  keypair.h [code]
     public API, key handling
     
    file  ntru.h [code]
     public API, basic data types
     
    file  rnd.h [code]
     public API, random polynomials
     
    +
    + + + + diff --git a/dir_d44c64559bbebec7f509842c48db8b23_dep.map b/dir_d44c64559bbebec7f509842c48db8b23_dep.map new file mode 100644 index 0000000..b0b0095 --- /dev/null +++ b/dir_d44c64559bbebec7f509842c48db8b23_dep.map @@ -0,0 +1,3 @@ + + + diff --git a/dir_d44c64559bbebec7f509842c48db8b23_dep.md5 b/dir_d44c64559bbebec7f509842c48db8b23_dep.md5 new file mode 100644 index 0000000..dc87a87 --- /dev/null +++ b/dir_d44c64559bbebec7f509842c48db8b23_dep.md5 @@ -0,0 +1 @@ +0949ded2bc36ea9f7de2d964cd6cf98d \ No newline at end of file diff --git a/dir_d44c64559bbebec7f509842c48db8b23_dep.png b/dir_d44c64559bbebec7f509842c48db8b23_dep.png new file mode 100644 index 0000000..8332be9 Binary files /dev/null and b/dir_d44c64559bbebec7f509842c48db8b23_dep.png differ diff --git a/doxygen.css b/doxygen.css index cee0d06..0a8f962 100644 --- a/doxygen.css +++ b/doxygen.css @@ -1,31 +1,50 @@ -/* The standard CSS for doxygen */ +/* The standard CSS for doxygen 1.8.7 */ body, table, div, p, dl { - font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; - font-size: 13px; - line-height: 1.3; + font: 400 14px/22px Roboto,sans-serif; } /* @group Heading Levels */ -h1 { +h1.groupheader { font-size: 150%; } .title { + font: 400 14px/28px Roboto,sans-serif; font-size: 150%; font-weight: bold; margin: 10px 2px; } -h2 { - font-size: 120%; +h2.groupheader { + border-bottom: 1px solid #879ECB; + color: #354C7B; + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; } -h3 { +h3.groupheader { font-size: 100%; } +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px cyan; +} + dt { font-weight: bold; } @@ -37,10 +56,14 @@ div.multicol { -webkit-column-count: 3; } -p.startli, p.startdd, p.starttd { +p.startli, p.startdd { margin-top: 2px; } +p.starttd { + margin-top: 0px; +} + p.endli { margin-bottom: 0px; } @@ -122,11 +145,11 @@ a.el { a.elRef { } -a.code, a.code:visited { +a.code, a.code:visited, a.line, a.line:visited { color: #4665A2; } -a.codeRef, a.codeRef:visited { +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { color: #4665A2; } @@ -136,20 +159,72 @@ dl.el { margin-left: -1cm; } -.fragment { - font-family: monospace, fixed; - font-size: 105%; +pre.fragment { + border: 1px solid #C4CFE5; + background-color: #FBFCFD; + padding: 4px 6px; + margin: 4px 8px 4px 2px; + overflow: auto; + word-wrap: break-word; + font-size: 9pt; + line-height: 125%; + font-family: monospace, fixed; + font-size: 105%; } -pre.fragment { - border: 1px solid #C4CFE5; +div.fragment { + padding: 4px 6px; + margin: 4px 8px 4px 2px; background-color: #FBFCFD; - padding: 4px 6px; - margin: 4px 8px 4px 2px; - overflow: auto; - word-wrap: break-word; - font-size: 9pt; - line-height: 125%; + border: 1px solid #C4CFE5; +} + +div.line { + font-family: monospace, fixed; + font-size: 13px; + min-height: 13px; + line-height: 1.0; + text-wrap: unrestricted; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -53px; + padding-left: 53px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line.glow { + background-color: cyan; + box-shadow: 0 0 10px cyan; +} + + +span.lineno { + padding-right: 4px; + text-align: right; + border-right: 2px solid #0F0; + background-color: #E8E8E8; + white-space: pre; +} +span.lineno a { + background-color: #D8D8D8; +} + +span.lineno a:hover { + background-color: #C8C8C8; } div.ah { @@ -189,7 +264,7 @@ body { div.contents { margin-top: 10px; - margin-left: 8px; + margin-left: 12px; margin-right: 8px; } @@ -293,6 +368,13 @@ span.vhdllogic { color: #ff0000 } +blockquote { + background-color: #F7F8FB; + border-left: 2px solid #9CAFD4; + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + /* @end */ /* @@ -346,6 +428,24 @@ table.memberdecls { padding: 0px; } +.memberdecls td, .fieldtable tr { + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: cyan; + box-shadow: 0 0 15px cyan; +} + .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight, .memTemplParams { @@ -360,8 +460,11 @@ table.memberdecls { color: #555; } -.memItemLeft, .memItemRight, .memTemplParams { - border-top: 1px solid #C4CFE5; +.memSeparator { + border-bottom: 1px solid #DEE4F0; + line-height: 1px; + margin: 0px; + padding: 0px; } .memItemLeft, .memTemplItemLeft { @@ -375,6 +478,7 @@ table.memberdecls { .memTemplParams { color: #4665A2; white-space: nowrap; + font-size: 80%; } /* @end */ @@ -407,14 +511,28 @@ table.memberdecls { padding: 0; margin-bottom: 10px; margin-right: 5px; + -webkit-transition: box-shadow 0.5s linear; + -moz-transition: box-shadow 0.5s linear; + -ms-transition: box-shadow 0.5s linear; + -o-transition: box-shadow 0.5s linear; + transition: box-shadow 0.5s linear; + display: table !important; + width: 100%; +} + +.memitem.glow { + box-shadow: 0 0 15px cyan; } .memname { - white-space: nowrap; font-weight: bold; margin-left: 6px; } +.memname td { + vertical-align: bottom; +} + .memproto, dl.reflist dt { border-top: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; @@ -423,21 +541,21 @@ table.memberdecls { color: #253555; font-weight: bold; text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); - /* opera specific markup */ - box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - border-top-right-radius: 8px; - border-top-left-radius: 8px; - /* firefox specific markup */ - -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; - -moz-border-radius-topright: 8px; - -moz-border-radius-topleft: 8px; - /* webkit specific markup */ - -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - -webkit-border-top-right-radius: 8px; - -webkit-border-top-left-radius: 8px; background-image:url('nav_f.png'); background-repeat:repeat-x; background-color: #E2E8F2; + /* opera specific markup */ + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + border-top-right-radius: 4px; + border-top-left-radius: 4px; + /* firefox specific markup */ + -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; + -moz-border-radius-topright: 4px; + -moz-border-radius-topleft: 4px; + /* webkit specific markup */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); + -webkit-border-top-right-radius: 4px; + -webkit-border-top-left-radius: 4px; } @@ -445,23 +563,24 @@ table.memberdecls { border-bottom: 1px solid #A8B8D9; border-left: 1px solid #A8B8D9; border-right: 1px solid #A8B8D9; - padding: 2px 5px; + padding: 6px 10px 2px 10px; background-color: #FBFCFD; border-top-width: 0; + background-image:url('nav_g.png'); + background-repeat:repeat-x; + background-color: #FFFFFF; /* opera specific markup */ - border-bottom-left-radius: 8px; - border-bottom-right-radius: 8px; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); /* firefox specific markup */ - -moz-border-radius-bottomleft: 8px; - -moz-border-radius-bottomright: 8px; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px; - background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7); /* webkit specific markup */ - -webkit-border-bottom-left-radius: 8px; - -webkit-border-bottom-right-radius: 8px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); - background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7)); } dl.reflist dt { @@ -488,9 +607,13 @@ dl.reflist dd { .paramname em { font-style: normal; } +.paramname code { + line-height: 14px; +} .params, .retval, .exception, .tparams { - border-spacing: 6px 2px; + margin-left: 0px; + padding-left: 0px; } .params .paramname, .retval .paramname { @@ -508,105 +631,191 @@ dl.reflist dd { vertical-align: top; } +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: #728DC1; + border-top:1px solid #5373B4; + border-left:1px solid #5373B4; + border-right:1px solid #C4CFE5; + border-bottom:1px solid #C4CFE5; + text-shadow: none; + color: white; + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} /* @end */ -/* @group Directory (tree) */ +/* these are for tree view inside a (index) page */ -/* for the tree view */ - -.ftvtree { - font-family: sans-serif; - margin: 0px; +div.directory { + margin: 10px 0px; + border-top: 1px solid #9CAFD4; + border-bottom: 1px solid #9CAFD4; + width: 100%; } -/* these are for tree view when used as main index */ - -.directory { - font-size: 9pt; - font-weight: bold; - margin: 5px; +.directory table { + border-collapse:collapse; } -.directory h3 { - margin: 0px; - margin-top: 1em; - font-size: 11pt; +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; } -/* -The following two styles can be used to replace the root node title -with an image of your choice. Simply uncomment the next two styles, -specify the name of your image and be sure to set 'height' to the -proper pixel height of your image. -*/ - -/* -.directory h3.swap { - height: 61px; - background-repeat: no-repeat; - background-image: url("yourimage.gif"); -} -.directory h3.swap span { - display: none; -} -*/ - -.directory > h3 { - margin-top: 0; +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; } -.directory p { - margin: 0px; - white-space: nowrap; +.directory td.entry a { + outline:none; } -.directory div { - display: none; - margin: 0px; +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.even { + padding-left: 6px; + background-color: #F7F8FB; } .directory img { vertical-align: -30%; } -/* these are for tree view when not used as main index */ - -.directory-alt { - font-size: 100%; - font-weight: bold; +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; } -.directory-alt h3 { - margin: 0px; - margin-top: 1em; - font-size: 11pt; +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: #3D578C; } -.directory-alt > h3 { - margin-top: 0; +.arrow { + color: #9CAFD4; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 22px; } -.directory-alt p { - margin: 0px; - white-space: nowrap; +.icon { + font-family: Arial, Helvetica; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: #728DC1; + color: white; + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; } -.directory-alt div { - display: none; - margin: 0px; +.icona { + width: 24px; + height: 22px; + display: inline-block; } -.directory-alt img { - vertical-align: -30%; +.iconfopen { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2folderopen.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.iconfclosed { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2folderclosed.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +.icondoc { + width: 24px; + height: 18px; + margin-bottom: 4px; + background-image:url('ftv2doc.png'); + background-position: 0px -4px; + background-repeat: repeat-y; + vertical-align:top; + display: inline-block; +} + +table.directory { + font: 400 14px Roboto,sans-serif; } /* @end */ div.dynheader { margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } address { @@ -616,6 +825,8 @@ address { table.doxtable { border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; } table.doxtable td, table.doxtable th { @@ -629,11 +840,10 @@ table.doxtable th { font-size: 110%; padding-bottom: 4px; padding-top: 5px; - text-align:left; } table.fieldtable { - width: 100%; + /*width: 100%;*/ margin-bottom: 10px; border: 1px solid #A8B8D9; border-spacing: 0px; @@ -656,9 +866,21 @@ table.fieldtable { vertical-align: top; } +.fieldtable td.fieldname { + padding-top: 3px; +} + .fieldtable td.fielddoc { border-bottom: 1px solid #A8B8D9; - width: 100%; + /*width: 100%;*/ +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; } .fieldtable tr:last-child td { @@ -699,6 +921,7 @@ table.fieldtable { font-size: 11px; background-image:url('tab_b.png'); background-repeat:repeat-x; + background-position: 0 -5px; height:30px; line-height:30px; color:#8AA0CC; @@ -726,6 +949,10 @@ table.fieldtable { display:block; text-decoration: none; outline: none; + color: #283A5D; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; } .navpath li.navelem a:hover @@ -763,9 +990,7 @@ div.summary a div.ingroups { - margin-left: 5px; font-size: 8pt; - padding-left: 5px; width: 50%; text-align: left; } @@ -786,7 +1011,7 @@ div.header div.headertitle { - padding: 5px 5px 5px 7px; + padding: 5px 5px 5px 10px; } dl @@ -794,47 +1019,74 @@ dl padding: 0 0 0 10px; } -dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug +/* dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug */ +dl.section { - border-left:4px solid; - padding: 0 0 0 6px; + margin-left: 0px; + padding-left: 0px; } dl.note { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #D0C000; } dl.warning, dl.attention { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #FF0000; } dl.pre, dl.post, dl.invariant { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #00D000; } dl.deprecated { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #505050; } dl.todo { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #00C0E0; } dl.test { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #3030E0; } dl.bug { + margin-left:-7px; + padding-left: 3px; + border-left:4px solid; border-color: #C08050; } +dl.section dd { + margin-bottom: 6px; +} + + #projectlogo { text-align: center; @@ -891,6 +1143,11 @@ dl.bug text-align: center; } +.diagraph +{ + text-align: center; +} + .caption { font-weight: bold; @@ -918,6 +1175,250 @@ dl.citelist dd { padding:5px 0; } +div.toc { + padding: 14px 25px; + background-color: #F4F6FA; + border: 1px solid #D8DFEE; + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 20px 10px 10px; + width: 200px; +} + +div.toc li { + background: url("bdwn.png") no-repeat scroll 0 5px transparent; + font: 10px/1.2 Verdana,DejaVu Sans,Geneva,sans-serif; + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +div.toc h3 { + font: bold 12px/1.2 Arial,FreeSans,sans-serif; + color: #4665A2; + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.level2 { + margin-left: 15px; +} + +div.toc li.level3 { + margin-left: 30px; +} + +div.toc li.level4 { + margin-left: 45px; +} + +.inherit_header { + font-weight: bold; + color: gray; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0px 2px 5px; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 4px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + white-space: nowrap; + background-color: white; + border: 1px solid gray; + border-radius: 4px 4px 4px 4px; + box-shadow: 1px 1px 7px gray; + display: none; + font-size: smaller; + max-width: 80%; + opacity: 0.9; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: grey; + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: #006318; +} + +#powerTip div { + margin: 0px; + padding: 0px; + font: 12px/16px Roboto,sans-serif; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: #ffffff; + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before { + border-top-color: #808080; + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: #ffffff; + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: #808080; + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: #ffffff; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: #ffffff; + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: #808080; + border-width: 11px; + top: 50%; + margin-top: -11px; +} + @media print { #top { display: none; } @@ -935,15 +1436,5 @@ dl.citelist dd { overflow:inherit; display:inline; } - pre.fragment - { - overflow: visible; - text-wrap: unrestricted; - white-space: -moz-pre-wrap; /* Moz */ - white-space: -pre-wrap; /* Opera 4-6 */ - white-space: -o-pre-wrap; /* Opera 7 */ - white-space: pre-wrap; /* CSS3 */ - word-wrap: break-word; /* IE 5.5+ */ - } } diff --git a/doxygen.png b/doxygen.png index 635ed52..3ff17d8 100644 Binary files a/doxygen.png and b/doxygen.png differ diff --git a/doxygen_8dox.html b/doxygen_8dox.html index 3f4ab57..64442ba 100644 --- a/doxygen_8dox.html +++ b/doxygen_8dox.html @@ -3,44 +3,35 @@ + post quantum cryptography: doxygen.dox File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,19 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    doxygen.dox File Reference
    -
    -
    -
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -94,13 +78,18 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + +
    +
    +
    doxygen.dox File Reference
    +
    +
    +
    + - diff --git a/dynsections.js b/dynsections.js new file mode 100644 index 0000000..1e6bf07 --- /dev/null +++ b/dynsections.js @@ -0,0 +1,104 @@ +function toggleVisibility(linkObj) +{ + var base = $(linkObj).attr('id'); + var summary = $('#'+base+'-summary'); + var content = $('#'+base+'-content'); + var trigger = $('#'+base+'-trigger'); + var src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.hide(); + summary.show(); + $(linkObj).addClass('closed').removeClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); + } else { + content.show(); + summary.hide(); + $(linkObj).removeClass('closed').addClass('opened'); + $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); + } + return false; +} + +function updateStripes() +{ + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); +} + +function toggleLevel(level) +{ + $('table.directory tr').each(function() { + var l = this.id.split('_').length-1; + var i = $('#img'+this.id.substring(3)); + var a = $('#arr'+this.id.substring(3)); + if (l + post quantum cryptography: /home/travis/build/hasufell/pqc/include/encrypt.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,46 +64,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/include/encrypt.h File Reference
    +
    encrypt.h File Reference

    public API, encryption More...

    -
    #include "ntru.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for encrypt.h:
    - +

    Go to the source code of this file.

    - - + +

    +

    Functions

    stringntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
    stringntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    public API, encryption

    This file holds the public API of encryption of the pqc NTRU implementation and is meant to be installed on the client system.

    Definition in file encrypt.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -141,10 +151,9 @@ Functions
    string* ntru_encrypt_string string* ntru_encrypt_string ( const string msg,
    -
    -
    +

    Encrypt a message in the form of a null-terminated char array and return a string.

    -
    Parameters:
    +
    Parameters
    @@ -153,9 +162,9 @@ Functions
    msgthe message
    pub_keythe public key
    -
    Returns:
    the newly allocated encrypted string, NULL on failure
    +
    Returns
    the newly allocated encrypted string, NULL on failure

    Encrypt a message in the form of a null-terminated char array and return a string.

    -
    Parameters:
    +
    Parameters
    @@ -164,34 +173,18 @@ Functions
    msgthe message
    pub_keythe public key
    -
    Returns:
    the newly allocated encrypted string
    +
    Returns
    the newly allocated encrypted string

    Definition at line 74 of file ntru_encrypt.c.

    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/encrypt_8h__incl.dot b/encrypt_8h__incl.dot deleted file mode 100644 index fa7bec7..0000000 --- a/encrypt_8h__incl.dot +++ /dev/null @@ -1,16 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/include/encrypt.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru_8h.html",tooltip="public API, basic data types"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/encrypt_8h__incl.map b/encrypt_8h__incl.map new file mode 100644 index 0000000..077af7d --- /dev/null +++ b/encrypt_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/encrypt_8h__incl.md5 b/encrypt_8h__incl.md5 index e82dea2..2f576d6 100644 --- a/encrypt_8h__incl.md5 +++ b/encrypt_8h__incl.md5 @@ -1 +1 @@ -f9fe215186c65b1a48490e4808f402c4 \ No newline at end of file +6aad9be46b94806b9b3f39bcf0b88dd9 \ No newline at end of file diff --git a/encrypt_8h__incl.png b/encrypt_8h__incl.png new file mode 100644 index 0000000..d3d9ec7 Binary files /dev/null and b/encrypt_8h__incl.png differ diff --git a/encrypt_8h_source.html b/encrypt_8h_source.html index c290fd5..c9da5ea 100644 --- a/encrypt_8h_source.html +++ b/encrypt_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/encrypt.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,59 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/include/encrypt.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00030 #ifndef PUBLIC_NTRU_ENCRYPT_H_
    -00031 #define PUBLIC_NTRU_ENCRYPT_H_
    -00032 
    -00033 
    -00034 #include "ntru.h"
    -00035 
    -00036 #include <fmpz_poly.h>
    -00037 #include <fmpz.h>
    -00038 
    -00039 
    -00051 string *
    -00052 ntru_encrypt_string(
    -00053         const string *msg,
    -00054         const fmpz_poly_t pub_key,
    -00055         const fmpz_poly_t rnd,
    -00056         const ntru_params *params);
    -00057 
    -00058 
    -00059 #endif /* PUBLIC_NTRU_ENCRYPT_H_ */
    -
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -134,13 +78,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    encrypt.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    30 #ifndef PUBLIC_NTRU_ENCRYPT_H_
    +
    31 #define PUBLIC_NTRU_ENCRYPT_H_
    +
    32 
    +
    33 
    +
    34 #include "ntru.h"
    +
    35 
    +
    36 #include <fmpz_poly.h>
    +
    37 #include <fmpz.h>
    +
    38 
    +
    39 
    +
    51 string *
    + +
    53  const string *msg,
    +
    54  const fmpz_poly_t pub_key,
    +
    55  const fmpz_poly_t rnd,
    +
    56  const ntru_params *params);
    +
    57 
    +
    58 
    +
    59 #endif /* PUBLIC_NTRU_ENCRYPT_H_ */
    +
    string * ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
    Definition: ntru_encrypt.c:74
    +
    public API, basic data types
    + +
    + - diff --git a/files.html b/files.html index 53fb737..150da6b 100644 --- a/files.html +++ b/files.html @@ -3,44 +3,35 @@ + post quantum cryptography: File List - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,49 +64,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    File List
    -
    -
    -
    Here is a list of all files with brief descriptions:
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    /home/travis/build/hasufell/pqc/include/decrypt.h [code]Public API, decryption
    /home/travis/build/hasufell/pqc/include/encrypt.h [code]Public API, encryption
    /home/travis/build/hasufell/pqc/include/keypair.h [code]Public API, key handling
    /home/travis/build/hasufell/pqc/include/ntru.h [code]Public API, basic data types
    /home/travis/build/hasufell/pqc/include/rnd.h [code]Public API, random polynomials
    /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.c [code]Ascii to polynomials
    /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h [code]Header for ntru_ascii_poly.c
    /home/travis/build/hasufell/pqc/src/ntru_common.h [code]Common macros/functions
    /home/travis/build/hasufell/pqc/src/ntru_decrypt.c [code]NTRU decryption
    /home/travis/build/hasufell/pqc/src/ntru_decrypt.h [code]Header for ntru_decrypt.c
    /home/travis/build/hasufell/pqc/src/ntru_encrypt.c [code]NTRU encryption
    /home/travis/build/hasufell/pqc/src/ntru_encrypt.h [code]Header for encrypt.c
    /home/travis/build/hasufell/pqc/src/ntru_err.h [code]Error handling
    /home/travis/build/hasufell/pqc/src/ntru_file.c [code]File operations
    /home/travis/build/hasufell/pqc/src/ntru_file.h [code]Header for ntru_file.c
    /home/travis/build/hasufell/pqc/src/ntru_keypair.c [code]Key creation and operations
    /home/travis/build/hasufell/pqc/src/ntru_keypair.h [code]Header for ntru_keypair.c
    /home/travis/build/hasufell/pqc/src/ntru_mem.c [code]Memory management
    /home/travis/build/hasufell/pqc/src/ntru_mem.h [code]Header for ntru_mem.c
    /home/travis/build/hasufell/pqc/src/ntru_params.h [code]NTRU parameters
    /home/travis/build/hasufell/pqc/src/ntru_poly.c [code]Operations on polynomials
    /home/travis/build/hasufell/pqc/src/ntru_poly.h [code]Header for ntru_poly.c
    /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.c [code]Polynomials to acii
    /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h [code]Header for ntru_poly_ascii.c
    /home/travis/build/hasufell/pqc/src/ntru_rnd.c [code]Random polynomials
    /home/travis/build/hasufell/pqc/src/ntru_rnd.h [code]Header for ntru_rnd.c
    /home/travis/build/hasufell/pqc/src/ntru_string.c [code]String type and operations
    /home/travis/build/hasufell/pqc/src/ntru_string.h [code]Header for ntru_string.c
    -
    +
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -124,13 +79,51 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - +
    +
    +
    File List
    +
    +
    +
    Here is a list of all files with brief descriptions:
    +
    [detail level 12]
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      include
     decrypt.hPublic API, decryption
     encrypt.hPublic API, encryption
     keypair.hPublic API, key handling
     ntru.hPublic API, basic data types
     rnd.hPublic API, random polynomials
      src
     ntru_ascii_poly.cAscii to polynomials
     ntru_ascii_poly.hHeader for ntru_ascii_poly.c
     ntru_common.hCommon macros/functions
     ntru_decrypt.cNTRU decryption
     ntru_decrypt.hHeader for ntru_decrypt.c
     ntru_encrypt.cNTRU encryption
     ntru_encrypt.hHeader for encrypt.c
     ntru_err.hError handling
     ntru_file.cFile operations
     ntru_file.hHeader for ntru_file.c
     ntru_keypair.cKey creation and operations
     ntru_keypair.hHeader for ntru_keypair.c
     ntru_mem.cMemory management
     ntru_mem.hHeader for ntru_mem.c
     ntru_params.hNTRU parameters
     ntru_poly.cOperations on polynomials
     ntru_poly.hHeader for ntru_poly.c
     ntru_poly_ascii.cPolynomials to acii
     ntru_poly_ascii.hHeader for ntru_poly_ascii.c
     ntru_rnd.cRandom polynomials
     ntru_rnd.hHeader for ntru_rnd.c
     ntru_string.cString type and operations
     ntru_string.hHeader for ntru_string.c
    +
    +
    + - diff --git a/ftv2blank.png b/ftv2blank.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/ftv2blank.png differ diff --git a/ftv2doc.png b/ftv2doc.png new file mode 100644 index 0000000..17edabf Binary files /dev/null and b/ftv2doc.png differ diff --git a/ftv2folderclosed.png b/ftv2folderclosed.png new file mode 100644 index 0000000..bb8ab35 Binary files /dev/null and b/ftv2folderclosed.png differ diff --git a/ftv2folderopen.png b/ftv2folderopen.png new file mode 100644 index 0000000..d6c7f67 Binary files /dev/null and b/ftv2folderopen.png differ diff --git a/ftv2lastnode.png b/ftv2lastnode.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/ftv2lastnode.png differ diff --git a/ftv2link.png b/ftv2link.png new file mode 100644 index 0000000..17edabf Binary files /dev/null and b/ftv2link.png differ diff --git a/ftv2mlastnode.png b/ftv2mlastnode.png new file mode 100644 index 0000000..0b63f6d Binary files /dev/null and b/ftv2mlastnode.png differ diff --git a/ftv2mnode.png b/ftv2mnode.png new file mode 100644 index 0000000..0b63f6d Binary files /dev/null and b/ftv2mnode.png differ diff --git a/ftv2node.png b/ftv2node.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/ftv2node.png differ diff --git a/ftv2plastnode.png b/ftv2plastnode.png new file mode 100644 index 0000000..c6ee22f Binary files /dev/null and b/ftv2plastnode.png differ diff --git a/ftv2pnode.png b/ftv2pnode.png new file mode 100644 index 0000000..c6ee22f Binary files /dev/null and b/ftv2pnode.png differ diff --git a/ftv2splitbar.png b/ftv2splitbar.png new file mode 100644 index 0000000..fe895f2 Binary files /dev/null and b/ftv2splitbar.png differ diff --git a/ftv2vertline.png b/ftv2vertline.png new file mode 100644 index 0000000..63c605b Binary files /dev/null and b/ftv2vertline.png differ diff --git a/functions.html b/functions.html index 7e6327f..33afa0c 100644 --- a/functions.html +++ b/functions.html @@ -3,44 +3,35 @@ + post quantum cryptography: Data Fields - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -80,7 +71,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Variables
  • +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
    Here is a list of all struct and union fields with links to the structures/unions they belong to:
    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/functions_vars.html b/functions_vars.html index 2d6c229..340c400 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -3,44 +3,35 @@ + post quantum cryptography: Data Fields - Variables - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -80,7 +71,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Variables
  • +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
     
    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/globals.html b/globals.html index 3b692e3..5d4b123 100644 --- a/globals.html +++ b/globals.html @@ -3,44 +3,35 @@ + post quantum cryptography: Globals - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -78,7 +69,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • All
  • Functions
  • Typedefs
  • -
  • Defines
  • +
  • Macros
  • +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
    Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
    @@ -391,27 +396,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/globals_defs.html b/globals_defs.html index 31be725..2428dfe 100644 --- a/globals_defs.html +++ b/globals_defs.html @@ -3,44 +3,35 @@ + post quantum cryptography: Globals - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -78,10 +69,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • All
  • Functions
  • Typedefs
  • -
  • Defines
  • +
  • Macros
  • +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
     
    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/globals_func.html b/globals_func.html index b41dbeb..3adfe30 100644 --- a/globals_func.html +++ b/globals_func.html @@ -3,44 +3,35 @@ + post quantum cryptography: Globals - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -78,7 +69,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • All
  • Functions
  • Typedefs
  • -
  • Defines
  • +
  • Macros
  • +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
      @@ -178,9 +183,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ntru_ascii_poly.c
  • get_rnd_int() -: ntru_rnd.h -, rnd.h +: rnd.h , ntru_rnd.c +, ntru_rnd.h
  • get_urnd_int() : rnd.h @@ -210,9 +215,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , ntru_mem.h
  • ntru_create_keypair() -: ntru_keypair.h -, keypair.h +: keypair.h , ntru_keypair.c +, ntru_keypair.h
  • ntru_decrypt_poly() : ntru_decrypt.c @@ -238,9 +243,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , ntru_encrypt.c
  • ntru_get_rnd_tern_poly_num() -: rnd.h +: ntru_rnd.h +, rnd.h , ntru_rnd.c -, ntru_rnd.h
  • ntru_malloc() : ntru_mem.h @@ -274,9 +279,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); , ntru.h
  • poly_draw() -: ntru.h +: ntru_poly.h +, ntru.h , ntru_poly.c -, ntru_poly.h
  • poly_draw_pretty() : ntru_poly.c @@ -295,9 +300,9 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); : ntru_poly.c
  • poly_new() -: ntru.h +: ntru_poly.h +, ntru.h , ntru_poly.c -, ntru_poly.h
  • poly_starmultiply() : ntru_poly.c @@ -345,27 +350,11 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/globals_type.html b/globals_type.html index af2cd7f..e0baf46 100644 --- a/globals_type.html +++ b/globals_type.html @@ -3,44 +3,35 @@ + post quantum cryptography: Globals - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -78,10 +69,24 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • All
  • Functions
  • Typedefs
  • -
  • Defines
  • +
  • Macros
  • +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
     
    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/graph_legend.dot b/graph_legend.dot deleted file mode 100644 index f7e78c2..0000000 --- a/graph_legend.dot +++ /dev/null @@ -1,22 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node9 [shape="box",label="Inherited",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",fillcolor="grey75",style="filled" fontcolor="black"]; - Node10 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [shape="box",label="PublicBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPublicBase.html"]; - Node11 -> Node10 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [shape="box",label="Truncated",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="red",URL="$classTruncated.html"]; - Node13 -> Node9 [dir="back",color="darkgreen",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [shape="box",label="ProtectedBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classProtectedBase.html"]; - Node14 -> Node9 [dir="back",color="firebrick4",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [shape="box",label="PrivateBase",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classPrivateBase.html"]; - Node15 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [shape="box",label="Undocumented",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="grey75"]; - Node16 -> Node9 [dir="back",color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [shape="box",label="Templ< int >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; - Node17 -> Node16 [dir="back",color="orange",fontsize="10",style="dashed",label="< int >",fontname="Helvetica"]; - Node17 [shape="box",label="Templ< T >",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classTempl.html"]; - Node18 -> Node9 [dir="back",color="darkorchid3",fontsize="10",style="dashed",label="m_usedClass",fontname="Helvetica"]; - Node18 [shape="box",label="Used",fontsize="10",height=0.2,width=0.4,fontname="Helvetica",color="black",URL="$classUsed.html"]; -} diff --git a/graph_legend.html b/graph_legend.html index 51fd017..086943f 100644 --- a/graph_legend.html +++ b/graph_legend.html @@ -3,44 +3,35 @@ + post quantum cryptography: Graph Legend - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -67,53 +58,66 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    +
    + +
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    + + +
    +
    +
    Graph Legend

    This page explains how to interpret the graphs that are generated by doxygen.

    -

    Consider the following example:

    -
    /*! Invisible class because of truncation */
    -class Invisible { };
    -
    -/*! Truncated class, inheritance relation is hidden */
    -class Truncated : public Invisible { };
    -
    -/* Class not documented with doxygen comments */
    -class Undocumented { };
    -
    -/*! Class that is inherited using public inheritance */
    -class PublicBase : public Truncated { };
    -
    -/*! A template class */
    -template<class T> class Templ { };
    -
    -/*! Class that is inherited using protected inheritance */
    -class ProtectedBase { };
    -
    -/*! Class that is inherited using private inheritance */
    -class PrivateBase { };
    -
    -/*! Class that is used by the Inherited class */
    -class Used { };
    -
    -/*! Super class that inherits a number of other classes */
    -class Inherited : public PublicBase,
    -                  protected ProtectedBase,
    -                  private PrivateBase,
    -                  public Undocumented,
    -                  public Templ<int>
    -{
    -  private:
    -    Used *m_usedClass;
    -};
    -

    This will result in the following graph:

    +

    Consider the following example:

    /*! Invisible class because of truncation */
    +
    class Invisible { };
    +
    +
    /*! Truncated class, inheritance relation is hidden */
    +
    class Truncated : public Invisible { };
    +
    +
    /* Class not documented with doxygen comments */
    +
    class Undocumented { };
    +
    +
    /*! Class that is inherited using public inheritance */
    +
    class PublicBase : public Truncated { };
    +
    +
    /*! A template class */
    +
    template<class T> class Templ { };
    +
    +
    /*! Class that is inherited using protected inheritance */
    +
    class ProtectedBase { };
    +
    +
    /*! Class that is inherited using private inheritance */
    +
    class PrivateBase { };
    +
    +
    /*! Class that is used by the Inherited class */
    +
    class Used { };
    +
    +
    /*! Super class that inherits a number of other classes */
    +
    class Inherited : public PublicBase,
    +
    protected ProtectedBase,
    +
    private PrivateBase,
    +
    public Undocumented,
    +
    public Templ<int>
    +
    {
    +
    private:
    +
    Used *m_usedClass;
    +
    };
    +

    This will result in the following graph:

    -

    The boxes in the above graph have the following meaning:

    +

    The boxes in the above graph have the following meaning:

    -

    The arrows have the following meaning:

    +

    The arrows have the following meaning:

    - -
    - All Data Structures Files Functions Variables Typedefs Defines
    - - -
    - -
    - - - + - diff --git a/graph_legend.md5 b/graph_legend.md5 index c0a4490..a06ed05 100644 --- a/graph_legend.md5 +++ b/graph_legend.md5 @@ -1 +1 @@ -70d597617e34367275a35eeb8fb7ea07 \ No newline at end of file +387ff8eb65306fa251338d3c9bd7bfff \ No newline at end of file diff --git a/graph_legend.png b/graph_legend.png new file mode 100644 index 0000000..a67a7ca Binary files /dev/null and b/graph_legend.png differ diff --git a/index.html b/index.html index a93a675..15d4b05 100644 --- a/index.html +++ b/index.html @@ -3,44 +3,35 @@ + post quantum cryptography: Index Page - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -67,53 +58,13 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    -
    -
    -
    -
    Index Page
    -
    -
    -
    Author:
    hasufell
    -

    -Introduction

    -

    Highly optimized C implementation of the NTRUEncrypt algorithm, using the FLINT library.

    -

    -Motivation

    -

    Modern quantum computers will enable us to ride extremely effective attacks on crypto algorithms like rsa. One known attack is the quantum algorithm called Shor's algorithm. In the light of fast paced computer hardware development and known quantum algorithms, it is of importance to find and implement alternatives which are not vulnerable to these attacks.

    -

    One known alternative is called NTRU and will be our main focus. It is lattice-based (shortest vector problem in a lattice). In fact, NTRU is a parametrised family of cryptosystems. As such it is represented by the triple (N, p, q), where N is prime, q is always larger than p and p and q are coprime. As well as four sets of polynomials: a polynomial part of the private key, a polynomial for generation of the public key, the message and a blinding value, respectively, all of degree at most N - 1. It is, in theory, very efficient, since encryption and decryption only use simple polynomial multiplication which are very fast compared to asymmetric encryption schemes.

    -

    -Goals

    -

    Our main goal is to implement an alternative library of the NTRU algorithm in C and gather experience in cryptographic programming. Further, it may help to raise awareness of the need of quantum-secure encryption and enable us to contribute to already present implementations. It may even reveal problems of other implementations and help advancing them. It may as well help with diversity in crypto implementations, which is always a good thing. On top of that we will provide a command-line interface to our library and allow basic operations like key creation and encryption from stdin.

    -

    Optimizing the algorithm itself is not within our scope. However, the library may undergo heavy changes on the mathematical implementation of polynomial arithmetic, in order to optimize run-time behaviour.

    -

    -Algorithms

    -

    Most of the algorithms in ntru_poly.c, ntru_decrypt.c, ntru_encrypt.c and ntru_keypair.c are based on the pseudo-code from Efficient NTRU Implementations by Colleen Marie O'Rourke.

    -

    Further work is based on Das NTRU-Kryptosystem von Anja Moldenhauer and the official NTRU Cryptosystems Technical Report #14.

    -

    -License

    -

    LGPL-2.1

    -

    -Dependencies

    -

    This library was written for Linux systems. Support for windows will not be added. \* FLINT-2.4.3 or later (compiled with gmp and mpfr) \* glib-2.0 \* pkg-config (for the build only)

    -

    -Installation

    -

    \* make \* make install

    -

    -Usage

    -

    See this API doc, the public headers are in the include/ subfolder.

    -

    -Performance

    -

    See Performance Analysis on github.

    -

    -References

    -

    \* This library on github \* Original NTRUEncrypt paper \* Efficient NTRU Implementations by Colleen Marie O'Rourke \* Das NTRU-Kryptosystem von Anja Moldenhauer \* NTRU Cryptosystems Technical Report #14 \* The NTRU Cryptosystem: Implementation and Comparative Analysis by Rodney D'Souza \* Wikipedia Article

    -
    +
    - All Data Structures Files Functions Variables Typedefs Defines
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -122,13 +73,79 @@ References
    - - +
    +
    +
    Index Page
    +
    +
    + +
    Author
    hasufell
    +

    +Introduction

    +

    Highly optimized C implementation of the NTRUEncrypt algorithm, using the FLINT library.

    +

    +Motivation

    +

    Modern quantum computers will enable us to ride extremely effective attacks on crypto algorithms like rsa. One known attack is the quantum algorithm called Shor's algorithm. In the light of fast paced computer hardware development and known quantum algorithms, it is of importance to find and implement alternatives which are not vulnerable to these attacks.

    +

    One known alternative is called NTRU and will be our main focus. It is lattice-based (shortest vector problem in a lattice). In fact, NTRU is a parametrised family of cryptosystems. As such it is represented by the triple (N, p, q), where N is prime, q is always larger than p and p and q are coprime. As well as four sets of polynomials: a polynomial part of the private key, a polynomial for generation of the public key, the message and a blinding value, respectively, all of degree at most N - 1. It is, in theory, very efficient, since encryption and decryption only use simple polynomial multiplication which are very fast compared to asymmetric encryption schemes.

    +

    +Goals

    +

    Our main goal is to implement an alternative library of the NTRU algorithm in C and gather experience in cryptographic programming. Further, it may help to raise awareness of the need of quantum-secure encryption and enable us to contribute to already present implementations. It may even reveal problems of other implementations and help advancing them. It may as well help with diversity in crypto implementations, which is always a good thing. On top of that we will provide a command-line interface to our library and allow basic operations like key creation and encryption from stdin.

    +

    Optimizing the algorithm itself is not within our scope. However, the library may undergo heavy changes on the mathematical implementation of polynomial arithmetic, in order to optimize run-time behaviour.

    +

    +Algorithms

    +

    Most of the algorithms in ntru_poly.c, ntru_decrypt.c, ntru_encrypt.c and ntru_keypair.c are based on the pseudo-code from Efficient NTRU Implementations by Colleen Marie O'Rourke.

    +

    Further work is based on Das NTRU-Kryptosystem von Anja Moldenhauer and the official NTRU Cryptosystems Technical Report #14.

    +

    +License

    +

    LGPL-2.1

    +

    +Dependencies

    +

    This library was written for Linux systems. Support for windows will not be added.

    +

    +Installation

    +
      +
    • make
    • +
    • make install
    • +
    +

    +Usage

    +

    See this API doc, the public headers are in the include/ subfolder.

    +

    +Performance

    +

    See Performance Analysis on github.

    +

    +References

    + +
    + - diff --git a/installdox b/installdox deleted file mode 100755 index edf5bbf..0000000 --- a/installdox +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/perl - -%subst = ( ); -$quiet = 0; - -while ( @ARGV ) { - $_ = shift @ARGV; - if ( s/^-// ) { - if ( /^l(.*)/ ) { - $v = ($1 eq "") ? shift @ARGV : $1; - ($v =~ /\/$/) || ($v .= "/"); - $_ = $v; - if ( /(.+)\@(.+)/ ) { - if ( exists $subst{$1} ) { - $subst{$1} = $2; - } else { - print STDERR "Unknown tag file $1 given with option -l\n"; - &usage(); - } - } else { - print STDERR "Argument $_ is invalid for option -l\n"; - &usage(); - } - } - elsif ( /^q/ ) { - $quiet = 1; - } - elsif ( /^\?|^h/ ) { - &usage(); - } - else { - print STDERR "Illegal option -$_\n"; - &usage(); - } - } - else { - push (@files, $_ ); - } -} - -foreach $sub (keys %subst) -{ - if ( $subst{$sub} eq "" ) - { - print STDERR "No substitute given for tag file `$sub'\n"; - &usage(); - } - elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" ) - { - print "Substituting $subst{$sub} for each occurrence of tag file $sub\n"; - } -} - -if ( ! @files ) { - if (opendir(D,".")) { - foreach $file ( readdir(D) ) { - $match = ".html"; - next if ( $file =~ /^\.\.?$/ ); - ($file =~ /$match/) && (push @files, $file); - ($file =~ /\.svg/) && (push @files, $file); - ($file =~ "navtree.js") && (push @files, $file); - } - closedir(D); - } -} - -if ( ! @files ) { - print STDERR "Warning: No input files given and none found!\n"; -} - -foreach $f (@files) -{ - if ( ! $quiet ) { - print "Editing: $f...\n"; - } - $oldf = $f; - $f .= ".bak"; - unless (rename $oldf,$f) { - print STDERR "Error: cannot rename file $oldf\n"; - exit 1; - } - if (open(F,"<$f")) { - unless (open(G,">$oldf")) { - print STDERR "Error: opening file $oldf for writing\n"; - exit 1; - } - if ($oldf ne "tree.js") { - while () { - s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g; - print G "$_"; - } - } - else { - while () { - s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g; - print G "$_"; - } - } - } - else { - print STDERR "Warning file $f does not exist\n"; - } - unlink $f; -} - -sub usage { - print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n"; - print STDERR "Options:\n"; - print STDERR " -l tagfile\@linkName tag file + URL or directory \n"; - print STDERR " -q Quiet mode\n\n"; - exit 1; -} diff --git a/jquery.js b/jquery.js index 90b3a2b..6aa2e4c 100644 --- a/jquery.js +++ b/jquery.js @@ -1,64 +1,39 @@ -/* - * jQuery JavaScript Library v1.3.2 +/*! + * jQuery JavaScript Library v1.7.1 * http://jquery.com/ * - * Copyright (c) 2009 John Resig - * Dual licensed under the MIT and GPL licenses. - * http://docs.jquery.com/License + * Copyright 2011, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license * - * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) - * Revision: 6246 + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2011, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Mon Nov 21 21:11:03 2011 -0500 */ -(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("",""]||!O.indexOf("",""]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"","
    "]||!O.indexOf("",""]||(!O.indexOf("",""]||!O.indexOf("",""]||!o.support.htmlSerialize&&[1,"div
    ","
    "]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); -/* - * Sizzle CSS Selector Engine - v0.9.3 - * Copyright 2009, The Dojo Foundation +(function(bb,L){var av=bb.document,bu=bb.navigator,bl=bb.location;var b=(function(){var bF=function(b0,b1){return new bF.fn.init(b0,b1,bD)},bU=bb.jQuery,bH=bb.$,bD,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bE=/\s+$/,bA=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,by=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bB=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bu.userAgent,bV,bC,e,bL=Object.prototype.toString,bG=Object.prototype.hasOwnProperty,bz=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bv=Array.prototype.indexOf,bx={};bF.fn=bF.prototype={constructor:bF,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&av.body){this.context=av;this[0]=av.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bF?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:av);b1=bA.exec(b0);if(b1){if(bF.isPlainObject(b4)){b0=[av.createElement(b1[1])];bF.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bF.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bF.clone(b1.fragment):b1.fragment).childNodes}return bF.merge(this,b0)}else{b5=av.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=av;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bF.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==L){this.selector=b0.selector;this.context=b0.context}return bF.makeArray(b0,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bF.isArray(b1)){bz.apply(b2,b1)}else{bF.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bF.each(this,b1,b0)},ready:function(b0){bF.bindReady();bC.add(b0);return this},eq:function(b0){b0=+b0;return b0===-1?this.slice(b0):this.slice(b0,b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bF.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:bz,sort:[].sort,splice:[].splice};bF.fn.init.prototype=bF.fn;bF.extend=bF.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bF.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b40){return}bC.fireWith(av,[bF]);if(bF.fn.trigger){bF(av).trigger("ready").off("ready")}}},bindReady:function(){if(bC){return}bC=bF.Callbacks("once memory");if(av.readyState==="complete"){return setTimeout(bF.ready,1)}if(av.addEventListener){av.addEventListener("DOMContentLoaded",e,false);bb.addEventListener("load",bF.ready,false)}else{if(av.attachEvent){av.attachEvent("onreadystatechange",e);bb.attachEvent("onload",bF.ready);var b0=false;try{b0=bb.frameElement==null}catch(b1){}if(av.documentElement.doScroll&&b0){bw()}}}},isFunction:function(b0){return bF.type(b0)==="function"},isArray:Array.isArray||function(b0){return bF.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNumeric:function(b0){return !isNaN(parseFloat(b0))&&isFinite(b0)},type:function(b0){return b0==null?String(b0):bx[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bF.type(b2)!=="object"||b2.nodeType||bF.isWindow(b2)){return false}try{if(b2.constructor&&!bG.call(b2,"constructor")&&!bG.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===L||bG.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw new Error(b0)},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bF.trim(b0);if(bb.JSON&&bb.JSON.parse){return bb.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bF.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(bb.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=L}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bF.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(bb.execScript||function(b1){bb["eval"].call(bb,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bB,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===L||bF.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b40&&b0[0]&&b0[b1-1])||b1===0||bF.isArray(b0));if(b3){for(;b21?aJ.call(arguments,0):bG;if(!(--bw)){bC.resolveWith(bC,bx)}}}function bz(bF){return function(bG){bB[bF]=arguments.length>1?aJ.call(arguments,0):bG;bC.notifyWith(bE,bB)}}if(e>1){for(;bv
    a";bI=bv.getElementsByTagName("*");bF=bv.getElementsByTagName("a")[0];if(!bI||!bI.length||!bF){return{}}bG=av.createElement("select");bx=bG.appendChild(av.createElement("option"));bE=bv.getElementsByTagName("input")[0];bJ={leadingWhitespace:(bv.firstChild.nodeType===3),tbody:!bv.getElementsByTagName("tbody").length,htmlSerialize:!!bv.getElementsByTagName("link").length,style:/top/.test(bF.getAttribute("style")),hrefNormalized:(bF.getAttribute("href")==="/a"),opacity:/^0.55/.test(bF.style.opacity),cssFloat:!!bF.style.cssFloat,checkOn:(bE.value==="on"),optSelected:bx.selected,getSetAttribute:bv.className!=="t",enctype:!!av.createElement("form").enctype,html5Clone:av.createElement("nav").cloneNode(true).outerHTML!=="<:nav>",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bE.checked=true;bJ.noCloneChecked=bE.cloneNode(true).checked;bG.disabled=true;bJ.optDisabled=!bx.disabled;try{delete bv.test}catch(bC){bJ.deleteExpando=false}if(!bv.addEventListener&&bv.attachEvent&&bv.fireEvent){bv.attachEvent("onclick",function(){bJ.noCloneEvent=false});bv.cloneNode(true).fireEvent("onclick")}bE=av.createElement("input");bE.value="t";bE.setAttribute("type","radio");bJ.radioValue=bE.value==="t";bE.setAttribute("checked","checked");bv.appendChild(bE);bD=av.createDocumentFragment();bD.appendChild(bv.lastChild);bJ.checkClone=bD.cloneNode(true).cloneNode(true).lastChild.checked;bJ.appendChecked=bE.checked;bD.removeChild(bE);bD.appendChild(bv);bv.innerHTML="";if(bb.getComputedStyle){bA=av.createElement("div");bA.style.width="0";bA.style.marginRight="0";bv.style.width="2px";bv.appendChild(bA);bJ.reliableMarginRight=(parseInt((bb.getComputedStyle(bA,null)||{marginRight:0}).marginRight,10)||0)===0}if(bv.attachEvent){for(by in {submit:1,change:1,focusin:1}){bB="on"+by;bw=(bB in bv);if(!bw){bv.setAttribute(bB,"return;");bw=(typeof bv[bB]==="function")}bJ[by+"Bubbles"]=bw}}bD.removeChild(bv);bD=bG=bx=bA=bv=bE=null;b(function(){var bM,bU,bV,bT,bN,bO,bL,bS,bR,e,bP,bQ=av.getElementsByTagName("body")[0];if(!bQ){return}bL=1;bS="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";bR="visibility:hidden;border:0;";e="style='"+bS+"border:5px solid #000;padding:0;'";bP="
    ";bM=av.createElement("div");bM.style.cssText=bR+"width:0;height:0;position:static;top:0;margin-top:"+bL+"px";bQ.insertBefore(bM,bQ.firstChild);bv=av.createElement("div");bM.appendChild(bv);bv.innerHTML="
    t
    ";bz=bv.getElementsByTagName("td");bw=(bz[0].offsetHeight===0);bz[0].style.display="";bz[1].style.display="none";bJ.reliableHiddenOffsets=bw&&(bz[0].offsetHeight===0);bv.innerHTML="";bv.style.width=bv.style.paddingLeft="1px";b.boxModel=bJ.boxModel=bv.offsetWidth===2;if(typeof bv.style.zoom!=="undefined"){bv.style.display="inline";bv.style.zoom=1;bJ.inlineBlockNeedsLayout=(bv.offsetWidth===2);bv.style.display="";bv.innerHTML="
    ";bJ.shrinkWrapBlocks=(bv.offsetWidth!==2)}bv.style.cssText=bS+bR;bv.innerHTML=bP;bU=bv.firstChild;bV=bU.firstChild;bN=bU.nextSibling.firstChild.firstChild;bO={doesNotAddBorder:(bV.offsetTop!==5),doesAddBorderForTableAndCells:(bN.offsetTop===5)};bV.style.position="fixed";bV.style.top="20px";bO.fixedPosition=(bV.offsetTop===20||bV.offsetTop===15);bV.style.position=bV.style.top="";bU.style.overflow="hidden";bU.style.position="relative";bO.subtractsBorderForOverflowNotVisible=(bV.offsetTop===-5);bO.doesNotIncludeMarginInBodyOffset=(bQ.offsetTop!==bL);bQ.removeChild(bM);bv=bM=null;b.extend(bJ,bO)});return bJ})();var aS=/^(?:\{.*\}|\[.*\])$/,aA=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!S(e)},data:function(bx,bv,bz,by){if(!b.acceptData(bx)){return}var bG,bA,bD,bE=b.expando,bC=typeof bv==="string",bF=bx.nodeType,e=bF?b.cache:bx,bw=bF?bx[bE]:bx[bE]&&bE,bB=bv==="events";if((!bw||!e[bw]||(!bB&&!by&&!e[bw].data))&&bC&&bz===L){return}if(!bw){if(bF){bx[bE]=bw=++b.uuid}else{bw=bE}}if(!e[bw]){e[bw]={};if(!bF){e[bw].toJSON=b.noop}}if(typeof bv==="object"||typeof bv==="function"){if(by){e[bw]=b.extend(e[bw],bv)}else{e[bw].data=b.extend(e[bw].data,bv)}}bG=bA=e[bw];if(!by){if(!bA.data){bA.data={}}bA=bA.data}if(bz!==L){bA[b.camelCase(bv)]=bz}if(bB&&!bA[bv]){return bG.events}if(bC){bD=bA[bv];if(bD==null){bD=bA[b.camelCase(bv)]}}else{bD=bA}return bD},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bB,bA,bz,bC=b.expando,bD=bx.nodeType,e=bD?b.cache:bx,bw=bD?bx[bC]:bC;if(!e[bw]){return}if(bv){bB=by?e[bw]:e[bw].data;if(bB){if(!b.isArray(bv)){if(bv in bB){bv=[bv]}else{bv=b.camelCase(bv);if(bv in bB){bv=[bv]}else{bv=bv.split(" ")}}}for(bA=0,bz=bv.length;bA-1){return true}}return false},val:function(bx){var e,bv,by,bw=this[0];if(!arguments.length){if(bw){e=b.valHooks[bw.nodeName.toLowerCase()]||b.valHooks[bw.type];if(e&&"get" in e&&(bv=e.get(bw,"value"))!==L){return bv}bv=bw.value;return typeof bv==="string"?bv.replace(aU,""):bv==null?"":bv}return}by=b.isFunction(bx);return this.each(function(bA){var bz=b(this),bB;if(this.nodeType!==1){return}if(by){bB=bx.call(this,bA,bz.val())}else{bB=bx}if(bB==null){bB=""}else{if(typeof bB==="number"){bB+=""}else{if(b.isArray(bB)){bB=b.map(bB,function(bC){return bC==null?"":bC+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bB,"value")===L){this.value=bB}})}});b.extend({valHooks:{option:{get:function(e){var bv=e.attributes.value;return !bv||bv.specified?e.value:e.text}},select:{get:function(e){var bA,bv,bz,bx,by=e.selectedIndex,bB=[],bC=e.options,bw=e.type==="select-one";if(by<0){return null}bv=bw?by:0;bz=bw?by+1:bC.length;for(;bv=0});if(!e.length){bv.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(bA,bx,bB,bz){var bw,e,by,bv=bA.nodeType; +if(!bA||bv===3||bv===8||bv===2){return}if(bz&&bx in b.attrFn){return b(bA)[bx](bB)}if(typeof bA.getAttribute==="undefined"){return b.prop(bA,bx,bB)}by=bv!==1||!b.isXMLDoc(bA);if(by){bx=bx.toLowerCase();e=b.attrHooks[bx]||(ao.test(bx)?aY:be)}if(bB!==L){if(bB===null){b.removeAttr(bA,bx);return}else{if(e&&"set" in e&&by&&(bw=e.set(bA,bB,bx))!==L){return bw}else{bA.setAttribute(bx,""+bB);return bB}}}else{if(e&&"get" in e&&by&&(bw=e.get(bA,bx))!==null){return bw}else{bw=bA.getAttribute(bx);return bw===null?L:bw}}},removeAttr:function(bx,bz){var by,bA,bv,e,bw=0;if(bz&&bx.nodeType===1){bA=bz.toLowerCase().split(af);e=bA.length;for(;bw=0)}}})});var bd=/^(?:textarea|input|select)$/i,n=/^([^\.]*)?(?:\.(.+))?$/,J=/\bhover(\.\S+)?\b/,aO=/^key/,bf=/^(?:mouse|contextmenu)|click/,T=/^(?:focusinfocus|focusoutblur)$/,U=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,Y=function(e){var bv=U.exec(e);if(bv){bv[1]=(bv[1]||"").toLowerCase();bv[3]=bv[3]&&new RegExp("(?:^|\\s)"+bv[3]+"(?:\\s|$)")}return bv},j=function(bw,e){var bv=bw.attributes||{};return((!e[1]||bw.nodeName.toLowerCase()===e[1])&&(!e[2]||(bv.id||{}).value===e[2])&&(!e[3]||e[3].test((bv["class"]||{}).value)))},bt=function(e){return b.event.special.hover?e:e.replace(J,"mouseenter$1 mouseleave$1")};b.event={add:function(bx,bC,bJ,bA,by){var bD,bB,bK,bI,bH,bF,e,bG,bv,bz,bw,bE;if(bx.nodeType===3||bx.nodeType===8||!bC||!bJ||!(bD=b._data(bx))){return}if(bJ.handler){bv=bJ;bJ=bv.handler}if(!bJ.guid){bJ.guid=b.guid++}bK=bD.events;if(!bK){bD.events=bK={}}bB=bD.handle;if(!bB){bD.handle=bB=function(bL){return typeof b!=="undefined"&&(!bL||b.event.triggered!==bL.type)?b.event.dispatch.apply(bB.elem,arguments):L};bB.elem=bx}bC=b.trim(bt(bC)).split(" ");for(bI=0;bI=0){bG=bG.slice(0,-1);bw=true}if(bG.indexOf(".")>=0){bx=bG.split(".");bG=bx.shift();bx.sort()}if((!bA||b.event.customEvent[bG])&&!b.event.global[bG]){return}bv=typeof bv==="object"?bv[b.expando]?bv:new b.Event(bG,bv):new b.Event(bG);bv.type=bG;bv.isTrigger=true;bv.exclusive=bw;bv.namespace=bx.join(".");bv.namespace_re=bv.namespace?new RegExp("(^|\\.)"+bx.join("\\.(?:.*\\.)?")+"(\\.|$)"):null;by=bG.indexOf(":")<0?"on"+bG:"";if(!bA){e=b.cache;for(bC in e){if(e[bC].events&&e[bC].events[bG]){b.event.trigger(bv,bD,e[bC].handle.elem,true)}}return}bv.result=L;if(!bv.target){bv.target=bA}bD=bD!=null?b.makeArray(bD):[];bD.unshift(bv);bF=b.event.special[bG]||{};if(bF.trigger&&bF.trigger.apply(bA,bD)===false){return}bB=[[bA,bF.bindType||bG]];if(!bJ&&!bF.noBubble&&!b.isWindow(bA)){bI=bF.delegateType||bG;bH=T.test(bI+bG)?bA:bA.parentNode;bz=null;for(;bH;bH=bH.parentNode){bB.push([bH,bI]);bz=bH}if(bz&&bz===bA.ownerDocument){bB.push([bz.defaultView||bz.parentWindow||bb,bI])}}for(bC=0;bCbA){bH.push({elem:this,matches:bz.slice(bA)})}for(bC=0;bC0?this.on(e,null,bx,bw):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}if(aO.test(e)){b.event.fixHooks[e]=b.event.keyHooks}if(bf.test(e)){b.event.fixHooks[e]=b.event.mouseHooks}}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * More information: http://sizzlejs.com/ */ -(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

    ";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
    ";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0) -{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
    ").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function() -{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
    ';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); - -/* - * jQuery hashchange event - v1.3 - 7/21/2010 - * http://benalman.com/projects/jquery-hashchange-plugin/ - * - * Copyright (c) 2010 "Cowboy" Ben Alman - * Dual licensed under the MIT and GPL licenses. - * http://benalman.com/about/license/ - */ -(function($,e,b){var c="hashchange",h=document,f,g=$.event.special,i=h.documentMode,d="on"+c in e&&(i===b||i>7);function a(j){j=j||location.href;return"#"+j.replace(/^[^#]*#?(.*)$/,"$1")}$.fn[c]=function(j){return j?this.bind(c,j):this.trigger(c)};$.fn[c].delay=50;g[c]=$.extend(g[c],{setup:function(){if(d){return false}$(f.start)},teardown:function(){if(d){return false}$(f.stop)}});f=(function(){var j={},p,m=a(),k=function(q){return q},l=k,o=k;j.start=function(){p||n()};j.stop=function(){p&&clearTimeout(p);p=b};function n(){var r=a(),q=o(m);if(r!==m){l(m=r,q);$(e).trigger(c)}else{if(q!==m){location.href=location.href.replace(/#.*/,"")+q}}p=setTimeout(n,$.fn[c].delay)}$.browser.msie&&!d&&(function(){var q,r;j.start=function(){if(!q){r=$.fn[c].src;r=r&&r+a();q=$('
    + + +
    -
    /home/travis/build/hasufell/pqc/include/keypair.h File Reference
    +
    keypair.h File Reference

    public API, key handling More...

    -
    #include "ntru.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    -#include <stdbool.h>
    -#include <stdint.h>
    +
    #include "ntru.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    +#include <stdbool.h>
    +#include <stdint.h>
    Include dependency graph for keypair.h:
    - +

    Go to the source code of this file.

    - - - + +

    +

    Data Structures

    struct  keypair

    +

    struct  keypair
     
    + - - + +

    Typedefs

    typedef struct keypair keypair

    +

    typedef struct keypair keypair
     
    + - - - - - - + + + + + + + + + + + +

    Functions

    bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
    void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
    void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
    void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
    void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
    void ntru_delete_keypair (keypair *pair)
    bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
     
    void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
     
    void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
     
    void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
     
    void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
     
    void ntru_delete_keypair (keypair *pair)
     
    -

    Detailed Description

    +

    Detailed Description

    public API, key handling

    This file holds the public API of generating, exporting and importing public and private keys of the pqc NTRU implementation and is meant to be installed on the client system.

    Definition in file keypair.h.

    -

    Typedef Documentation

    - +

    Typedef Documentation

    +
    @@ -130,20 +149,19 @@ Functions
    typedef struct keypair keypair
    -
    -
    +

    Definition at line 42 of file keypair.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -166,10 +184,9 @@ Functions
    void export_priv_key void export_priv_key ( char const *const  filename,
    -
    -
    +

    Export the private key to a file.

    -
    Parameters:
    +
    Parameters
    @@ -182,12 +199,12 @@ Functions - +
    filenamethe file to save the private key into
    privthe private key
    - + @@ -210,10 +227,9 @@ Functions
    void export_public_key void export_public_key ( char const *const  filename,
    -
    -
    +

    Export the public key to a file.

    -
    Parameters:
    +
    Parameters
    @@ -226,12 +242,12 @@ Functions - +
    filenamethe file to save the public key into
    pubthe public key
    - + @@ -260,10 +276,9 @@ Functions
    void import_priv_key void import_priv_key ( char const *const  filename,
    -
    -
    +

    Import the private key from a file and store him along with his inverse.

    -
    Parameters:
    +
    Parameters
    @@ -277,12 +292,12 @@ Functions - +
    filenamethe file to get the private key from
    privwhere to save the private key [out]
    - + @@ -305,10 +320,8 @@ Functions
    void import_public_key void import_public_key ( char const *const  filename,
    -
    -
    -

    Import the public key from a file.

    -
    Parameters:
    +
    +

    Import the public key from a file.

    Parameters
    @@ -321,12 +334,12 @@ Functions - +
    filenamethe file to get the public key from
    pubwhere to save the public key [out]
    - + @@ -355,10 +368,9 @@ Functions
    bool ntru_create_keypair bool ntru_create_keypair ( fmpz_poly_t  f,
    -
    -
    +

    Creates an NTRU key pair, consisting of public and private components.

    -
    Parameters:
    +
    Parameters
    @@ -368,7 +380,7 @@ Functions

    Creates an NTRU key pair, consisting of public and private components.

    -
    Parameters:
    +
    Parameters
    fa random polynomial
    ga random polynomial
    @@ -377,28 +389,27 @@ Functions
    fa random polynomial
    ga random polynomial
    -
    Returns:
    true for success, false if f or g are not invertible (then the caller hast to try different ones)
    +
    Returns
    true for success, false if f or g are not invertible (then the caller hast to try different ones)

    Definition at line 47 of file ntru_keypair.c.

    - +
    - +
    void ntru_delete_keypair void ntru_delete_keypair ( keypair pair)
    -
    -
    +

    Used to free the inner structure of a keypair. This will not call free() on the pair itself.

    -
    Parameters:
    +
    Parameters
    pairthe pair to free the inner structure of
    @@ -410,27 +421,11 @@ Functions
    - - - - -
    - -
    - - - + - diff --git a/keypair_8h__incl.dot b/keypair_8h__incl.dot deleted file mode 100644 index dd60593..0000000 --- a/keypair_8h__incl.dot +++ /dev/null @@ -1,19 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/include/keypair.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru_8h.html",tooltip="public API, basic data types"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/keypair_8h__incl.map b/keypair_8h__incl.map new file mode 100644 index 0000000..18fd83f --- /dev/null +++ b/keypair_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/keypair_8h__incl.md5 b/keypair_8h__incl.md5 index 5f88845..0997380 100644 --- a/keypair_8h__incl.md5 +++ b/keypair_8h__incl.md5 @@ -1 +1 @@ -4303da91ade606bc2d885da5a117a4fa \ No newline at end of file +2b4a3f942ca05de6bc8500cbf9030539 \ No newline at end of file diff --git a/keypair_8h__incl.png b/keypair_8h__incl.png new file mode 100644 index 0000000..fa347ca Binary files /dev/null and b/keypair_8h__incl.png differ diff --git a/keypair_8h_source.html b/keypair_8h_source.html index 31077d1..a8e8e05 100644 --- a/keypair_8h_source.html +++ b/keypair_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/keypair.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,94 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/include/keypair.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00031 #ifndef PUBLIC_NTRU_KEYPAIR_H_
    -00032 #define PUBLIC_NTRU_KEYPAIR_H_
    -00033 
    -00034 #include "ntru.h"
    -00035 
    -00036 #include <fmpz_poly.h>
    -00037 #include <fmpz.h>
    -00038 #include <stdbool.h>
    -00039 #include <stdint.h>
    -00040 
    -00041 
    -00042 typedef struct keypair keypair;
    -00043 
    -00044 
    -00049 struct keypair {
    -00054     fmpz_poly_t priv;
    -00059     fmpz_poly_t priv_inv;
    -00064     fmpz_poly_t pub;
    -00065 };
    -00066 
    -00067 
    -00078 bool
    -00079 ntru_create_keypair(
    -00080         fmpz_poly_t f,
    -00081         fmpz_poly_t g,
    -00082         keypair *pair,
    -00083         ntru_params *params);
    -00084 
    -00092 void
    -00093 export_public_key(char const * const filename,
    -00094         fmpz_poly_t pub,
    -00095         ntru_params *params);
    -00096 
    -00104 void
    -00105 export_priv_key(char const * const filename,
    -00106         fmpz_poly_t priv,
    -00107         ntru_params *params);
    -00108 
    -00115 void
    -00116 import_public_key(char const * const filename,
    -00117         fmpz_poly_t pub,
    -00118         ntru_params *params);
    -00119 
    -00129 void
    -00130 import_priv_key(char const * const filename,
    -00131         fmpz_poly_t priv,
    -00132         fmpz_poly_t priv_inv,
    -00133         ntru_params *params);
    -00134 
    -00142 void
    -00143 ntru_delete_keypair(keypair *pair);
    -00144 
    -00145 
    -00146 #endif /* PUBLIC_NTRU_KEYPAIR_H_ */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -169,13 +78,109 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    keypair.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    31 #ifndef PUBLIC_NTRU_KEYPAIR_H_
    +
    32 #define PUBLIC_NTRU_KEYPAIR_H_
    +
    33 
    +
    34 #include "ntru.h"
    +
    35 
    +
    36 #include <fmpz_poly.h>
    +
    37 #include <fmpz.h>
    +
    38 #include <stdbool.h>
    +
    39 #include <stdint.h>
    +
    40 
    +
    41 
    +
    42 typedef struct keypair keypair;
    +
    43 
    +
    44 
    +
    49 struct keypair {
    +
    54  fmpz_poly_t priv;
    +
    59  fmpz_poly_t priv_inv;
    +
    64  fmpz_poly_t pub;
    +
    65 };
    +
    66 
    +
    67 
    +
    78 bool
    + +
    80  fmpz_poly_t f,
    +
    81  fmpz_poly_t g,
    +
    82  keypair *pair,
    +
    83  ntru_params *params);
    +
    84 
    +
    92 void
    +
    93 export_public_key(char const * const filename,
    +
    94  fmpz_poly_t pub,
    +
    95  ntru_params *params);
    +
    96 
    +
    104 void
    +
    105 export_priv_key(char const * const filename,
    +
    106  fmpz_poly_t priv,
    +
    107  ntru_params *params);
    +
    108 
    +
    115 void
    +
    116 import_public_key(char const * const filename,
    +
    117  fmpz_poly_t pub,
    +
    118  ntru_params *params);
    +
    119 
    +
    129 void
    +
    130 import_priv_key(char const * const filename,
    +
    131  fmpz_poly_t priv,
    +
    132  fmpz_poly_t priv_inv,
    +
    133  ntru_params *params);
    +
    134 
    +
    142 void
    + +
    144 
    +
    145 
    +
    146 #endif /* PUBLIC_NTRU_KEYPAIR_H_ */
    +
    void ntru_delete_keypair(keypair *pair)
    Definition: ntru_keypair.c:197
    +
    void import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
    Definition: ntru_keypair.c:157
    +
    public API, basic data types
    +
    void export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params)
    Definition: ntru_keypair.c:111
    +
    bool ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
    Definition: ntru_keypair.c:47
    + +
    fmpz_poly_t priv_inv
    Definition: ntru_keypair.h:56
    +
    void import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
    Definition: ntru_keypair.c:132
    +
    fmpz_poly_t pub
    Definition: ntru_keypair.h:61
    +
    fmpz_poly_t priv
    Definition: ntru_keypair.h:51
    + +
    void export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
    Definition: ntru_keypair.c:96
    +
    + - diff --git a/nav_f.png b/nav_f.png index 1b07a16..72a58a5 100644 Binary files a/nav_f.png and b/nav_f.png differ diff --git a/nav_g.png b/nav_g.png new file mode 100644 index 0000000..2093a23 Binary files /dev/null and b/nav_g.png differ diff --git a/nav_h.png b/nav_h.png index 01f5fa6..33389b1 100644 Binary files a/nav_h.png and b/nav_h.png differ diff --git a/ntru_8h.html b/ntru_8h.html index f8171bb..5636ffb 100644 --- a/ntru_8h.html +++ b/ntru_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/ntru.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,22 +64,40 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/include/ntru.h File Reference
    +
    ntru.h File Reference

    public API, basic data types More...

    -
    #include <fmpz_poly.h>
    -#include <fmpz.h>
    -#include <stdint.h>
    +
    #include <fmpz_poly.h>
    +#include <fmpz.h>
    +#include <stdint.h>
    Include dependency graph for ntru.h:
    @@ -99,34 +108,50 @@ Include dependency graph for ntru.h:

    Go to the source code of this file.

    - - - - + + + +

    +

    Data Structures

    struct  ntru_params
    struct  string

    +

    struct  ntru_params
     
    struct  string
     
    + - - - + + + +

    Typedefs

    typedef struct ntru_params ntru_params
    typedef struct string string

    +

    typedef struct ntru_params ntru_params
     
    typedef struct string string
     
    + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + +

    Functions

    void prints (const string *print_string)
    void string_delete (string *del_string)
    void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
    void poly_delete (fmpz_poly_t poly)
    void poly_delete_array (fmpz_poly_t **poly_array)
    void poly_delete_all (fmpz_poly_t poly,...)
    void poly_draw (const fmpz_poly_t poly)
    void poly_draw_pretty (const fmpz_poly_t poly)
    stringread_file (char const *const filename)
    void write_file (string const *wstring, char const *const filename)
    void prints (const string *print_string)
     
    void string_delete (string *del_string)
     
    void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
     
    void poly_delete (fmpz_poly_t poly)
     
    void poly_delete_array (fmpz_poly_t **poly_array)
     
    void poly_delete_all (fmpz_poly_t poly,...)
     
    void poly_draw (const fmpz_poly_t poly)
     
    void poly_draw_pretty (const fmpz_poly_t poly)
     
    stringread_file (char const *const filename)
     
    void write_file (string const *wstring, char const *const filename)
     
    -

    Detailed Description

    +

    Detailed Description

    public API, basic data types

    This file holds the public API of the most basic data types and operations of the pqc NTRU implementation and is meant to be installed on the client system.

    Definition in file ntru.h.

    -

    Typedef Documentation

    - +

    Typedef Documentation

    +
    @@ -134,14 +159,13 @@ Functions
    typedef struct ntru_params ntru_params
    -
    -
    +

    Definition at line 39 of file ntru.h.

    - +
    @@ -149,30 +173,28 @@ Functions
    typedef struct string string
    -
    -
    +

    Definition at line 40 of file ntru.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    void poly_delete void poly_delete ( fmpz_poly_t  poly)
    -
    -
    +

    This deletes the internal structure of a polynomial, and frees the pointer.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to delete
    @@ -183,12 +205,12 @@ Functions
    - +
    - + @@ -205,10 +227,9 @@ Functions
    void poly_delete_all void poly_delete_all ( fmpz_poly_t  poly,
    -
    -
    +

    This deletes the internal structure of all polynomials, and frees the pointers. You must call this with NULL as last argument!

    -
    Parameters:
    +
    Parameters
    @@ -220,22 +241,21 @@ Functions - +
    polythe polynomial to delete
    ...follow up polynomials
    - +
    void poly_delete_array void poly_delete_array ( fmpz_poly_t **  poly_array)
    -
    -
    +

    Delete the internal structure of a polynomial array which must be NULL terminated. It is expected that poly_array is not on the stack and was obtained by a function like ascii_to_poly().

    -
    Parameters:
    +
    Parameters
    poly_arraythe polynomial array
    @@ -246,22 +266,21 @@ Functions
    - +
    - +
    void poly_draw void poly_draw ( const fmpz_poly_t  poly)
    -
    -
    +

    Draws a polynomial to stdout.

    -
    Parameters:
    +
    Parameters
    polydraw this
    @@ -272,22 +291,21 @@ Functions
    - +
    - +
    void poly_draw_pretty void poly_draw_pretty ( const fmpz_poly_t  poly)
    -
    -
    +

    Draws a polynomial to stdout, in pretty format.

    -
    Parameters:
    +
    Parameters
    polydraw this
    @@ -298,12 +316,12 @@ Functions
    - +
    - + @@ -326,10 +344,9 @@ Functions
    void poly_new void poly_new ( fmpz_poly_t  new_poly,
    -
    -
    +

    Initializes and builds a polynomial with the coefficient values of c[] of size len within NTRU parameters and returns a newly allocated polynomial. For an empty polynom, both c and len can be NULL/0.

    -
    Parameters:
    +
    Parameters
    @@ -337,28 +354,27 @@ Functions
    new_polythe polynomial to initialize and fill with coefficients [out]
    carray of polynomial coefficients, can be NULL
    -
    Returns:
    newly allocated polynomial pointer, must be freed with fmpz_poly_clear()
    +
    Returns
    newly allocated polynomial pointer, must be freed with fmpz_poly_clear()

    Definition at line 110 of file ntru_poly.c.

    - +
    - +
    void prints void prints ( const string print_string)
    -
    -
    +

    Prints the given string to stdout.

    -
    Parameters:
    +
    Parameters
    print_stringthe print to string
    @@ -369,57 +385,55 @@ Functions
    - +
    - +
    string* read_file string* read_file ( char const *const  filename)
    -
    -
    +

    Reads a file and returns a newly allocated string.

    -
    Parameters:
    +
    Parameters
    filenamefile to open
    -
    Returns:
    a newly allocated string which must be freed by the caller or NULL on failure
    +
    Returns
    a newly allocated string which must be freed by the caller or NULL on failure

    Reads a file and returns a newly allocated string.

    -
    Parameters:
    +
    Parameters
    filenamefile to open
    -
    Returns:
    a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)
    +
    Returns
    a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)

    Definition at line 50 of file ntru_file.c.

    - +
    - +
    void string_delete void string_delete ( string del_string)
    -
    -
    +

    Delete the inner structure of the string and frees the string itself from the heap. Must not be called on stack variables.

    -
    Parameters:
    +
    Parameters
    del_stringthe string to delete
    @@ -430,12 +444,12 @@ Functions
    - +
    - + @@ -452,10 +466,9 @@ Functions
    void write_file void write_file ( string const *  wstring,
    -
    -
    +

    Write a string to a file. The file will be pruned or created if it does not exist.

    -
    Parameters:
    +
    Parameters
    @@ -463,41 +476,25 @@ Functions

    Write a string to a file. The file will be pruned or created if it does not exist.

    -
    Parameters:
    +
    Parameters
    wstringthe string to write to the file
    filenamethe name of the file to write to
    wstringthe string to write to the file
    filenamethe name of the file to write to
    -
    Returns:
    true for success or false for failure if fopen or fclose failed
    +
    Returns
    true for success or false for failure if fopen or fclose failed

    Definition at line 107 of file ntru_file.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru_8h__incl.dot b/ntru_8h__incl.dot deleted file mode 100644 index 5a3741d..0000000 --- a/ntru_8h__incl.dot +++ /dev/null @@ -1,12 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/include/ntru.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru_8h__incl.map b/ntru_8h__incl.map new file mode 100644 index 0000000..6ce85f8 --- /dev/null +++ b/ntru_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/ntru_8h__incl.md5 b/ntru_8h__incl.md5 index 326e880..9896a1d 100644 --- a/ntru_8h__incl.md5 +++ b/ntru_8h__incl.md5 @@ -1 +1 @@ -512dd154d90a38f15b27224cf5c624d1 \ No newline at end of file +eacd6dc5eb22433d8cb012ec28b3ce8a \ No newline at end of file diff --git a/ntru_8h__incl.png b/ntru_8h__incl.png new file mode 100644 index 0000000..b187fb0 Binary files /dev/null and b/ntru_8h__incl.png differ diff --git a/ntru_8h_source.html b/ntru_8h_source.html index 3412ebe..217c038 100644 --- a/ntru_8h_source.html +++ b/ntru_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/ntru.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,99 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/include/ntru.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00030 #ifndef PUBLIC_NTRU_NTRU_H_
    -00031 #define PUBLIC_NTRU_NTRU_H_
    -00032 
    -00033 
    -00034 #include <fmpz_poly.h>
    -00035 #include <fmpz.h>
    -00036 #include <stdint.h>
    -00037 
    -00038 
    -00039 typedef struct ntru_params ntru_params;
    -00040 typedef struct string string;
    -00041 
    -00042 
    -00047 struct ntru_params {
    -00052     uint32_t N;
    -00056     uint32_t q;
    -00060     uint32_t p;
    -00061 };
    -00062 
    -00066 struct string {
    -00074     char *ptr;
    -00078     size_t len;
    -00079 };
    -00080 
    -00081 
    -00087 void
    -00088 prints(const string *print_string);
    -00089 
    -00098 void
    -00099 string_delete(string *del_string);
    -00100 
    -00114 void
    -00115 poly_new(fmpz_poly_t new_poly,
    -00116         int const * const c,
    -00117         const size_t len);
    -00118 
    -00125 void
    -00126 poly_delete(fmpz_poly_t poly);
    -00127 
    -00136 void
    -00137 poly_delete_array(fmpz_poly_t **poly_array);
    -00138 
    -00147 void
    -00148 poly_delete_all(fmpz_poly_t poly, ...);
    -00149 
    -00155 void
    -00156 poly_draw(const fmpz_poly_t poly);
    -00157 
    -00164 void
    -00165 poly_draw_pretty(const fmpz_poly_t poly);
    -00166 
    -00174 string *
    -00175 read_file(char const * const filename);
    -00176 
    -00184 void
    -00185 write_file(string const *wstring, char const * const filename);
    -00186 
    -00187 
    -00188 #endif /* NTRU_NTRU_H_ */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -174,13 +78,119 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    30 #ifndef PUBLIC_NTRU_NTRU_H_
    +
    31 #define PUBLIC_NTRU_NTRU_H_
    +
    32 
    +
    33 
    +
    34 #include <fmpz_poly.h>
    +
    35 #include <fmpz.h>
    +
    36 #include <stdint.h>
    +
    37 
    +
    38 
    +
    39 typedef struct ntru_params ntru_params;
    +
    40 typedef struct string string;
    +
    41 
    +
    42 
    +
    47 struct ntru_params {
    +
    52  uint32_t N;
    +
    56  uint32_t q;
    +
    60  uint32_t p;
    +
    61 };
    +
    62 
    +
    66 struct string {
    +
    74  char *ptr;
    +
    78  size_t len;
    +
    79 };
    +
    80 
    +
    81 
    +
    87 void
    +
    88 prints(const string *print_string);
    +
    89 
    +
    98 void
    +
    99 string_delete(string *del_string);
    +
    100 
    +
    114 void
    +
    115 poly_new(fmpz_poly_t new_poly,
    +
    116  int const * const c,
    +
    117  const size_t len);
    +
    118 
    +
    125 void
    +
    126 poly_delete(fmpz_poly_t poly);
    +
    127 
    +
    136 void
    +
    137 poly_delete_array(fmpz_poly_t **poly_array);
    +
    138 
    +
    147 void
    +
    148 poly_delete_all(fmpz_poly_t poly, ...);
    +
    149 
    +
    155 void
    +
    156 poly_draw(const fmpz_poly_t poly);
    +
    157 
    +
    164 void
    +
    165 poly_draw_pretty(const fmpz_poly_t poly);
    +
    166 
    +
    174 string *
    +
    175 read_file(char const * const filename);
    +
    176 
    +
    184 void
    +
    185 write_file(string const *wstring, char const * const filename);
    +
    186 
    +
    187 
    +
    188 #endif /* NTRU_NTRU_H_ */
    +
    void string_delete(string *del_string)
    Definition: ntru_string.c:47
    +
    void poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len)
    Definition: ntru_poly.c:110
    +
    size_t len
    Definition: ntru_string.h:53
    +
    void poly_delete_array(fmpz_poly_t **poly_array)
    Definition: ntru_poly.c:131
    +
    uint32_t N
    Definition: ntru_params.h:48
    +
    void poly_draw(const fmpz_poly_t poly)
    Definition: ntru_poly.c:574
    +
    void poly_delete_all(fmpz_poly_t poly,...)
    Definition: ntru_poly.c:149
    +
    uint32_t p
    Definition: ntru_params.h:56
    + +
    void write_file(string const *wstring, char const *const filename)
    Definition: ntru_file.c:107
    +
    void prints(const string *print_string)
    Definition: ntru_string.c:37
    + +
    uint32_t q
    Definition: ntru_params.h:52
    +
    string * read_file(char const *const filename)
    Definition: ntru_file.c:50
    +
    void poly_delete(fmpz_poly_t poly)
    Definition: ntru_poly.c:123
    +
    char * ptr
    Definition: ntru_string.h:49
    +
    void poly_draw_pretty(const fmpz_poly_t poly)
    Definition: ntru_poly.c:583
    +
    + - diff --git a/ntru__ascii__poly_8c.html b/ntru__ascii__poly_8c.html index 910a04b..f8973c7 100644 --- a/ntru__ascii__poly_8c.html +++ b/ntru__ascii__poly_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,58 +64,80 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.c File Reference
    +
    ntru_ascii_poly.c File Reference

    ascii to polynomials More...

    -
    #include "ntru_ascii_poly.h"
    -#include "ntru_common.h"
    -#include "ntru_mem.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_string.h"
    -#include <glib.h>
    -#include <stdint.h>
    -#include <stdlib.h>
    -#include <string.h>
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_ascii_poly.h"
    +#include "ntru_common.h"
    +#include "ntru_mem.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_string.h"
    +#include <glib.h>
    +#include <stdint.h>
    +#include <stdlib.h>
    +#include <string.h>
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_ascii_poly.c:
    - +

    Go to the source code of this file.

    - - - - - + + + + + + + +

    +

    Functions

    static char * get_int_to_bin_str (uint8_t value)
    fmpz_poly_t * ascii_bin_to_bin_poly (const char *to_poly, const ntru_params *params)
    fmpz_poly_t ** ascii_to_bin_poly_arr (const string *to_poly, const ntru_params *params)
    fmpz_poly_t ** base64_to_poly_arr (const string *to_poly, const ntru_params *params)
    static char * get_int_to_bin_str (uint8_t value)
     
    fmpz_poly_t * ascii_bin_to_bin_poly (const char *to_poly, const ntru_params *params)
     
    fmpz_poly_t ** ascii_to_bin_poly_arr (const string *to_poly, const ntru_params *params)
     
    fmpz_poly_t ** base64_to_poly_arr (const string *to_poly, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    ascii to polynomials

    This file allows to convert ascii strings, including base64 encoded ones, to polynomials.

    Definition in file ntru_ascii_poly.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -141,31 +154,30 @@ Functions
    fmpz_poly_t* ascii_bin_to_bin_poly fmpz_poly_t* ascii_bin_to_bin_poly ( const char *  to_poly,
    -
    -
    +

    Convert a "binary" ascii string to a binary polyomial. The ascii string will be converted to a binary representation and the following mapping will apply between binary -> poly:

    1 => 1

    0 => -1

    If the polynomial is of degree less than N -1, then it will be filled with trailing 2's for later use in bin_poly_to_ascii().

    -
    Parameters:
    +
    Parameters
    to_polythe string to get into binary polynomial format
    paramsthe NTRUEncrypt context
    -
    Returns:
    newly allocated array of binary polynomials
    +
    Returns
    newly allocated array of binary polynomials

    Definition at line 81 of file ntru_ascii_poly.c.

    - +
    - + @@ -182,31 +194,30 @@ Functions
    fmpz_poly_t** ascii_to_bin_poly_arr fmpz_poly_t** ascii_to_bin_poly_arr ( const string to_poly,
    -
    -
    +

    Convert an ascii string to an array of binary polyomials. The ascii string will be converted to a binary representation and the following mapping will apply between binary -> poly:

    1 => 1

    0 => -1

    If the last polynomial is of degree less than N -1, then it will be filled with trailing 2's for later use in bin_poly_arr_to_ascii().

    -
    Parameters:
    +
    Parameters
    to_polythe string to get into binary polynomial format
    paramsthe NTRUEncrypt context
    -
    Returns:
    newly allocated array of binary polynomials
    +
    Returns
    newly allocated array of binary polynomials

    Definition at line 101 of file ntru_ascii_poly.c.

    - +
    - + @@ -223,73 +234,63 @@ Functions
    fmpz_poly_t** base64_to_poly_arr fmpz_poly_t** base64_to_poly_arr ( const string to_poly,
    -
    -
    +

    Convert an base64 encoded string to an array of polyomials with coefficients which are expected to be in the range [0, q-1]. The chars will be converted (after decoding) to their integer representation and directly put into the coefficients.

    If the last polynomial is of degree less than N -1, then it will be filled with trailing q's for later user in poly_arr_to_base64().

    -
    Parameters:
    +
    Parameters
    to_polythe string to get into polynomial format, which is of type string, so we can iterate safely over it (the string might have null-bytes in the middle of it)
    paramsthe NTRUEncrypt context
    -
    Returns:
    newly allocated array of polynomials
    +
    Returns
    newly allocated array of polynomials

    Definition at line 146 of file ntru_ascii_poly.c.

    - +
    + + + + + +
    - + - +
    static char * get_int_to_bin_str static char * get_int_to_bin_str ( uint8_t  value) [static]
    - -
    +
    +static
    +

    Convert an integer to it's binary representation as a string and return it.

    As in: 90 => "10110101"

    -
    Parameters:
    +
    Parameters
    valuethe integer to convert
    -
    Returns:
    the binary representation as a newly allocated string
    +
    Returns
    the binary representation as a newly allocated string

    Definition at line 62 of file ntru_ascii_poly.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__ascii__poly_8c__incl.dot b/ntru__ascii__poly_8c__incl.dot deleted file mode 100644 index e288410..0000000 --- a/ntru__ascii__poly_8c__incl.dot +++ /dev/null @@ -1,49 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_ascii_poly.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_ascii_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__ascii__poly_8h.html",tooltip="header for ntru_ascii_poly.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node5 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__mem_8h.html",tooltip="header for ntru_mem.c"]; - Node10 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node11 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [label="glib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/ntru__ascii__poly_8c__incl.map b/ntru__ascii__poly_8c__incl.map new file mode 100644 index 0000000..2cf929d --- /dev/null +++ b/ntru__ascii__poly_8c__incl.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ntru__ascii__poly_8c__incl.md5 b/ntru__ascii__poly_8c__incl.md5 index 1767536..c67d638 100644 --- a/ntru__ascii__poly_8c__incl.md5 +++ b/ntru__ascii__poly_8c__incl.md5 @@ -1 +1 @@ -a44d09273de9c60d0e0582d08fae85fa \ No newline at end of file +4b96241be94029950c1b05fd20de29d0 \ No newline at end of file diff --git a/ntru__ascii__poly_8c__incl.png b/ntru__ascii__poly_8c__incl.png new file mode 100644 index 0000000..fcd7075 Binary files /dev/null and b/ntru__ascii__poly_8c__incl.png differ diff --git a/ntru__ascii__poly_8c_source.html b/ntru__ascii__poly_8c_source.html index 9c0732b..e418cc9 100644 --- a/ntru__ascii__poly_8c_source.html +++ b/ntru__ascii__poly_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,212 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_ascii_poly.h"
    -00030 #include "ntru_common.h"
    -00031 #include "ntru_mem.h"
    -00032 #include "ntru_params.h"
    -00033 #include "ntru_poly.h"
    -00034 #include "ntru_string.h"
    -00035 
    -00036 #include <glib.h>
    -00037 
    -00038 #include <stdint.h>
    -00039 #include <stdlib.h>
    -00040 #include <string.h>
    -00041 
    -00042 #include <fmpz_poly.h>
    -00043 #include <fmpz.h>
    -00044 
    -00045 
    -00055 static char *
    -00056 get_int_to_bin_str(uint8_t value);
    -00057 
    -00058 
    -00059 /*------------------------------------------------------------------------*/
    -00060 
    -00061 static char *
    -00062 get_int_to_bin_str(uint8_t value)
    -00063 {
    -00064     int i;
    -00065     const size_t bin_string_size = ASCII_BITS + 1;
    -00066     char *bin_string = ntru_malloc(sizeof(*bin_string) *
    -00067             (bin_string_size)); /* account for trailing null-byte */
    -00068 
    -00069     /* terminate properly */
    -00070     bin_string[bin_string_size - 1] = '\0';
    -00071 
    -00072     for (i = ASCII_BITS - 1; i >= 0; --i, value >>= 1)
    -00073         bin_string[i] = (value & 1) + '0';
    -00074 
    -00075     return bin_string;
    -00076 }
    -00077 
    -00078 /*------------------------------------------------------------------------*/
    -00079 
    -00080 fmpz_poly_t *
    -00081 ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params)
    -00082 {
    -00083     uint32_t i = 0;
    -00084     fmpz_poly_t *new_poly = ntru_malloc(sizeof(*new_poly));
    -00085 
    -00086     fmpz_poly_init(*new_poly);
    -00087 
    -00088     while (to_poly[i] && i < params->N) {
    -00089         fmpz_poly_set_coeff_si(*new_poly,
    -00090                 i,
    -00091                 (to_poly[i] == '0') ? -1 : 1);
    -00092         i++;
    -00093     }
    -00094 
    -00095     return new_poly;
    -00096 }
    -00097 
    -00098 /*------------------------------------------------------------------------*/
    -00099 
    -00100 fmpz_poly_t **
    -00101 ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params)
    -00102 {
    -00103     char *cur = to_poly->ptr;
    -00104     char *out = ntru_malloc(CHAR_SIZE * (to_poly->len * ASCII_BITS + 1));
    -00105     uint32_t polyc = 0;
    -00106     size_t out_len = 0;
    -00107     fmpz_poly_t **poly_array;
    -00108 
    -00109     for (uint32_t i = 0; i < to_poly->len; i++) {
    -00110         char *tmp_string = get_int_to_bin_str((int)(*cur));
    -00111         memcpy(out + out_len, tmp_string, ASCII_BITS);
    -00112         out_len += ASCII_BITS;
    -00113         cur++;
    -00114         free(tmp_string);
    -00115     }
    -00116     out[out_len] = '\0';
    -00117 
    -00118     poly_array = ntru_malloc(sizeof(**poly_array) *
    -00119             (strlen(out) / params->N + 1));
    -00120 
    -00121     for (uint32_t i = 0; i < out_len; i += params->N) {
    -00122         char chunk[params->N + 1];
    -00123         size_t real_chunk_size;
    -00124 
    -00125         real_chunk_size =
    -00126             (out_len - i > params->N) ? params->N : out_len - i;
    -00127 
    -00128         memcpy(chunk, out + i, real_chunk_size);
    -00129         chunk[real_chunk_size] = '\0';
    -00130 
    -00131         poly_array[polyc] = ascii_bin_to_bin_poly(chunk, params);
    -00132 
    -00133         polyc++;
    -00134     }
    -00135 
    -00136     free(out);
    -00137 
    -00138     poly_array[polyc] = NULL;
    -00139 
    -00140     return poly_array;
    -00141 }
    -00142 
    -00143 /*------------------------------------------------------------------------*/
    -00144 
    -00145 fmpz_poly_t **
    -00146 base64_to_poly_arr(const string *to_poly, const ntru_params *params)
    -00147 {
    -00148     uint32_t i = 0,
    -00149              polyc = 0;
    -00150     gsize out_len;
    -00151     guchar *base64_decoded = NULL,
    -00152            *base_tmp = NULL;
    -00153     string *new_string = ntru_malloc(sizeof(*new_string));
    -00154     fmpz_poly_t **poly_array;
    -00155     char *tmp = ntru_malloc(sizeof(char) * (to_poly->len + 1));
    -00156 
    -00157     /* g_base64_decode() needs it null-terminated */
    -00158     memcpy(tmp, to_poly->ptr, to_poly->len);
    -00159     tmp[to_poly->len] = '\0';
    -00160 
    -00161     base_tmp = g_base64_decode((const gchar *)tmp, &out_len);
    -00162 
    -00163     /* g_base64_decode() needs it null-terminated */
    -00164     REALLOC(tmp, sizeof(char) * (out_len + 1));
    -00165     memcpy(tmp, base_tmp, out_len);
    -00166     tmp[out_len] = '\0';
    -00167 
    -00168     base64_decoded = g_base64_decode((const gchar *)tmp, &out_len);
    -00169 
    -00170     new_string->ptr = (char *)base64_decoded;
    -00171     new_string->len = (unsigned long)(out_len);
    -00172 
    -00173     poly_array = ntru_malloc(sizeof(**poly_array) *
    -00174             (new_string->len / params->N));
    -00175 
    -00176     while (i < new_string->len) {
    -00177         uint32_t j = 0;
    -00178         fmpz_poly_t *new_poly = ntru_malloc(sizeof(*new_poly));
    -00179 
    -00180         fmpz_poly_init(*new_poly);
    -00181 
    -00182         while (j < params->N) {
    -00183             fmpz_poly_set_coeff_si(*new_poly,
    -00184                     j,
    -00185                     (uint8_t)(base64_decoded[i]));
    -00186             j++;
    -00187             i++;
    -00188         }
    -00189 
    -00190         /* fill the last poly with q (which is a non-standard
    -00191          * coefficient) */
    -00192         for (uint32_t k = j; k < params->N; k++) {
    -00193             fmpz_poly_set_coeff_si(*new_poly,
    -00194                     k,
    -00195                     params->q);
    -00196         }
    -00197 
    -00198         poly_array[polyc] = new_poly;
    -00199         polyc++;
    -00200     }
    -00201 
    -00202     poly_array[polyc] = NULL;
    -00203 
    -00204     string_delete(new_string);
    -00205     free(base_tmp);
    -00206     free(tmp);
    -00207 
    -00208     return poly_array;
    -00209 }
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -287,13 +78,235 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_ascii_poly.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_ascii_poly.h"
    +
    30 #include "ntru_common.h"
    +
    31 #include "ntru_mem.h"
    +
    32 #include "ntru_params.h"
    +
    33 #include "ntru_poly.h"
    +
    34 #include "ntru_string.h"
    +
    35 
    +
    36 #include <glib.h>
    +
    37 
    +
    38 #include <stdint.h>
    +
    39 #include <stdlib.h>
    +
    40 #include <string.h>
    +
    41 
    +
    42 #include <fmpz_poly.h>
    +
    43 #include <fmpz.h>
    +
    44 
    +
    45 
    +
    55 static char *
    +
    56 get_int_to_bin_str(uint8_t value);
    +
    57 
    +
    58 
    +
    59 /*------------------------------------------------------------------------*/
    +
    60 
    +
    61 static char *
    +
    62 get_int_to_bin_str(uint8_t value)
    +
    63 {
    +
    64  int i;
    +
    65  const size_t bin_string_size = ASCII_BITS + 1;
    +
    66  char *bin_string = ntru_malloc(sizeof(*bin_string) *
    +
    67  (bin_string_size)); /* account for trailing null-byte */
    +
    68 
    +
    69  /* terminate properly */
    +
    70  bin_string[bin_string_size - 1] = '\0';
    +
    71 
    +
    72  for (i = ASCII_BITS - 1; i >= 0; --i, value >>= 1)
    +
    73  bin_string[i] = (value & 1) + '0';
    +
    74 
    +
    75  return bin_string;
    +
    76 }
    +
    77 
    +
    78 /*------------------------------------------------------------------------*/
    +
    79 
    +
    80 fmpz_poly_t *
    +
    81 ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params)
    +
    82 {
    +
    83  uint32_t i = 0;
    +
    84  fmpz_poly_t *new_poly = ntru_malloc(sizeof(*new_poly));
    +
    85 
    +
    86  fmpz_poly_init(*new_poly);
    +
    87 
    +
    88  while (to_poly[i] && i < params->N) {
    +
    89  fmpz_poly_set_coeff_si(*new_poly,
    +
    90  i,
    +
    91  (to_poly[i] == '0') ? -1 : 1);
    +
    92  i++;
    +
    93  }
    +
    94 
    +
    95  return new_poly;
    +
    96 }
    +
    97 
    +
    98 /*------------------------------------------------------------------------*/
    +
    99 
    +
    100 fmpz_poly_t **
    +
    101 ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params)
    +
    102 {
    +
    103  char *cur = to_poly->ptr;
    +
    104  char *out = ntru_malloc(CHAR_SIZE * (to_poly->len * ASCII_BITS + 1));
    +
    105  uint32_t polyc = 0;
    +
    106  size_t out_len = 0;
    +
    107  fmpz_poly_t **poly_array;
    +
    108 
    +
    109  for (uint32_t i = 0; i < to_poly->len; i++) {
    +
    110  char *tmp_string = get_int_to_bin_str((int)(*cur));
    +
    111  memcpy(out + out_len, tmp_string, ASCII_BITS);
    +
    112  out_len += ASCII_BITS;
    +
    113  cur++;
    +
    114  free(tmp_string);
    +
    115  }
    +
    116  out[out_len] = '\0';
    +
    117 
    +
    118  poly_array = ntru_malloc(sizeof(**poly_array) *
    +
    119  (strlen(out) / params->N + 1));
    +
    120 
    +
    121  for (uint32_t i = 0; i < out_len; i += params->N) {
    +
    122  char chunk[params->N + 1];
    +
    123  size_t real_chunk_size;
    +
    124 
    +
    125  real_chunk_size =
    +
    126  (out_len - i > params->N) ? params->N : out_len - i;
    +
    127 
    +
    128  memcpy(chunk, out + i, real_chunk_size);
    +
    129  chunk[real_chunk_size] = '\0';
    +
    130 
    +
    131  poly_array[polyc] = ascii_bin_to_bin_poly(chunk, params);
    +
    132 
    +
    133  polyc++;
    +
    134  }
    +
    135 
    +
    136  free(out);
    +
    137 
    +
    138  poly_array[polyc] = NULL;
    +
    139 
    +
    140  return poly_array;
    +
    141 }
    +
    142 
    +
    143 /*------------------------------------------------------------------------*/
    +
    144 
    +
    145 fmpz_poly_t **
    +
    146 base64_to_poly_arr(const string *to_poly, const ntru_params *params)
    +
    147 {
    +
    148  uint32_t i = 0,
    +
    149  polyc = 0;
    +
    150  gsize out_len;
    +
    151  guchar *base64_decoded = NULL,
    +
    152  *base_tmp = NULL;
    +
    153  string *new_string = ntru_malloc(sizeof(*new_string));
    +
    154  fmpz_poly_t **poly_array;
    +
    155  char *tmp = ntru_malloc(sizeof(char) * (to_poly->len + 1));
    +
    156 
    +
    157  /* g_base64_decode() needs it null-terminated */
    +
    158  memcpy(tmp, to_poly->ptr, to_poly->len);
    +
    159  tmp[to_poly->len] = '\0';
    +
    160 
    +
    161  base_tmp = g_base64_decode((const gchar *)tmp, &out_len);
    +
    162 
    +
    163  /* g_base64_decode() needs it null-terminated */
    +
    164  REALLOC(tmp, sizeof(char) * (out_len + 1));
    +
    165  memcpy(tmp, base_tmp, out_len);
    +
    166  tmp[out_len] = '\0';
    +
    167 
    +
    168  base64_decoded = g_base64_decode((const gchar *)tmp, &out_len);
    +
    169 
    +
    170  new_string->ptr = (char *)base64_decoded;
    +
    171  new_string->len = (unsigned long)(out_len);
    +
    172 
    +
    173  poly_array = ntru_malloc(sizeof(**poly_array) *
    +
    174  (new_string->len / params->N));
    +
    175 
    +
    176  while (i < new_string->len) {
    +
    177  uint32_t j = 0;
    +
    178  fmpz_poly_t *new_poly = ntru_malloc(sizeof(*new_poly));
    +
    179 
    +
    180  fmpz_poly_init(*new_poly);
    +
    181 
    +
    182  while (j < params->N) {
    +
    183  fmpz_poly_set_coeff_si(*new_poly,
    +
    184  j,
    +
    185  (uint8_t)(base64_decoded[i]));
    +
    186  j++;
    +
    187  i++;
    +
    188  }
    +
    189 
    +
    190  /* fill the last poly with q (which is a non-standard
    +
    191  * coefficient) */
    +
    192  for (uint32_t k = j; k < params->N; k++) {
    +
    193  fmpz_poly_set_coeff_si(*new_poly,
    +
    194  k,
    +
    195  params->q);
    +
    196  }
    +
    197 
    +
    198  poly_array[polyc] = new_poly;
    +
    199  polyc++;
    +
    200  }
    +
    201 
    +
    202  poly_array[polyc] = NULL;
    +
    203 
    +
    204  string_delete(new_string);
    +
    205  free(base_tmp);
    +
    206  free(tmp);
    +
    207 
    +
    208  return poly_array;
    +
    209 }
    +
    fmpz_poly_t ** ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params)
    +
    #define ASCII_BITS
    Definition: ntru_common.h:38
    +
    void string_delete(string *del_string)
    Definition: ntru_string.c:47
    +
    size_t len
    Definition: ntru_string.h:53
    +
    uint32_t N
    Definition: ntru_params.h:48
    +
    fmpz_poly_t ** base64_to_poly_arr(const string *to_poly, const ntru_params *params)
    + +
    header for ntru_mem.c
    +
    NTRU parameters.
    +
    #define REALLOC(ptr, size)
    Definition: ntru_mem.h:38
    +
    common macros/functions
    +
    static char * get_int_to_bin_str(uint8_t value)
    +
    void * ntru_malloc(size_t size)
    Definition: ntru_mem.c:38
    +
    uint32_t q
    Definition: ntru_params.h:52
    +
    header for ntru_string.c
    +
    #define CHAR_SIZE
    Definition: ntru_common.h:37
    +
    char * ptr
    Definition: ntru_string.h:49
    +
    fmpz_poly_t * ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params)
    +
    header for ntru_poly.c
    +
    header for ntru_ascii_poly.c
    +
    + - diff --git a/ntru__ascii__poly_8h.html b/ntru__ascii__poly_8h.html index 9a63aaa..a1f9b3b 100644 --- a/ntru__ascii__poly_8h.html +++ b/ntru__ascii__poly_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,50 +64,71 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h File Reference
    +
    ntru_ascii_poly.h File Reference
    -

    header for ntru_ascii_poly.c +

    header for ntru_ascii_poly.c More...

    -
    #include "ntru_common.h"
    -#include "ntru_string.h"
    -#include "ntru_params.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_common.h"
    +#include "ntru_string.h"
    +#include "ntru_params.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_ascii_poly.h:
    - +

    Go to the source code of this file.

    - - - - + + + + + +

    +

    Functions

    fmpz_poly_t * ascii_bin_to_bin_poly (const char *to_poly, const ntru_params *params)
    fmpz_poly_t ** ascii_to_bin_poly_arr (const string *to_poly, const ntru_params *params)
    fmpz_poly_t ** base64_to_poly_arr (const string *to_poly, const ntru_params *params)
    fmpz_poly_t * ascii_bin_to_bin_poly (const char *to_poly, const ntru_params *params)
     
    fmpz_poly_t ** ascii_to_bin_poly_arr (const string *to_poly, const ntru_params *params)
     
    fmpz_poly_t ** base64_to_poly_arr (const string *to_poly, const ntru_params *params)
     
    -

    Detailed Description

    -

    header for ntru_ascii_poly.c

    -

    Header for the internal API of ntru_ascii_poly.c.

    +

    Detailed Description

    +

    header for ntru_ascii_poly.c

    +

    Header for the internal API of ntru_ascii_poly.c.

    Definition in file ntru_ascii_poly.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -133,31 +145,30 @@ Functions
    fmpz_poly_t* ascii_bin_to_bin_poly fmpz_poly_t* ascii_bin_to_bin_poly ( const char *  to_poly,
    -
    -
    +

    Convert a "binary" ascii string to a binary polyomial. The ascii string will be converted to a binary representation and the following mapping will apply between binary -> poly:

    1 => 1

    0 => -1

    If the polynomial is of degree less than N -1, then it will be filled with trailing 2's for later use in bin_poly_to_ascii().

    -
    Parameters:
    +
    Parameters
    to_polythe string to get into binary polynomial format
    paramsthe NTRUEncrypt context
    -
    Returns:
    newly allocated array of binary polynomials
    +
    Returns
    newly allocated array of binary polynomials

    Definition at line 81 of file ntru_ascii_poly.c.

    - +
    - + @@ -174,31 +185,30 @@ Functions
    fmpz_poly_t** ascii_to_bin_poly_arr fmpz_poly_t** ascii_to_bin_poly_arr ( const string to_poly,
    -
    -
    +

    Convert an ascii string to an array of binary polyomials. The ascii string will be converted to a binary representation and the following mapping will apply between binary -> poly:

    1 => 1

    0 => -1

    If the last polynomial is of degree less than N -1, then it will be filled with trailing 2's for later use in bin_poly_arr_to_ascii().

    -
    Parameters:
    +
    Parameters
    to_polythe string to get into binary polynomial format
    paramsthe NTRUEncrypt context
    -
    Returns:
    newly allocated array of binary polynomials
    +
    Returns
    newly allocated array of binary polynomials

    Definition at line 101 of file ntru_ascii_poly.c.

    - +
    - + @@ -215,45 +225,28 @@ Functions
    fmpz_poly_t** base64_to_poly_arr fmpz_poly_t** base64_to_poly_arr ( const string to_poly,
    -
    -
    +

    Convert an base64 encoded string to an array of polyomials with coefficients which are expected to be in the range [0, q-1]. The chars will be converted (after decoding) to their integer representation and directly put into the coefficients.

    If the last polynomial is of degree less than N -1, then it will be filled with trailing q's for later user in poly_arr_to_base64().

    -
    Parameters:
    +
    Parameters
    to_polythe string to get into polynomial format, which is of type string, so we can iterate safely over it (the string might have null-bytes in the middle of it)
    paramsthe NTRUEncrypt context
    -
    Returns:
    newly allocated array of polynomials
    +
    Returns
    newly allocated array of polynomials

    Definition at line 146 of file ntru_ascii_poly.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__ascii__poly_8h__incl.dot b/ntru__ascii__poly_8h__incl.dot deleted file mode 100644 index ce1109b..0000000 --- a/ntru__ascii__poly_8h__incl.dot +++ /dev/null @@ -1,21 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node4 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node5 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__ascii__poly_8h__incl.map b/ntru__ascii__poly_8h__incl.map new file mode 100644 index 0000000..9e56527 --- /dev/null +++ b/ntru__ascii__poly_8h__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/ntru__ascii__poly_8h__incl.md5 b/ntru__ascii__poly_8h__incl.md5 index 22ed0cf..90f3b99 100644 --- a/ntru__ascii__poly_8h__incl.md5 +++ b/ntru__ascii__poly_8h__incl.md5 @@ -1 +1 @@ -eeb812a91fe6b7412ad0dddfa4530952 \ No newline at end of file +81e7fc7cf2132dda2768b24004a75bbb \ No newline at end of file diff --git a/ntru__ascii__poly_8h__incl.png b/ntru__ascii__poly_8h__incl.png new file mode 100644 index 0000000..6dd7055 Binary files /dev/null and b/ntru__ascii__poly_8h__incl.png differ diff --git a/ntru__ascii__poly_8h_source.html b/ntru__ascii__poly_8h_source.html index b9222da..09c96af 100644 --- a/ntru__ascii__poly_8h_source.html +++ b/ntru__ascii__poly_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,63 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_ASCII_POLY_H_
    -00029 #define NTRU_ASCII_POLY_H_
    -00030 
    -00031 
    -00032 #include "ntru_common.h"
    -00033 #include "ntru_string.h"
    -00034 #include "ntru_params.h"
    -00035 
    -00036 #include <fmpz_poly.h>
    -00037 #include <fmpz.h>
    -00038 
    -00039 
    -00056 fmpz_poly_t *
    -00057 ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params);
    -00058 
    -00075 fmpz_poly_t **
    -00076 ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params);
    -00077 
    -00093 fmpz_poly_t **
    -00094 base64_to_poly_arr(const string *to_poly, const ntru_params *params);
    -00095 
    -00096 
    -00097 #endif /* NTRU_ASCII_POLY_H_ */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -138,13 +78,73 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_ascii_poly.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_ASCII_POLY_H_
    +
    29 #define NTRU_ASCII_POLY_H_
    +
    30 
    +
    31 
    +
    32 #include "ntru_common.h"
    +
    33 #include "ntru_string.h"
    +
    34 #include "ntru_params.h"
    +
    35 
    +
    36 #include <fmpz_poly.h>
    +
    37 #include <fmpz.h>
    +
    38 
    +
    39 
    +
    56 fmpz_poly_t *
    +
    57 ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params);
    +
    58 
    +
    75 fmpz_poly_t **
    +
    76 ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params);
    +
    77 
    +
    93 fmpz_poly_t **
    +
    94 base64_to_poly_arr(const string *to_poly, const ntru_params *params);
    +
    95 
    +
    96 
    +
    97 #endif /* NTRU_ASCII_POLY_H_ */
    +
    fmpz_poly_t ** ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params)
    + +
    NTRU parameters.
    +
    common macros/functions
    +
    fmpz_poly_t ** base64_to_poly_arr(const string *to_poly, const ntru_params *params)
    +
    header for ntru_string.c
    +
    fmpz_poly_t * ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params)
    +
    + - diff --git a/ntru__common_8h.html b/ntru__common_8h.html index cbde136..df2ba36 100644 --- a/ntru__common_8h.html +++ b/ntru__common_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_common.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,18 +64,36 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_common.h File Reference
    +
    ntru_common.h File Reference

    common macros/functions More...

    -
    #include <stdlib.h>
    +
    #include <stdlib.h>
    Include dependency graph for ntru_common.h:
    @@ -95,69 +104,53 @@ Include dependency graph for ntru_common.h:

    Go to the source code of this file.

    - - - + + + + +

    -Defines

    #define CHAR_SIZE   sizeof(char)
    #define ASCII_BITS   8

    +Macros

    #define CHAR_SIZE   sizeof(char)
     
    #define ASCII_BITS   8
     
    -

    Detailed Description

    +

    Detailed Description

    common macros/functions

    This file holds common macros and functions shared throughout the whole codebase without any particular purpose.

    Definition in file ntru_common.h.

    -

    Define Documentation

    - +

    Macro Definition Documentation

    +
    - +
    #define ASCII_BITS   8#define ASCII_BITS   8
    -
    -
    +

    Definition at line 38 of file ntru_common.h.

    - +
    - +
    #define CHAR_SIZE   sizeof(char)#define CHAR_SIZE   sizeof(char)
    -
    -
    +

    Definition at line 37 of file ntru_common.h.

    - - - - -
    - -
    - - - + - diff --git a/ntru__common_8h__incl.dot b/ntru__common_8h__incl.dot deleted file mode 100644 index 9b13edb..0000000 --- a/ntru__common_8h__incl.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__common_8h__incl.map b/ntru__common_8h__incl.map new file mode 100644 index 0000000..1ba3095 --- /dev/null +++ b/ntru__common_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/ntru__common_8h__incl.md5 b/ntru__common_8h__incl.md5 index c975c8b..b4380ba 100644 --- a/ntru__common_8h__incl.md5 +++ b/ntru__common_8h__incl.md5 @@ -1 +1 @@ -387a14e03c762904414073faf13de234 \ No newline at end of file +263919482a59e32c059432052bc45afa \ No newline at end of file diff --git a/ntru__common_8h__incl.png b/ntru__common_8h__incl.png new file mode 100644 index 0000000..9fd4e37 Binary files /dev/null and b/ntru__common_8h__incl.png differ diff --git a/ntru__common_8h_source.html b/ntru__common_8h_source.html index 342cfa8..c7aadc9 100644 --- a/ntru__common_8h_source.html +++ b/ntru__common_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_common.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,52 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_common.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00030 #ifndef NTRU_COMMON_H
    -00031 #define NTRU_COMMON_H
    -00032 
    -00033 
    -00034 #include <stdlib.h>
    -00035 
    -00036 
    -00037 #define CHAR_SIZE sizeof(char)
    -00038 #define ASCII_BITS 8
    -00039 
    -00040 
    -00041 #endif /* NTRU_COMMON_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -127,13 +78,55 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_common.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    30 #ifndef NTRU_COMMON_H
    +
    31 #define NTRU_COMMON_H
    +
    32 
    +
    33 
    +
    34 #include <stdlib.h>
    +
    35 
    +
    36 
    +
    37 #define CHAR_SIZE sizeof(char)
    +
    38 #define ASCII_BITS 8
    +
    39 
    +
    40 
    +
    41 #endif /* NTRU_COMMON_H */
    +
    + - diff --git a/ntru__decrypt_8c.html b/ntru__decrypt_8c.html index f7a45c7..6d8ce11 100644 --- a/ntru__decrypt_8c.html +++ b/ntru__decrypt_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,54 +64,74 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_decrypt.c File Reference
    +
    ntru_decrypt.c File Reference

    NTRU decryption. More...

    -
    #include "ntru_ascii_poly.h"
    -#include "ntru_decrypt.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_poly_ascii.h"
    -#include "ntru_string.h"
    -#include <stdbool.h>
    -#include <string.h>
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_ascii_poly.h"
    +#include "ntru_decrypt.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_poly_ascii.h"
    +#include "ntru_string.h"
    +#include <stdbool.h>
    +#include <string.h>
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_decrypt.c:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    void ntru_decrypt_poly (const fmpz_poly_t encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, fmpz_poly_t out_bin, const ntru_params *params)
    stringntru_decrypt_string (const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
    void ntru_decrypt_poly (const fmpz_poly_t encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, fmpz_poly_t out_bin, const ntru_params *params)
     
    stringntru_decrypt_string (const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    NTRU decryption.

    This file handles the NTRU decryption algorithm.

    Definition in file ntru_decrypt.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -155,10 +166,9 @@ Functions
    void ntru_decrypt_poly void ntru_decrypt_poly ( const fmpz_poly_t  encr_msg,
    -
    -
    +

    Decryption of the given Polynom with the private key, its inverse and the fitting ntru_params

    -
    Parameters:
    +
    Parameters
    @@ -173,12 +183,12 @@ Functions - +
    encr_msgencrypted polynom with maximum length of N from the given context
    priv_keythe polynom containing the private key to decrypt the message
    - + @@ -207,10 +217,9 @@ Functions
    string* ntru_decrypt_string string* ntru_decrypt_string ( const string encr_msg,
    -
    -
    +

    Decryption of a given encrypted string.

    -
    Parameters:
    +
    Parameters
    @@ -219,34 +228,18 @@ Functions
    encr_msgthe encrypted message in the form of a string
    priv_keythe polynom containing the private key to decrypt the message
    -
    Returns:
    the decrypted string
    +
    Returns
    the decrypted string

    Definition at line 92 of file ntru_decrypt.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__decrypt_8c__incl.dot b/ntru__decrypt_8c__incl.dot deleted file mode 100644 index 1a937f2..0000000 --- a/ntru__decrypt_8c__incl.dot +++ /dev/null @@ -1,56 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_decrypt.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_ascii_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__ascii__poly_8h.html",tooltip="header for ntru_ascii_poly.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node5 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_decrypt.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__decrypt_8h.html",tooltip="header for ntru_decrypt.c"]; - Node10 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node11 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [label="ntru_poly_ascii.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly__ascii_8h.html",tooltip="header for ntru_poly_ascii.c"]; - Node15 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/ntru__decrypt_8c__incl.map b/ntru__decrypt_8c__incl.map new file mode 100644 index 0000000..cd456c8 --- /dev/null +++ b/ntru__decrypt_8c__incl.map @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/ntru__decrypt_8c__incl.md5 b/ntru__decrypt_8c__incl.md5 index 4c08d37..c786193 100644 --- a/ntru__decrypt_8c__incl.md5 +++ b/ntru__decrypt_8c__incl.md5 @@ -1 +1 @@ -7dbd28d16ee280fd2e4a31ed4f916592 \ No newline at end of file +fd7a83e2e136c4b6ede8e55ee7aa3b6d \ No newline at end of file diff --git a/ntru__decrypt_8c__incl.png b/ntru__decrypt_8c__incl.png new file mode 100644 index 0000000..35f0deb Binary files /dev/null and b/ntru__decrypt_8c__incl.png differ diff --git a/ntru__decrypt_8c_source.html b/ntru__decrypt_8c_source.html index cdfdad3..346d81f 100644 --- a/ntru__decrypt_8c_source.html +++ b/ntru__decrypt_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,136 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_decrypt.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_ascii_poly.h"
    -00030 #include "ntru_decrypt.h"
    -00031 #include "ntru_params.h"
    -00032 #include "ntru_poly.h"
    -00033 #include "ntru_poly_ascii.h"
    -00034 #include "ntru_string.h"
    -00035 
    -00036 #include <stdbool.h>
    -00037 #include <string.h>
    -00038 
    -00039 #include <fmpz_poly.h>
    -00040 #include <fmpz.h>
    -00041 
    -00042 
    -00043 /*------------------------------------------------------------------------*/
    -00044 
    -00045 void
    -00046 ntru_decrypt_poly(
    -00047         const fmpz_poly_t encr_msg,
    -00048         const fmpz_poly_t priv_key,
    -00049         const fmpz_poly_t priv_key_inv,
    -00050         fmpz_poly_t out_bin,
    -00051         const ntru_params *params)
    -00052 {
    -00053     fmpz_poly_t a,
    -00054                 priv_key_tmp,
    -00055                 priv_key_inv_tmp,
    -00056                 encr_msg_tmp;
    -00057 
    -00058     if (!encr_msg || !priv_key || !priv_key_inv || !out_bin || !params)
    -00059         NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    -00060 
    -00061     fmpz_poly_init(a);
    -00062     fmpz_poly_zero(a);
    -00063 
    -00064     /*
    -00065      * make sure all are shifted to
    -00066      * [-q/2, q/2]
    -00067      */
    -00068     fmpz_poly_init(priv_key_tmp);
    -00069     fmpz_poly_init(priv_key_inv_tmp);
    -00070     fmpz_poly_init(encr_msg_tmp);
    -00071     fmpz_poly_set(priv_key_tmp, priv_key);
    -00072     fmpz_poly_set(priv_key_inv_tmp, priv_key_inv);
    -00073     fmpz_poly_set(encr_msg_tmp, encr_msg);
    -00074     fmpz_poly_mod(priv_key_tmp, params->q);
    -00075     fmpz_poly_mod(priv_key_inv_tmp, params->q);
    -00076     fmpz_poly_mod(encr_msg_tmp, params->q);
    -00077 
    -00078     poly_starmultiply(priv_key_tmp, encr_msg_tmp, a, params, params->q);
    -00079     fmpz_poly_mod(a, params->q);
    -00080     poly_starmultiply(a, priv_key_inv_tmp, out_bin, params, params->p);
    -00081     fmpz_poly_mod(out_bin, params->p);
    -00082 
    -00083     fmpz_poly_clear(a);
    -00084     fmpz_poly_clear(priv_key_tmp);
    -00085     fmpz_poly_clear(priv_key_inv_tmp);
    -00086     fmpz_poly_clear(encr_msg_tmp);
    -00087 }
    -00088 
    -00089 /*------------------------------------------------------------------------*/
    -00090 
    -00091 string *
    -00092 ntru_decrypt_string(
    -00093         const string *encr_msg,
    -00094         const fmpz_poly_t priv_key,
    -00095         const fmpz_poly_t priv_key_inv,
    -00096         const ntru_params *params)
    -00097 {
    -00098     uint32_t i = 0;
    -00099     string *decr_msg;
    -00100     fmpz_poly_t **poly_array;
    -00101 
    -00102     if (!encr_msg || !encr_msg->len)
    -00103         NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    -00104 
    -00105     poly_array = base64_to_poly_arr(encr_msg, params);
    -00106 
    -00107     while (*poly_array[i]) {
    -00108         ntru_decrypt_poly(*poly_array[i],
    -00109                     priv_key,
    -00110                     priv_key_inv,
    -00111                     *poly_array[i],
    -00112                     params);
    -00113         i++;
    -00114     }
    -00115 
    -00116     decr_msg = bin_poly_arr_to_ascii((const fmpz_poly_t **)poly_array,
    -00117             i, params);
    -00118 
    -00119     poly_delete_array(poly_array);
    -00120 
    -00121     return decr_msg;
    -00122 }
    -00123 
    -00124 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -211,13 +78,157 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_decrypt.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_ascii_poly.h"
    +
    30 #include "ntru_decrypt.h"
    +
    31 #include "ntru_params.h"
    +
    32 #include "ntru_poly.h"
    +
    33 #include "ntru_poly_ascii.h"
    +
    34 #include "ntru_string.h"
    +
    35 
    +
    36 #include <stdbool.h>
    +
    37 #include <string.h>
    +
    38 
    +
    39 #include <fmpz_poly.h>
    +
    40 #include <fmpz.h>
    +
    41 
    +
    42 
    +
    43 /*------------------------------------------------------------------------*/
    +
    44 
    +
    45 void
    + +
    47  const fmpz_poly_t encr_msg,
    +
    48  const fmpz_poly_t priv_key,
    +
    49  const fmpz_poly_t priv_key_inv,
    +
    50  fmpz_poly_t out_bin,
    +
    51  const ntru_params *params)
    +
    52 {
    +
    53  fmpz_poly_t a,
    +
    54  priv_key_tmp,
    +
    55  priv_key_inv_tmp,
    +
    56  encr_msg_tmp;
    +
    57 
    +
    58  if (!encr_msg || !priv_key || !priv_key_inv || !out_bin || !params)
    +
    59  NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    +
    60 
    +
    61  fmpz_poly_init(a);
    +
    62  fmpz_poly_zero(a);
    +
    63 
    +
    64  /*
    +
    65  * make sure all are shifted to
    +
    66  * [-q/2, q/2]
    +
    67  */
    +
    68  fmpz_poly_init(priv_key_tmp);
    +
    69  fmpz_poly_init(priv_key_inv_tmp);
    +
    70  fmpz_poly_init(encr_msg_tmp);
    +
    71  fmpz_poly_set(priv_key_tmp, priv_key);
    +
    72  fmpz_poly_set(priv_key_inv_tmp, priv_key_inv);
    +
    73  fmpz_poly_set(encr_msg_tmp, encr_msg);
    +
    74  fmpz_poly_mod(priv_key_tmp, params->q);
    +
    75  fmpz_poly_mod(priv_key_inv_tmp, params->q);
    +
    76  fmpz_poly_mod(encr_msg_tmp, params->q);
    +
    77 
    +
    78  poly_starmultiply(priv_key_tmp, encr_msg_tmp, a, params, params->q);
    +
    79  fmpz_poly_mod(a, params->q);
    +
    80  poly_starmultiply(a, priv_key_inv_tmp, out_bin, params, params->p);
    +
    81  fmpz_poly_mod(out_bin, params->p);
    +
    82 
    +
    83  fmpz_poly_clear(a);
    +
    84  fmpz_poly_clear(priv_key_tmp);
    +
    85  fmpz_poly_clear(priv_key_inv_tmp);
    +
    86  fmpz_poly_clear(encr_msg_tmp);
    +
    87 }
    +
    88 
    +
    89 /*------------------------------------------------------------------------*/
    +
    90 
    +
    91 string *
    + +
    93  const string *encr_msg,
    +
    94  const fmpz_poly_t priv_key,
    +
    95  const fmpz_poly_t priv_key_inv,
    +
    96  const ntru_params *params)
    +
    97 {
    +
    98  uint32_t i = 0;
    +
    99  string *decr_msg;
    +
    100  fmpz_poly_t **poly_array;
    +
    101 
    +
    102  if (!encr_msg || !encr_msg->len)
    +
    103  NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    +
    104 
    +
    105  poly_array = base64_to_poly_arr(encr_msg, params);
    +
    106 
    +
    107  while (*poly_array[i]) {
    +
    108  ntru_decrypt_poly(*poly_array[i],
    +
    109  priv_key,
    +
    110  priv_key_inv,
    +
    111  *poly_array[i],
    +
    112  params);
    +
    113  i++;
    +
    114  }
    +
    115 
    +
    116  decr_msg = bin_poly_arr_to_ascii((const fmpz_poly_t **)poly_array,
    +
    117  i, params);
    +
    118 
    +
    119  poly_delete_array(poly_array);
    +
    120 
    +
    121  return decr_msg;
    +
    122 }
    +
    123 
    +
    124 /*------------------------------------------------------------------------*/
    +
    size_t len
    Definition: ntru_string.h:53
    +
    void fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:182
    +
    #define NTRU_ABORT_DEBUG(...)
    Definition: ntru_err.h:39
    +
    uint32_t p
    Definition: ntru_params.h:56
    +
    fmpz_poly_t ** base64_to_poly_arr(const string *to_poly, const ntru_params *params)
    +
    header for ntru_decrypt.c
    + +
    header for ntru_poly_ascii.c
    +
    NTRU parameters.
    +
    void poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    Definition: ntru_poly.c:239
    +
    void poly_delete_array(fmpz_poly_t **poly_array)
    Definition: ntru_poly.c:131
    +
    string * bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
    +
    uint32_t q
    Definition: ntru_params.h:52
    +
    void ntru_decrypt_poly(const fmpz_poly_t encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, fmpz_poly_t out_bin, const ntru_params *params)
    Definition: ntru_decrypt.c:46
    +
    header for ntru_string.c
    +
    string * ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
    Definition: ntru_decrypt.c:92
    +
    header for ntru_poly.c
    +
    header for ntru_ascii_poly.c
    +
    + - diff --git a/ntru__decrypt_8h.html b/ntru__decrypt_8h.html index fc17b03..54bc813 100644 --- a/ntru__decrypt_8h.html +++ b/ntru__decrypt_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,49 +64,69 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_decrypt.h File Reference
    +
    ntru_decrypt.h File Reference
    -

    header for ntru_decrypt.c +

    header for ntru_decrypt.c More...

    -
    #include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_string.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_string.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_decrypt.h:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    void ntru_decrypt_poly (const fmpz_poly_t encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, fmpz_poly_t out_tern, const ntru_params *params)
    stringntru_decrypt_string (const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
    void ntru_decrypt_poly (const fmpz_poly_t encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, fmpz_poly_t out_tern, const ntru_params *params)
     
    stringntru_decrypt_string (const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
     
    -

    Detailed Description

    -

    header for ntru_decrypt.c

    -

    Header for the external API of ntru_decrypt.c.

    +

    Detailed Description

    +

    header for ntru_decrypt.c

    +

    Header for the external API of ntru_decrypt.c.

    Definition in file ntru_decrypt.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -150,10 +161,9 @@ Functions
    void ntru_decrypt_poly void ntru_decrypt_poly ( const fmpz_poly_t  encr_msg,
    -
    -
    +

    Decryption of the given Polynom with the private key, its inverse and the fitting ntru_params

    -
    Parameters:
    +
    Parameters
    @@ -168,12 +178,12 @@ Functions - +
    encr_msgencrypted polynom with maximum length of N from the given context
    priv_keythe polynom containing the private key to decrypt the message
    - + @@ -202,10 +212,9 @@ Functions
    string* ntru_decrypt_string string* ntru_decrypt_string ( const string encr_msg,
    -
    -
    +

    Decryption of a given encrypted string.

    -
    Parameters:
    +
    Parameters
    @@ -214,34 +223,18 @@ Functions
    encr_msgthe encrypted message in the form of a string
    priv_keythe polynom containing the private key to decrypt the message
    -
    Returns:
    the decrypted string
    +
    Returns
    the decrypted string

    Definition at line 92 of file ntru_decrypt.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__decrypt_8h__incl.dot b/ntru__decrypt_8h__incl.dot deleted file mode 100644 index bdb6d70..0000000 --- a/ntru__decrypt_8h__incl.dot +++ /dev/null @@ -1,30 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_decrypt.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node4 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node4 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node4 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node10 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__decrypt_8h__incl.map b/ntru__decrypt_8h__incl.map new file mode 100644 index 0000000..35c1361 --- /dev/null +++ b/ntru__decrypt_8h__incl.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/ntru__decrypt_8h__incl.md5 b/ntru__decrypt_8h__incl.md5 index 0699f68..e7a1060 100644 --- a/ntru__decrypt_8h__incl.md5 +++ b/ntru__decrypt_8h__incl.md5 @@ -1 +1 @@ -5e60f3f7ddf44d6bc8445e25e29c3343 \ No newline at end of file +8fb618f6c80c80fe82e657fdec2bcc8e \ No newline at end of file diff --git a/ntru__decrypt_8h__incl.png b/ntru__decrypt_8h__incl.png new file mode 100644 index 0000000..2425348 Binary files /dev/null and b/ntru__decrypt_8h__incl.png differ diff --git a/ntru__decrypt_8h_source.html b/ntru__decrypt_8h_source.html index baa23c2..ea9362e 100644 --- a/ntru__decrypt_8h_source.html +++ b/ntru__decrypt_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,68 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_decrypt.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_DECRYPT_H
    -00029 #define NTRU_DECRYPT_H
    -00030 
    -00031 #include "ntru_params.h"
    -00032 #include "ntru_poly.h"
    -00033 #include "ntru_string.h"
    -00034 
    -00035 #include <fmpz_poly.h>
    -00036 #include <fmpz.h>
    -00037 
    -00038 
    -00051 void
    -00052 ntru_decrypt_poly(
    -00053         const fmpz_poly_t encr_msg,
    -00054         const fmpz_poly_t priv_key,
    -00055         const fmpz_poly_t priv_key_inv,
    -00056         fmpz_poly_t out_tern,
    -00057         const ntru_params *params);
    -00058 
    -00069 string *
    -00070 ntru_decrypt_string(
    -00071         const string *encr_msg,
    -00072         const fmpz_poly_t priv_key,
    -00073         const fmpz_poly_t priv_key_inv,
    -00074         const ntru_params *params);
    -00075 
    -00076 
    -00077 #endif /* NTRU_DECRYPT */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -143,13 +78,77 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_decrypt.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_DECRYPT_H
    +
    29 #define NTRU_DECRYPT_H
    +
    30 
    +
    31 #include "ntru_params.h"
    +
    32 #include "ntru_poly.h"
    +
    33 #include "ntru_string.h"
    +
    34 
    +
    35 #include <fmpz_poly.h>
    +
    36 #include <fmpz.h>
    +
    37 
    +
    38 
    +
    51 void
    + +
    53  const fmpz_poly_t encr_msg,
    +
    54  const fmpz_poly_t priv_key,
    +
    55  const fmpz_poly_t priv_key_inv,
    +
    56  fmpz_poly_t out_tern,
    +
    57  const ntru_params *params);
    +
    58 
    +
    69 string *
    + +
    71  const string *encr_msg,
    +
    72  const fmpz_poly_t priv_key,
    +
    73  const fmpz_poly_t priv_key_inv,
    +
    74  const ntru_params *params);
    +
    75 
    +
    76 
    +
    77 #endif /* NTRU_DECRYPT */
    +
    void ntru_decrypt_poly(const fmpz_poly_t encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, fmpz_poly_t out_tern, const ntru_params *params)
    Definition: ntru_decrypt.c:46
    + +
    NTRU parameters.
    +
    string * ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params)
    Definition: ntru_decrypt.c:92
    +
    header for ntru_string.c
    +
    header for ntru_poly.c
    +
    + - diff --git a/ntru__encrypt_8c.html b/ntru__encrypt_8c.html index 0d87a29..517879b 100644 --- a/ntru__encrypt_8c.html +++ b/ntru__encrypt_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,54 +64,74 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_encrypt.c File Reference
    +
    ntru_encrypt.c File Reference

    NTRU encryption. More...

    -
    #include "ntru_ascii_poly.h"
    -#include "ntru_encrypt.h"
    -#include "ntru_mem.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_poly_ascii.h"
    -#include "ntru_string.h"
    -#include <string.h>
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_ascii_poly.h"
    +#include "ntru_encrypt.h"
    +#include "ntru_mem.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_poly_ascii.h"
    +#include "ntru_string.h"
    +#include <string.h>
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_encrypt.c:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    void ntru_encrypt_poly (const fmpz_poly_t msg_bin, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params)
    stringntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
    void ntru_encrypt_poly (const fmpz_poly_t msg_bin, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params)
     
    stringntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    NTRU encryption.

    This file handles the NTRU encryption algorithm.

    Definition in file ntru_encrypt.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -155,15 +166,14 @@ Functions
    void ntru_encrypt_poly void ntru_encrypt_poly ( const fmpz_poly_t  msg_tern,
    -
    -
    +

    encrypt the msg, using the math: e = (h ∗ r) + m (mod q)

    e = the encrypted poly

    h = the public key

    r = the random poly

    m = the message poly

    q = large mod

    -
    Parameters:
    +
    Parameters
    @@ -178,12 +188,12 @@ Functions - +
    msg_ternthe message to encrypt, in ternary format
    pub_keythe public key
    - + @@ -212,10 +222,9 @@ Functions
    string* ntru_encrypt_string string* ntru_encrypt_string ( const string msg,
    -
    -
    +

    Encrypt a message in the form of a null-terminated char array and return a string.

    -
    Parameters:
    +
    Parameters
    @@ -224,34 +233,18 @@ Functions
    msgthe message
    pub_keythe public key
    -
    Returns:
    the newly allocated encrypted string
    +
    Returns
    the newly allocated encrypted string

    Definition at line 74 of file ntru_encrypt.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__encrypt_8c__incl.dot b/ntru__encrypt_8c__incl.dot deleted file mode 100644 index 7eb101e..0000000 --- a/ntru__encrypt_8c__incl.dot +++ /dev/null @@ -1,58 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_encrypt.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_ascii_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__ascii__poly_8h.html",tooltip="header for ntru_ascii_poly.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node5 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_encrypt.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__encrypt_8h.html",tooltip="header for encrypt.c"]; - Node10 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node11 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [label="ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__mem_8h.html",tooltip="header for ntru_mem.c"]; - Node15 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [label="ntru_poly_ascii.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly__ascii_8h.html",tooltip="header for ntru_poly_ascii.c"]; - Node16 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node17 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/ntru__encrypt_8c__incl.map b/ntru__encrypt_8c__incl.map new file mode 100644 index 0000000..f6e8043 --- /dev/null +++ b/ntru__encrypt_8c__incl.map @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ntru__encrypt_8c__incl.md5 b/ntru__encrypt_8c__incl.md5 index 9780356..18ccea7 100644 --- a/ntru__encrypt_8c__incl.md5 +++ b/ntru__encrypt_8c__incl.md5 @@ -1 +1 @@ -99d0879ce83c16c396109da391990130 \ No newline at end of file +7c1c6abc6b2d58a64859dd38bfb8acdb \ No newline at end of file diff --git a/ntru__encrypt_8c__incl.png b/ntru__encrypt_8c__incl.png new file mode 100644 index 0000000..e3da775 Binary files /dev/null and b/ntru__encrypt_8c__incl.png differ diff --git a/ntru__encrypt_8c_source.html b/ntru__encrypt_8c_source.html index eac195c..f43597d 100644 --- a/ntru__encrypt_8c_source.html +++ b/ntru__encrypt_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,118 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_encrypt.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_ascii_poly.h"
    -00030 #include "ntru_encrypt.h"
    -00031 #include "ntru_mem.h"
    -00032 #include "ntru_params.h"
    -00033 #include "ntru_poly.h"
    -00034 #include "ntru_poly_ascii.h"
    -00035 #include "ntru_string.h"
    -00036 
    -00037 #include <string.h>
    -00038 
    -00039 #include <fmpz_poly.h>
    -00040 #include <fmpz.h>
    -00041 
    -00042 
    -00043 /*------------------------------------------------------------------------*/
    -00044 
    -00045 void
    -00046 ntru_encrypt_poly(
    -00047         const fmpz_poly_t msg_bin,
    -00048         const fmpz_poly_t pub_key,
    -00049         const fmpz_poly_t rnd,
    -00050         fmpz_poly_t out,
    -00051         const ntru_params *params)
    -00052 {
    -00053     fmpz_poly_t tmp_poly_msg;
    -00054 
    -00055     if (!msg_bin || !pub_key || !rnd || !out || !params)
    -00056         NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    -00057 
    -00058     /* allow aliasing */
    -00059     fmpz_poly_init(tmp_poly_msg);
    -00060     fmpz_poly_set(tmp_poly_msg, msg_bin);
    -00061 
    -00062     fmpz_poly_zero(out);
    -00063     poly_starmultiply(pub_key, rnd, out, params, params->q);
    -00064 
    -00065     fmpz_poly_add(out, out, tmp_poly_msg);
    -00066     fmpz_poly_mod_unsigned(out, params->q);
    -00067 
    -00068     fmpz_poly_clear(tmp_poly_msg);
    -00069 }
    -00070 
    -00071 /*------------------------------------------------------------------------*/
    -00072 
    -00073 string *
    -00074 ntru_encrypt_string(
    -00075         const string *msg,
    -00076         const fmpz_poly_t pub_key,
    -00077         const fmpz_poly_t rnd,
    -00078         const ntru_params *params)
    -00079 {
    -00080     uint32_t i = 0;
    -00081     string *enc_msg;
    -00082     fmpz_poly_t **poly_array;
    -00083 
    -00084     if (!msg || !msg->len)
    -00085         NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    -00086 
    -00087     poly_array = ascii_to_bin_poly_arr(msg, params);
    -00088 
    -00089     while (*poly_array[i]) {
    -00090         ntru_encrypt_poly(*poly_array[i],
    -00091                 pub_key,
    -00092                 rnd,
    -00093                 *poly_array[i],
    -00094                 params);
    -00095         i++;
    -00096     }
    -00097 
    -00098     enc_msg = poly_arr_to_base64((const fmpz_poly_t **)poly_array,
    -00099             i, params);
    -00100 
    -00101     poly_delete_array(poly_array);
    -00102 
    -00103     return enc_msg;
    -00104 }
    -00105 
    -00106 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -193,13 +78,139 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_encrypt.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_ascii_poly.h"
    +
    30 #include "ntru_encrypt.h"
    +
    31 #include "ntru_mem.h"
    +
    32 #include "ntru_params.h"
    +
    33 #include "ntru_poly.h"
    +
    34 #include "ntru_poly_ascii.h"
    +
    35 #include "ntru_string.h"
    +
    36 
    +
    37 #include <string.h>
    +
    38 
    +
    39 #include <fmpz_poly.h>
    +
    40 #include <fmpz.h>
    +
    41 
    +
    42 
    +
    43 /*------------------------------------------------------------------------*/
    +
    44 
    +
    45 void
    + +
    47  const fmpz_poly_t msg_bin,
    +
    48  const fmpz_poly_t pub_key,
    +
    49  const fmpz_poly_t rnd,
    +
    50  fmpz_poly_t out,
    +
    51  const ntru_params *params)
    +
    52 {
    +
    53  fmpz_poly_t tmp_poly_msg;
    +
    54 
    +
    55  if (!msg_bin || !pub_key || !rnd || !out || !params)
    +
    56  NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    +
    57 
    +
    58  /* allow aliasing */
    +
    59  fmpz_poly_init(tmp_poly_msg);
    +
    60  fmpz_poly_set(tmp_poly_msg, msg_bin);
    +
    61 
    +
    62  fmpz_poly_zero(out);
    +
    63  poly_starmultiply(pub_key, rnd, out, params, params->q);
    +
    64 
    +
    65  fmpz_poly_add(out, out, tmp_poly_msg);
    +
    66  fmpz_poly_mod_unsigned(out, params->q);
    +
    67 
    +
    68  fmpz_poly_clear(tmp_poly_msg);
    +
    69 }
    +
    70 
    +
    71 /*------------------------------------------------------------------------*/
    +
    72 
    +
    73 string *
    + +
    75  const string *msg,
    +
    76  const fmpz_poly_t pub_key,
    +
    77  const fmpz_poly_t rnd,
    +
    78  const ntru_params *params)
    +
    79 {
    +
    80  uint32_t i = 0;
    +
    81  string *enc_msg;
    +
    82  fmpz_poly_t **poly_array;
    +
    83 
    +
    84  if (!msg || !msg->len)
    +
    85  NTRU_ABORT_DEBUG("Unexpected NULL parameters");
    +
    86 
    +
    87  poly_array = ascii_to_bin_poly_arr(msg, params);
    +
    88 
    +
    89  while (*poly_array[i]) {
    +
    90  ntru_encrypt_poly(*poly_array[i],
    +
    91  pub_key,
    +
    92  rnd,
    +
    93  *poly_array[i],
    +
    94  params);
    +
    95  i++;
    +
    96  }
    +
    97 
    +
    98  enc_msg = poly_arr_to_base64((const fmpz_poly_t **)poly_array,
    +
    99  i, params);
    +
    100 
    +
    101  poly_delete_array(poly_array);
    +
    102 
    +
    103  return enc_msg;
    +
    104 }
    +
    105 
    +
    106 /*------------------------------------------------------------------------*/
    +
    fmpz_poly_t ** ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params)
    +
    size_t len
    Definition: ntru_string.h:53
    +
    void ntru_encrypt_poly(const fmpz_poly_t msg_bin, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params)
    Definition: ntru_encrypt.c:46
    +
    string * poly_arr_to_base64(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    +
    void fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:166
    +
    #define NTRU_ABORT_DEBUG(...)
    Definition: ntru_err.h:39
    + +
    header for encrypt.c
    +
    header for ntru_mem.c
    +
    header for ntru_poly_ascii.c
    +
    NTRU parameters.
    +
    string * ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
    Definition: ntru_encrypt.c:74
    +
    void poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    Definition: ntru_poly.c:239
    +
    void poly_delete_array(fmpz_poly_t **poly_array)
    Definition: ntru_poly.c:131
    +
    uint32_t q
    Definition: ntru_params.h:52
    +
    header for ntru_string.c
    +
    header for ntru_poly.c
    +
    header for ntru_ascii_poly.c
    +
    + - diff --git a/ntru__encrypt_8h.html b/ntru__encrypt_8h.html index 8952883..3381549 100644 --- a/ntru__encrypt_8h.html +++ b/ntru__encrypt_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,49 +64,69 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_encrypt.h File Reference
    +
    ntru_encrypt.h File Reference

    header for encrypt.c More...

    -
    #include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_string.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_string.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_encrypt.h:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    void ntru_encrypt_poly (const fmpz_poly_t msg_tern, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params)
    stringntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
    void ntru_encrypt_poly (const fmpz_poly_t msg_tern, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params)
     
    stringntru_encrypt_string (const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    header for encrypt.c

    -

    Header for the internal API of ntru_encrypt.c.

    +

    Header for the internal API of ntru_encrypt.c.

    Definition in file ntru_encrypt.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -150,15 +161,14 @@ Functions
    void ntru_encrypt_poly void ntru_encrypt_poly ( const fmpz_poly_t  msg_tern,
    -
    -
    +

    encrypt the msg, using the math: e = (h ∗ r) + m (mod q)

    e = the encrypted poly

    h = the public key

    r = the random poly

    m = the message poly

    q = large mod

    -
    Parameters:
    +
    Parameters
    @@ -173,12 +183,12 @@ Functions - +
    msg_ternthe message to encrypt, in ternary format
    pub_keythe public key
    - + @@ -207,10 +217,9 @@ Functions
    string* ntru_encrypt_string string* ntru_encrypt_string ( const string msg,
    -
    -
    +

    Encrypt a message in the form of a null-terminated char array and return a string.

    -
    Parameters:
    +
    Parameters
    @@ -219,34 +228,18 @@ Functions
    msgthe message
    pub_keythe public key
    -
    Returns:
    the newly allocated encrypted string
    +
    Returns
    the newly allocated encrypted string

    Definition at line 74 of file ntru_encrypt.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__encrypt_8h__incl.dot b/ntru__encrypt_8h__incl.dot deleted file mode 100644 index 9ac35dc..0000000 --- a/ntru__encrypt_8h__incl.dot +++ /dev/null @@ -1,30 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_encrypt.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node4 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node4 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node4 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node4 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node10 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__encrypt_8h__incl.map b/ntru__encrypt_8h__incl.map new file mode 100644 index 0000000..e38d25d --- /dev/null +++ b/ntru__encrypt_8h__incl.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/ntru__encrypt_8h__incl.md5 b/ntru__encrypt_8h__incl.md5 index cc542d0..4c117eb 100644 --- a/ntru__encrypt_8h__incl.md5 +++ b/ntru__encrypt_8h__incl.md5 @@ -1 +1 @@ -0c16aafbff376266fd942e48b12d9d11 \ No newline at end of file +e4e4917898c572685b6a0d48ebcb9834 \ No newline at end of file diff --git a/ntru__encrypt_8h__incl.png b/ntru__encrypt_8h__incl.png new file mode 100644 index 0000000..0bb520d Binary files /dev/null and b/ntru__encrypt_8h__incl.png differ diff --git a/ntru__encrypt_8h_source.html b/ntru__encrypt_8h_source.html index e4e8b54..0f6a65d 100644 --- a/ntru__encrypt_8h_source.html +++ b/ntru__encrypt_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,69 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_encrypt.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef PQC_ENCRYPT_H
    -00029 #define PQC_ENCRYPT_H
    -00030 
    -00031 
    -00032 #include "ntru_params.h"
    -00033 #include "ntru_poly.h"
    -00034 #include "ntru_string.h"
    -00035 
    -00036 #include <fmpz_poly.h>
    -00037 #include <fmpz.h>
    -00038 
    -00039 
    -00062 void
    -00063 ntru_encrypt_poly(
    -00064         const fmpz_poly_t msg_tern,
    -00065         const fmpz_poly_t pub_key,
    -00066         const fmpz_poly_t rnd,
    -00067         fmpz_poly_t out,
    -00068         const ntru_params *params);
    -00069 
    -00081 string *
    -00082 ntru_encrypt_string(
    -00083         const string *msg,
    -00084         const fmpz_poly_t pub_key,
    -00085         const fmpz_poly_t rnd,
    -00086         const ntru_params *params);
    -00087 
    -00088 
    -00089 #endif /* PQC_ENCRYPT_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -144,13 +78,78 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_encrypt.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef PQC_ENCRYPT_H
    +
    29 #define PQC_ENCRYPT_H
    +
    30 
    +
    31 
    +
    32 #include "ntru_params.h"
    +
    33 #include "ntru_poly.h"
    +
    34 #include "ntru_string.h"
    +
    35 
    +
    36 #include <fmpz_poly.h>
    +
    37 #include <fmpz.h>
    +
    38 
    +
    39 
    +
    62 void
    + +
    64  const fmpz_poly_t msg_tern,
    +
    65  const fmpz_poly_t pub_key,
    +
    66  const fmpz_poly_t rnd,
    +
    67  fmpz_poly_t out,
    +
    68  const ntru_params *params);
    +
    69 
    +
    81 string *
    + +
    83  const string *msg,
    +
    84  const fmpz_poly_t pub_key,
    +
    85  const fmpz_poly_t rnd,
    +
    86  const ntru_params *params);
    +
    87 
    +
    88 
    +
    89 #endif /* PQC_ENCRYPT_H */
    + +
    NTRU parameters.
    +
    header for ntru_string.c
    +
    void ntru_encrypt_poly(const fmpz_poly_t msg_tern, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, fmpz_poly_t out, const ntru_params *params)
    Definition: ntru_encrypt.c:46
    +
    string * ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params)
    Definition: ntru_encrypt.c:74
    +
    header for ntru_poly.c
    +
    + - diff --git a/ntru__err_8h.html b/ntru__err_8h.html index 2a0f527..e00ff0a 100644 --- a/ntru__err_8h.html +++ b/ntru__err_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_err.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,134 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    - -
    -
    /home/travis/build/hasufell/pqc/src/ntru_err.h File Reference
    -
    -
    - -

    error handling -More...

    - -

    Go to the source code of this file.

    - - - - - - -

    -Defines

    #define NTRU_ABORT(...)
    #define NTRU_ABORT_DEBUG(...)
    #define NTRU_WARN(...)
    #define NTRU_WARN_DEBUG(...)
    -

    Detailed Description

    -

    error handling

    -

    This file provides error macros and functions for the NTRU cryptosystem.

    - -

    Definition in file ntru_err.h.

    -

    Define Documentation

    - -
    -
    - - - - - - - - -
    #define NTRU_ABORT( ...)
    -
    -
    -Value:
    { \
    -    fprintf(stderr, __VA_ARGS__); \
    -    abort(); \
    -}
    -
    -

    Definition at line 33 of file ntru_err.h.

    - -
    -
    - -
    -
    - - - - - - - - -
    #define NTRU_ABORT_DEBUG( ...)
    -
    -
    -Value:
    { \
    -    fprintf(stderr, __VA_ARGS__); \
    -    fprintf(stderr, " [file %s, line %d]:\n", \
    -                __FILE__, __LINE__); \
    -    abort(); \
    -}
    -
    -

    Definition at line 39 of file ntru_err.h.

    - -
    -
    - -
    -
    - - - - - - - - -
    #define NTRU_WARN( ...)
    -
    -
    -Value:
    { \
    -    fprintf(stderr, __VA_ARGS__); \
    -}
    -
    -

    Definition at line 47 of file ntru_err.h.

    - -
    -
    - -
    -
    - - - - - - - - -
    #define NTRU_WARN_DEBUG( ...)
    -
    -
    -Value:
    { \
    -    fprintf(stderr, __VA_ARGS__); \
    -    fprintf(stderr, " [file %s, line %d]:\n", \
    -                __FILE__, __LINE__); \
    -}
    -
    -

    Definition at line 52 of file ntru_err.h.

    - -
    -
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -209,13 +78,137 @@ Defines
    + + +
    + +
    +
    ntru_err.h File Reference
    +
    +
    +

    error handling +More...

    +

    Go to the source code of this file.

    + + + + + + + + + + +

    +Macros

    #define NTRU_ABORT(...)
     
    #define NTRU_ABORT_DEBUG(...)
     
    #define NTRU_WARN(...)
     
    #define NTRU_WARN_DEBUG(...)
     
    +

    Detailed Description

    +

    error handling

    +

    This file provides error macros and functions for the NTRU cryptosystem.

    + +

    Definition in file ntru_err.h.

    +

    Macro Definition Documentation

    + +
    +
    + + + + + + + + +
    #define NTRU_ABORT( ...)
    +
    +Value:
    { \
    +
    fprintf(stderr, __VA_ARGS__); \
    +
    abort(); \
    +
    }
    +
    +

    Definition at line 33 of file ntru_err.h.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define NTRU_ABORT_DEBUG( ...)
    +
    +Value:
    { \
    +
    fprintf(stderr, __VA_ARGS__); \
    +
    fprintf(stderr, " [file %s, line %d]:\n", \
    +
    __FILE__, __LINE__); \
    +
    abort(); \
    +
    }
    +
    +

    Definition at line 39 of file ntru_err.h.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define NTRU_WARN( ...)
    +
    +Value:
    { \
    +
    fprintf(stderr, __VA_ARGS__); \
    +
    }
    +
    +

    Definition at line 47 of file ntru_err.h.

    + +
    +
    + +
    +
    + + + + + + + + +
    #define NTRU_WARN_DEBUG( ...)
    +
    +Value:
    { \
    +
    fprintf(stderr, __VA_ARGS__); \
    +
    fprintf(stderr, " [file %s, line %d]:\n", \
    +
    __FILE__, __LINE__); \
    +
    }
    +
    +

    Definition at line 52 of file ntru_err.h.

    + +
    +
    +
    + - diff --git a/ntru__err_8h_source.html b/ntru__err_8h_source.html index 64844bc..0fdd678 100644 --- a/ntru__err_8h_source.html +++ b/ntru__err_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_err.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,72 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_err.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #ifndef NTRU_ERR_H
    -00030 #define NTRU_ERR_H
    -00031 
    -00032 
    -00033 #define NTRU_ABORT(...) \
    -00034 { \
    -00035     fprintf(stderr, __VA_ARGS__); \
    -00036     abort(); \
    -00037 }
    -00038 
    -00039 #define NTRU_ABORT_DEBUG(...) \
    -00040 { \
    -00041     fprintf(stderr, __VA_ARGS__); \
    -00042     fprintf(stderr, " [file %s, line %d]:\n", \
    -00043                 __FILE__, __LINE__); \
    -00044     abort(); \
    -00045 }
    -00046 
    -00047 #define NTRU_WARN(...) \
    -00048 { \
    -00049     fprintf(stderr, __VA_ARGS__); \
    -00050 }
    -00051 
    -00052 #define NTRU_WARN_DEBUG(...) \
    -00053 { \
    -00054     fprintf(stderr, __VA_ARGS__); \
    -00055     fprintf(stderr, " [file %s, line %d]:\n", \
    -00056                 __FILE__, __LINE__); \
    -00057 }
    -00058 
    -00059 
    -00060 #endif /* NTRU_ERR_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -147,13 +78,75 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_err.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #ifndef NTRU_ERR_H
    +
    30 #define NTRU_ERR_H
    +
    31 
    +
    32 
    +
    33 #define NTRU_ABORT(...) \
    +
    34 { \
    +
    35  fprintf(stderr, __VA_ARGS__); \
    +
    36  abort(); \
    +
    37 }
    +
    38 
    +
    39 #define NTRU_ABORT_DEBUG(...) \
    +
    40 { \
    +
    41  fprintf(stderr, __VA_ARGS__); \
    +
    42  fprintf(stderr, " [file %s, line %d]:\n", \
    +
    43  __FILE__, __LINE__); \
    +
    44  abort(); \
    +
    45 }
    +
    46 
    +
    47 #define NTRU_WARN(...) \
    +
    48 { \
    +
    49  fprintf(stderr, __VA_ARGS__); \
    +
    50 }
    +
    51 
    +
    52 #define NTRU_WARN_DEBUG(...) \
    +
    53 { \
    +
    54  fprintf(stderr, __VA_ARGS__); \
    +
    55  fprintf(stderr, " [file %s, line %d]:\n", \
    +
    56  __FILE__, __LINE__); \
    +
    57 }
    +
    58 
    +
    59 
    +
    60 #endif /* NTRU_ERR_H */
    +
    + - diff --git a/ntru__file_8c.html b/ntru__file_8c.html index a467896..e325e82 100644 --- a/ntru__file_8c.html +++ b/ntru__file_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,104 +64,124 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_file.c File Reference
    +
    ntru_file.c File Reference

    file operations More...

    -
    #include "ntru_common.h"
    -#include "ntru_err.h"
    -#include "ntru_mem.h"
    -#include "ntru_string.h"
    -#include <fcntl.h>
    -#include <stdbool.h>
    -#include <stdint.h>
    -#include <stdio.h>
    -#include <stdlib.h>
    -#include <string.h>
    -#include <sys/stat.h>
    -#include <sys/types.h>
    -#include <unistd.h>
    +
    #include "ntru_common.h"
    +#include "ntru_err.h"
    +#include "ntru_mem.h"
    +#include "ntru_string.h"
    +#include <fcntl.h>
    +#include <stdbool.h>
    +#include <stdint.h>
    +#include <stdio.h>
    +#include <stdlib.h>
    +#include <string.h>
    +#include <sys/stat.h>
    +#include <sys/types.h>
    +#include <unistd.h>
    Include dependency graph for ntru_file.c:
    - +

    Go to the source code of this file.

    - - - + + +

    -Defines

    #define STD_FILE_BUF   4096

    +

    +Macros

    #define STD_FILE_BUF   4096
     
    + - - + + + +

    Functions

    stringread_file (char const *const filename)
    bool write_file (string const *wstring, char const *const filename)
    stringread_file (char const *const filename)
     
    bool write_file (string const *wstring, char const *const filename)
     
    -

    Detailed Description

    +

    Detailed Description

    file operations

    Allows operations on files, such as reading and writing.

    Definition in file ntru_file.c.

    -

    Define Documentation

    - +

    Macro Definition Documentation

    +
    - +
    #define STD_FILE_BUF   4096#define STD_FILE_BUF   4096
    -
    -
    +

    Definition at line 44 of file ntru_file.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    string* read_file string* read_file ( char const *const  filename)
    -
    -
    +

    Reads a file and returns a newly allocated string.

    -
    Parameters:
    +
    Parameters
    filenamefile to open
    -
    Returns:
    a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)
    +
    Returns
    a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)

    Definition at line 50 of file ntru_file.c.

    - +
    - + @@ -187,44 +198,27 @@ Functions
    bool write_file bool write_file ( string const *  wstring,
    -
    -
    +

    Write a string to a file. The file will be pruned or created if it does not exist.

    -
    Parameters:
    +
    Parameters
    wstringthe string to write to the file
    filenamethe name of the file to write to
    -
    Returns:
    true for success or false for failure if fopen or fclose failed
    +
    Returns
    true for success or false for failure if fopen or fclose failed

    Definition at line 107 of file ntru_file.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__file_8c__incl.dot b/ntru__file_8c__incl.dot deleted file mode 100644 index 09a55c4..0000000 --- a/ntru__file_8c__incl.dot +++ /dev/null @@ -1,35 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_file.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__mem_8h.html",tooltip="header for ntru_mem.c"]; - Node5 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node6 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="fcntl.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="sys/stat.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="sys/types.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [label="unistd.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__file_8c__incl.map b/ntru__file_8c__incl.map new file mode 100644 index 0000000..eca79f9 --- /dev/null +++ b/ntru__file_8c__incl.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/ntru__file_8c__incl.md5 b/ntru__file_8c__incl.md5 index 01c8303..3840828 100644 --- a/ntru__file_8c__incl.md5 +++ b/ntru__file_8c__incl.md5 @@ -1 +1 @@ -3f5614474a6bac84c8ead4a69185b1d7 \ No newline at end of file +14fe5052b4997663bc758bcb68f81974 \ No newline at end of file diff --git a/ntru__file_8c__incl.png b/ntru__file_8c__incl.png new file mode 100644 index 0000000..5b96710 Binary files /dev/null and b/ntru__file_8c__incl.png differ diff --git a/ntru__file_8c_source.html b/ntru__file_8c_source.html index 8691414..6e41528 100644 --- a/ntru__file_8c_source.html +++ b/ntru__file_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,141 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_file.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_common.h"
    -00030 #include "ntru_err.h"
    -00031 #include "ntru_mem.h"
    -00032 #include "ntru_string.h"
    -00033 
    -00034 #include <fcntl.h>
    -00035 #include <stdbool.h>
    -00036 #include <stdint.h>
    -00037 #include <stdio.h>
    -00038 #include <stdlib.h>
    -00039 #include <string.h>
    -00040 #include <sys/stat.h>
    -00041 #include <sys/types.h>
    -00042 #include <unistd.h>
    -00043 
    -00044 #define STD_FILE_BUF 4096
    -00045 
    -00046 
    -00047 /*------------------------------------------------------------------------*/
    -00048 
    -00049 string *
    -00050 read_file(char const * const filename)
    -00051 {
    -00052     char buf[STD_FILE_BUF],
    -00053          *cstring = NULL;
    -00054     int fd = 0;
    -00055     size_t str_size = 0;
    -00056     ssize_t n;
    -00057     size_t file_length = 0;
    -00058     string *result_string;
    -00059 
    -00060     fd = open(filename, O_RDONLY);
    -00061     file_length = lseek(fd, 0, SEEK_END) + 1;
    -00062     lseek(fd, 0, SEEK_SET);
    -00063 
    -00064     cstring = malloc(sizeof(char) * file_length);
    -00065 
    -00066     if (fd != -1) {
    -00067         /* read and copy chunks */
    -00068         while ((n = read(fd, buf, STD_FILE_BUF)) != 0) {
    -00069 
    -00070             if (n == -1) {
    -00071                 NTRU_WARN_DEBUG("Failed while reading file descriptor %d",
    -00072                         fd);
    -00073                 goto failure_cleanup;
    -00074             }
    -00075 
    -00076             str_size += n; /* count total bytes read */
    -00077 
    -00078             /* append buffer to string */
    -00079             memcpy(cstring + (str_size - n), buf, (size_t)n);
    -00080         }
    -00081         /* add trailing NULL byte */
    -00082         cstring[str_size] = '\0';
    -00083 
    -00084         if (close(fd)) {
    -00085             NTRU_WARN_DEBUG("Failed to close file descripter %d\n", fd);
    -00086             goto failure_cleanup;
    -00087         }
    -00088 
    -00089         result_string = ntru_malloc(sizeof(*result_string));
    -00090         result_string->ptr = cstring;
    -00091         result_string->len = str_size;
    -00092 
    -00093         return result_string;
    -00094 
    -00095     } else {
    -00096         return NULL;
    -00097     }
    -00098 
    -00099 failure_cleanup:
    -00100     free(cstring);
    -00101     return NULL;
    -00102 }
    -00103 
    -00104 /*------------------------------------------------------------------------*/
    -00105 
    -00106 bool
    -00107 write_file(string const *wstring, char const * const filename)
    -00108 {
    -00109     FILE *fp;
    -00110 
    -00111     fp = fopen(filename, "w");
    -00112 
    -00113     if (!fp) {
    -00114         NTRU_WARN_DEBUG("Failed while creating file\n");
    -00115         return false;
    -00116     }
    -00117 
    -00118     for (uint32_t i = 0; i < wstring->len; i++)
    -00119         fprintf(fp, "%c", wstring->ptr[i]);
    -00120 
    -00121     if (fclose(fp)) {
    -00122         NTRU_WARN_DEBUG("Failed to close file descripter\n");
    -00123         return false;
    -00124     }
    -00125 
    -00126     return true;
    -00127 }
    -00128 
    -00129 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -216,13 +78,155 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_file.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_common.h"
    +
    30 #include "ntru_err.h"
    +
    31 #include "ntru_mem.h"
    +
    32 #include "ntru_string.h"
    +
    33 
    +
    34 #include <fcntl.h>
    +
    35 #include <stdbool.h>
    +
    36 #include <stdint.h>
    +
    37 #include <stdio.h>
    +
    38 #include <stdlib.h>
    +
    39 #include <string.h>
    +
    40 #include <sys/stat.h>
    +
    41 #include <sys/types.h>
    +
    42 #include <unistd.h>
    +
    43 
    +
    44 #define STD_FILE_BUF 4096
    +
    45 
    +
    46 
    +
    47 /*------------------------------------------------------------------------*/
    +
    48 
    +
    49 string *
    +
    50 read_file(char const * const filename)
    +
    51 {
    +
    52  char buf[STD_FILE_BUF],
    +
    53  *cstring = NULL;
    +
    54  int fd = 0;
    +
    55  size_t str_size = 0;
    +
    56  ssize_t n;
    +
    57  size_t file_length = 0;
    +
    58  string *result_string;
    +
    59 
    +
    60  fd = open(filename, O_RDONLY);
    +
    61  file_length = lseek(fd, 0, SEEK_END) + 1;
    +
    62  lseek(fd, 0, SEEK_SET);
    +
    63 
    +
    64  cstring = malloc(sizeof(char) * file_length);
    +
    65 
    +
    66  if (fd != -1) {
    +
    67  /* read and copy chunks */
    +
    68  while ((n = read(fd, buf, STD_FILE_BUF)) != 0) {
    +
    69 
    +
    70  if (n == -1) {
    +
    71  NTRU_WARN_DEBUG("Failed while reading file descriptor %d",
    +
    72  fd);
    +
    73  goto failure_cleanup;
    +
    74  }
    +
    75 
    +
    76  str_size += n; /* count total bytes read */
    +
    77 
    +
    78  /* append buffer to string */
    +
    79  memcpy(cstring + (str_size - n), buf, (size_t)n);
    +
    80  }
    +
    81  /* add trailing NULL byte */
    +
    82  cstring[str_size] = '\0';
    +
    83 
    +
    84  if (close(fd)) {
    +
    85  NTRU_WARN_DEBUG("Failed to close file descripter %d\n", fd);
    +
    86  goto failure_cleanup;
    +
    87  }
    +
    88 
    +
    89  result_string = ntru_malloc(sizeof(*result_string));
    +
    90  result_string->ptr = cstring;
    +
    91  result_string->len = str_size;
    +
    92 
    +
    93  return result_string;
    +
    94 
    +
    95  } else {
    +
    96  return NULL;
    +
    97  }
    +
    98 
    +
    99 failure_cleanup:
    +
    100  free(cstring);
    +
    101  return NULL;
    +
    102 }
    +
    103 
    +
    104 /*------------------------------------------------------------------------*/
    +
    105 
    +
    106 bool
    +
    107 write_file(string const *wstring, char const * const filename)
    +
    108 {
    +
    109  FILE *fp;
    +
    110 
    +
    111  fp = fopen(filename, "w");
    +
    112 
    +
    113  if (!fp) {
    +
    114  NTRU_WARN_DEBUG("Failed while creating file\n");
    +
    115  return false;
    +
    116  }
    +
    117 
    +
    118  for (uint32_t i = 0; i < wstring->len; i++)
    +
    119  fprintf(fp, "%c", wstring->ptr[i]);
    +
    120 
    +
    121  if (fclose(fp)) {
    +
    122  NTRU_WARN_DEBUG("Failed to close file descripter\n");
    +
    123  return false;
    +
    124  }
    +
    125 
    +
    126  return true;
    +
    127 }
    +
    128 
    +
    129 /*------------------------------------------------------------------------*/
    +
    size_t len
    Definition: ntru_string.h:53
    +
    bool write_file(string const *wstring, char const *const filename)
    Definition: ntru_file.c:107
    +
    header for ntru_mem.c
    +
    #define STD_FILE_BUF
    Definition: ntru_file.c:44
    +
    string * read_file(char const *const filename)
    Definition: ntru_file.c:50
    +
    common macros/functions
    +
    #define NTRU_WARN_DEBUG(...)
    Definition: ntru_err.h:52
    +
    error handling
    +
    void * ntru_malloc(size_t size)
    Definition: ntru_mem.c:38
    +
    header for ntru_string.c
    +
    char * ptr
    Definition: ntru_string.h:49
    +
    + - diff --git a/ntru__file_8h.html b/ntru__file_8h.html index 9b94f34..a39f753 100644 --- a/ntru__file_8h.html +++ b/ntru__file_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,74 +64,93 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_file.h File Reference
    +
    ntru_file.h File Reference
    -

    header for ntru_file.c +

    header for ntru_file.c More...

    -
    #include "ntru_common.h"
    -#include "ntru_string.h"
    -#include <stdbool.h>
    +
    #include "ntru_common.h"
    +#include "ntru_string.h"
    +#include <stdbool.h>
    Include dependency graph for ntru_file.h:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    stringread_file (char const *const filename)
    bool write_file (string const *wstring, char const *const filename)
    stringread_file (char const *const filename)
     
    bool write_file (string const *wstring, char const *const filename)
     
    -

    Detailed Description

    -

    header for ntru_file.c

    -

    Header for the external API of ntru_file.c.

    +

    Detailed Description

    +

    header for ntru_file.c

    +

    Header for the external API of ntru_file.c.

    Definition in file ntru_file.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    string* read_file string* read_file ( char const *const  filename)
    -
    -
    +

    Reads a file and returns a newly allocated string.

    -
    Parameters:
    +
    Parameters
    filenamefile to open
    -
    Returns:
    a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)
    +
    Returns
    a newly allocated string which must be freed by the caller or NULL on failure (e.g. if the file could not be opened/closed)

    Definition at line 50 of file ntru_file.c.

    - +
    - + @@ -157,44 +167,27 @@ Functions
    bool write_file bool write_file ( string const *  wstring,
    -
    -
    +

    Write a string to a file. The file will be pruned or created if it does not exist.

    -
    Parameters:
    +
    Parameters
    wstringthe string to write to the file
    filenamethe name of the file to write to
    -
    Returns:
    true for success or false for failure if fopen or fclose failed
    +
    Returns
    true for success or false for failure if fopen or fclose failed

    Definition at line 107 of file ntru_file.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__file_8h__incl.dot b/ntru__file_8h__incl.dot deleted file mode 100644 index 2032919..0000000 --- a/ntru__file_8h__incl.dot +++ /dev/null @@ -1,15 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_file.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node4 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__file_8h__incl.map b/ntru__file_8h__incl.map new file mode 100644 index 0000000..a66551a --- /dev/null +++ b/ntru__file_8h__incl.map @@ -0,0 +1,4 @@ + + + + diff --git a/ntru__file_8h__incl.md5 b/ntru__file_8h__incl.md5 index 4b663fe..63d3bef 100644 --- a/ntru__file_8h__incl.md5 +++ b/ntru__file_8h__incl.md5 @@ -1 +1 @@ -f2ffeaf3ebe24d90c8c312a86c034e9e \ No newline at end of file +6777d5bfce02261879638e31ca068e7d \ No newline at end of file diff --git a/ntru__file_8h__incl.png b/ntru__file_8h__incl.png new file mode 100644 index 0000000..53d1cc5 Binary files /dev/null and b/ntru__file_8h__incl.png differ diff --git a/ntru__file_8h_source.html b/ntru__file_8h_source.html index 98fe49b..d28e03d 100644 --- a/ntru__file_8h_source.html +++ b/ntru__file_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,58 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_file.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_FILE_H
    -00029 #define NTRU_FILE_H
    -00030 
    -00031 
    -00032 #include "ntru_common.h"
    -00033 #include "ntru_string.h"
    -00034 
    -00035 #include <stdbool.h>
    -00036 
    -00037 
    -00045 string *
    -00046 read_file(char const * const filename);
    -00047 
    -00056 bool
    -00057 write_file(string const *wstring, char const * const filename);
    -00058 
    -00059 
    -00060 #endif /* NTRU_FILE_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -133,13 +78,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_file.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_FILE_H
    +
    29 #define NTRU_FILE_H
    +
    30 
    +
    31 
    +
    32 #include "ntru_common.h"
    +
    33 #include "ntru_string.h"
    +
    34 
    +
    35 #include <stdbool.h>
    +
    36 
    +
    37 
    +
    45 string *
    +
    46 read_file(char const * const filename);
    +
    47 
    +
    56 bool
    +
    57 write_file(string const *wstring, char const * const filename);
    +
    58 
    +
    59 
    +
    60 #endif /* NTRU_FILE_H */
    +
    bool write_file(string const *wstring, char const *const filename)
    Definition: ntru_file.c:107
    +
    string * read_file(char const *const filename)
    Definition: ntru_file.c:50
    +
    common macros/functions
    +
    header for ntru_string.c
    +
    + - diff --git a/ntru__keypair_8c.html b/ntru__keypair_8c.html index 57641b5..8ff7848 100644 --- a/ntru__keypair_8c.html +++ b/ntru__keypair_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,59 +64,83 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_keypair.c File Reference
    +
    ntru_keypair.c File Reference

    key creation and operations More...

    -
    #include "ntru_ascii_poly.h"
    -#include "ntru_file.h"
    -#include "ntru_keypair.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_poly_ascii.h"
    -#include "ntru_string.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    -#include <stdbool.h>
    -#include <string.h>
    +
    #include "ntru_ascii_poly.h"
    +#include "ntru_file.h"
    +#include "ntru_keypair.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_poly_ascii.h"
    +#include "ntru_string.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    +#include <stdbool.h>
    +#include <string.h>
    Include dependency graph for ntru_keypair.c:
    - +

    Go to the source code of this file.

    - - - - - - - + + + + + + + + + + + +

    +

    Functions

    bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
    void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
    void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
    void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
    void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
    void ntru_delete_keypair (keypair *pair)
    bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
     
    void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
     
    void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
     
    void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
     
    void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
     
    void ntru_delete_keypair (keypair *pair)
     
    -

    Detailed Description

    +

    Detailed Description

    key creation and operations

    This file handles the creation of the key pair and possibly common operations on them.

    Definition in file ntru_keypair.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -148,10 +163,9 @@ Functions
    void export_priv_key void export_priv_key ( char const *const  filename,
    -
    -
    +

    Export the private key to a file.

    -
    Parameters:
    +
    Parameters
    @@ -164,12 +178,12 @@ Functions - +
    filenamethe file to save the private key into
    privthe private key
    - + @@ -192,10 +206,9 @@ Functions
    void export_public_key void export_public_key ( char const *const  filename,
    -
    -
    +

    Export the public key to a file.

    -
    Parameters:
    +
    Parameters
    @@ -208,12 +221,12 @@ Functions - +
    filenamethe file to save the public key into
    pubthe public key
    - + @@ -242,10 +255,9 @@ Functions
    void import_priv_key void import_priv_key ( char const *const  filename,
    -
    -
    +

    Import the private key from a file and store him along with his inverse.

    -
    Parameters:
    +
    Parameters
    @@ -259,12 +271,12 @@ Functions - +
    filenamethe file to get the private key from
    privwhere to save the private key [out]
    - + @@ -287,10 +299,8 @@ Functions
    void import_public_key void import_public_key ( char const *const  filename,
    -
    -
    -

    Import the public key from a file.

    -
    Parameters:
    +
    +

    Import the public key from a file.

    Parameters
    @@ -303,12 +313,12 @@ Functions - +
    filenamethe file to get the public key from
    pubwhere to save the public key [out]
    - + @@ -337,10 +347,9 @@ Functions
    bool ntru_create_keypair bool ntru_create_keypair ( fmpz_poly_t  f,
    -
    -
    +

    Creates an NTRU key pair, consisting of public and private components.

    -
    Parameters:
    +
    Parameters
    @@ -349,28 +358,27 @@ Functions
    fa random polynomial
    ga random polynomial
    -
    Returns:
    true for success, false if f or g are not invertible (then the caller hast to try different ones)
    +
    Returns
    true for success, false if f or g are not invertible (then the caller hast to try different ones)

    Definition at line 47 of file ntru_keypair.c.

    - +
    - +
    void ntru_delete_keypair void ntru_delete_keypair ( keypair pair)
    -
    -
    +

    Used to free the inner structure of a keypair. This will not call free() on the pair itself.

    -
    Parameters:
    +
    Parameters
    pairthe pair to free the inner structure of
    @@ -382,27 +390,11 @@ Functions
    - - - - -
    - -
    - - - + - diff --git a/ntru__keypair_8c__incl.dot b/ntru__keypair_8c__incl.dot deleted file mode 100644 index c0a354f..0000000 --- a/ntru__keypair_8c__incl.dot +++ /dev/null @@ -1,60 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_keypair.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_ascii_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__ascii__poly_8h.html",tooltip="header for ntru_ascii_poly.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node5 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_file.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__file_8h.html",tooltip="header for ntru_file.c"]; - Node10 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="ntru_keypair.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__keypair_8h.html",tooltip="header for ntru_keypair.c"]; - Node12 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node13 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node13 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node13 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [label="ntru_poly_ascii.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly__ascii_8h.html",tooltip="header for ntru_poly_ascii.c"]; - Node16 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node17 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node17 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__keypair_8c__incl.map b/ntru__keypair_8c__incl.map new file mode 100644 index 0000000..6176746 --- /dev/null +++ b/ntru__keypair_8c__incl.map @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ntru__keypair_8c__incl.md5 b/ntru__keypair_8c__incl.md5 index 2e25ee0..ae02036 100644 --- a/ntru__keypair_8c__incl.md5 +++ b/ntru__keypair_8c__incl.md5 @@ -1 +1 @@ -19384e450a717a8c3944d423527b302d \ No newline at end of file +4d32fd169409284b568269543f3add8f \ No newline at end of file diff --git a/ntru__keypair_8c__incl.png b/ntru__keypair_8c__incl.png new file mode 100644 index 0000000..1e4d761 Binary files /dev/null and b/ntru__keypair_8c__incl.png differ diff --git a/ntru__keypair_8c_source.html b/ntru__keypair_8c_source.html index f0e3536..d9a4d52 100644 --- a/ntru__keypair_8c_source.html +++ b/ntru__keypair_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,216 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_keypair.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_ascii_poly.h"
    -00030 #include "ntru_file.h"
    -00031 #include "ntru_keypair.h"
    -00032 #include "ntru_params.h"
    -00033 #include "ntru_poly.h"
    -00034 #include "ntru_poly_ascii.h"
    -00035 #include "ntru_string.h"
    -00036 
    -00037 #include <fmpz_poly.h>
    -00038 #include <fmpz.h>
    -00039 
    -00040 #include <stdbool.h>
    -00041 #include <string.h>
    -00042 
    -00043 
    -00044 /*------------------------------------------------------------------------*/
    -00045 
    -00046 bool
    -00047 ntru_create_keypair(
    -00048         fmpz_poly_t f,
    -00049         fmpz_poly_t g,
    -00050         keypair *pair,
    -00051         ntru_params *params)
    -00052 {
    -00053     bool retval = false;
    -00054     fmpz_poly_t Fq,
    -00055                 Fp,
    -00056                 pub;
    -00057 
    -00058     if (!f || !g || !params)
    -00059         goto _return;
    -00060 
    -00061     fmpz_poly_init(Fq);
    -00062     fmpz_poly_init(Fp);
    -00063     fmpz_poly_init(pub);
    -00064 
    -00065     if (!poly_inverse_poly_q(f, Fq, params))
    -00066         goto _cleanup;
    -00067 
    -00068     if (!poly_inverse_poly_p(f, Fp, params))
    -00069         goto _cleanup;
    -00070 
    -00071     poly_starmultiply(Fq, g, pub, params, params->q);
    -00072     fmpz_poly_scalar_mul_ui(pub, pub, params->p);
    -00073     fmpz_poly_mod_unsigned(pub, params->q);
    -00074 
    -00075     fmpz_poly_init(pair->priv);
    -00076     fmpz_poly_init(pair->priv_inv);
    -00077     fmpz_poly_init(pair->pub);
    -00078 
    -00079     fmpz_poly_set(pair->priv, f);
    -00080     fmpz_poly_set(pair->priv_inv, Fp);
    -00081     fmpz_poly_set(pair->pub, pub);
    -00082 
    -00083     retval = true;
    -00084 
    -00085 _cleanup:
    -00086     fmpz_poly_clear(Fq);
    -00087     fmpz_poly_clear(Fp);
    -00088     fmpz_poly_clear(pub);
    -00089 _return:
    -00090     return retval;
    -00091 }
    -00092 
    -00093 /*------------------------------------------------------------------------*/
    -00094 
    -00095 void
    -00096 export_public_key(char const * const filename,
    -00097         fmpz_poly_t pub,
    -00098         ntru_params *params)
    -00099 {
    -00100     string *pub_string;
    -00101 
    -00102     pub_string = poly_to_base64(pub, params);
    -00103     write_file(pub_string, filename);
    -00104 
    -00105     string_delete(pub_string);
    -00106 }
    -00107 
    -00108 /*------------------------------------------------------------------------*/
    -00109 
    -00110 void
    -00111 export_priv_key(char const * const filename,
    -00112         fmpz_poly_t priv,
    -00113         ntru_params *params)
    -00114 {
    -00115     string *priv_string;
    -00116     fmpz_poly_t priv_u;
    -00117 
    -00118     fmpz_poly_init(priv_u);
    -00119     fmpz_poly_set(priv_u, priv);
    -00120     fmpz_poly_mod_unsigned(priv_u, params->p);
    -00121 
    -00122     priv_string = poly_to_base64(priv_u, params);
    -00123     write_file(priv_string, filename);
    -00124 
    -00125     fmpz_poly_clear(priv_u);
    -00126     string_delete(priv_string);
    -00127 }
    -00128 
    -00129 /*------------------------------------------------------------------------*/
    -00130 
    -00131 void
    -00132 import_public_key(char const * const filename,
    -00133         fmpz_poly_t pub,
    -00134         ntru_params *params)
    -00135 {
    -00136     string *pub_string;
    -00137     fmpz_poly_t **imported;
    -00138 
    -00139     pub_string = read_file(filename);
    -00140     imported = base64_to_poly_arr(pub_string, params);
    -00141 
    -00142     /* if the array exceeds one element, then something
    -00143      * went horribly wrong */
    -00144     if (*imported[1])
    -00145         NTRU_ABORT_DEBUG("Failed importing public key!");
    -00146 
    -00147     fmpz_poly_set(pub, **imported);
    -00148 
    -00149     string_delete(pub_string);
    -00150     poly_delete_array(imported);
    -00151     free(imported);
    -00152 }
    -00153 
    -00154 /*------------------------------------------------------------------------*/
    -00155 
    -00156 void
    -00157 import_priv_key(char const * const filename,
    -00158         fmpz_poly_t priv,
    -00159         fmpz_poly_t priv_inv,
    -00160         ntru_params *params)
    -00161 {
    -00162     string *pub_string;
    -00163     fmpz_poly_t **imported,
    -00164                 Fp;
    -00165 
    -00166     fmpz_poly_init(Fp);
    -00167 
    -00168     pub_string = read_file(filename);
    -00169 
    -00170     imported = base64_to_poly_arr(pub_string, params);
    -00171     fmpz_poly_mod(**imported, params->p);
    -00172 
    -00173     /* if the array exceeds one element, then something
    -00174      * went horribly wrong */
    -00175     if (*imported[1])
    -00176         NTRU_ABORT_DEBUG("Failed importing private key!");
    -00177 
    -00178     fmpz_poly_set(priv, **imported);
    -00179 
    -00180     if (!poly_inverse_poly_p(priv, Fp, params))
    -00181         goto cleanup;
    -00182 
    -00183     fmpz_poly_mod(Fp, params->p);
    -00184 
    -00185     fmpz_poly_set(priv_inv, Fp);
    -00186     fmpz_poly_clear(Fp);
    -00187 
    -00188 cleanup:
    -00189     string_delete(pub_string);
    -00190     poly_delete_array(imported);
    -00191     free(imported);
    -00192 }
    -00193 
    -00194 /*------------------------------------------------------------------------*/
    -00195 
    -00196 void
    -00197 ntru_delete_keypair(keypair *pair)
    -00198 {
    -00199     fmpz_poly_clear(pair->priv_inv);
    -00200     fmpz_poly_clear(pair->priv);
    -00201     fmpz_poly_clear(pair->pub);
    -00202 }
    -00203 
    -00204 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -291,13 +78,251 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_keypair.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_ascii_poly.h"
    +
    30 #include "ntru_file.h"
    +
    31 #include "ntru_keypair.h"
    +
    32 #include "ntru_params.h"
    +
    33 #include "ntru_poly.h"
    +
    34 #include "ntru_poly_ascii.h"
    +
    35 #include "ntru_string.h"
    +
    36 
    +
    37 #include <fmpz_poly.h>
    +
    38 #include <fmpz.h>
    +
    39 
    +
    40 #include <stdbool.h>
    +
    41 #include <string.h>
    +
    42 
    +
    43 
    +
    44 /*------------------------------------------------------------------------*/
    +
    45 
    +
    46 bool
    + +
    48  fmpz_poly_t f,
    +
    49  fmpz_poly_t g,
    +
    50  keypair *pair,
    +
    51  ntru_params *params)
    +
    52 {
    +
    53  bool retval = false;
    +
    54  fmpz_poly_t Fq,
    +
    55  Fp,
    +
    56  pub;
    +
    57 
    +
    58  if (!f || !g || !params)
    +
    59  goto _return;
    +
    60 
    +
    61  fmpz_poly_init(Fq);
    +
    62  fmpz_poly_init(Fp);
    +
    63  fmpz_poly_init(pub);
    +
    64 
    +
    65  if (!poly_inverse_poly_q(f, Fq, params))
    +
    66  goto _cleanup;
    +
    67 
    +
    68  if (!poly_inverse_poly_p(f, Fp, params))
    +
    69  goto _cleanup;
    +
    70 
    +
    71  poly_starmultiply(Fq, g, pub, params, params->q);
    +
    72  fmpz_poly_scalar_mul_ui(pub, pub, params->p);
    +
    73  fmpz_poly_mod_unsigned(pub, params->q);
    +
    74 
    +
    75  fmpz_poly_init(pair->priv);
    +
    76  fmpz_poly_init(pair->priv_inv);
    +
    77  fmpz_poly_init(pair->pub);
    +
    78 
    +
    79  fmpz_poly_set(pair->priv, f);
    +
    80  fmpz_poly_set(pair->priv_inv, Fp);
    +
    81  fmpz_poly_set(pair->pub, pub);
    +
    82 
    +
    83  retval = true;
    +
    84 
    +
    85 _cleanup:
    +
    86  fmpz_poly_clear(Fq);
    +
    87  fmpz_poly_clear(Fp);
    +
    88  fmpz_poly_clear(pub);
    +
    89 _return:
    +
    90  return retval;
    +
    91 }
    +
    92 
    +
    93 /*------------------------------------------------------------------------*/
    +
    94 
    +
    95 void
    +
    96 export_public_key(char const * const filename,
    +
    97  fmpz_poly_t pub,
    +
    98  ntru_params *params)
    +
    99 {
    +
    100  string *pub_string;
    +
    101 
    +
    102  pub_string = poly_to_base64(pub, params);
    +
    103  write_file(pub_string, filename);
    +
    104 
    +
    105  string_delete(pub_string);
    +
    106 }
    +
    107 
    +
    108 /*------------------------------------------------------------------------*/
    +
    109 
    +
    110 void
    +
    111 export_priv_key(char const * const filename,
    +
    112  fmpz_poly_t priv,
    +
    113  ntru_params *params)
    +
    114 {
    +
    115  string *priv_string;
    +
    116  fmpz_poly_t priv_u;
    +
    117 
    +
    118  fmpz_poly_init(priv_u);
    +
    119  fmpz_poly_set(priv_u, priv);
    +
    120  fmpz_poly_mod_unsigned(priv_u, params->p);
    +
    121 
    +
    122  priv_string = poly_to_base64(priv_u, params);
    +
    123  write_file(priv_string, filename);
    +
    124 
    +
    125  fmpz_poly_clear(priv_u);
    +
    126  string_delete(priv_string);
    +
    127 }
    +
    128 
    +
    129 /*------------------------------------------------------------------------*/
    +
    130 
    +
    131 void
    +
    132 import_public_key(char const * const filename,
    +
    133  fmpz_poly_t pub,
    +
    134  ntru_params *params)
    +
    135 {
    +
    136  string *pub_string;
    +
    137  fmpz_poly_t **imported;
    +
    138 
    +
    139  pub_string = read_file(filename);
    +
    140  imported = base64_to_poly_arr(pub_string, params);
    +
    141 
    +
    142  /* if the array exceeds one element, then something
    +
    143  * went horribly wrong */
    +
    144  if (*imported[1])
    +
    145  NTRU_ABORT_DEBUG("Failed importing public key!");
    +
    146 
    +
    147  fmpz_poly_set(pub, **imported);
    +
    148 
    +
    149  string_delete(pub_string);
    +
    150  poly_delete_array(imported);
    +
    151  free(imported);
    +
    152 }
    +
    153 
    +
    154 /*------------------------------------------------------------------------*/
    +
    155 
    +
    156 void
    +
    157 import_priv_key(char const * const filename,
    +
    158  fmpz_poly_t priv,
    +
    159  fmpz_poly_t priv_inv,
    +
    160  ntru_params *params)
    +
    161 {
    +
    162  string *pub_string;
    +
    163  fmpz_poly_t **imported,
    +
    164  Fp;
    +
    165 
    +
    166  fmpz_poly_init(Fp);
    +
    167 
    +
    168  pub_string = read_file(filename);
    +
    169 
    +
    170  imported = base64_to_poly_arr(pub_string, params);
    +
    171  fmpz_poly_mod(**imported, params->p);
    +
    172 
    +
    173  /* if the array exceeds one element, then something
    +
    174  * went horribly wrong */
    +
    175  if (*imported[1])
    +
    176  NTRU_ABORT_DEBUG("Failed importing private key!");
    +
    177 
    +
    178  fmpz_poly_set(priv, **imported);
    +
    179 
    +
    180  if (!poly_inverse_poly_p(priv, Fp, params))
    +
    181  goto cleanup;
    +
    182 
    +
    183  fmpz_poly_mod(Fp, params->p);
    +
    184 
    +
    185  fmpz_poly_set(priv_inv, Fp);
    +
    186  fmpz_poly_clear(Fp);
    +
    187 
    +
    188 cleanup:
    +
    189  string_delete(pub_string);
    +
    190  poly_delete_array(imported);
    +
    191  free(imported);
    +
    192 }
    +
    193 
    +
    194 /*------------------------------------------------------------------------*/
    +
    195 
    +
    196 void
    + +
    198 {
    +
    199  fmpz_poly_clear(pair->priv_inv);
    +
    200  fmpz_poly_clear(pair->priv);
    +
    201  fmpz_poly_clear(pair->pub);
    +
    202 }
    +
    203 
    +
    204 /*------------------------------------------------------------------------*/
    +
    bool poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    Definition: ntru_poly.c:297
    +
    void string_delete(string *del_string)
    Definition: ntru_string.c:47
    +
    header for ntru_keypair.c
    +
    void ntru_delete_keypair(keypair *pair)
    Definition: ntru_keypair.c:197
    +
    void fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:166
    +
    bool write_file(string const *wstring, char const *const filename)
    Definition: ntru_file.c:107
    +
    void fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:182
    +
    #define NTRU_ABORT_DEBUG(...)
    Definition: ntru_err.h:39
    +
    uint32_t p
    Definition: ntru_params.h:56
    +
    bool poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
    Definition: ntru_poly.c:409
    +
    fmpz_poly_t ** base64_to_poly_arr(const string *to_poly, const ntru_params *params)
    + +
    header for ntru_file.c
    +
    fmpz_poly_t priv_inv
    Definition: ntru_keypair.h:56
    +
    header for ntru_poly_ascii.c
    +
    NTRU parameters.
    +
    string * read_file(char const *const filename)
    Definition: ntru_file.c:50
    +
    void export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
    Definition: ntru_keypair.c:96
    +
    fmpz_poly_t pub
    Definition: ntru_keypair.h:61
    +
    void poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    Definition: ntru_poly.c:239
    +
    string * poly_to_base64(const fmpz_poly_t poly, const ntru_params *params)
    +
    void poly_delete_array(fmpz_poly_t **poly_array)
    Definition: ntru_poly.c:131
    +
    fmpz_poly_t priv
    Definition: ntru_keypair.h:51
    + +
    uint32_t q
    Definition: ntru_params.h:52
    +
    header for ntru_string.c
    +
    bool ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
    Definition: ntru_keypair.c:47
    +
    void export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params)
    Definition: ntru_keypair.c:111
    +
    void import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
    Definition: ntru_keypair.c:132
    +
    void import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
    Definition: ntru_keypair.c:157
    +
    header for ntru_poly.c
    +
    header for ntru_ascii_poly.c
    +
    + - diff --git a/ntru__keypair_8h.html b/ntru__keypair_8h.html index 30e389c..a33d02d 100644 --- a/ntru__keypair_8h.html +++ b/ntru__keypair_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,55 +64,83 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_keypair.h File Reference
    +
    ntru_keypair.h File Reference
    -

    header for ntru_keypair.c +

    header for ntru_keypair.c More...

    -
    #include "ntru_params.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    -#include <stdbool.h>
    +
    #include "ntru_params.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    +#include <stdbool.h>
    Include dependency graph for ntru_keypair.h:
    - +

    Go to the source code of this file.

    - - - + +

    +

    Data Structures

    struct  keypair

    +

    struct  keypair
     
    + - - + +

    Typedefs

    typedef struct keypair keypair

    +

    typedef struct keypair keypair
     
    + - - - - - - + + + + + + + + + + + +

    Functions

    bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
    void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
    void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
    void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
    void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
    void ntru_delete_keypair (keypair *pair)
    bool ntru_create_keypair (fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
     
    void export_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
     
    void export_priv_key (char const *const filename, fmpz_poly_t priv, ntru_params *params)
     
    void import_public_key (char const *const filename, fmpz_poly_t pub, ntru_params *params)
     
    void import_priv_key (char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
     
    void ntru_delete_keypair (keypair *pair)
     
    -

    Detailed Description

    -

    header for ntru_keypair.c

    -

    Header for internal API of ntru_keypair.c.

    +

    Detailed Description

    +

    header for ntru_keypair.c

    +

    Header for internal API of ntru_keypair.c.

    Definition in file ntru_keypair.h.

    -

    Typedef Documentation

    - +

    Typedef Documentation

    +
    @@ -129,20 +148,19 @@ Functions
    typedef struct keypair keypair
    -
    -
    +

    Definition at line 39 of file ntru_keypair.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -165,10 +183,9 @@ Functions
    void export_priv_key void export_priv_key ( char const *const  filename,
    -
    -
    +

    Export the private key to a file.

    -
    Parameters:
    +
    Parameters
    @@ -181,12 +198,12 @@ Functions - +
    filenamethe file to save the private key into
    privthe private key
    - + @@ -209,10 +226,9 @@ Functions
    void export_public_key void export_public_key ( char const *const  filename,
    -
    -
    +

    Export the public key to a file.

    -
    Parameters:
    +
    Parameters
    @@ -225,12 +241,12 @@ Functions - +
    filenamethe file to save the public key into
    pubthe public key
    - + @@ -259,10 +275,9 @@ Functions
    void import_priv_key void import_priv_key ( char const *const  filename,
    -
    -
    +

    Import the private key from a file and store him along with his inverse.

    -
    Parameters:
    +
    Parameters
    @@ -276,12 +291,12 @@ Functions - +
    filenamethe file to get the private key from
    privwhere to save the private key [out]
    - + @@ -304,10 +319,8 @@ Functions
    void import_public_key void import_public_key ( char const *const  filename,
    -
    -
    -

    Import the public key from a file.

    -
    Parameters:
    +
    +

    Import the public key from a file.

    Parameters
    @@ -320,12 +333,12 @@ Functions - +
    filenamethe file to get the public key from
    pubwhere to save the public key [out]
    - + @@ -354,10 +367,9 @@ Functions
    bool ntru_create_keypair bool ntru_create_keypair ( fmpz_poly_t  f,
    -
    -
    +

    Creates an NTRU key pair, consisting of public and private components.

    -
    Parameters:
    +
    Parameters
    @@ -366,28 +378,27 @@ Functions
    fa random polynomial
    ga random polynomial
    -
    Returns:
    true for success, false if f or g are not invertible (then the caller hast to try different ones)
    +
    Returns
    true for success, false if f or g are not invertible (then the caller hast to try different ones)

    Definition at line 47 of file ntru_keypair.c.

    - +
    - +
    void ntru_delete_keypair void ntru_delete_keypair ( keypair pair)
    -
    -
    +

    Used to free the inner structure of a keypair. This will not call free() on the pair itself.

    -
    Parameters:
    +
    Parameters
    pairthe pair to free the inner structure of
    @@ -399,27 +410,11 @@ Functions
    - - - - -
    - -
    - - - + - diff --git a/ntru__keypair_8h__incl.dot b/ntru__keypair_8h__incl.dot deleted file mode 100644 index 040a90e..0000000 --- a/ntru__keypair_8h__incl.dot +++ /dev/null @@ -1,16 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_keypair.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__keypair_8h__incl.map b/ntru__keypair_8h__incl.map new file mode 100644 index 0000000..84e294d --- /dev/null +++ b/ntru__keypair_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/ntru__keypair_8h__incl.md5 b/ntru__keypair_8h__incl.md5 index fe135fa..61a3c27 100644 --- a/ntru__keypair_8h__incl.md5 +++ b/ntru__keypair_8h__incl.md5 @@ -1 +1 @@ -b563620bbeef40262ba6bb0f04338e05 \ No newline at end of file +2d001a5467f4de2d56cacf708d06d2f1 \ No newline at end of file diff --git a/ntru__keypair_8h__incl.png b/ntru__keypair_8h__incl.png new file mode 100644 index 0000000..5cdecfc Binary files /dev/null and b/ntru__keypair_8h__incl.png differ diff --git a/ntru__keypair_8h_source.html b/ntru__keypair_8h_source.html index aa2b0de..6f3ec0c 100644 --- a/ntru__keypair_8h_source.html +++ b/ntru__keypair_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,94 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_keypair.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_KEYPAIR_H
    -00029 #define NTRU_KEYPAIR_H
    -00030 
    -00031 
    -00032 #include "ntru_params.h"
    -00033 
    -00034 #include <fmpz_poly.h>
    -00035 #include <fmpz.h>
    -00036 #include <stdbool.h>
    -00037 
    -00038 
    -00039 typedef struct keypair keypair;
    -00040 
    -00041 
    -00046 struct keypair {
    -00051     fmpz_poly_t priv;
    -00056     fmpz_poly_t priv_inv;
    -00061     fmpz_poly_t pub;
    -00062 };
    -00063 
    -00064 
    -00077 bool
    -00078 ntru_create_keypair(
    -00079         fmpz_poly_t f,
    -00080         fmpz_poly_t g,
    -00081         keypair *pair,
    -00082         ntru_params *params);
    -00083 
    -00091 void
    -00092 export_public_key(char const * const filename,
    -00093         fmpz_poly_t pub,
    -00094         ntru_params *params);
    -00095 
    -00103 void
    -00104 export_priv_key(char const * const filename,
    -00105         fmpz_poly_t priv,
    -00106         ntru_params *params);
    -00107 
    -00114 void
    -00115 import_public_key(char const * const filename,
    -00116         fmpz_poly_t pub,
    -00117         ntru_params *params);
    -00118 
    -00128 void
    -00129 import_priv_key(char const * const filename,
    -00130         fmpz_poly_t priv,
    -00131         fmpz_poly_t priv_inv,
    -00132         ntru_params *params);
    -00133 
    -00141 void
    -00142 ntru_delete_keypair(keypair *pair);
    -00143 
    -00144 
    -00145 #endif /* NTRU_KEYPAIR_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -169,13 +78,109 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_keypair.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_KEYPAIR_H
    +
    29 #define NTRU_KEYPAIR_H
    +
    30 
    +
    31 
    +
    32 #include "ntru_params.h"
    +
    33 
    +
    34 #include <fmpz_poly.h>
    +
    35 #include <fmpz.h>
    +
    36 #include <stdbool.h>
    +
    37 
    +
    38 
    +
    39 typedef struct keypair keypair;
    +
    40 
    +
    41 
    +
    46 struct keypair {
    +
    51  fmpz_poly_t priv;
    +
    56  fmpz_poly_t priv_inv;
    +
    61  fmpz_poly_t pub;
    +
    62 };
    +
    63 
    +
    64 
    +
    77 bool
    + +
    79  fmpz_poly_t f,
    +
    80  fmpz_poly_t g,
    +
    81  keypair *pair,
    +
    82  ntru_params *params);
    +
    83 
    +
    91 void
    +
    92 export_public_key(char const * const filename,
    +
    93  fmpz_poly_t pub,
    +
    94  ntru_params *params);
    +
    95 
    +
    103 void
    +
    104 export_priv_key(char const * const filename,
    +
    105  fmpz_poly_t priv,
    +
    106  ntru_params *params);
    +
    107 
    +
    114 void
    +
    115 import_public_key(char const * const filename,
    +
    116  fmpz_poly_t pub,
    +
    117  ntru_params *params);
    +
    118 
    +
    128 void
    +
    129 import_priv_key(char const * const filename,
    +
    130  fmpz_poly_t priv,
    +
    131  fmpz_poly_t priv_inv,
    +
    132  ntru_params *params);
    +
    133 
    +
    141 void
    + +
    143 
    +
    144 
    +
    145 #endif /* NTRU_KEYPAIR_H */
    +
    void export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
    Definition: ntru_keypair.c:96
    +
    void import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params)
    Definition: ntru_keypair.c:157
    +
    bool ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params)
    Definition: ntru_keypair.c:47
    + +
    fmpz_poly_t priv_inv
    Definition: ntru_keypair.h:56
    +
    NTRU parameters.
    +
    void import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params)
    Definition: ntru_keypair.c:132
    +
    fmpz_poly_t pub
    Definition: ntru_keypair.h:61
    +
    fmpz_poly_t priv
    Definition: ntru_keypair.h:51
    + +
    void ntru_delete_keypair(keypair *pair)
    Definition: ntru_keypair.c:197
    +
    void export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params)
    Definition: ntru_keypair.c:111
    +
    + - diff --git a/ntru__mem_8c.html b/ntru__mem_8c.html index 8bfdb4e..3a6b54d 100644 --- a/ntru__mem_8c.html +++ b/ntru__mem_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,47 +64,67 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_mem.c File Reference
    +
    ntru_mem.c File Reference

    memory management More...

    -
    #include "ntru_mem.h"
    -#include <stdio.h>
    -#include <stdlib.h>
    +
    #include "ntru_mem.h"
    +#include <stdio.h>
    +#include <stdlib.h>
    Include dependency graph for ntru_mem.c:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    void * ntru_malloc (size_t size)
    void * ntru_calloc (size_t nmemb, size_t size)
    void * ntru_malloc (size_t size)
     
    void * ntru_calloc (size_t nmemb, size_t size)
     
    -

    Detailed Description

    +

    Detailed Description

    memory management

    This file provides functions for memory management.

    Definition in file ntru_mem.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -130,71 +141,53 @@ Functions
    void* ntru_calloc void* ntru_calloc ( size_t  nmemb,
    -
    -
    +

    Allocate memory of size and return a void pointer. The memory is zeroed.

    -
    Parameters:
    +
    Parameters
    nmembamount of blocks to allocate
    sizeof the memory blocks to allocate in bytes
    -
    Returns:
    void pointer to the beginning of the allocated memory block
    +
    Returns
    void pointer to the beginning of the allocated memory block

    Definition at line 56 of file ntru_mem.c.

    - +
    - +
    void* ntru_malloc void* ntru_malloc ( size_t  size)
    -
    -
    +

    Allocate memory of size and return a void pointer.

    -
    Parameters:
    +
    Parameters
    sizeof the memory to allocate in bytes
    -
    Returns:
    void pointer to the beginning of the allocated memory block
    +
    Returns
    void pointer to the beginning of the allocated memory block

    Definition at line 38 of file ntru_mem.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__mem_8c__incl.dot b/ntru__mem_8c__incl.dot deleted file mode 100644 index eea2119..0000000 --- a/ntru__mem_8c__incl.dot +++ /dev/null @@ -1,13 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_mem.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__mem_8h.html",tooltip="header for ntru_mem.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/ntru__mem_8c__incl.map b/ntru__mem_8c__incl.map new file mode 100644 index 0000000..7ed5466 --- /dev/null +++ b/ntru__mem_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/ntru__mem_8c__incl.md5 b/ntru__mem_8c__incl.md5 index 35be7fb..d49ae0c 100644 --- a/ntru__mem_8c__incl.md5 +++ b/ntru__mem_8c__incl.md5 @@ -1 +1 @@ -e0ec6745fb39c92ebf752eca5cb5d782 \ No newline at end of file +8ef578098811e3b509f862e2e72452c4 \ No newline at end of file diff --git a/ntru__mem_8c__incl.png b/ntru__mem_8c__incl.png new file mode 100644 index 0000000..6a5a577 Binary files /dev/null and b/ntru__mem_8c__incl.png differ diff --git a/ntru__mem_8c_source.html b/ntru__mem_8c_source.html index 64ab6ee..682de49 100644 --- a/ntru__mem_8c_source.html +++ b/ntru__mem_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,83 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_mem.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_mem.h"
    -00030 
    -00031 #include <stdio.h>
    -00032 #include <stdlib.h>
    -00033 
    -00034 
    -00035 /*------------------------------------------------------------------------*/
    -00036 
    -00037 void *
    -00038 ntru_malloc(size_t size)
    -00039 {
    -00040     void *ptr;
    -00041 
    -00042     ptr = malloc(size);
    -00043 
    -00044     if (size)
    -00045         if (!ptr) {
    -00046             fprintf(stderr, "failed to allocate memory, aborting!");
    -00047             abort();
    -00048         }
    -00049 
    -00050     return ptr;
    -00051 }
    -00052 
    -00053 /*------------------------------------------------------------------------*/
    -00054 
    -00055 void *
    -00056 ntru_calloc(size_t nmemb, size_t size)
    -00057 {
    -00058     void *ptr;
    -00059 
    -00060     ptr = calloc(nmemb, size);
    -00061 
    -00062     if (size)
    -00063         if (!ptr) {
    -00064             fprintf(stderr, "failed to allocate memory, aborting!");
    -00065             abort();
    -00066         }
    -00067 
    -00068     return ptr;
    -00069 }
    -00070 
    -00071 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -158,13 +78,89 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_mem.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_mem.h"
    +
    30 
    +
    31 #include <stdio.h>
    +
    32 #include <stdlib.h>
    +
    33 
    +
    34 
    +
    35 /*------------------------------------------------------------------------*/
    +
    36 
    +
    37 void *
    +
    38 ntru_malloc(size_t size)
    +
    39 {
    +
    40  void *ptr;
    +
    41 
    +
    42  ptr = malloc(size);
    +
    43 
    +
    44  if (size)
    +
    45  if (!ptr) {
    +
    46  fprintf(stderr, "failed to allocate memory, aborting!");
    +
    47  abort();
    +
    48  }
    +
    49 
    +
    50  return ptr;
    +
    51 }
    +
    52 
    +
    53 /*------------------------------------------------------------------------*/
    +
    54 
    +
    55 void *
    +
    56 ntru_calloc(size_t nmemb, size_t size)
    +
    57 {
    +
    58  void *ptr;
    +
    59 
    +
    60  ptr = calloc(nmemb, size);
    +
    61 
    +
    62  if (size)
    +
    63  if (!ptr) {
    +
    64  fprintf(stderr, "failed to allocate memory, aborting!");
    +
    65  abort();
    +
    66  }
    +
    67 
    +
    68  return ptr;
    +
    69 }
    +
    70 
    +
    71 /*------------------------------------------------------------------------*/
    +
    void * ntru_calloc(size_t nmemb, size_t size)
    Definition: ntru_mem.c:56
    +
    header for ntru_mem.c
    +
    void * ntru_malloc(size_t size)
    Definition: ntru_mem.c:38
    +
    + - diff --git a/ntru__mem_8h.html b/ntru__mem_8h.html index 8c206c4..398903e 100644 --- a/ntru__mem_8h.html +++ b/ntru__mem_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,19 +64,37 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_mem.h File Reference
    +
    ntru_mem.h File Reference
    -

    header for ntru_mem.c +

    header for ntru_mem.c More...

    -
    #include <stdlib.h>
    +
    #include <stdlib.h>
    Include dependency graph for ntru_mem.h:
    @@ -96,26 +105,30 @@ Include dependency graph for ntru_mem.h:

    Go to the source code of this file.

    - - - + + +

    -Defines

    #define REALLOC(ptr, size)

    +

    +Macros

    #define REALLOC(ptr, size)
     
    + - - + + + +

    Functions

    void * ntru_malloc (size_t size)
    void * ntru_calloc (size_t nmemb, size_t size)
    void * ntru_malloc (size_t size)
     
    void * ntru_calloc (size_t nmemb, size_t size)
     
    -

    Detailed Description

    -

    header for ntru_mem.c

    -

    Header for the internal API of ntru_mem.c.

    +

    Detailed Description

    +

    header for ntru_mem.c

    +

    Header for the internal API of ntru_mem.c.

    Definition in file ntru_mem.h.

    -

    Define Documentation

    - +

    Macro Definition Documentation

    +
    - + @@ -132,30 +145,29 @@ Functions
    #define REALLOC#define REALLOC (   ptr,
    -
    -
    -Value:
    { \
    -    void *tmp_ptr = NULL; \
    -    tmp_ptr = realloc(ptr, size); \
    -    if (tmp_ptr == NULL) { \
    -        fprintf(stderr,"NULL Pointer in %s [%d]",__FILE__,__LINE__); \
    -        abort(); \
    -    } \
    -    ptr = tmp_ptr; \
    -}
    -

    Realloc macro which checks if reallocation worked via a temporary pointer.

    +
    +Value:
    { \
    +
    void *tmp_ptr = NULL; \
    +
    tmp_ptr = realloc(ptr, size); \
    +
    if (tmp_ptr == NULL) { \
    +
    fprintf(stderr,"NULL Pointer in %s [%d]",__FILE__,__LINE__); \
    +
    abort(); \
    +
    } \
    +
    ptr = tmp_ptr; \
    +
    }
    +

    Realloc macro which checks if reallocation worked via a temporary pointer.

    Definition at line 38 of file ntru_mem.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -172,71 +184,53 @@ Functions
    void* ntru_calloc void* ntru_calloc ( size_t  nmemb,
    -
    -
    +

    Allocate memory of size and return a void pointer. The memory is zeroed.

    -
    Parameters:
    +
    Parameters
    nmembamount of blocks to allocate
    sizeof the memory blocks to allocate in bytes
    -
    Returns:
    void pointer to the beginning of the allocated memory block
    +
    Returns
    void pointer to the beginning of the allocated memory block

    Definition at line 56 of file ntru_mem.c.

    - +
    - +
    void* ntru_malloc void* ntru_malloc ( size_t  size)
    -
    -
    +

    Allocate memory of size and return a void pointer.

    -
    Parameters:
    +
    Parameters
    sizeof the memory to allocate in bytes
    -
    Returns:
    void pointer to the beginning of the allocated memory block
    +
    Returns
    void pointer to the beginning of the allocated memory block

    Definition at line 38 of file ntru_mem.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__mem_8h__incl.dot b/ntru__mem_8h__incl.dot deleted file mode 100644 index 38506e0..0000000 --- a/ntru__mem_8h__incl.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__mem_8h__incl.map b/ntru__mem_8h__incl.map new file mode 100644 index 0000000..1244895 --- /dev/null +++ b/ntru__mem_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/ntru__mem_8h__incl.md5 b/ntru__mem_8h__incl.md5 index a15927d..cd81dd2 100644 --- a/ntru__mem_8h__incl.md5 +++ b/ntru__mem_8h__incl.md5 @@ -1 +1 @@ -3452728e2a5e42b766e2e73bbd8432b8 \ No newline at end of file +7b40cab38c353d2d0cc4551da628811b \ No newline at end of file diff --git a/ntru__mem_8h__incl.png b/ntru__mem_8h__incl.png new file mode 100644 index 0000000..50b3d58 Binary files /dev/null and b/ntru__mem_8h__incl.png differ diff --git a/ntru__mem_8h_source.html b/ntru__mem_8h_source.html index b6ef1ef..e5526ed 100644 --- a/ntru__mem_8h_source.html +++ b/ntru__mem_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,66 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_mem.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_MEM_H
    -00029 #define NTRU_MEM_H
    -00030 
    -00031 #include <stdlib.h>
    -00032 
    -00033 
    -00038 #define REALLOC(ptr, size) \
    -00039 { \
    -00040     void *tmp_ptr = NULL; \
    -00041     tmp_ptr = realloc(ptr, size); \
    -00042     if (tmp_ptr == NULL) { \
    -00043         fprintf(stderr,"NULL Pointer in %s [%d]",__FILE__,__LINE__); \
    -00044         abort(); \
    -00045     } \
    -00046     ptr = tmp_ptr; \
    -00047 }
    -00048 
    -00049 
    -00057 void *
    -00058 ntru_malloc(size_t size);
    -00059 
    -00068 void *
    -00069 ntru_calloc(size_t nmemb, size_t size);
    -00070 
    -00071 
    -00072 #endif /* NTRU_MEM_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -141,13 +78,71 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_mem.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_MEM_H
    +
    29 #define NTRU_MEM_H
    +
    30 
    +
    31 #include <stdlib.h>
    +
    32 
    +
    33 
    +
    38 #define REALLOC(ptr, size) \
    +
    39 { \
    +
    40  void *tmp_ptr = NULL; \
    +
    41  tmp_ptr = realloc(ptr, size); \
    +
    42  if (tmp_ptr == NULL) { \
    +
    43  fprintf(stderr,"NULL Pointer in %s [%d]",__FILE__,__LINE__); \
    +
    44  abort(); \
    +
    45  } \
    +
    46  ptr = tmp_ptr; \
    +
    47 }
    +
    48 
    +
    49 
    +
    57 void *
    +
    58 ntru_malloc(size_t size);
    +
    59 
    +
    68 void *
    +
    69 ntru_calloc(size_t nmemb, size_t size);
    +
    70 
    +
    71 
    +
    72 #endif /* NTRU_MEM_H */
    +
    void * ntru_malloc(size_t size)
    Definition: ntru_mem.c:38
    +
    void * ntru_calloc(size_t nmemb, size_t size)
    Definition: ntru_mem.c:56
    +
    + - diff --git a/ntru__params_8h.html b/ntru__params_8h.html index 104c75c..edaa2d0 100644 --- a/ntru__params_8h.html +++ b/ntru__params_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_params.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,19 +64,37 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_params.h File Reference
    +
    ntru_params.h File Reference

    NTRU parameters. More...

    -
    #include <stdint.h>
    +
    #include <stdint.h>
    Include dependency graph for ntru_params.h:
    @@ -96,20 +105,23 @@ Include dependency graph for ntru_params.h:

    Go to the source code of this file.

    - - - + +

    +

    Data Structures

    struct  ntru_params

    +

    struct  ntru_params
     
    + - + +

    Typedefs

    typedef struct ntru_params ntru_params
    typedef struct ntru_params ntru_params
     
    -

    Detailed Description

    +

    Detailed Description

    NTRU parameters.

    This file defines the ntru_params and related data types.

    Definition in file ntru_params.h.

    -

    Typedef Documentation

    - +

    Typedef Documentation

    +
    @@ -117,35 +129,18 @@ Typedefs
    typedef struct ntru_params ntru_params
    -
    -
    +

    Definition at line 36 of file ntru_params.h.

    - - - - -
    - -
    - - - + - diff --git a/ntru__params_8h__incl.dot b/ntru__params_8h__incl.dot deleted file mode 100644 index b0b5351..0000000 --- a/ntru__params_8h__incl.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__params_8h__incl.map b/ntru__params_8h__incl.map new file mode 100644 index 0000000..c299e87 --- /dev/null +++ b/ntru__params_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/ntru__params_8h__incl.md5 b/ntru__params_8h__incl.md5 index 2bbf370..50f53c3 100644 --- a/ntru__params_8h__incl.md5 +++ b/ntru__params_8h__incl.md5 @@ -1 +1 @@ -fa96686c8369bd3430304d00772b916a \ No newline at end of file +d511064a1708f422ff965c0b9b68a095 \ No newline at end of file diff --git a/ntru__params_8h__incl.png b/ntru__params_8h__incl.png new file mode 100644 index 0000000..f7f3696 Binary files /dev/null and b/ntru__params_8h__incl.png differ diff --git a/ntru__params_8h_source.html b/ntru__params_8h_source.html index 83d1959..b4c0d49 100644 --- a/ntru__params_8h_source.html +++ b/ntru__params_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_params.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,58 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_params.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #ifndef NTRU_PARAMS_H
    -00030 #define NTRU_PARAMS_H
    -00031 
    -00032 
    -00033 #include <stdint.h>
    -00034 
    -00035 
    -00036 typedef struct ntru_params ntru_params;
    -00037 
    -00038 
    -00043 struct ntru_params {
    -00048     uint32_t N;
    -00052     uint32_t q;
    -00056     uint32_t p;
    -00057 };
    -00058 
    -00059 
    -00060 #endif /* NTRU_PARAMS_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -133,13 +78,65 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_params.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #ifndef NTRU_PARAMS_H
    +
    30 #define NTRU_PARAMS_H
    +
    31 
    +
    32 
    +
    33 #include <stdint.h>
    +
    34 
    +
    35 
    +
    36 typedef struct ntru_params ntru_params;
    +
    37 
    +
    38 
    +
    43 struct ntru_params {
    +
    48  uint32_t N;
    +
    52  uint32_t q;
    +
    56  uint32_t p;
    +
    57 };
    +
    58 
    +
    59 
    +
    60 #endif /* NTRU_PARAMS_H */
    +
    uint32_t N
    Definition: ntru_params.h:48
    +
    uint32_t p
    Definition: ntru_params.h:56
    + +
    uint32_t q
    Definition: ntru_params.h:52
    +
    + - diff --git a/ntru__poly_8c.html b/ntru__poly_8c.html index 225723e..b5fac24 100644 --- a/ntru__poly_8c.html +++ b/ntru__poly_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,70 +64,104 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly.c File Reference
    +
    ntru_poly.c File Reference

    operations on polynomials More...

    -
    #include "ntru_err.h"
    -#include "ntru_mem.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include <stdarg.h>
    -#include <stdbool.h>
    -#include <stdint.h>
    -#include <stdio.h>
    -#include <stdlib.h>
    -#include <sys/types.h>
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_err.h"
    +#include "ntru_mem.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include <stdarg.h>
    +#include <stdbool.h>
    +#include <stdint.h>
    +#include <stdio.h>
    +#include <stdlib.h>
    +#include <sys/types.h>
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_poly.c:
    - +

    Go to the source code of this file.

    - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +

    Functions

    static void poly_mod2_to_modq (const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    int fmpz_cmp_si_n (const fmpz_t f, slong g)
    void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
    void poly_delete (fmpz_poly_t poly)
    void poly_delete_array (fmpz_poly_t **poly_array)
    void poly_delete_all (fmpz_poly_t poly,...)
    void fmpz_poly_mod_unsigned (fmpz_poly_t a, const uint32_t mod)
    void fmpz_poly_mod (fmpz_poly_t a, const uint32_t mod)
    void fmpz_poly_set_coeff_fmpz_n (fmpz_poly_t poly, slong n, const fmpz_t x)
    int fmpz_invmod_ui (fmpz_t f, const fmpz_t g, const uint32_t mod)
    void fmpz_add_n (fmpz_t f, const fmpz_t g, const fmpz_t h)
    void poly_starmultiply (const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    bool poly_inverse_poly_q (const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    bool poly_inverse_poly_p (const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
    void poly_draw (const fmpz_poly_t poly)
    void poly_draw_pretty (const fmpz_poly_t poly)
    static void poly_mod2_to_modq (const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
     
    int fmpz_cmp_si_n (const fmpz_t f, slong g)
     
    void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
     
    void poly_delete (fmpz_poly_t poly)
     
    void poly_delete_array (fmpz_poly_t **poly_array)
     
    void poly_delete_all (fmpz_poly_t poly,...)
     
    void fmpz_poly_mod_unsigned (fmpz_poly_t a, const uint32_t mod)
     
    void fmpz_poly_mod (fmpz_poly_t a, const uint32_t mod)
     
    void fmpz_poly_set_coeff_fmpz_n (fmpz_poly_t poly, slong n, const fmpz_t x)
     
    int fmpz_invmod_ui (fmpz_t f, const fmpz_t g, const uint32_t mod)
     
    void fmpz_add_n (fmpz_t f, const fmpz_t g, const fmpz_t h)
     
    void poly_starmultiply (const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
     
    bool poly_inverse_poly_q (const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
     
    bool poly_inverse_poly_p (const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
     
    void poly_draw (const fmpz_poly_t poly)
     
    void poly_draw_pretty (const fmpz_poly_t poly)
     
    -

    Detailed Description

    +

    Detailed Description

    operations on polynomials

    This files purpose is to handle polynomials in general, allowing modification, arithmetic and common algorithms like inverting them.

    Definition in file ntru_poly.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -159,20 +184,19 @@ Functions
    void fmpz_add_n void fmpz_add_n ( fmpz_t  f,
    -
    -
    +

    The same as fmpz_add() except that it handles NULL pointer for g and h.

    Definition at line 222 of file ntru_poly.c.

    - +
    - + @@ -189,28 +213,27 @@ Functions
    int fmpz_cmp_si_n int fmpz_cmp_si_n ( const fmpz_t  f,
    -
    -
    +

    The same as fmpz_cmp_si except that it will interpret f as a 0-coefficient if it is a NULL pointer.

    -
    Parameters:
    +
    Parameters
    fthe fmpz value to use for comparison
    gthe signed long integer to use for comparison
    -
    Returns:
    negative value if f < g, positiv evalue if g < f, otherwise 0
    +
    Returns
    negative value if f < g, positiv evalue if g < f, otherwise 0

    Definition at line 93 of file ntru_poly.c.

    - +
    - + @@ -233,10 +256,9 @@ Functions
    int fmpz_invmod_ui int fmpz_invmod_ui ( fmpz_t  f,
    -
    -
    +

    Wrapper around fmpz_invmod() where we convert mod to an fmpz_t implicitly.

    -
    Parameters:
    +
    Parameters
    @@ -249,12 +271,12 @@ Functions - +
    fresult [out]
    gthe inverse
    - + @@ -271,11 +293,10 @@ Functions
    void fmpz_poly_mod void fmpz_poly_mod ( fmpz_poly_t  a,
    -
    -
    +

    Calls fmpz_poly_get_nmod_poly() and fmpz_poly_set_nmod_poly() in a row, so we don't have to deal with the intermediate nmod_poly_t type if we don't need it.

    This also normalises the coefficients to the interval -m/2 <= r < m/2.

    -
    Parameters:
    +
    Parameters
    @@ -287,12 +308,12 @@ Functions - +
    athe polynom to apply the modulus to
    modthe modulus
    - + @@ -309,11 +330,10 @@ Functions
    void fmpz_poly_mod_unsigned void fmpz_poly_mod_unsigned ( fmpz_poly_t  a,
    -
    -
    +

    Calls fmpz_poly_get_nmod_poly() and fmpz_poly_set_nmod_poly_unsigned() in a row, so we don't have to deal with the intermediate nmod_poly_t type if we don't need it.

    This also normalises the coefficients to the interval 0 <= r < m.

    -
    Parameters:
    +
    Parameters
    @@ -325,12 +345,12 @@ Functions - +
    athe polynom to apply the modulus to
    modthe modulus
    - + @@ -353,10 +373,9 @@ Functions
    void fmpz_poly_set_coeff_fmpz_n void fmpz_poly_set_coeff_fmpz_n ( fmpz_poly_t  poly,
    -
    -
    +

    The same as fmpz_poly_set_coeff_fmpz() except that it will take care of null-pointer coefficients and use fmpz_poly_set_coeff_si() in that case.

    -
    Parameters:
    +
    Parameters
    @@ -369,22 +388,21 @@ Functions - +
    polythe polynom we want to change a coefficient of
    nthe coefficient we want to set
    - +
    void poly_delete void poly_delete ( fmpz_poly_t  poly)
    -
    -
    +

    This deletes the internal structure of a polynomial, and frees the pointer.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to delete
    @@ -395,12 +413,12 @@ Functions
    - +
    - + @@ -417,10 +435,9 @@ Functions
    void poly_delete_all void poly_delete_all ( fmpz_poly_t  poly,
    -
    -
    +

    This deletes the internal structure of all polynomials, and frees the pointers. You must call this with NULL as last argument!

    -
    Parameters:
    +
    Parameters
    @@ -432,22 +449,21 @@ Functions - +
    polythe polynomial to delete
    ...follow up polynomials
    - +
    void poly_delete_array void poly_delete_array ( fmpz_poly_t **  poly_array)
    -
    -
    +

    Delete the internal structure of a polynomial array which must be NULL terminated. It is expected that poly_array is not on the stack and was obtained by a function like ascii_to_poly().

    -
    Parameters:
    +
    Parameters
    poly_arraythe polynomial array
    @@ -458,22 +474,21 @@ Functions
    - +
    - +
    void poly_draw void poly_draw ( const fmpz_poly_t  poly)
    -
    -
    +

    Draws a polynomial to stdout.

    -
    Parameters:
    +
    Parameters
    polydraw this
    @@ -484,22 +499,21 @@ Functions
    - +
    - +
    void poly_draw_pretty void poly_draw_pretty ( const fmpz_poly_t  poly)
    -
    -
    +

    Draws a polynomial to stdout, in pretty format.

    -
    Parameters:
    +
    Parameters
    polydraw this
    @@ -510,12 +524,12 @@ Functions
    - +
    - + @@ -538,11 +552,10 @@ Functions
    bool poly_inverse_poly_p bool poly_inverse_poly_p ( const fmpz_poly_t  a,
    -
    -
    +

    Compute the inverse of a polynomial in (Z/pZ)[X]/(X^N - 1). See NTRU Cryptosystems Tech Report #014 "Almost Inverses - and Fast NTRU Key Creation."

    -
    Parameters:
    +and Fast NTRU Key Creation."

    +
    Parameters
    @@ -550,18 +563,18 @@ Functions
    apolynomial to invert
    Fppolynomial [out]
    -
    Returns:
    true if invertible, false if not
    +
    Returns
    true if invertible, false if not

    Definition at line 409 of file ntru_poly.c.

    - +
    - + @@ -584,12 +597,11 @@ Functions
    bool poly_inverse_poly_q bool poly_inverse_poly_q ( const fmpz_poly_t  a,
    -
    -
    +

    Compute the inverse of a polynomial in modulo a power of 2, which is q. This is based off the pseudo-code for "Inversion - in (Z/2Z)[X](X^N - 1)" and "Inversion in (Z/p^r Z)[X](X^N - 1)". See NTRU Cryptosystems Tech Report #014 "Almost Inverses - and Fast NTRU Key Creation."

    -
    Parameters:
    +in (Z/2Z)[X](X^N - 1)" and "Inversion in (Z/p^r Z)[X](X^N - 1)". See NTRU Cryptosystems Tech Report #014 "Almost Inverses +and Fast NTRU Key Creation."

    +
    Parameters
    @@ -597,18 +609,21 @@ Functions
    apolynomial to invert (is allowed to be the same as param Fq)
    Fqpolynomial [out]
    -
    Returns:
    true if invertible, false if not
    +
    Returns
    true if invertible, false if not

    Definition at line 297 of file ntru_poly.c.

    - +
    + + + + + +
    - + @@ -628,13 +643,17 @@ Functions - +
    static void poly_mod2_to_modq static void poly_mod2_to_modq ( const fmpz_poly_t  a,
    ) [static]
    - -
    +
    +static
    +

    Find the inverse polynomial modulo a power of 2, which is q.

    -
    Parameters:
    +
    Parameters
    @@ -647,12 +666,12 @@ Functions - +
    apolynomial to invert
    Fqpolynomial [out]
    - + @@ -675,10 +694,9 @@ Functions
    void poly_new void poly_new ( fmpz_poly_t  new_poly,
    -
    -
    +

    Initializes and builds a polynomial with the coefficient values of c[] of size len within NTRU parameters and returns a newly allocated polynomial. For an empty polynom, both c and len can be NULL/0.

    -
    Parameters:
    +
    Parameters
    @@ -686,18 +704,18 @@ Functions
    new_polythe polynomial to initialize and fill with coefficients [out]
    carray of polynomial coefficients, can be NULL
    -
    Returns:
    newly allocated polynomial pointer, must be freed with fmpz_poly_clear()
    +
    Returns
    newly allocated polynomial pointer, must be freed with fmpz_poly_clear()

    Definition at line 110 of file ntru_poly.c.

    - +
    - + @@ -732,10 +750,9 @@ Functions
    void poly_starmultiply void poly_starmultiply ( const fmpz_poly_t  a,
    -
    -
    +

    Starmultiplication, as follows: c = a * b mod (x^N − 1)

    -
    Parameters:
    +
    Parameters
    @@ -751,27 +768,11 @@ Functions - - - - -
    - -
    - - - + - diff --git a/ntru__poly_8c__incl.dot b/ntru__poly_8c__incl.dot deleted file mode 100644 index 10505c8..0000000 --- a/ntru__poly_8c__incl.dot +++ /dev/null @@ -1,39 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_poly.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__mem_8h.html",tooltip="header for ntru_mem.c"]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node5 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node7 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node7 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node7 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="sys/types.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__poly_8c__incl.map b/ntru__poly_8c__incl.map new file mode 100644 index 0000000..321dc34 --- /dev/null +++ b/ntru__poly_8c__incl.map @@ -0,0 +1,6 @@ + + + + + + diff --git a/ntru__poly_8c__incl.md5 b/ntru__poly_8c__incl.md5 index cae12c7..b18f49e 100644 --- a/ntru__poly_8c__incl.md5 +++ b/ntru__poly_8c__incl.md5 @@ -1 +1 @@ -cf2b10a3d4d39122f153cf5ffd964630 \ No newline at end of file +09a30adc8579de2bd9491c9e1363cf87 \ No newline at end of file diff --git a/ntru__poly_8c__incl.png b/ntru__poly_8c__incl.png new file mode 100644 index 0000000..dfb0851 Binary files /dev/null and b/ntru__poly_8c__incl.png differ diff --git a/ntru__poly_8c_source.html b/ntru__poly_8c_source.html index 3b7c36f..e5e7d61 100644 --- a/ntru__poly_8c_source.html +++ b/ntru__poly_8c_source.html @@ -3,44 +3,35 @@ +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.c Source File - - - - + + - + -
    - - +
    apolynom to multiply (can be the same as c)
    bpolynom to multiply
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,592 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00030 #include "ntru_err.h"
    -00031 #include "ntru_mem.h"
    -00032 #include "ntru_params.h"
    -00033 #include "ntru_poly.h"
    -00034 
    -00035 #include <stdarg.h>
    -00036 #include <stdbool.h>
    -00037 #include <stdint.h>
    -00038 #include <stdio.h>
    -00039 #include <stdlib.h>
    -00040 #include <sys/types.h>
    -00041 
    -00042 #include <fmpz_poly.h>
    -00043 #include <fmpz.h>
    -00044 
    -00045 
    -00054 static
    -00055 void poly_mod2_to_modq(const fmpz_poly_t a,
    -00056         fmpz_poly_t Fq,
    -00057         const ntru_params *params);
    -00058 
    -00059 
    -00060 /*------------------------------------------------------------------------*/
    -00061 
    -00062 static void
    -00063 poly_mod2_to_modq(const fmpz_poly_t a,
    -00064         fmpz_poly_t Fq,
    -00065         const ntru_params *params)
    -00066 {
    -00067     int v = 2;
    -00068     fmpz_poly_t poly_tmp, two;
    -00069 
    -00070     fmpz_poly_init(poly_tmp);
    -00071     fmpz_poly_zero(poly_tmp);
    -00072     fmpz_poly_init(two);
    -00073     fmpz_poly_set_coeff_ui(two, 0, 2);
    -00074 
    -00075     while (v < (int)(params->q)) {
    -00076         v = v * 2;
    -00077 
    -00078         poly_starmultiply(a, Fq, poly_tmp, params, v);
    -00079         fmpz_poly_sub(poly_tmp, two, poly_tmp);
    -00080         fmpz_poly_mod_unsigned(poly_tmp, v);
    -00081         poly_starmultiply(Fq, poly_tmp, Fq, params, v);
    -00082 
    -00083     }
    -00084 
    -00085     fmpz_poly_clear(poly_tmp);
    -00086     fmpz_poly_clear(two);
    -00087 
    -00088 }
    -00089 
    -00090 /*------------------------------------------------------------------------*/
    -00091 
    -00092 int
    -00093 fmpz_cmp_si_n(const fmpz_t f, slong g)
    -00094 {
    -00095     fmpz_t f_cmp;
    -00096 
    -00097     fmpz_init(f_cmp);
    -00098 
    -00099     if (f)
    -00100         fmpz_set(f_cmp, f);
    -00101     else
    -00102         fmpz_set_si(f_cmp, 0);
    -00103 
    -00104     return fmpz_cmp_si(f_cmp, g);
    -00105 }
    -00106 
    -00107 /*------------------------------------------------------------------------*/
    -00108 
    -00109 void
    -00110 poly_new(fmpz_poly_t new_poly,
    -00111         int const * const c,
    -00112         const size_t len)
    -00113 {
    -00114     fmpz_poly_init(new_poly);
    -00115 
    -00116     for (uint32_t i = 0; i < len; i++)
    -00117         fmpz_poly_set_coeff_si(new_poly, i, c[i]);
    -00118 }
    -00119 
    -00120 /*------------------------------------------------------------------------*/
    -00121 
    -00122 void
    -00123 poly_delete(fmpz_poly_t poly)
    -00124 {
    -00125     fmpz_poly_clear(poly);
    -00126 }
    -00127 
    -00128 /*------------------------------------------------------------------------*/
    -00129 
    -00130 void
    -00131 poly_delete_array(fmpz_poly_t **poly_array)
    -00132 {
    -00133     uint32_t i = 0;
    -00134 
    -00135     while(poly_array[i]) {
    -00136         poly_delete(*(poly_array[i]));
    -00137         free(poly_array[i]);
    -00138         i++;
    -00139     }
    -00140 
    -00141     /* avoid double free */
    -00142     if (i > 1)
    -00143         free(poly_array);
    -00144 }
    -00145 
    -00146 /*------------------------------------------------------------------------*/
    -00147 
    -00148 void
    -00149 poly_delete_all(fmpz_poly_t poly, ...)
    -00150 {
    -00151     fmpz_poly_struct *next_poly;
    -00152     va_list args;
    -00153 
    -00154     next_poly = poly;
    -00155     va_start(args, poly);
    -00156     while (next_poly != NULL) {
    -00157         poly_delete(next_poly);
    -00158         next_poly = va_arg(args, fmpz_poly_struct*);
    -00159     }
    -00160     va_end(args);
    -00161 }
    -00162 
    -00163 /*------------------------------------------------------------------------*/
    -00164 
    -00165 void
    -00166 fmpz_poly_mod_unsigned(fmpz_poly_t a,
    -00167         const uint32_t mod)
    -00168 {
    -00169     nmod_poly_t nmod_tmp;
    -00170 
    -00171     nmod_poly_init(nmod_tmp, mod);
    -00172 
    -00173     fmpz_poly_get_nmod_poly(nmod_tmp, a);
    -00174     fmpz_poly_set_nmod_poly_unsigned(a, nmod_tmp);
    -00175 
    -00176     nmod_poly_clear(nmod_tmp);
    -00177 }
    -00178 
    -00179 /*------------------------------------------------------------------------*/
    -00180 
    -00181 void
    -00182 fmpz_poly_mod(fmpz_poly_t a,
    -00183         const uint32_t mod)
    -00184 {
    -00185     nmod_poly_t nmod_tmp;
    -00186 
    -00187     nmod_poly_init(nmod_tmp, mod);
    -00188 
    -00189     fmpz_poly_get_nmod_poly(nmod_tmp, a);
    -00190     fmpz_poly_set_nmod_poly(a, nmod_tmp);
    -00191 
    -00192     nmod_poly_clear(nmod_tmp);
    -00193 }
    -00194 
    -00195 /*------------------------------------------------------------------------*/
    -00196 
    -00197 void
    -00198 fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n,
    -00199         const fmpz_t x)
    -00200 {
    -00201     if (x)
    -00202         fmpz_poly_set_coeff_fmpz(poly, n, x);
    -00203     else
    -00204         fmpz_poly_set_coeff_si(poly, n, 0);
    -00205 }
    -00206 
    -00207 /*------------------------------------------------------------------------*/
    -00208 
    -00209 int
    -00210 fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod)
    -00211 {
    -00212     fmpz_t modulus;
    -00213 
    -00214     fmpz_init_set_ui(modulus, mod);
    -00215 
    -00216     return fmpz_invmod(f, g, modulus);
    -00217 }
    -00218 
    -00219 /*------------------------------------------------------------------------*/
    -00220 
    -00221 void
    -00222 fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h)
    -00223 {
    -00224     if (!g && !h) {
    -00225         fmpz_zero(f);
    -00226     } else {
    -00227         if (!g && h)
    -00228             fmpz_add_ui(f, h, 0);
    -00229         else if (g && !h)
    -00230             fmpz_add_ui(f, g, 0);
    -00231         else
    -00232             fmpz_add(f, g, h);
    -00233     }
    -00234 }
    -00235 
    -00236 /*------------------------------------------------------------------------*/
    -00237 
    -00238 void
    -00239 poly_starmultiply(const fmpz_poly_t a,
    -00240         const fmpz_poly_t b,
    -00241         fmpz_poly_t c,
    -00242         const ntru_params *params,
    -00243         uint32_t modulus)
    -00244 {
    -00245     fmpz_poly_t a_tmp;
    -00246     fmpz_t c_coeff_k;
    -00247 
    -00248     fmpz_poly_init(a_tmp);
    -00249     fmpz_init(c_coeff_k);
    -00250 
    -00251     /* avoid side effects */
    -00252     fmpz_poly_set(a_tmp, a);
    -00253     fmpz_poly_zero(c);
    -00254 
    -00255     for (int k = params->N - 1; k >= 0; k--) {
    -00256         int j;
    -00257 
    -00258         j = k + 1;
    -00259 
    -00260         fmpz_set_si(c_coeff_k, 0);
    -00261 
    -00262         for (int i = params->N - 1; i >= 0; i--) {
    -00263             fmpz *a_tmp_coeff_i,
    -00264                  *b_coeff_j;
    -00265 
    -00266             if (j == (int)(params->N))
    -00267                 j = 0;
    -00268 
    -00269             a_tmp_coeff_i = fmpz_poly_get_coeff_ptr(a_tmp, i);
    -00270             b_coeff_j = fmpz_poly_get_coeff_ptr(b, j);
    -00271 
    -00272             if (fmpz_cmp_si_n(a_tmp_coeff_i, 0) &&
    -00273                     fmpz_cmp_si_n(b_coeff_j, 0)) {
    -00274                 fmpz_t fmpz_tmp;
    -00275 
    -00276                 fmpz_init(fmpz_tmp);
    -00277 
    -00278                 fmpz_mul(fmpz_tmp, a_tmp_coeff_i, b_coeff_j);
    -00279                 fmpz_add(fmpz_tmp, fmpz_tmp, c_coeff_k);
    -00280                 fmpz_mod_ui(c_coeff_k, fmpz_tmp, modulus);
    -00281 
    -00282                 fmpz_poly_set_coeff_fmpz(c, k, c_coeff_k);
    -00283 
    -00284                 fmpz_clear(fmpz_tmp);
    -00285             }
    -00286             j++;
    -00287         }
    -00288         fmpz_clear(c_coeff_k);
    -00289     }
    -00290 
    -00291     fmpz_poly_clear(a_tmp);
    -00292 }
    -00293 
    -00294 /*------------------------------------------------------------------------*/
    -00295 
    -00296 bool
    -00297 poly_inverse_poly_q(const fmpz_poly_t a,
    -00298         fmpz_poly_t Fq,
    -00299         const ntru_params *params)
    -00300 {
    -00301     bool retval = false;
    -00302     int k = 0,
    -00303         j = 0;
    -00304     fmpz *b_last;
    -00305     fmpz_poly_t a_tmp,
    -00306                 b,
    -00307                 c,
    -00308                 f,
    -00309                 g;
    -00310 
    -00311     /* general initialization of temp variables */
    -00312     fmpz_poly_init(b);
    -00313     fmpz_poly_set_coeff_ui(b, 0, 1);
    -00314     fmpz_poly_init(c);
    -00315     fmpz_poly_init(f);
    -00316     fmpz_poly_set(f, a);
    -00317 
    -00318     /* set g(x) = x^N − 1 */
    -00319     fmpz_poly_init(g);
    -00320     fmpz_poly_set_coeff_si(g, 0, -1);
    -00321     fmpz_poly_set_coeff_si(g, params->N, 1);
    -00322 
    -00323     /* avoid side effects */
    -00324     fmpz_poly_init(a_tmp);
    -00325     fmpz_poly_set(a_tmp, a);
    -00326     fmpz_poly_zero(Fq);
    -00327 
    -00328     while (1) {
    -00329         while (fmpz_is_zero(fmpz_poly_get_coeff_ptr(f, 0))) {
    -00330             for (uint32_t i = 1; i <= params->N; i++) {
    -00331                 fmpz *f_coeff = fmpz_poly_get_coeff_ptr(f, i);
    -00332                 fmpz *c_coeff = fmpz_poly_get_coeff_ptr(c, params->N - i);
    -00333 
    -00334                 /* f(x) = f(x) / x */
    -00335                 fmpz_poly_set_coeff_fmpz_n(f, i - 1,
    -00336                         f_coeff);
    -00337 
    -00338                 /* c(x) = c(x) * x */
    -00339                 fmpz_poly_set_coeff_fmpz_n(c, params->N + 1 - i,
    -00340                         c_coeff);
    -00341             }
    -00342 
    -00343             fmpz_poly_set_coeff_si(f, params->N, 0);
    -00344             fmpz_poly_set_coeff_si(c, 0, 0);
    -00345 
    -00346             k++;
    -00347 
    -00348             if (fmpz_poly_degree(f) == -1)
    -00349                 goto _cleanup;
    -00350         }
    -00351 
    -00352         if (fmpz_poly_degree(f) == 0)
    -00353             break;
    -00354 
    -00355         if (fmpz_poly_degree(f) < fmpz_poly_degree(g)) {
    -00356             fmpz_poly_swap(f, g);
    -00357             fmpz_poly_swap(b, c);
    -00358         }
    -00359 
    -00360         fmpz_poly_add(f, g, f);
    -00361         fmpz_poly_mod_unsigned(f, 2);
    -00362 
    -00363         fmpz_poly_add(b, c, b);
    -00364         fmpz_poly_mod_unsigned(b, 2);
    -00365     }
    -00366 
    -00367     k = k % params->N;
    -00368 
    -00369     b_last = fmpz_poly_get_coeff_ptr(b, params->N);
    -00370     if (fmpz_cmp_si_n(b_last, 0))
    -00371         goto _cleanup;
    -00372 
    -00373     /* Fq(x) = x^(N-k) * b(x) */
    -00374     for (int i = params->N - 1; i >= 0; i--) {
    -00375         fmpz *b_i;
    -00376 
    -00377         j = i - k;
    -00378 
    -00379         if (j < 0)
    -00380             j = j + params->N;
    -00381 
    -00382         b_i = fmpz_poly_get_coeff_ptr(b, i);
    -00383         fmpz_poly_set_coeff_fmpz_n(Fq, j, b_i);
    -00384     }
    -00385 
    -00386     poly_mod2_to_modq(a_tmp, Fq, params);
    -00387 
    -00388     /* check if the f * Fq = 1 (mod p) condition holds true */
    -00389     fmpz_poly_set(a_tmp, a);
    -00390     poly_starmultiply(a_tmp, Fq, a_tmp, params, params->q);
    -00391     if (fmpz_poly_is_one(a_tmp))
    -00392         retval = true;
    -00393     else
    -00394         fmpz_poly_zero(Fq);
    -00395 
    -00396 _cleanup:
    -00397     fmpz_poly_clear(a_tmp);
    -00398     fmpz_poly_clear(b);
    -00399     fmpz_poly_clear(c);
    -00400     fmpz_poly_clear(f);
    -00401     fmpz_poly_clear(g);
    -00402 
    -00403     return retval;
    -00404 }
    -00405 
    -00406 /*------------------------------------------------------------------------*/
    -00407 
    -00408 bool
    -00409 poly_inverse_poly_p(const fmpz_poly_t a,
    -00410         fmpz_poly_t Fp,
    -00411         const ntru_params *params)
    -00412 {
    -00413     bool retval = false;
    -00414     int k = 0,
    -00415         j = 0;
    -00416     fmpz *b_last;
    -00417     fmpz_poly_t a_tmp,
    -00418                 b,
    -00419                 c,
    -00420                 f,
    -00421                 g;
    -00422 
    -00423     /* general initialization of temp variables */
    -00424     fmpz_poly_init(b);
    -00425     fmpz_poly_set_coeff_ui(b, 0, 1);
    -00426     fmpz_poly_init(c);
    -00427     fmpz_poly_init(f);
    -00428     fmpz_poly_set(f, a);
    -00429 
    -00430     /* set g(x) = x^N − 1 */
    -00431     fmpz_poly_init(g);
    -00432     fmpz_poly_set_coeff_si(g, 0, -1);
    -00433     fmpz_poly_set_coeff_si(g, params->N, 1);
    -00434 
    -00435     /* avoid side effects */
    -00436     fmpz_poly_init(a_tmp);
    -00437     fmpz_poly_set(a_tmp, a);
    -00438     fmpz_poly_zero(Fp);
    -00439 
    -00440     while (1) {
    -00441         while (fmpz_is_zero(fmpz_poly_get_coeff_ptr(f, 0))) {
    -00442             for (uint32_t i = 1; i <= params->N; i++) {
    -00443                 fmpz *f_coeff = fmpz_poly_get_coeff_ptr(f, i);
    -00444                 fmpz *c_coeff = fmpz_poly_get_coeff_ptr(c, params->N - i);
    -00445 
    -00446                 /* f(x) = f(x) / x */
    -00447                 fmpz_poly_set_coeff_fmpz_n(f, i - 1,
    -00448                         f_coeff);
    -00449 
    -00450                 /* c(x) = c(x) * x */
    -00451                 fmpz_poly_set_coeff_fmpz_n(c, params->N + 1 - i,
    -00452                         c_coeff);
    -00453             }
    -00454 
    -00455             fmpz_poly_set_coeff_si(f, params->N, 0);
    -00456             fmpz_poly_set_coeff_si(c, 0, 0);
    -00457 
    -00458             k++;
    -00459 
    -00460             if (fmpz_poly_degree(f) == -1)
    -00461                 goto cleanup;
    -00462         }
    -00463 
    -00464         if (fmpz_poly_degree(f) == 0)
    -00465             break;
    -00466 
    -00467         if (fmpz_poly_degree(f) < fmpz_poly_degree(g)) {
    -00468             /* exchange f and g and exchange b and c */
    -00469             fmpz_poly_swap(f, g);
    -00470             fmpz_poly_swap(b, c);
    -00471         }
    -00472 
    -00473         {
    -00474             fmpz_poly_t c_tmp,
    -00475                         g_tmp;
    -00476             fmpz_t u,
    -00477                    mp_tmp;
    -00478 
    -00479             fmpz_init(u);
    -00480             fmpz_zero(u);
    -00481 
    -00482             fmpz_init_set(mp_tmp, fmpz_poly_get_coeff_ptr(f, 0));
    -00483 
    -00484             fmpz_poly_init(g_tmp);
    -00485             fmpz_poly_set(g_tmp, g);
    -00486 
    -00487             fmpz_poly_init(c_tmp);
    -00488             fmpz_poly_set(c_tmp, c);
    -00489 
    -00490             /* u = f[0] * g[0]^(-1) mod p */
    -00491               /* = (f[0] mod p) * (g[0] inverse mod p) mod p */
    -00492             fmpz_invmod_ui(u,
    -00493                     fmpz_poly_get_coeff_ptr(g, 0),
    -00494                     params->p);
    -00495             fmpz_mod_ui(mp_tmp, mp_tmp, params->p);
    -00496             fmpz_mul(u, mp_tmp, u);
    -00497             fmpz_mod_ui(u, u, params->p);
    -00498 
    -00499             /* f = f - u * g mod p */
    -00500             fmpz_poly_scalar_mul_fmpz(g_tmp, g_tmp, u);
    -00501             fmpz_poly_sub(f, g_tmp, f);
    -00502             fmpz_poly_mod_unsigned(f, params->p);
    -00503 
    -00504             /* b = b - u * c mod p */
    -00505             fmpz_poly_scalar_mul_fmpz(c_tmp, c_tmp, u);
    -00506             fmpz_poly_sub(b, c_tmp, b);
    -00507             fmpz_poly_mod_unsigned(b, params->p);
    -00508 
    -00509             fmpz_clear(u);
    -00510             fmpz_poly_clear(g_tmp);
    -00511             fmpz_poly_clear(c_tmp);
    -00512         }
    -00513     }
    -00514 
    -00515     k = k % params->N;
    -00516 
    -00517     b_last = fmpz_poly_get_coeff_ptr(b, params->N);
    -00518     if (fmpz_cmp_si_n(b_last, 0))
    -00519         goto cleanup;
    -00520 
    -00521     /* Fp(x) = x^(N-k) * b(x) */
    -00522     for (int i = params->N - 1; i >= 0; i--) {
    -00523         fmpz *b_i;
    -00524 
    -00525         /* b(X) = f[0]^(-1) * b(X) (mod p) */
    -00526         {
    -00527             fmpz_t mp_tmp;
    -00528 
    -00529             fmpz_init(mp_tmp);
    -00530 
    -00531             fmpz_invmod_ui(mp_tmp,
    -00532                     fmpz_poly_get_coeff_ptr(f, 0),
    -00533                     params->p);
    -00534 
    -00535             if (fmpz_poly_get_coeff_ptr(b, i)) {
    -00536                 fmpz_mul(fmpz_poly_get_coeff_ptr(b, i),
    -00537                         fmpz_poly_get_coeff_ptr(b, i),
    -00538                         mp_tmp);
    -00539                 fmpz_mod_ui(fmpz_poly_get_coeff_ptr(b, i),
    -00540                         fmpz_poly_get_coeff_ptr(b, i),
    -00541                         params->p);
    -00542             }
    -00543         }
    -00544 
    -00545         j = i - k;
    -00546         if (j < 0)
    -00547             j = j + params->N;
    -00548 
    -00549         b_i = fmpz_poly_get_coeff_ptr(b, i);
    -00550         fmpz_poly_set_coeff_fmpz_n(Fp, j, b_i);
    -00551     }
    -00552 
    -00553     /* check if the f * Fp = 1 (mod p) condition holds true */
    -00554     fmpz_poly_set(a_tmp, a);
    -00555     poly_starmultiply(a_tmp, Fp, a_tmp, params, params->p);
    -00556     if (fmpz_poly_is_one(a_tmp))
    -00557         retval = true;
    -00558     else
    -00559         fmpz_poly_zero(Fp);
    -00560 
    -00561 cleanup:
    -00562     fmpz_poly_clear(a_tmp);
    -00563     fmpz_poly_clear(b);
    -00564     fmpz_poly_clear(c);
    -00565     fmpz_poly_clear(f);
    -00566     fmpz_poly_clear(g);
    -00567 
    -00568     return retval;
    -00569 }
    -00570 
    -00571 /*------------------------------------------------------------------------*/
    -00572 
    -00573 void
    -00574 poly_draw(const fmpz_poly_t poly)
    -00575 {
    -00576     fmpz_poly_print(poly);
    -00577     flint_printf("\n");
    -00578 }
    -00579 
    -00580 /*------------------------------------------------------------------------*/
    -00581 
    -00582 void
    -00583 poly_draw_pretty(const fmpz_poly_t poly)
    -00584 {
    -00585     fmpz_poly_print_pretty(poly, "x");
    -00586     flint_printf("\n");
    -00587 }
    -00588 
    -00589 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -667,13 +78,619 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_poly.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    30 #include "ntru_err.h"
    +
    31 #include "ntru_mem.h"
    +
    32 #include "ntru_params.h"
    +
    33 #include "ntru_poly.h"
    +
    34 
    +
    35 #include <stdarg.h>
    +
    36 #include <stdbool.h>
    +
    37 #include <stdint.h>
    +
    38 #include <stdio.h>
    +
    39 #include <stdlib.h>
    +
    40 #include <sys/types.h>
    +
    41 
    +
    42 #include <fmpz_poly.h>
    +
    43 #include <fmpz.h>
    +
    44 
    +
    45 
    +
    54 static
    +
    55 void poly_mod2_to_modq(const fmpz_poly_t a,
    +
    56  fmpz_poly_t Fq,
    +
    57  const ntru_params *params);
    +
    58 
    +
    59 
    +
    60 /*------------------------------------------------------------------------*/
    +
    61 
    +
    62 static void
    +
    63 poly_mod2_to_modq(const fmpz_poly_t a,
    +
    64  fmpz_poly_t Fq,
    +
    65  const ntru_params *params)
    +
    66 {
    +
    67  int v = 2;
    +
    68  fmpz_poly_t poly_tmp, two;
    +
    69 
    +
    70  fmpz_poly_init(poly_tmp);
    +
    71  fmpz_poly_zero(poly_tmp);
    +
    72  fmpz_poly_init(two);
    +
    73  fmpz_poly_set_coeff_ui(two, 0, 2);
    +
    74 
    +
    75  while (v < (int)(params->q)) {
    +
    76  v = v * 2;
    +
    77 
    +
    78  poly_starmultiply(a, Fq, poly_tmp, params, v);
    +
    79  fmpz_poly_sub(poly_tmp, two, poly_tmp);
    +
    80  fmpz_poly_mod_unsigned(poly_tmp, v);
    +
    81  poly_starmultiply(Fq, poly_tmp, Fq, params, v);
    +
    82 
    +
    83  }
    +
    84 
    +
    85  fmpz_poly_clear(poly_tmp);
    +
    86  fmpz_poly_clear(two);
    +
    87 
    +
    88 }
    +
    89 
    +
    90 /*------------------------------------------------------------------------*/
    +
    91 
    +
    92 int
    +
    93 fmpz_cmp_si_n(const fmpz_t f, slong g)
    +
    94 {
    +
    95  fmpz_t f_cmp;
    +
    96 
    +
    97  fmpz_init(f_cmp);
    +
    98 
    +
    99  if (f)
    +
    100  fmpz_set(f_cmp, f);
    +
    101  else
    +
    102  fmpz_set_si(f_cmp, 0);
    +
    103 
    +
    104  return fmpz_cmp_si(f_cmp, g);
    +
    105 }
    +
    106 
    +
    107 /*------------------------------------------------------------------------*/
    +
    108 
    +
    109 void
    +
    110 poly_new(fmpz_poly_t new_poly,
    +
    111  int const * const c,
    +
    112  const size_t len)
    +
    113 {
    +
    114  fmpz_poly_init(new_poly);
    +
    115 
    +
    116  for (uint32_t i = 0; i < len; i++)
    +
    117  fmpz_poly_set_coeff_si(new_poly, i, c[i]);
    +
    118 }
    +
    119 
    +
    120 /*------------------------------------------------------------------------*/
    +
    121 
    +
    122 void
    +
    123 poly_delete(fmpz_poly_t poly)
    +
    124 {
    +
    125  fmpz_poly_clear(poly);
    +
    126 }
    +
    127 
    +
    128 /*------------------------------------------------------------------------*/
    +
    129 
    +
    130 void
    +
    131 poly_delete_array(fmpz_poly_t **poly_array)
    +
    132 {
    +
    133  uint32_t i = 0;
    +
    134 
    +
    135  while(poly_array[i]) {
    +
    136  poly_delete(*(poly_array[i]));
    +
    137  free(poly_array[i]);
    +
    138  i++;
    +
    139  }
    +
    140 
    +
    141  /* avoid double free */
    +
    142  if (i > 1)
    +
    143  free(poly_array);
    +
    144 }
    +
    145 
    +
    146 /*------------------------------------------------------------------------*/
    +
    147 
    +
    148 void
    +
    149 poly_delete_all(fmpz_poly_t poly, ...)
    +
    150 {
    +
    151  fmpz_poly_struct *next_poly;
    +
    152  va_list args;
    +
    153 
    +
    154  next_poly = poly;
    +
    155  va_start(args, poly);
    +
    156  while (next_poly != NULL) {
    +
    157  poly_delete(next_poly);
    +
    158  next_poly = va_arg(args, fmpz_poly_struct*);
    +
    159  }
    +
    160  va_end(args);
    +
    161 }
    +
    162 
    +
    163 /*------------------------------------------------------------------------*/
    +
    164 
    +
    165 void
    + +
    167  const uint32_t mod)
    +
    168 {
    +
    169  nmod_poly_t nmod_tmp;
    +
    170 
    +
    171  nmod_poly_init(nmod_tmp, mod);
    +
    172 
    +
    173  fmpz_poly_get_nmod_poly(nmod_tmp, a);
    +
    174  fmpz_poly_set_nmod_poly_unsigned(a, nmod_tmp);
    +
    175 
    +
    176  nmod_poly_clear(nmod_tmp);
    +
    177 }
    +
    178 
    +
    179 /*------------------------------------------------------------------------*/
    +
    180 
    +
    181 void
    +
    182 fmpz_poly_mod(fmpz_poly_t a,
    +
    183  const uint32_t mod)
    +
    184 {
    +
    185  nmod_poly_t nmod_tmp;
    +
    186 
    +
    187  nmod_poly_init(nmod_tmp, mod);
    +
    188 
    +
    189  fmpz_poly_get_nmod_poly(nmod_tmp, a);
    +
    190  fmpz_poly_set_nmod_poly(a, nmod_tmp);
    +
    191 
    +
    192  nmod_poly_clear(nmod_tmp);
    +
    193 }
    +
    194 
    +
    195 /*------------------------------------------------------------------------*/
    +
    196 
    +
    197 void
    +
    198 fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n,
    +
    199  const fmpz_t x)
    +
    200 {
    +
    201  if (x)
    +
    202  fmpz_poly_set_coeff_fmpz(poly, n, x);
    +
    203  else
    +
    204  fmpz_poly_set_coeff_si(poly, n, 0);
    +
    205 }
    +
    206 
    +
    207 /*------------------------------------------------------------------------*/
    +
    208 
    +
    209 int
    +
    210 fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod)
    +
    211 {
    +
    212  fmpz_t modulus;
    +
    213 
    +
    214  fmpz_init_set_ui(modulus, mod);
    +
    215 
    +
    216  return fmpz_invmod(f, g, modulus);
    +
    217 }
    +
    218 
    +
    219 /*------------------------------------------------------------------------*/
    +
    220 
    +
    221 void
    +
    222 fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h)
    +
    223 {
    +
    224  if (!g && !h) {
    +
    225  fmpz_zero(f);
    +
    226  } else {
    +
    227  if (!g && h)
    +
    228  fmpz_add_ui(f, h, 0);
    +
    229  else if (g && !h)
    +
    230  fmpz_add_ui(f, g, 0);
    +
    231  else
    +
    232  fmpz_add(f, g, h);
    +
    233  }
    +
    234 }
    +
    235 
    +
    236 /*------------------------------------------------------------------------*/
    +
    237 
    +
    238 void
    +
    239 poly_starmultiply(const fmpz_poly_t a,
    +
    240  const fmpz_poly_t b,
    +
    241  fmpz_poly_t c,
    +
    242  const ntru_params *params,
    +
    243  uint32_t modulus)
    +
    244 {
    +
    245  fmpz_poly_t a_tmp;
    +
    246  fmpz_t c_coeff_k;
    +
    247 
    +
    248  fmpz_poly_init(a_tmp);
    +
    249  fmpz_init(c_coeff_k);
    +
    250 
    +
    251  /* avoid side effects */
    +
    252  fmpz_poly_set(a_tmp, a);
    +
    253  fmpz_poly_zero(c);
    +
    254 
    +
    255  for (int k = params->N - 1; k >= 0; k--) {
    +
    256  int j;
    +
    257 
    +
    258  j = k + 1;
    +
    259 
    +
    260  fmpz_set_si(c_coeff_k, 0);
    +
    261 
    +
    262  for (int i = params->N - 1; i >= 0; i--) {
    +
    263  fmpz *a_tmp_coeff_i,
    +
    264  *b_coeff_j;
    +
    265 
    +
    266  if (j == (int)(params->N))
    +
    267  j = 0;
    +
    268 
    +
    269  a_tmp_coeff_i = fmpz_poly_get_coeff_ptr(a_tmp, i);
    +
    270  b_coeff_j = fmpz_poly_get_coeff_ptr(b, j);
    +
    271 
    +
    272  if (fmpz_cmp_si_n(a_tmp_coeff_i, 0) &&
    +
    273  fmpz_cmp_si_n(b_coeff_j, 0)) {
    +
    274  fmpz_t fmpz_tmp;
    +
    275 
    +
    276  fmpz_init(fmpz_tmp);
    +
    277 
    +
    278  fmpz_mul(fmpz_tmp, a_tmp_coeff_i, b_coeff_j);
    +
    279  fmpz_add(fmpz_tmp, fmpz_tmp, c_coeff_k);
    +
    280  fmpz_mod_ui(c_coeff_k, fmpz_tmp, modulus);
    +
    281 
    +
    282  fmpz_poly_set_coeff_fmpz(c, k, c_coeff_k);
    +
    283 
    +
    284  fmpz_clear(fmpz_tmp);
    +
    285  }
    +
    286  j++;
    +
    287  }
    +
    288  fmpz_clear(c_coeff_k);
    +
    289  }
    +
    290 
    +
    291  fmpz_poly_clear(a_tmp);
    +
    292 }
    +
    293 
    +
    294 /*------------------------------------------------------------------------*/
    +
    295 
    +
    296 bool
    +
    297 poly_inverse_poly_q(const fmpz_poly_t a,
    +
    298  fmpz_poly_t Fq,
    +
    299  const ntru_params *params)
    +
    300 {
    +
    301  bool retval = false;
    +
    302  int k = 0,
    +
    303  j = 0;
    +
    304  fmpz *b_last;
    +
    305  fmpz_poly_t a_tmp,
    +
    306  b,
    +
    307  c,
    +
    308  f,
    +
    309  g;
    +
    310 
    +
    311  /* general initialization of temp variables */
    +
    312  fmpz_poly_init(b);
    +
    313  fmpz_poly_set_coeff_ui(b, 0, 1);
    +
    314  fmpz_poly_init(c);
    +
    315  fmpz_poly_init(f);
    +
    316  fmpz_poly_set(f, a);
    +
    317 
    +
    318  /* set g(x) = x^N − 1 */
    +
    319  fmpz_poly_init(g);
    +
    320  fmpz_poly_set_coeff_si(g, 0, -1);
    +
    321  fmpz_poly_set_coeff_si(g, params->N, 1);
    +
    322 
    +
    323  /* avoid side effects */
    +
    324  fmpz_poly_init(a_tmp);
    +
    325  fmpz_poly_set(a_tmp, a);
    +
    326  fmpz_poly_zero(Fq);
    +
    327 
    +
    328  while (1) {
    +
    329  while (fmpz_is_zero(fmpz_poly_get_coeff_ptr(f, 0))) {
    +
    330  for (uint32_t i = 1; i <= params->N; i++) {
    +
    331  fmpz *f_coeff = fmpz_poly_get_coeff_ptr(f, i);
    +
    332  fmpz *c_coeff = fmpz_poly_get_coeff_ptr(c, params->N - i);
    +
    333 
    +
    334  /* f(x) = f(x) / x */
    + +
    336  f_coeff);
    +
    337 
    +
    338  /* c(x) = c(x) * x */
    +
    339  fmpz_poly_set_coeff_fmpz_n(c, params->N + 1 - i,
    +
    340  c_coeff);
    +
    341  }
    +
    342 
    +
    343  fmpz_poly_set_coeff_si(f, params->N, 0);
    +
    344  fmpz_poly_set_coeff_si(c, 0, 0);
    +
    345 
    +
    346  k++;
    +
    347 
    +
    348  if (fmpz_poly_degree(f) == -1)
    +
    349  goto _cleanup;
    +
    350  }
    +
    351 
    +
    352  if (fmpz_poly_degree(f) == 0)
    +
    353  break;
    +
    354 
    +
    355  if (fmpz_poly_degree(f) < fmpz_poly_degree(g)) {
    +
    356  fmpz_poly_swap(f, g);
    +
    357  fmpz_poly_swap(b, c);
    +
    358  }
    +
    359 
    +
    360  fmpz_poly_add(f, g, f);
    + +
    362 
    +
    363  fmpz_poly_add(b, c, b);
    + +
    365  }
    +
    366 
    +
    367  k = k % params->N;
    +
    368 
    +
    369  b_last = fmpz_poly_get_coeff_ptr(b, params->N);
    +
    370  if (fmpz_cmp_si_n(b_last, 0))
    +
    371  goto _cleanup;
    +
    372 
    +
    373  /* Fq(x) = x^(N-k) * b(x) */
    +
    374  for (int i = params->N - 1; i >= 0; i--) {
    +
    375  fmpz *b_i;
    +
    376 
    +
    377  j = i - k;
    +
    378 
    +
    379  if (j < 0)
    +
    380  j = j + params->N;
    +
    381 
    +
    382  b_i = fmpz_poly_get_coeff_ptr(b, i);
    +
    383  fmpz_poly_set_coeff_fmpz_n(Fq, j, b_i);
    +
    384  }
    +
    385 
    +
    386  poly_mod2_to_modq(a_tmp, Fq, params);
    +
    387 
    +
    388  /* check if the f * Fq = 1 (mod p) condition holds true */
    +
    389  fmpz_poly_set(a_tmp, a);
    +
    390  poly_starmultiply(a_tmp, Fq, a_tmp, params, params->q);
    +
    391  if (fmpz_poly_is_one(a_tmp))
    +
    392  retval = true;
    +
    393  else
    +
    394  fmpz_poly_zero(Fq);
    +
    395 
    +
    396 _cleanup:
    +
    397  fmpz_poly_clear(a_tmp);
    +
    398  fmpz_poly_clear(b);
    +
    399  fmpz_poly_clear(c);
    +
    400  fmpz_poly_clear(f);
    +
    401  fmpz_poly_clear(g);
    +
    402 
    +
    403  return retval;
    +
    404 }
    +
    405 
    +
    406 /*------------------------------------------------------------------------*/
    +
    407 
    +
    408 bool
    +
    409 poly_inverse_poly_p(const fmpz_poly_t a,
    +
    410  fmpz_poly_t Fp,
    +
    411  const ntru_params *params)
    +
    412 {
    +
    413  bool retval = false;
    +
    414  int k = 0,
    +
    415  j = 0;
    +
    416  fmpz *b_last;
    +
    417  fmpz_poly_t a_tmp,
    +
    418  b,
    +
    419  c,
    +
    420  f,
    +
    421  g;
    +
    422 
    +
    423  /* general initialization of temp variables */
    +
    424  fmpz_poly_init(b);
    +
    425  fmpz_poly_set_coeff_ui(b, 0, 1);
    +
    426  fmpz_poly_init(c);
    +
    427  fmpz_poly_init(f);
    +
    428  fmpz_poly_set(f, a);
    +
    429 
    +
    430  /* set g(x) = x^N − 1 */
    +
    431  fmpz_poly_init(g);
    +
    432  fmpz_poly_set_coeff_si(g, 0, -1);
    +
    433  fmpz_poly_set_coeff_si(g, params->N, 1);
    +
    434 
    +
    435  /* avoid side effects */
    +
    436  fmpz_poly_init(a_tmp);
    +
    437  fmpz_poly_set(a_tmp, a);
    +
    438  fmpz_poly_zero(Fp);
    +
    439 
    +
    440  while (1) {
    +
    441  while (fmpz_is_zero(fmpz_poly_get_coeff_ptr(f, 0))) {
    +
    442  for (uint32_t i = 1; i <= params->N; i++) {
    +
    443  fmpz *f_coeff = fmpz_poly_get_coeff_ptr(f, i);
    +
    444  fmpz *c_coeff = fmpz_poly_get_coeff_ptr(c, params->N - i);
    +
    445 
    +
    446  /* f(x) = f(x) / x */
    + +
    448  f_coeff);
    +
    449 
    +
    450  /* c(x) = c(x) * x */
    +
    451  fmpz_poly_set_coeff_fmpz_n(c, params->N + 1 - i,
    +
    452  c_coeff);
    +
    453  }
    +
    454 
    +
    455  fmpz_poly_set_coeff_si(f, params->N, 0);
    +
    456  fmpz_poly_set_coeff_si(c, 0, 0);
    +
    457 
    +
    458  k++;
    +
    459 
    +
    460  if (fmpz_poly_degree(f) == -1)
    +
    461  goto cleanup;
    +
    462  }
    +
    463 
    +
    464  if (fmpz_poly_degree(f) == 0)
    +
    465  break;
    +
    466 
    +
    467  if (fmpz_poly_degree(f) < fmpz_poly_degree(g)) {
    +
    468  /* exchange f and g and exchange b and c */
    +
    469  fmpz_poly_swap(f, g);
    +
    470  fmpz_poly_swap(b, c);
    +
    471  }
    +
    472 
    +
    473  {
    +
    474  fmpz_poly_t c_tmp,
    +
    475  g_tmp;
    +
    476  fmpz_t u,
    +
    477  mp_tmp;
    +
    478 
    +
    479  fmpz_init(u);
    +
    480  fmpz_zero(u);
    +
    481 
    +
    482  fmpz_init_set(mp_tmp, fmpz_poly_get_coeff_ptr(f, 0));
    +
    483 
    +
    484  fmpz_poly_init(g_tmp);
    +
    485  fmpz_poly_set(g_tmp, g);
    +
    486 
    +
    487  fmpz_poly_init(c_tmp);
    +
    488  fmpz_poly_set(c_tmp, c);
    +
    489 
    +
    490  /* u = f[0] * g[0]^(-1) mod p */
    +
    491  /* = (f[0] mod p) * (g[0] inverse mod p) mod p */
    +
    492  fmpz_invmod_ui(u,
    +
    493  fmpz_poly_get_coeff_ptr(g, 0),
    +
    494  params->p);
    +
    495  fmpz_mod_ui(mp_tmp, mp_tmp, params->p);
    +
    496  fmpz_mul(u, mp_tmp, u);
    +
    497  fmpz_mod_ui(u, u, params->p);
    +
    498 
    +
    499  /* f = f - u * g mod p */
    +
    500  fmpz_poly_scalar_mul_fmpz(g_tmp, g_tmp, u);
    +
    501  fmpz_poly_sub(f, g_tmp, f);
    +
    502  fmpz_poly_mod_unsigned(f, params->p);
    +
    503 
    +
    504  /* b = b - u * c mod p */
    +
    505  fmpz_poly_scalar_mul_fmpz(c_tmp, c_tmp, u);
    +
    506  fmpz_poly_sub(b, c_tmp, b);
    +
    507  fmpz_poly_mod_unsigned(b, params->p);
    +
    508 
    +
    509  fmpz_clear(u);
    +
    510  fmpz_poly_clear(g_tmp);
    +
    511  fmpz_poly_clear(c_tmp);
    +
    512  }
    +
    513  }
    +
    514 
    +
    515  k = k % params->N;
    +
    516 
    +
    517  b_last = fmpz_poly_get_coeff_ptr(b, params->N);
    +
    518  if (fmpz_cmp_si_n(b_last, 0))
    +
    519  goto cleanup;
    +
    520 
    +
    521  /* Fp(x) = x^(N-k) * b(x) */
    +
    522  for (int i = params->N - 1; i >= 0; i--) {
    +
    523  fmpz *b_i;
    +
    524 
    +
    525  /* b(X) = f[0]^(-1) * b(X) (mod p) */
    +
    526  {
    +
    527  fmpz_t mp_tmp;
    +
    528 
    +
    529  fmpz_init(mp_tmp);
    +
    530 
    +
    531  fmpz_invmod_ui(mp_tmp,
    +
    532  fmpz_poly_get_coeff_ptr(f, 0),
    +
    533  params->p);
    +
    534 
    +
    535  if (fmpz_poly_get_coeff_ptr(b, i)) {
    +
    536  fmpz_mul(fmpz_poly_get_coeff_ptr(b, i),
    +
    537  fmpz_poly_get_coeff_ptr(b, i),
    +
    538  mp_tmp);
    +
    539  fmpz_mod_ui(fmpz_poly_get_coeff_ptr(b, i),
    +
    540  fmpz_poly_get_coeff_ptr(b, i),
    +
    541  params->p);
    +
    542  }
    +
    543  }
    +
    544 
    +
    545  j = i - k;
    +
    546  if (j < 0)
    +
    547  j = j + params->N;
    +
    548 
    +
    549  b_i = fmpz_poly_get_coeff_ptr(b, i);
    +
    550  fmpz_poly_set_coeff_fmpz_n(Fp, j, b_i);
    +
    551  }
    +
    552 
    +
    553  /* check if the f * Fp = 1 (mod p) condition holds true */
    +
    554  fmpz_poly_set(a_tmp, a);
    +
    555  poly_starmultiply(a_tmp, Fp, a_tmp, params, params->p);
    +
    556  if (fmpz_poly_is_one(a_tmp))
    +
    557  retval = true;
    +
    558  else
    +
    559  fmpz_poly_zero(Fp);
    +
    560 
    +
    561 cleanup:
    +
    562  fmpz_poly_clear(a_tmp);
    +
    563  fmpz_poly_clear(b);
    +
    564  fmpz_poly_clear(c);
    +
    565  fmpz_poly_clear(f);
    +
    566  fmpz_poly_clear(g);
    +
    567 
    +
    568  return retval;
    +
    569 }
    +
    570 
    +
    571 /*------------------------------------------------------------------------*/
    +
    572 
    +
    573 void
    +
    574 poly_draw(const fmpz_poly_t poly)
    +
    575 {
    +
    576  fmpz_poly_print(poly);
    +
    577  flint_printf("\n");
    +
    578 }
    +
    579 
    +
    580 /*------------------------------------------------------------------------*/
    +
    581 
    +
    582 void
    +
    583 poly_draw_pretty(const fmpz_poly_t poly)
    +
    584 {
    +
    585  fmpz_poly_print_pretty(poly, "x");
    +
    586  flint_printf("\n");
    +
    587 }
    +
    588 
    +
    589 /*------------------------------------------------------------------------*/
    +
    bool poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    Definition: ntru_poly.c:297
    +
    uint32_t N
    Definition: ntru_params.h:48
    +
    void fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:166
    +
    void fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:182
    +
    uint32_t p
    Definition: ntru_params.h:56
    +
    bool poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
    Definition: ntru_poly.c:409
    + +
    header for ntru_mem.c
    +
    int fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod)
    Definition: ntru_poly.c:210
    +
    void poly_draw(const fmpz_poly_t poly)
    Definition: ntru_poly.c:574
    +
    NTRU parameters.
    +
    void fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n, const fmpz_t x)
    Definition: ntru_poly.c:198
    +
    void poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    Definition: ntru_poly.c:239
    +
    void poly_delete(fmpz_poly_t poly)
    Definition: ntru_poly.c:123
    +
    void poly_delete_all(fmpz_poly_t poly,...)
    Definition: ntru_poly.c:149
    +
    error handling
    +
    void poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len)
    Definition: ntru_poly.c:110
    +
    void poly_delete_array(fmpz_poly_t **poly_array)
    Definition: ntru_poly.c:131
    +
    void fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h)
    Definition: ntru_poly.c:222
    +
    uint32_t q
    Definition: ntru_params.h:52
    +
    int fmpz_cmp_si_n(const fmpz_t f, slong g)
    Definition: ntru_poly.c:93
    +
    void poly_draw_pretty(const fmpz_poly_t poly)
    Definition: ntru_poly.c:583
    +
    header for ntru_poly.c
    +
    static void poly_mod2_to_modq(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    Definition: ntru_poly.c:63
    +
    + - diff --git a/ntru__poly_8h.html b/ntru__poly_8h.html index 873362e..d64d639 100644 --- a/ntru__poly_8h.html +++ b/ntru__poly_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,64 +64,97 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly.h File Reference
    +
    ntru_poly.h File Reference
    -

    header for ntru_poly.c +

    header for ntru_poly.c More...

    -
    #include "ntru_err.h"
    -#include "ntru_params.h"
    -#include <stdarg.h>
    -#include <stdbool.h>
    -#include <stdint.h>
    -#include <stdlib.h>
    -#include <fmpz_poly.h>
    +
    #include "ntru_err.h"
    +#include "ntru_params.h"
    +#include <stdarg.h>
    +#include <stdbool.h>
    +#include <stdint.h>
    +#include <stdlib.h>
    +#include <fmpz_poly.h>
    Include dependency graph for ntru_poly.h:
    - +

    Go to the source code of this file.

    - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +

    Functions

    int fmpz_cmp_si_n (const fmpz_t f, slong g)
    void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
    void poly_delete (fmpz_poly_t poly)
    void poly_delete_array (fmpz_poly_t **poly_array)
    void poly_delete_all (fmpz_poly_t poly,...)
    void fmpz_poly_mod_unsigned (fmpz_poly_t a, const uint32_t mod)
    void fmpz_poly_mod (fmpz_poly_t a, const uint32_t mod)
    void fmpz_poly_set_coeff_fmpz_n (fmpz_poly_t poly, slong n, const fmpz_t x)
    int fmpz_invmod_ui (fmpz_t f, const fmpz_t g, const uint32_t mod)
    void fmpz_add_n (fmpz_t f, const fmpz_t g, const fmpz_t h)
    void poly_starmultiply (const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    bool poly_inverse_poly_q (const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    bool poly_inverse_poly_p (const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
    void poly_draw (const fmpz_poly_t poly)
    void poly_draw_pretty (const fmpz_poly_t poly)
    int fmpz_cmp_si_n (const fmpz_t f, slong g)
     
    void poly_new (fmpz_poly_t new_poly, int const *const c, const size_t len)
     
    void poly_delete (fmpz_poly_t poly)
     
    void poly_delete_array (fmpz_poly_t **poly_array)
     
    void poly_delete_all (fmpz_poly_t poly,...)
     
    void fmpz_poly_mod_unsigned (fmpz_poly_t a, const uint32_t mod)
     
    void fmpz_poly_mod (fmpz_poly_t a, const uint32_t mod)
     
    void fmpz_poly_set_coeff_fmpz_n (fmpz_poly_t poly, slong n, const fmpz_t x)
     
    int fmpz_invmod_ui (fmpz_t f, const fmpz_t g, const uint32_t mod)
     
    void fmpz_add_n (fmpz_t f, const fmpz_t g, const fmpz_t h)
     
    void poly_starmultiply (const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
     
    bool poly_inverse_poly_q (const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
     
    bool poly_inverse_poly_p (const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
     
    void poly_draw (const fmpz_poly_t poly)
     
    void poly_draw_pretty (const fmpz_poly_t poly)
     
    -

    Detailed Description

    -

    header for ntru_poly.c

    -

    Header for the internal API of ntru_poly.c.

    +

    Detailed Description

    +

    header for ntru_poly.c

    +

    Header for the internal API of ntru_poly.c.

    Definition in file ntru_poly.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -153,20 +177,19 @@ Functions
    void fmpz_add_n void fmpz_add_n ( fmpz_t  f,
    -
    -
    +

    The same as fmpz_add() except that it handles NULL pointer for g and h.

    Definition at line 222 of file ntru_poly.c.

    - +
    - + @@ -183,28 +206,27 @@ Functions
    int fmpz_cmp_si_n int fmpz_cmp_si_n ( const fmpz_t  f,
    -
    -
    +

    The same as fmpz_cmp_si except that it will interpret f as a 0-coefficient if it is a NULL pointer.

    -
    Parameters:
    +
    Parameters
    fthe fmpz value to use for comparison
    gthe signed long integer to use for comparison
    -
    Returns:
    negative value if f < g, positiv evalue if g < f, otherwise 0
    +
    Returns
    negative value if f < g, positiv evalue if g < f, otherwise 0

    Definition at line 93 of file ntru_poly.c.

    - +
    - + @@ -227,10 +249,9 @@ Functions
    int fmpz_invmod_ui int fmpz_invmod_ui ( fmpz_t  f,
    -
    -
    +

    Wrapper around fmpz_invmod() where we convert mod to an fmpz_t implicitly.

    -
    Parameters:
    +
    Parameters
    @@ -243,12 +264,12 @@ Functions - +
    fresult [out]
    gthe inverse
    - + @@ -265,11 +286,10 @@ Functions
    void fmpz_poly_mod void fmpz_poly_mod ( fmpz_poly_t  a,
    -
    -
    +

    Calls fmpz_poly_get_nmod_poly() and fmpz_poly_set_nmod_poly() in a row, so we don't have to deal with the intermediate nmod_poly_t type if we don't need it.

    This also normalises the coefficients to the interval -m/2 <= r < m/2.

    -
    Parameters:
    +
    Parameters
    @@ -281,12 +301,12 @@ Functions - +
    athe polynom to apply the modulus to
    modthe modulus
    - + @@ -303,11 +323,10 @@ Functions
    void fmpz_poly_mod_unsigned void fmpz_poly_mod_unsigned ( fmpz_poly_t  a,
    -
    -
    +

    Calls fmpz_poly_get_nmod_poly() and fmpz_poly_set_nmod_poly_unsigned() in a row, so we don't have to deal with the intermediate nmod_poly_t type if we don't need it.

    This also normalises the coefficients to the interval 0 <= r < m.

    -
    Parameters:
    +
    Parameters
    @@ -319,12 +338,12 @@ Functions - +
    athe polynom to apply the modulus to
    modthe modulus
    - + @@ -347,10 +366,9 @@ Functions
    void fmpz_poly_set_coeff_fmpz_n void fmpz_poly_set_coeff_fmpz_n ( fmpz_poly_t  poly,
    -
    -
    +

    The same as fmpz_poly_set_coeff_fmpz() except that it will take care of null-pointer coefficients and use fmpz_poly_set_coeff_si() in that case.

    -
    Parameters:
    +
    Parameters
    @@ -363,22 +381,21 @@ Functions - +
    polythe polynom we want to change a coefficient of
    nthe coefficient we want to set
    - +
    void poly_delete void poly_delete ( fmpz_poly_t  poly)
    -
    -
    +

    This deletes the internal structure of a polynomial, and frees the pointer.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to delete
    @@ -389,12 +406,12 @@ Functions
    - +
    - + @@ -411,10 +428,9 @@ Functions
    void poly_delete_all void poly_delete_all ( fmpz_poly_t  poly,
    -
    -
    +

    This deletes the internal structure of all polynomials, and frees the pointers. You must call this with NULL as last argument!

    -
    Parameters:
    +
    Parameters
    @@ -426,22 +442,21 @@ Functions - +
    polythe polynomial to delete
    ...follow up polynomials
    - +
    void poly_delete_array void poly_delete_array ( fmpz_poly_t **  poly_array)
    -
    -
    +

    Delete the internal structure of a polynomial array which must be NULL terminated. It is expected that poly_array is not on the stack and was obtained by a function like ascii_to_poly().

    -
    Parameters:
    +
    Parameters
    poly_arraythe polynomial array
    @@ -452,22 +467,21 @@ Functions
    - +
    - +
    void poly_draw void poly_draw ( const fmpz_poly_t  poly)
    -
    -
    +

    Draws a polynomial to stdout.

    -
    Parameters:
    +
    Parameters
    polydraw this
    @@ -478,22 +492,21 @@ Functions
    - +
    - +
    void poly_draw_pretty void poly_draw_pretty ( const fmpz_poly_t  poly)
    -
    -
    +

    Draws a polynomial to stdout, in pretty format.

    -
    Parameters:
    +
    Parameters
    polydraw this
    @@ -504,12 +517,12 @@ Functions
    - +
    - + @@ -532,11 +545,10 @@ Functions
    bool poly_inverse_poly_p bool poly_inverse_poly_p ( const fmpz_poly_t  a,
    -
    -
    +

    Compute the inverse of a polynomial in (Z/pZ)[X]/(X^N - 1). See NTRU Cryptosystems Tech Report #014 "Almost Inverses - and Fast NTRU Key Creation."

    -
    Parameters:
    +and Fast NTRU Key Creation."

    +
    Parameters
    @@ -544,18 +556,18 @@ Functions
    apolynomial to invert
    Fppolynomial [out]
    -
    Returns:
    true if invertible, false if not
    +
    Returns
    true if invertible, false if not

    Definition at line 409 of file ntru_poly.c.

    - +
    - + @@ -578,12 +590,11 @@ Functions
    bool poly_inverse_poly_q bool poly_inverse_poly_q ( const fmpz_poly_t  a,
    -
    -
    +

    Compute the inverse of a polynomial in modulo a power of 2, which is q. This is based off the pseudo-code for "Inversion - in (Z/2Z)[X](X^N - 1)" and "Inversion in (Z/p^r Z)[X](X^N - 1)". See NTRU Cryptosystems Tech Report #014 "Almost Inverses - and Fast NTRU Key Creation."

    -
    Parameters:
    +in (Z/2Z)[X](X^N - 1)" and "Inversion in (Z/p^r Z)[X](X^N - 1)". See NTRU Cryptosystems Tech Report #014 "Almost Inverses +and Fast NTRU Key Creation."

    +
    Parameters
    @@ -591,18 +602,18 @@ Functions
    apolynomial to invert (is allowed to be the same as param Fq)
    Fqpolynomial [out]
    -
    Returns:
    true if invertible, false if not
    +
    Returns
    true if invertible, false if not

    Definition at line 297 of file ntru_poly.c.

    - +
    - + @@ -625,10 +636,9 @@ Functions
    void poly_new void poly_new ( fmpz_poly_t  new_poly,
    -
    -
    +

    Initializes and builds a polynomial with the coefficient values of c[] of size len within NTRU parameters and returns a newly allocated polynomial. For an empty polynom, both c and len can be NULL/0.

    -
    Parameters:
    +
    Parameters
    @@ -636,18 +646,18 @@ Functions
    new_polythe polynomial to initialize and fill with coefficients [out]
    carray of polynomial coefficients, can be NULL
    -
    Returns:
    newly allocated polynomial pointer, must be freed with fmpz_poly_clear()
    +
    Returns
    newly allocated polynomial pointer, must be freed with fmpz_poly_clear()

    Definition at line 110 of file ntru_poly.c.

    - +
    - + @@ -682,10 +692,9 @@ Functions
    void poly_starmultiply void poly_starmultiply ( const fmpz_poly_t  a,
    -
    -
    +

    Starmultiplication, as follows: c = a * b mod (x^N − 1)

    -
    Parameters:
    +
    Parameters
    @@ -701,27 +710,11 @@ Functions - - - - -
    - -
    - - - + - diff --git a/ntru__poly_8h__incl.dot b/ntru__poly_8h__incl.dot deleted file mode 100644 index 4414695..0000000 --- a/ntru__poly_8h__incl.dot +++ /dev/null @@ -1,21 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__poly_8h__incl.map b/ntru__poly_8h__incl.map new file mode 100644 index 0000000..563424f --- /dev/null +++ b/ntru__poly_8h__incl.map @@ -0,0 +1,4 @@ + + + + diff --git a/ntru__poly_8h__incl.md5 b/ntru__poly_8h__incl.md5 index 551d2eb..1d9f111 100644 --- a/ntru__poly_8h__incl.md5 +++ b/ntru__poly_8h__incl.md5 @@ -1 +1 @@ -9b93babc2fcd24b4d52e7c54c1f7574e \ No newline at end of file +a5c08d5b8da9117d09078846c5a2687e \ No newline at end of file diff --git a/ntru__poly_8h__incl.png b/ntru__poly_8h__incl.png new file mode 100644 index 0000000..db01507 Binary files /dev/null and b/ntru__poly_8h__incl.png differ diff --git a/ntru__poly_8h_source.html b/ntru__poly_8h_source.html index deb5871..b13669a 100644 --- a/ntru__poly_8h_source.html +++ b/ntru__poly_8h_source.html @@ -3,44 +3,35 @@ +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.h Source File - - - - + + - + -
    - - +
    apolynom to multiply (can be the same as c)
    bpolynom to multiply
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,117 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_POLY_H
    -00029 #define NTRU_POLY_H
    -00030 
    -00031 #include "ntru_err.h"
    -00032 #include "ntru_params.h"
    -00033 
    -00034 #include <stdarg.h>
    -00035 #include <stdbool.h>
    -00036 #include <stdint.h>
    -00037 #include <stdlib.h>
    -00038 
    -00039 #include <fmpz_poly.h>
    -00040 
    -00041 
    -00050 int
    -00051 fmpz_cmp_si_n(const fmpz_t f, slong g);
    -00052 
    -00066 void
    -00067 poly_new(fmpz_poly_t new_poly,
    -00068         int const * const c,
    -00069         const size_t len);
    -00070 
    -00077 void
    -00078 poly_delete(fmpz_poly_t poly);
    -00079 
    -00088 void
    -00089 poly_delete_array(fmpz_poly_t **poly_array);
    -00090 
    -00099 void
    -00100 poly_delete_all(fmpz_poly_t poly, ...);
    -00101 
    -00114 void
    -00115 fmpz_poly_mod_unsigned(fmpz_poly_t a,
    -00116         const uint32_t mod);
    -00117 
    -00130 void
    -00131 fmpz_poly_mod(fmpz_poly_t a,
    -00132         const uint32_t mod);
    -00133 
    -00143 void
    -00144 fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly,
    -00145         slong n,
    -00146         const fmpz_t x);
    -00147 
    -00156 int
    -00157 fmpz_invmod_ui(fmpz_t f,
    -00158         const fmpz_t g,
    -00159         const uint32_t mod);
    -00160 
    -00165 void
    -00166 fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h);
    -00167 
    -00178 void
    -00179 poly_starmultiply(const fmpz_poly_t a,
    -00180         const fmpz_poly_t b,
    -00181         fmpz_poly_t c,
    -00182         const ntru_params *params,
    -00183         uint32_t modulus);
    -00184 
    -00197 bool
    -00198 poly_inverse_poly_q(const fmpz_poly_t a,
    -00199         fmpz_poly_t Fq,
    -00200         const ntru_params *params);
    -00201 
    -00212 bool
    -00213 poly_inverse_poly_p(const fmpz_poly_t a,
    -00214         fmpz_poly_t Fp,
    -00215         const ntru_params *params);
    -00216 
    -00222 void
    -00223 poly_draw(const fmpz_poly_t poly);
    -00224 
    -00231 void
    -00232 poly_draw_pretty(const fmpz_poly_t poly);
    -00233 
    -00234 
    -00235 #endif /* NTRU_POLY_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -192,13 +78,138 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_poly.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_POLY_H
    +
    29 #define NTRU_POLY_H
    +
    30 
    +
    31 #include "ntru_err.h"
    +
    32 #include "ntru_params.h"
    +
    33 
    +
    34 #include <stdarg.h>
    +
    35 #include <stdbool.h>
    +
    36 #include <stdint.h>
    +
    37 #include <stdlib.h>
    +
    38 
    +
    39 #include <fmpz_poly.h>
    +
    40 
    +
    41 
    +
    50 int
    +
    51 fmpz_cmp_si_n(const fmpz_t f, slong g);
    +
    52 
    +
    66 void
    +
    67 poly_new(fmpz_poly_t new_poly,
    +
    68  int const * const c,
    +
    69  const size_t len);
    +
    70 
    +
    77 void
    +
    78 poly_delete(fmpz_poly_t poly);
    +
    79 
    +
    88 void
    +
    89 poly_delete_array(fmpz_poly_t **poly_array);
    +
    90 
    +
    99 void
    +
    100 poly_delete_all(fmpz_poly_t poly, ...);
    +
    101 
    +
    114 void
    +
    115 fmpz_poly_mod_unsigned(fmpz_poly_t a,
    +
    116  const uint32_t mod);
    +
    117 
    +
    130 void
    +
    131 fmpz_poly_mod(fmpz_poly_t a,
    +
    132  const uint32_t mod);
    +
    133 
    +
    143 void
    +
    144 fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly,
    +
    145  slong n,
    +
    146  const fmpz_t x);
    +
    147 
    +
    156 int
    +
    157 fmpz_invmod_ui(fmpz_t f,
    +
    158  const fmpz_t g,
    +
    159  const uint32_t mod);
    +
    160 
    +
    165 void
    +
    166 fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h);
    +
    167 
    +
    178 void
    +
    179 poly_starmultiply(const fmpz_poly_t a,
    +
    180  const fmpz_poly_t b,
    +
    181  fmpz_poly_t c,
    +
    182  const ntru_params *params,
    +
    183  uint32_t modulus);
    +
    184 
    +
    197 bool
    +
    198 poly_inverse_poly_q(const fmpz_poly_t a,
    +
    199  fmpz_poly_t Fq,
    +
    200  const ntru_params *params);
    +
    201 
    +
    212 bool
    +
    213 poly_inverse_poly_p(const fmpz_poly_t a,
    +
    214  fmpz_poly_t Fp,
    +
    215  const ntru_params *params);
    +
    216 
    +
    222 void
    +
    223 poly_draw(const fmpz_poly_t poly);
    +
    224 
    +
    231 void
    +
    232 poly_draw_pretty(const fmpz_poly_t poly);
    +
    233 
    +
    234 
    +
    235 #endif /* NTRU_POLY_H */
    +
    void poly_delete_all(fmpz_poly_t poly,...)
    Definition: ntru_poly.c:149
    +
    void fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n, const fmpz_t x)
    Definition: ntru_poly.c:198
    +
    int fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod)
    Definition: ntru_poly.c:210
    +
    void poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len)
    Definition: ntru_poly.c:110
    +
    void poly_draw(const fmpz_poly_t poly)
    Definition: ntru_poly.c:574
    + +
    NTRU parameters.
    +
    void fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:182
    +
    void poly_draw_pretty(const fmpz_poly_t poly)
    Definition: ntru_poly.c:583
    +
    bool poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params)
    Definition: ntru_poly.c:409
    +
    void poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus)
    Definition: ntru_poly.c:239
    +
    void poly_delete_array(fmpz_poly_t **poly_array)
    Definition: ntru_poly.c:131
    +
    void fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h)
    Definition: ntru_poly.c:222
    +
    bool poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params)
    Definition: ntru_poly.c:297
    +
    void poly_delete(fmpz_poly_t poly)
    Definition: ntru_poly.c:123
    +
    error handling
    +
    void fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod)
    Definition: ntru_poly.c:166
    +
    int fmpz_cmp_si_n(const fmpz_t f, slong g)
    Definition: ntru_poly.c:93
    +
    + - diff --git a/ntru__poly__ascii_8c.html b/ntru__poly__ascii_8c.html index d8fa1e5..55af04b 100644 --- a/ntru__poly__ascii_8c.html +++ b/ntru__poly__ascii_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,61 +64,86 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.c File Reference
    +
    ntru_poly_ascii.c File Reference

    polynomials to acii More...

    -
    #include "ntru_poly_ascii.h"
    -#include "ntru_common.h"
    -#include "ntru_mem.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include "ntru_string.h"
    -#include <glib.h>
    -#include <stdint.h>
    -#include <stdlib.h>
    -#include <string.h>
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_poly_ascii.h"
    +#include "ntru_common.h"
    +#include "ntru_mem.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include "ntru_string.h"
    +#include <glib.h>
    +#include <stdint.h>
    +#include <stdlib.h>
    +#include <string.h>
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_poly_ascii.c:
    - +

    Go to the source code of this file.

    - - - - - - - - + + + + + + + + + + + + + +

    +

    Functions

    static stringget_bin_arr_to_ascii (const char *binary_rep)
    stringbin_poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
    stringbin_poly_arr_to_ascii (const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
    stringpoly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
    stringpoly_arr_to_ascii (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    stringpoly_to_base64 (const fmpz_poly_t poly, const ntru_params *params)
    stringpoly_arr_to_base64 (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    static stringget_bin_arr_to_ascii (const char *binary_rep)
     
    stringbin_poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
     
    stringbin_poly_arr_to_ascii (const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
     
    stringpoly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
     
    stringpoly_arr_to_ascii (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
     
    stringpoly_to_base64 (const fmpz_poly_t poly, const ntru_params *params)
     
    stringpoly_arr_to_base64 (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
     
    -

    Detailed Description

    +

    Detailed Description

    polynomials to acii

    This file allows to convert polynomials to ascii strings, including base64 encoded.

    Definition in file ntru_poly_ascii.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -150,14 +166,13 @@ Functions
    string* bin_poly_arr_to_ascii string* bin_poly_arr_to_ascii ( const fmpz_poly_t **  bin_poly_arr,
    -
    -
    +

    Convert an array of binary polynomials back to a real string. The polynomial coefficients represent a binary format of the ascii string with the following mapping:

    1 => 1

    -1 => 0

    2 => 0

    The 2's are only used for filling up the last polynomial, so they will just end up as '\0's at the end of the string and will not confuse the result.

    -
    Parameters:
    +
    Parameters
    @@ -165,18 +180,18 @@ Functions
    bin_poly_arrthe array of polynomials
    poly_cthe amount of polynomials in bin_poly_arr
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 143 of file ntru_poly_ascii.c.

    - +
    - + @@ -193,62 +208,68 @@ Functions
    string* bin_poly_to_ascii string* bin_poly_to_ascii ( const fmpz_poly_t  poly,
    -
    -
    +

    Convert a single binary polynomial back to a real string. The polynomial coefficients represent a binary format of the ascii string with the following mapping:

    1 => 1

    -1 => 0

    2 => 0

    The 2's are only used for filling up the rest of the polynomial, so they will just end up as '\0's at the end of the string and will not confuse the result.

    -
    Parameters:
    +
    Parameters
    polythe binary polynomial to convert
    paramsthe NTRU parameters
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 114 of file ntru_poly_ascii.c.

    - +
    + + + + + +
    - + - +
    static string * get_bin_arr_to_ascii static string * get_bin_arr_to_ascii ( const char *  binary_rep) [static]
    - -
    +
    +static
    +

    Converts a binary representation of multiple concatenated integers to the corresponding array of ascii chars, which is NULL-terminated.

    It reads in 8bit chunks, as in:

    10110101|00111100|01011001 => 90|60|89 => "Z<Y"

    Chunks that are 00000000 are stripped from the result.

    -
    Parameters:
    +
    Parameters
    binary_repthe binary representation of multiple integers concatenated
    -
    Returns:
    string of corresponding ascii-chars, newly allocated
    +
    Returns
    string of corresponding ascii-chars, newly allocated

    Definition at line 69 of file ntru_poly_ascii.c.

    - +
    - + @@ -271,11 +292,10 @@ Functions
    string* poly_arr_to_ascii string* poly_arr_to_ascii ( const fmpz_poly_t **  poly_array,
    -
    -
    +

    Convert an array of polynomials back to a real string. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    @@ -283,18 +303,18 @@ Functions
    poly_arraythe array of polynomials
    poly_cthe amount of polynomials in poly_arr
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 203 of file ntru_poly_ascii.c.

    - +
    - + @@ -317,11 +337,10 @@ Functions
    string* poly_arr_to_base64 string* poly_arr_to_base64 ( const fmpz_poly_t **  poly_arr,
    -
    -
    +

    Convert an array of polynomials back to a real string which is base64 encoded. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    @@ -329,18 +348,18 @@ Functions
    poly_arrthe array of polynomials
    poly_cthe amount of polynomials in poly_arr
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 264 of file ntru_poly_ascii.c.

    - +
    - + @@ -357,29 +376,28 @@ Functions
    string* poly_to_ascii string* poly_to_ascii ( const fmpz_poly_t  poly,
    -
    -
    +

    Convert a single polynom back to a real string which is ascii encoded (full 256 C char spectrum). The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to convert
    paramsthe NTRU parameters
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 180 of file ntru_poly_ascii.c.

    - +
    - + @@ -396,45 +414,28 @@ Functions
    string* poly_to_base64 string* poly_to_base64 ( const fmpz_poly_t  poly,
    -
    -
    +

    Convert a single polynom back to a real string which is base64 encoded. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to convert
    paramsthe NTRU parameters
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 237 of file ntru_poly_ascii.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__poly__ascii_8c__incl.dot b/ntru__poly__ascii_8c__incl.dot deleted file mode 100644 index 004812b..0000000 --- a/ntru__poly__ascii_8c__incl.dot +++ /dev/null @@ -1,49 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_poly_ascii.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_poly_ascii.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly__ascii_8h.html",tooltip="header for ntru_poly_ascii.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node3 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node5 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node7 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="ntru_mem.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__mem_8h.html",tooltip="header for ntru_mem.c"]; - Node10 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node11 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node11 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node13 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node13 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node14 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node14 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node11 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node15 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node15 [label="glib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node16 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node16 [label="string.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/ntru__poly__ascii_8c__incl.map b/ntru__poly__ascii_8c__incl.map new file mode 100644 index 0000000..0369b78 --- /dev/null +++ b/ntru__poly__ascii_8c__incl.map @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ntru__poly__ascii_8c__incl.md5 b/ntru__poly__ascii_8c__incl.md5 index d222b4d..b714945 100644 --- a/ntru__poly__ascii_8c__incl.md5 +++ b/ntru__poly__ascii_8c__incl.md5 @@ -1 +1 @@ -9fcf17a21bcd353f4c16d617d3d52467 \ No newline at end of file +48c92a3995035281292b591ebc928bc1 \ No newline at end of file diff --git a/ntru__poly__ascii_8c__incl.png b/ntru__poly__ascii_8c__incl.png new file mode 100644 index 0000000..10c75e7 Binary files /dev/null and b/ntru__poly__ascii_8c__incl.png differ diff --git a/ntru__poly__ascii_8c_source.html b/ntru__poly__ascii_8c_source.html index a8fa80a..61bdcd2 100644 --- a/ntru__poly__ascii_8c_source.html +++ b/ntru__poly__ascii_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,285 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_poly_ascii.h"
    -00030 #include "ntru_common.h"
    -00031 #include "ntru_mem.h"
    -00032 #include "ntru_params.h"
    -00033 #include "ntru_poly.h"
    -00034 #include "ntru_string.h"
    -00035 
    -00036 #include <glib.h>
    -00037 
    -00038 #include <stdint.h>
    -00039 #include <stdlib.h>
    -00040 #include <string.h>
    -00041 
    -00042 #include <fmpz_poly.h>
    -00043 #include <fmpz.h>
    -00044 
    -00045 
    -00062 static string *
    -00063 get_bin_arr_to_ascii(const char *binary_rep);
    -00064 
    -00065 
    -00066 /*------------------------------------------------------------------------*/
    -00067 
    -00068 static string *
    -00069 get_bin_arr_to_ascii(const char *binary_rep)
    -00070 {
    -00071     size_t int_arr_size = 0;
    -00072     uint8_t *int_arr = NULL;
    -00073     uint32_t i = 0;
    -00074     char *int_string = NULL;
    -00075     string *result = ntru_malloc(sizeof(*result));
    -00076 
    -00077     if (!binary_rep || !*binary_rep)
    -00078         return NULL;
    -00079 
    -00080     int_arr_size = strlen(binary_rep) / ASCII_BITS + 1;
    -00081     int_arr = ntru_malloc(sizeof(*int_arr) * int_arr_size);
    -00082 
    -00083     while (*binary_rep) {
    -00084         int_arr[i] = 0;
    -00085 
    -00086         /* convert one binary integer to real integer */
    -00087         for (uint32_t j = 0; j < ASCII_BITS && *binary_rep; j++) {
    -00088             if (*binary_rep == '1')
    -00089                 int_arr[i] = int_arr[i] * 2 + 1;
    -00090             else if (*binary_rep == '0')
    -00091                 int_arr[i] *= 2;
    -00092             binary_rep++;
    -00093         }
    -00094 
    -00095         i++; /* amount of real integers */
    -00096     }
    -00097 
    -00098     int_string = ntru_malloc(CHAR_SIZE * (i + 1));
    -00099 
    -00100     for (uint32_t j = 0; j < i; j++)
    -00101         int_string[j] = (char) int_arr[j];
    -00102 
    -00103     result->ptr = int_string;
    -00104     result->len = i;
    -00105 
    -00106     free(int_arr);
    -00107 
    -00108     return result;
    -00109 }
    -00110 
    -00111 /*------------------------------------------------------------------------*/
    -00112 
    -00113 string *
    -00114 bin_poly_to_ascii(const fmpz_poly_t poly,
    -00115         const ntru_params *params)
    -00116 {
    -00117     string *result_string = ntru_malloc(sizeof(*result_string));
    -00118     char *binary_rep = ntru_malloc(CHAR_SIZE * (params->N));
    -00119     uint32_t i = 0;
    -00120 
    -00121     for (i = 0; i < params->N; i++) {
    -00122         fmpz *coeff = fmpz_poly_get_coeff_ptr(poly, i);
    -00123 
    -00124         if (coeff) {
    -00125             if (!fmpz_cmp_si(coeff, 1))
    -00126                 binary_rep[i] = '1';
    -00127             else if (!fmpz_cmp_si(coeff, -1))
    -00128                 binary_rep[i] = '0';
    -00129         } else {
    -00130             break;
    -00131         }
    -00132     }
    -00133 
    -00134     result_string->ptr = binary_rep;
    -00135     result_string->len = i;
    -00136 
    -00137     return result_string;
    -00138 }
    -00139 
    -00140 /*------------------------------------------------------------------------*/
    -00141 
    -00142 string *
    -00143 bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr,
    -00144         const uint32_t poly_c,
    -00145         const ntru_params *params)
    -00146 {
    -00147     char *binary_rep = NULL;
    -00148     size_t string_len = 0;
    -00149     string *ascii_string = NULL;
    -00150 
    -00151     /*
    -00152      * parse the polynomial coefficients into a string
    -00153      */
    -00154     binary_rep = ntru_malloc(CHAR_SIZE * (params->N * poly_c + 1));
    -00155     for (uint32_t i = 0; i < poly_c; i++) {
    -00156         string *single_poly_string = NULL;
    -00157 
    -00158         single_poly_string = bin_poly_to_ascii(*bin_poly_arr[i], params);
    -00159 
    -00160         memcpy(binary_rep + string_len,
    -00161                 single_poly_string->ptr,
    -00162                 single_poly_string->len);
    -00163 
    -00164         string_len += single_poly_string->len;
    -00165 
    -00166         string_delete(single_poly_string);
    -00167     }
    -00168     binary_rep[string_len] = '\0';
    -00169 
    -00170     ascii_string = get_bin_arr_to_ascii(binary_rep);
    -00171 
    -00172     free(binary_rep);
    -00173 
    -00174     return ascii_string;
    -00175 }
    -00176 
    -00177 /*------------------------------------------------------------------------*/
    -00178 
    -00179 string *
    -00180 poly_to_ascii(const fmpz_poly_t poly,
    -00181         const ntru_params *params)
    -00182 {
    -00183     string *result_string = ntru_malloc(sizeof(*result_string));
    -00184     char *string_rep = ntru_malloc(CHAR_SIZE * (params->N));
    -00185 
    -00186     for (uint32_t j = 0; j < params->N; j++) {
    -00187         uint8_t coeff = fmpz_poly_get_coeff_ui(poly, j);
    -00188         if (coeff == params->q)
    -00189             string_rep[j] = '\0';
    -00190         else
    -00191             string_rep[j] = (char)coeff;
    -00192     }
    -00193 
    -00194     result_string->ptr = string_rep;
    -00195     result_string->len = params->N;
    -00196 
    -00197     return result_string;
    -00198 }
    -00199 
    -00200 /*------------------------------------------------------------------------*/
    -00201 
    -00202 string *
    -00203 poly_arr_to_ascii(const fmpz_poly_t **poly_array,
    -00204         const uint32_t poly_c,
    -00205         const ntru_params *params)
    -00206 {
    -00207     char *string_rep = NULL;
    -00208     size_t string_len = 0;
    -00209     string *result_string = ntru_malloc(sizeof(*result_string));
    -00210 
    -00211     /*
    -00212      * parse the polynomial coefficients into a string
    -00213      */
    -00214     string_rep = ntru_malloc(CHAR_SIZE * (params->N * poly_c + 1));
    -00215     for (uint32_t i = 0; i < poly_c; i++) {
    -00216         string *poly_str;
    -00217 
    -00218         poly_str = poly_to_ascii(*poly_array[i], params);
    -00219 
    -00220         memcpy(string_rep + string_len,
    -00221                 poly_str->ptr,
    -00222                 poly_str->len);
    -00223         string_len += poly_str->len;
    -00224 
    -00225         string_delete(poly_str);
    -00226     }
    -00227 
    -00228     result_string->ptr = string_rep;
    -00229     result_string->len = string_len;
    -00230 
    -00231     return result_string;
    -00232 }
    -00233 
    -00234 /*------------------------------------------------------------------------*/
    -00235 
    -00236 string *
    -00237 poly_to_base64(const fmpz_poly_t poly,
    -00238         const ntru_params *params)
    -00239 {
    -00240     string *result_string = ntru_malloc(sizeof(*result_string));
    -00241     string *string_rep = NULL;
    -00242     gchar *base64_string = NULL,
    -00243           *tmp = NULL;
    -00244 
    -00245     string_rep = poly_to_ascii(poly, params);
    -00246 
    -00247     tmp = g_base64_encode((const guchar *)string_rep->ptr,
    -00248             string_rep->len);
    -00249     base64_string = g_base64_encode((const guchar *)tmp,
    -00250             strlen(tmp));
    -00251 
    -00252     result_string->ptr = base64_string;
    -00253     result_string->len = strlen(base64_string);
    -00254 
    -00255     string_delete(string_rep);
    -00256     free(tmp);
    -00257 
    -00258     return result_string;
    -00259 }
    -00260 
    -00261 /*------------------------------------------------------------------------*/
    -00262 
    -00263 string *
    -00264 poly_arr_to_base64(const fmpz_poly_t **poly_array,
    -00265         const uint32_t poly_c,
    -00266         const ntru_params *params)
    -00267 {
    -00268     string *string_rep;
    -00269     string *result_string = ntru_malloc(sizeof(*result_string));
    -00270 
    -00271     gchar *base64_string = NULL,
    -00272           *tmp = NULL;
    -00273 
    -00274     string_rep = poly_arr_to_ascii(poly_array, poly_c, params);
    -00275 
    -00276     tmp = g_base64_encode((const guchar *)string_rep->ptr, string_rep->len);
    -00277     base64_string = g_base64_encode((const guchar *)tmp,
    -00278             strlen(tmp));
    -00279 
    -00280     result_string->ptr = base64_string;
    -00281     result_string->len = strlen(base64_string);
    -00282 
    -00283     string_delete(string_rep);
    -00284     free(tmp);
    -00285 
    -00286     return result_string;
    -00287 }
    -00288 
    -00289 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -360,13 +78,310 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_poly_ascii.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_poly_ascii.h"
    +
    30 #include "ntru_common.h"
    +
    31 #include "ntru_mem.h"
    +
    32 #include "ntru_params.h"
    +
    33 #include "ntru_poly.h"
    +
    34 #include "ntru_string.h"
    +
    35 
    +
    36 #include <glib.h>
    +
    37 
    +
    38 #include <stdint.h>
    +
    39 #include <stdlib.h>
    +
    40 #include <string.h>
    +
    41 
    +
    42 #include <fmpz_poly.h>
    +
    43 #include <fmpz.h>
    +
    44 
    +
    45 
    +
    62 static string *
    +
    63 get_bin_arr_to_ascii(const char *binary_rep);
    +
    64 
    +
    65 
    +
    66 /*------------------------------------------------------------------------*/
    +
    67 
    +
    68 static string *
    +
    69 get_bin_arr_to_ascii(const char *binary_rep)
    +
    70 {
    +
    71  size_t int_arr_size = 0;
    +
    72  uint8_t *int_arr = NULL;
    +
    73  uint32_t i = 0;
    +
    74  char *int_string = NULL;
    +
    75  string *result = ntru_malloc(sizeof(*result));
    +
    76 
    +
    77  if (!binary_rep || !*binary_rep)
    +
    78  return NULL;
    +
    79 
    +
    80  int_arr_size = strlen(binary_rep) / ASCII_BITS + 1;
    +
    81  int_arr = ntru_malloc(sizeof(*int_arr) * int_arr_size);
    +
    82 
    +
    83  while (*binary_rep) {
    +
    84  int_arr[i] = 0;
    +
    85 
    +
    86  /* convert one binary integer to real integer */
    +
    87  for (uint32_t j = 0; j < ASCII_BITS && *binary_rep; j++) {
    +
    88  if (*binary_rep == '1')
    +
    89  int_arr[i] = int_arr[i] * 2 + 1;
    +
    90  else if (*binary_rep == '0')
    +
    91  int_arr[i] *= 2;
    +
    92  binary_rep++;
    +
    93  }
    +
    94 
    +
    95  i++; /* amount of real integers */
    +
    96  }
    +
    97 
    +
    98  int_string = ntru_malloc(CHAR_SIZE * (i + 1));
    +
    99 
    +
    100  for (uint32_t j = 0; j < i; j++)
    +
    101  int_string[j] = (char) int_arr[j];
    +
    102 
    +
    103  result->ptr = int_string;
    +
    104  result->len = i;
    +
    105 
    +
    106  free(int_arr);
    +
    107 
    +
    108  return result;
    +
    109 }
    +
    110 
    +
    111 /*------------------------------------------------------------------------*/
    +
    112 
    +
    113 string *
    +
    114 bin_poly_to_ascii(const fmpz_poly_t poly,
    +
    115  const ntru_params *params)
    +
    116 {
    +
    117  string *result_string = ntru_malloc(sizeof(*result_string));
    +
    118  char *binary_rep = ntru_malloc(CHAR_SIZE * (params->N));
    +
    119  uint32_t i = 0;
    +
    120 
    +
    121  for (i = 0; i < params->N; i++) {
    +
    122  fmpz *coeff = fmpz_poly_get_coeff_ptr(poly, i);
    +
    123 
    +
    124  if (coeff) {
    +
    125  if (!fmpz_cmp_si(coeff, 1))
    +
    126  binary_rep[i] = '1';
    +
    127  else if (!fmpz_cmp_si(coeff, -1))
    +
    128  binary_rep[i] = '0';
    +
    129  } else {
    +
    130  break;
    +
    131  }
    +
    132  }
    +
    133 
    +
    134  result_string->ptr = binary_rep;
    +
    135  result_string->len = i;
    +
    136 
    +
    137  return result_string;
    +
    138 }
    +
    139 
    +
    140 /*------------------------------------------------------------------------*/
    +
    141 
    +
    142 string *
    +
    143 bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr,
    +
    144  const uint32_t poly_c,
    +
    145  const ntru_params *params)
    +
    146 {
    +
    147  char *binary_rep = NULL;
    +
    148  size_t string_len = 0;
    +
    149  string *ascii_string = NULL;
    +
    150 
    +
    151  /*
    +
    152  * parse the polynomial coefficients into a string
    +
    153  */
    +
    154  binary_rep = ntru_malloc(CHAR_SIZE * (params->N * poly_c + 1));
    +
    155  for (uint32_t i = 0; i < poly_c; i++) {
    +
    156  string *single_poly_string = NULL;
    +
    157 
    +
    158  single_poly_string = bin_poly_to_ascii(*bin_poly_arr[i], params);
    +
    159 
    +
    160  memcpy(binary_rep + string_len,
    +
    161  single_poly_string->ptr,
    +
    162  single_poly_string->len);
    +
    163 
    +
    164  string_len += single_poly_string->len;
    +
    165 
    +
    166  string_delete(single_poly_string);
    +
    167  }
    +
    168  binary_rep[string_len] = '\0';
    +
    169 
    +
    170  ascii_string = get_bin_arr_to_ascii(binary_rep);
    +
    171 
    +
    172  free(binary_rep);
    +
    173 
    +
    174  return ascii_string;
    +
    175 }
    +
    176 
    +
    177 /*------------------------------------------------------------------------*/
    +
    178 
    +
    179 string *
    +
    180 poly_to_ascii(const fmpz_poly_t poly,
    +
    181  const ntru_params *params)
    +
    182 {
    +
    183  string *result_string = ntru_malloc(sizeof(*result_string));
    +
    184  char *string_rep = ntru_malloc(CHAR_SIZE * (params->N));
    +
    185 
    +
    186  for (uint32_t j = 0; j < params->N; j++) {
    +
    187  uint8_t coeff = fmpz_poly_get_coeff_ui(poly, j);
    +
    188  if (coeff == params->q)
    +
    189  string_rep[j] = '\0';
    +
    190  else
    +
    191  string_rep[j] = (char)coeff;
    +
    192  }
    +
    193 
    +
    194  result_string->ptr = string_rep;
    +
    195  result_string->len = params->N;
    +
    196 
    +
    197  return result_string;
    +
    198 }
    +
    199 
    +
    200 /*------------------------------------------------------------------------*/
    +
    201 
    +
    202 string *
    +
    203 poly_arr_to_ascii(const fmpz_poly_t **poly_array,
    +
    204  const uint32_t poly_c,
    +
    205  const ntru_params *params)
    +
    206 {
    +
    207  char *string_rep = NULL;
    +
    208  size_t string_len = 0;
    +
    209  string *result_string = ntru_malloc(sizeof(*result_string));
    +
    210 
    +
    211  /*
    +
    212  * parse the polynomial coefficients into a string
    +
    213  */
    +
    214  string_rep = ntru_malloc(CHAR_SIZE * (params->N * poly_c + 1));
    +
    215  for (uint32_t i = 0; i < poly_c; i++) {
    +
    216  string *poly_str;
    +
    217 
    +
    218  poly_str = poly_to_ascii(*poly_array[i], params);
    +
    219 
    +
    220  memcpy(string_rep + string_len,
    +
    221  poly_str->ptr,
    +
    222  poly_str->len);
    +
    223  string_len += poly_str->len;
    +
    224 
    +
    225  string_delete(poly_str);
    +
    226  }
    +
    227 
    +
    228  result_string->ptr = string_rep;
    +
    229  result_string->len = string_len;
    +
    230 
    +
    231  return result_string;
    +
    232 }
    +
    233 
    +
    234 /*------------------------------------------------------------------------*/
    +
    235 
    +
    236 string *
    +
    237 poly_to_base64(const fmpz_poly_t poly,
    +
    238  const ntru_params *params)
    +
    239 {
    +
    240  string *result_string = ntru_malloc(sizeof(*result_string));
    +
    241  string *string_rep = NULL;
    +
    242  gchar *base64_string = NULL,
    +
    243  *tmp = NULL;
    +
    244 
    +
    245  string_rep = poly_to_ascii(poly, params);
    +
    246 
    +
    247  tmp = g_base64_encode((const guchar *)string_rep->ptr,
    +
    248  string_rep->len);
    +
    249  base64_string = g_base64_encode((const guchar *)tmp,
    +
    250  strlen(tmp));
    +
    251 
    +
    252  result_string->ptr = base64_string;
    +
    253  result_string->len = strlen(base64_string);
    +
    254 
    +
    255  string_delete(string_rep);
    +
    256  free(tmp);
    +
    257 
    +
    258  return result_string;
    +
    259 }
    +
    260 
    +
    261 /*------------------------------------------------------------------------*/
    +
    262 
    +
    263 string *
    +
    264 poly_arr_to_base64(const fmpz_poly_t **poly_array,
    +
    265  const uint32_t poly_c,
    +
    266  const ntru_params *params)
    +
    267 {
    +
    268  string *string_rep;
    +
    269  string *result_string = ntru_malloc(sizeof(*result_string));
    +
    270 
    +
    271  gchar *base64_string = NULL,
    +
    272  *tmp = NULL;
    +
    273 
    +
    274  string_rep = poly_arr_to_ascii(poly_array, poly_c, params);
    +
    275 
    +
    276  tmp = g_base64_encode((const guchar *)string_rep->ptr, string_rep->len);
    +
    277  base64_string = g_base64_encode((const guchar *)tmp,
    +
    278  strlen(tmp));
    +
    279 
    +
    280  result_string->ptr = base64_string;
    +
    281  result_string->len = strlen(base64_string);
    +
    282 
    +
    283  string_delete(string_rep);
    +
    284  free(tmp);
    +
    285 
    +
    286  return result_string;
    +
    287 }
    +
    288 
    +
    289 /*------------------------------------------------------------------------*/
    +
    #define ASCII_BITS
    Definition: ntru_common.h:38
    +
    void string_delete(string *del_string)
    Definition: ntru_string.c:47
    +
    size_t len
    Definition: ntru_string.h:53
    +
    uint32_t N
    Definition: ntru_params.h:48
    +
    string * poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params)
    +
    string * poly_arr_to_base64(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    + +
    header for ntru_mem.c
    +
    static string * get_bin_arr_to_ascii(const char *binary_rep)
    +
    header for ntru_poly_ascii.c
    +
    NTRU parameters.
    +
    common macros/functions
    +
    string * poly_to_base64(const fmpz_poly_t poly, const ntru_params *params)
    +
    string * bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
    +
    string * bin_poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params)
    +
    void * ntru_malloc(size_t size)
    Definition: ntru_mem.c:38
    +
    uint32_t q
    Definition: ntru_params.h:52
    +
    string * poly_arr_to_ascii(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    +
    header for ntru_string.c
    +
    #define CHAR_SIZE
    Definition: ntru_common.h:37
    +
    char * ptr
    Definition: ntru_string.h:49
    +
    header for ntru_poly.c
    +
    + - diff --git a/ntru__poly__ascii_8h.html b/ntru__poly__ascii_8h.html index 4003b5c..9bff0ad 100644 --- a/ntru__poly__ascii_8h.html +++ b/ntru__poly__ascii_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,53 +64,77 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h File Reference
    +
    ntru_poly_ascii.h File Reference
    -

    header for ntru_poly_ascii.c +

    header for ntru_poly_ascii.c More...

    -
    #include "ntru_common.h"
    -#include "ntru_params.h"
    -#include "ntru_string.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    +
    #include "ntru_common.h"
    +#include "ntru_params.h"
    +#include "ntru_string.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    Include dependency graph for ntru_poly_ascii.h:
    - +

    Go to the source code of this file.

    - - - - - - - + + + + + + + + + + + +

    +

    Functions

    stringbin_poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
    stringbin_poly_arr_to_ascii (const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
    stringpoly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
    stringpoly_arr_to_ascii (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    stringpoly_to_base64 (const fmpz_poly_t poly, const ntru_params *params)
    stringpoly_arr_to_base64 (const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params)
    stringbin_poly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
     
    stringbin_poly_arr_to_ascii (const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
     
    stringpoly_to_ascii (const fmpz_poly_t poly, const ntru_params *params)
     
    stringpoly_arr_to_ascii (const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
     
    stringpoly_to_base64 (const fmpz_poly_t poly, const ntru_params *params)
     
    stringpoly_arr_to_base64 (const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params)
     
    -

    Detailed Description

    -

    header for ntru_poly_ascii.c

    -

    Header for the internal API of ntru_poly_ascii.c.

    +

    Detailed Description

    +

    header for ntru_poly_ascii.c

    +

    Header for the internal API of ntru_poly_ascii.c.

    Definition in file ntru_poly_ascii.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - + @@ -142,14 +157,13 @@ Functions
    string* bin_poly_arr_to_ascii string* bin_poly_arr_to_ascii ( const fmpz_poly_t **  bin_poly_arr,
    -
    -
    +

    Convert an array of binary polynomials back to a real string. The polynomial coefficients represent a binary format of the ascii string with the following mapping:

    1 => 1

    -1 => 0

    2 => 0

    The 2's are only used for filling up the last polynomial, so they will just end up as '\0's at the end of the string and will not confuse the result.

    -
    Parameters:
    +
    Parameters
    @@ -157,18 +171,18 @@ Functions
    bin_poly_arrthe array of polynomials
    poly_cthe amount of polynomials in bin_poly_arr
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 143 of file ntru_poly_ascii.c.

    - +
    - + @@ -185,32 +199,31 @@ Functions
    string* bin_poly_to_ascii string* bin_poly_to_ascii ( const fmpz_poly_t  poly,
    -
    -
    +

    Convert a single binary polynomial back to a real string. The polynomial coefficients represent a binary format of the ascii string with the following mapping:

    1 => 1

    -1 => 0

    2 => 0

    The 2's are only used for filling up the rest of the polynomial, so they will just end up as '\0's at the end of the string and will not confuse the result.

    -
    Parameters:
    +
    Parameters
    polythe binary polynomial to convert
    paramsthe NTRU parameters
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 114 of file ntru_poly_ascii.c.

    - +
    - + @@ -233,11 +246,10 @@ Functions
    string* poly_arr_to_ascii string* poly_arr_to_ascii ( const fmpz_poly_t **  poly_array,
    -
    -
    +

    Convert an array of polynomials back to a real string. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    @@ -245,18 +257,18 @@ Functions
    poly_arraythe array of polynomials
    poly_cthe amount of polynomials in poly_arr
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 203 of file ntru_poly_ascii.c.

    - +
    - + @@ -279,11 +291,10 @@ Functions
    string* poly_arr_to_base64 string* poly_arr_to_base64 ( const fmpz_poly_t **  poly_arr,
    -
    -
    +

    Convert an array of polynomials back to a real string which is base64 encoded. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    @@ -291,18 +302,18 @@ Functions
    poly_arrthe array of polynomials
    poly_cthe amount of polynomials in poly_arr
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 264 of file ntru_poly_ascii.c.

    - +
    - + @@ -319,29 +330,28 @@ Functions
    string* poly_to_ascii string* poly_to_ascii ( const fmpz_poly_t  poly,
    -
    -
    +

    Convert a single polynom back to a real string which is ascii encoded (full 256 C char spectrum). The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to convert
    paramsthe NTRU parameters
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 180 of file ntru_poly_ascii.c.

    - +
    - + @@ -358,45 +368,28 @@ Functions
    string* poly_to_base64 string* poly_to_base64 ( const fmpz_poly_t  poly,
    -
    -
    +

    Convert a single polynom back to a real string which is base64 encoded. The polynomial coefficients are expected to be in the range [0, q-1] and will be casted back to chars without any mapping.

    Trailing q coefficients are only used for filling up the rest of a polynomial with '\0', so they will not confuse the result.

    -
    Parameters:
    +
    Parameters
    polythe polynomial to convert
    paramsthe NTRU parameters
    -
    Returns:
    the real string, newly allocated
    +
    Returns
    the real string, newly allocated

    Definition at line 237 of file ntru_poly_ascii.c.

    - - - - -
    - -
    - - - + - diff --git a/ntru__poly__ascii_8h__incl.dot b/ntru__poly__ascii_8h__incl.dot deleted file mode 100644 index 34db180..0000000 --- a/ntru__poly__ascii_8h__incl.dot +++ /dev/null @@ -1,21 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_common.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__common_8h.html",tooltip="common macros/functions"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node6 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__poly__ascii_8h__incl.map b/ntru__poly__ascii_8h__incl.map new file mode 100644 index 0000000..ad7ccab --- /dev/null +++ b/ntru__poly__ascii_8h__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/ntru__poly__ascii_8h__incl.md5 b/ntru__poly__ascii_8h__incl.md5 index e99459f..063cf39 100644 --- a/ntru__poly__ascii_8h__incl.md5 +++ b/ntru__poly__ascii_8h__incl.md5 @@ -1 +1 @@ -6aaf2e6e55206c8741aae7f9a2c4a990 \ No newline at end of file +e81ad785da148a0aac52ca08f927fae9 \ No newline at end of file diff --git a/ntru__poly__ascii_8h__incl.png b/ntru__poly__ascii_8h__incl.png new file mode 100644 index 0000000..da26707 Binary files /dev/null and b/ntru__poly__ascii_8h__incl.png differ diff --git a/ntru__poly__ascii_8h_source.html b/ntru__poly__ascii_8h_source.html index d4755bf..fd0b56d 100644 --- a/ntru__poly__ascii_8h_source.html +++ b/ntru__poly__ascii_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,81 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_POLY_ASCII_H_
    -00029 #define NTRU_POLY_ASCII_H_
    -00030 
    -00031 
    -00032 #include "ntru_common.h"
    -00033 #include "ntru_params.h"
    -00034 #include "ntru_string.h"
    -00035 
    -00036 #include <fmpz_poly.h>
    -00037 #include <fmpz.h>
    -00038 
    -00039 
    -00059 string *
    -00060 bin_poly_to_ascii(const fmpz_poly_t poly,
    -00061         const ntru_params *params);
    -00062 
    -00083 string *
    -00084 bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr,
    -00085         const uint32_t poly_c,
    -00086         const ntru_params *params);
    -00087 
    -00101 string *
    -00102 poly_to_ascii(const fmpz_poly_t poly,
    -00103         const ntru_params *params);
    -00104 
    -00118 string *
    -00119 poly_arr_to_ascii(const fmpz_poly_t **poly_array,
    -00120         const uint32_t poly_c,
    -00121         const ntru_params *params);
    -00122 
    -00136 string *
    -00137 poly_to_base64(const fmpz_poly_t poly,
    -00138         const ntru_params *params);
    -00139 
    -00154 string *
    -00155 poly_arr_to_base64(const fmpz_poly_t **poly_arr,
    -00156         const uint32_t poly_c,
    -00157         const ntru_params *params);
    -00158 
    -00159 
    -00160 #endif /* NTRU_POLY_ASCII_H_ */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -156,13 +78,94 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_poly_ascii.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_POLY_ASCII_H_
    +
    29 #define NTRU_POLY_ASCII_H_
    +
    30 
    +
    31 
    +
    32 #include "ntru_common.h"
    +
    33 #include "ntru_params.h"
    +
    34 #include "ntru_string.h"
    +
    35 
    +
    36 #include <fmpz_poly.h>
    +
    37 #include <fmpz.h>
    +
    38 
    +
    39 
    +
    59 string *
    +
    60 bin_poly_to_ascii(const fmpz_poly_t poly,
    +
    61  const ntru_params *params);
    +
    62 
    +
    83 string *
    +
    84 bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr,
    +
    85  const uint32_t poly_c,
    +
    86  const ntru_params *params);
    +
    87 
    +
    101 string *
    +
    102 poly_to_ascii(const fmpz_poly_t poly,
    +
    103  const ntru_params *params);
    +
    104 
    +
    118 string *
    +
    119 poly_arr_to_ascii(const fmpz_poly_t **poly_array,
    +
    120  const uint32_t poly_c,
    +
    121  const ntru_params *params);
    +
    122 
    +
    136 string *
    +
    137 poly_to_base64(const fmpz_poly_t poly,
    +
    138  const ntru_params *params);
    +
    139 
    +
    154 string *
    +
    155 poly_arr_to_base64(const fmpz_poly_t **poly_arr,
    +
    156  const uint32_t poly_c,
    +
    157  const ntru_params *params);
    +
    158 
    +
    159 
    +
    160 #endif /* NTRU_POLY_ASCII_H_ */
    +
    string * poly_to_base64(const fmpz_poly_t poly, const ntru_params *params)
    +
    string * poly_arr_to_ascii(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params)
    +
    string * bin_poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params)
    + +
    string * bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params)
    +
    NTRU parameters.
    +
    string * poly_arr_to_base64(const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params)
    +
    common macros/functions
    +
    header for ntru_string.c
    +
    string * poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params)
    +
    + - diff --git a/ntru__rnd_8c.html b/ntru__rnd_8c.html index 347a124..a0a82b8 100644 --- a/ntru__rnd_8c.html +++ b/ntru__rnd_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,95 +64,114 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_rnd.c File Reference
    +
    ntru_rnd.c File Reference

    random polynomials More...

    -
    #include "math.h"
    -#include "ntru_err.h"
    -#include "ntru_params.h"
    -#include "ntru_poly.h"
    -#include <fmpz_poly.h>
    -#include <fcntl.h>
    -#include <stdlib.h>
    -#include <unistd.h>
    +
    #include "math.h"
    +#include "ntru_err.h"
    +#include "ntru_params.h"
    +#include "ntru_poly.h"
    +#include <fmpz_poly.h>
    +#include <fcntl.h>
    +#include <stdlib.h>
    +#include <unistd.h>
    Include dependency graph for ntru_rnd.c:
    - +

    Go to the source code of this file.

    - - - - + + + + + +

    +

    Functions

    int get_rnd_int (void)
    int get_urnd_int (void)
    void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
    int get_rnd_int (void)
     
    int get_urnd_int (void)
     
    void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
     
    -

    Detailed Description

    +

    Detailed Description

    random polynomials

    This file allows generation of random polynomials.

    Definition in file ntru_rnd.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    int get_rnd_int int get_rnd_int ( void  )
    -
    -
    +

    Get a random integer from /dev/random.

    -
    Returns:
    random integer
    +
    Returns
    random integer

    Definition at line 42 of file ntru_rnd.c.

    - +
    - +
    int get_urnd_int int get_urnd_int ( void  )
    -
    -
    +

    Get a pseudo random integer from /dev/urandom.

    -
    Returns:
    pseudo-random integer.
    +
    Returns
    pseudo-random integer.

    Definition at line 66 of file ntru_rnd.c.

    - +
    - + @@ -196,10 +206,9 @@ Functions
    void ntru_get_rnd_tern_poly_num void ntru_get_rnd_tern_poly_num ( fmpz_poly_t  poly,
    -
    -
    +

    Get a random ternary polynomial with specified numbers of 1 coefficients and -1 coefficients.

    -
    Parameters:
    +
    Parameters
    @@ -215,27 +224,11 @@ Functions - - - - -
    - -
    - - - + - diff --git a/ntru__rnd_8c__incl.dot b/ntru__rnd_8c__incl.dot deleted file mode 100644 index 9351953..0000000 --- a/ntru__rnd_8c__incl.dot +++ /dev/null @@ -1,33 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_rnd.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="math.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="ntru_err.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__err_8h.html",tooltip="error handling"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node4 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node6 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 [label="ntru_poly.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__poly_8h.html",tooltip="header for ntru_poly.c"]; - Node6 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 -> Node7 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node7 [label="stdarg.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node6 -> Node8 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node8 [label="stdbool.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node6 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node6 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node9 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node6 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node10 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node10 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node11 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node11 [label="fcntl.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node9 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node12 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node12 [label="unistd.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__rnd_8c__incl.map b/ntru__rnd_8c__incl.map new file mode 100644 index 0000000..0ce1626 --- /dev/null +++ b/ntru__rnd_8c__incl.map @@ -0,0 +1,5 @@ + + + + + diff --git a/ntru__rnd_8c__incl.md5 b/ntru__rnd_8c__incl.md5 index 8100cdf..1dea86c 100644 --- a/ntru__rnd_8c__incl.md5 +++ b/ntru__rnd_8c__incl.md5 @@ -1 +1 @@ -b23b0fd1fd1fe2e7b4622e7dff6c8195 \ No newline at end of file +3ad977b7ca7c1e7da55a601aad629baa \ No newline at end of file diff --git a/ntru__rnd_8c__incl.png b/ntru__rnd_8c__incl.png new file mode 100644 index 0000000..e8dd745 Binary files /dev/null and b/ntru__rnd_8c__incl.png differ diff --git a/ntru__rnd_8c_source.html b/ntru__rnd_8c_source.html index 8ee5dd2..cee545c 100644 --- a/ntru__rnd_8c_source.html +++ b/ntru__rnd_8c_source.html @@ -3,44 +3,35 @@ +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.c Source File - - - - + + - + -
    - - +
    polythe resulting random polynomial [out]
    paramsthe NTRU context
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,125 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_rnd.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #include "math.h"
    -00029 #include "ntru_err.h"
    -00030 #include "ntru_params.h"
    -00031 #include "ntru_poly.h"
    -00032 
    -00033 #include <fmpz_poly.h>
    -00034 #include <fcntl.h>
    -00035 #include <stdlib.h>
    -00036 #include <unistd.h>
    -00037 
    -00038 
    -00039 /*------------------------------------------------------------------------*/
    -00040 
    -00041 int
    -00042 get_rnd_int(void)
    -00043 {
    -00044     int rnd_data = open("/dev/random", O_RDONLY);
    -00045     int rnd_int;
    -00046     size_t rnd_len = 0;
    -00047 
    -00048     while (rnd_len < sizeof(rnd_int)) {
    -00049         ssize_t result = read(rnd_data, ((char*)&rnd_int) + rnd_len,
    -00050                 sizeof(rnd_int) - rnd_len);
    -00051 
    -00052         if (result < 0)
    -00053             NTRU_ABORT("Unable to read /dev/random!\n");
    -00054 
    -00055         rnd_len += result;
    -00056     }
    -00057 
    -00058     close(rnd_data);
    -00059 
    -00060     return rnd_int;
    -00061 }
    -00062 
    -00063 /*------------------------------------------------------------------------*/
    -00064 
    -00065 int
    -00066 get_urnd_int(void)
    -00067 {
    -00068     int rnd_data = open("/dev/urandom", O_RDONLY);
    -00069     int rnd_int;
    -00070     ssize_t result;
    -00071 
    -00072     result = read(rnd_data, ((char*)&rnd_int),
    -00073             sizeof(rnd_int));
    -00074 
    -00075     if (result < 0)
    -00076         NTRU_ABORT("Unable to read /dev/urandom!\n");
    -00077 
    -00078     close(rnd_data);
    -00079 
    -00080     return rnd_int;
    -00081 }
    -00082 
    -00083 /*------------------------------------------------------------------------*/
    -00084 
    -00085 void
    -00086 ntru_get_rnd_tern_poly_num(fmpz_poly_t poly,
    -00087         const ntru_params *params,
    -00088         uint32_t num_ones,
    -00089         uint32_t num_neg_ones,
    -00090         int (*rnd_int)(void))
    -00091 {
    -00092     if (!poly || ! params)
    -00093         NTRU_ABORT_DEBUG("unexpected NULL parameters");
    -00094 
    -00095     fmpz_poly_zero(poly);
    -00096 
    -00097     while (num_ones != 0 || num_neg_ones != 0) {
    -00098         int32_t pos = rnd_int() % params->N;
    -00099 
    -00100         if (!fmpz_cmp_si_n(fmpz_poly_get_coeff_ptr(poly, pos), 0)) {
    -00101             if (num_ones > 0) {
    -00102                 fmpz_poly_set_coeff_si(poly, pos, 1);
    -00103                 num_ones--;
    -00104             } else if (num_neg_ones > 0) {
    -00105                 fmpz_poly_set_coeff_si(poly, pos, -1);
    -00106                 num_neg_ones--;
    -00107             }
    -00108         }
    -00109     }
    -00110 }
    -00111 
    -00112 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -200,13 +78,139 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_rnd.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #include "math.h"
    +
    29 #include "ntru_err.h"
    +
    30 #include "ntru_params.h"
    +
    31 #include "ntru_poly.h"
    +
    32 
    +
    33 #include <fmpz_poly.h>
    +
    34 #include <fcntl.h>
    +
    35 #include <stdlib.h>
    +
    36 #include <unistd.h>
    +
    37 
    +
    38 
    +
    39 /*------------------------------------------------------------------------*/
    +
    40 
    +
    41 int
    + +
    43 {
    +
    44  int rnd_data = open("/dev/random", O_RDONLY);
    +
    45  int rnd_int;
    +
    46  size_t rnd_len = 0;
    +
    47 
    +
    48  while (rnd_len < sizeof(rnd_int)) {
    +
    49  ssize_t result = read(rnd_data, ((char*)&rnd_int) + rnd_len,
    +
    50  sizeof(rnd_int) - rnd_len);
    +
    51 
    +
    52  if (result < 0)
    +
    53  NTRU_ABORT("Unable to read /dev/random!\n");
    +
    54 
    +
    55  rnd_len += result;
    +
    56  }
    +
    57 
    +
    58  close(rnd_data);
    +
    59 
    +
    60  return rnd_int;
    +
    61 }
    +
    62 
    +
    63 /*------------------------------------------------------------------------*/
    +
    64 
    +
    65 int
    + +
    67 {
    +
    68  int rnd_data = open("/dev/urandom", O_RDONLY);
    +
    69  int rnd_int;
    +
    70  ssize_t result;
    +
    71 
    +
    72  result = read(rnd_data, ((char*)&rnd_int),
    +
    73  sizeof(rnd_int));
    +
    74 
    +
    75  if (result < 0)
    +
    76  NTRU_ABORT("Unable to read /dev/urandom!\n");
    +
    77 
    +
    78  close(rnd_data);
    +
    79 
    +
    80  return rnd_int;
    +
    81 }
    +
    82 
    +
    83 /*------------------------------------------------------------------------*/
    +
    84 
    +
    85 void
    +
    86 ntru_get_rnd_tern_poly_num(fmpz_poly_t poly,
    +
    87  const ntru_params *params,
    +
    88  uint32_t num_ones,
    +
    89  uint32_t num_neg_ones,
    +
    90  int (*rnd_int)(void))
    +
    91 {
    +
    92  if (!poly || ! params)
    +
    93  NTRU_ABORT_DEBUG("unexpected NULL parameters");
    +
    94 
    +
    95  fmpz_poly_zero(poly);
    +
    96 
    +
    97  while (num_ones != 0 || num_neg_ones != 0) {
    +
    98  int32_t pos = rnd_int() % params->N;
    +
    99 
    +
    100  if (!fmpz_cmp_si_n(fmpz_poly_get_coeff_ptr(poly, pos), 0)) {
    +
    101  if (num_ones > 0) {
    +
    102  fmpz_poly_set_coeff_si(poly, pos, 1);
    +
    103  num_ones--;
    +
    104  } else if (num_neg_ones > 0) {
    +
    105  fmpz_poly_set_coeff_si(poly, pos, -1);
    +
    106  num_neg_ones--;
    +
    107  }
    +
    108  }
    +
    109  }
    +
    110 }
    +
    111 
    +
    112 /*------------------------------------------------------------------------*/
    +
    uint32_t N
    Definition: ntru_params.h:48
    +
    int get_urnd_int(void)
    Definition: ntru_rnd.c:66
    +
    #define NTRU_ABORT_DEBUG(...)
    Definition: ntru_err.h:39
    +
    int get_rnd_int(void)
    Definition: ntru_rnd.c:42
    + +
    NTRU parameters.
    +
    void ntru_get_rnd_tern_poly_num(fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
    Definition: ntru_rnd.c:86
    +
    error handling
    +
    int fmpz_cmp_si_n(const fmpz_t f, slong g)
    Definition: ntru_poly.c:93
    +
    header for ntru_poly.c
    +
    #define NTRU_ABORT(...)
    Definition: ntru_err.h:33
    +
    + - diff --git a/ntru__rnd_8h.html b/ntru__rnd_8h.html index a148020..ed7c92e 100644 --- a/ntru__rnd_8h.html +++ b/ntru__rnd_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,90 +64,109 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_rnd.h File Reference
    +
    ntru_rnd.h File Reference
    -

    header for ntru_rnd.c +

    header for ntru_rnd.c More...

    -
    #include "ntru_params.h"
    -#include <stdlib.h>
    -#include <fmpz_poly.h>
    +
    #include "ntru_params.h"
    +#include <stdlib.h>
    +#include <fmpz_poly.h>
    Include dependency graph for ntru_rnd.h:
    - +

    Go to the source code of this file.

    - - - - + + + + + +

    +

    Functions

    int get_rnd_int (void)
    int get_urnd_int (void)
    void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
    int get_rnd_int (void)
     
    int get_urnd_int (void)
     
    void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
     
    -

    Detailed Description

    -

    header for ntru_rnd.c

    -

    Header for the internal API of ntru_rnd.c.

    +

    Detailed Description

    +

    header for ntru_rnd.c

    +

    Header for the internal API of ntru_rnd.c.

    Definition in file ntru_rnd.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    int get_rnd_int int get_rnd_int ( void  )
    -
    -
    +

    Get a random integer from /dev/random.

    -
    Returns:
    random integer
    +
    Returns
    random integer

    Definition at line 42 of file ntru_rnd.c.

    - +
    - +
    int get_urnd_int int get_urnd_int ( void  )
    -
    -
    +

    Get a pseudo random integer from /dev/urandom.

    -
    Returns:
    pseudo-random integer.
    +
    Returns
    pseudo-random integer.

    Definition at line 66 of file ntru_rnd.c.

    - +
    - + @@ -191,10 +201,9 @@ Functions
    void ntru_get_rnd_tern_poly_num void ntru_get_rnd_tern_poly_num ( fmpz_poly_t  poly,
    -
    -
    +

    Get a random ternary polynomial with specified numbers of 1 coefficients and -1 coefficients.

    -
    Parameters:
    +
    Parameters
    @@ -210,27 +219,11 @@ Functions - - - - -
    - -
    - - - + - diff --git a/ntru__rnd_8h__incl.dot b/ntru__rnd_8h__incl.dot deleted file mode 100644 index 35004fa..0000000 --- a/ntru__rnd_8h__incl.dot +++ /dev/null @@ -1,14 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_rnd.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_params.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__params_8h.html",tooltip="NTRU parameters."]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__rnd_8h__incl.map b/ntru__rnd_8h__incl.map new file mode 100644 index 0000000..f140a7e --- /dev/null +++ b/ntru__rnd_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/ntru__rnd_8h__incl.md5 b/ntru__rnd_8h__incl.md5 index 573417e..a8bb33f 100644 --- a/ntru__rnd_8h__incl.md5 +++ b/ntru__rnd_8h__incl.md5 @@ -1 +1 @@ -0568aa53021b7e286e0fea45a123f5ca \ No newline at end of file +42152b091f3c78295f2ca4f7f556c63a \ No newline at end of file diff --git a/ntru__rnd_8h__incl.png b/ntru__rnd_8h__incl.png new file mode 100644 index 0000000..c28addd Binary files /dev/null and b/ntru__rnd_8h__incl.png differ diff --git a/ntru__rnd_8h_source.html b/ntru__rnd_8h_source.html index 0325d0c..83851b7 100644 --- a/ntru__rnd_8h_source.html +++ b/ntru__rnd_8h_source.html @@ -3,44 +3,35 @@ +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.h Source File - - - - + + - + -
    - - +
    polythe resulting random polynomial [out]
    paramsthe NTRU context
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,65 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_rnd.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_RND_H
    -00029 #define NTRU_RND_H
    -00030 
    -00031 #include "ntru_params.h"
    -00032 
    -00033 #include <stdlib.h>
    -00034 
    -00035 #include <fmpz_poly.h>
    -00036 
    -00037 
    -00043 int
    -00044 get_rnd_int(void);
    -00045 
    -00051 int
    -00052 get_urnd_int(void);
    -00053 
    -00065 void
    -00066 ntru_get_rnd_tern_poly_num(fmpz_poly_t poly,
    -00067         const ntru_params *params,
    -00068         uint32_t num_ones,
    -00069         uint32_t num_neg_ones,
    -00070         int (*rnd_int)(void));
    -00071 
    -00072 
    -00073 #endif /* NTRU_RND_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -140,13 +78,73 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_rnd.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_RND_H
    +
    29 #define NTRU_RND_H
    +
    30 
    +
    31 #include "ntru_params.h"
    +
    32 
    +
    33 #include <stdlib.h>
    +
    34 
    +
    35 #include <fmpz_poly.h>
    +
    36 
    +
    37 
    +
    43 int
    +
    44 get_rnd_int(void);
    +
    45 
    +
    51 int
    +
    52 get_urnd_int(void);
    +
    53 
    +
    65 void
    +
    66 ntru_get_rnd_tern_poly_num(fmpz_poly_t poly,
    +
    67  const ntru_params *params,
    +
    68  uint32_t num_ones,
    +
    69  uint32_t num_neg_ones,
    +
    70  int (*rnd_int)(void));
    +
    71 
    +
    72 
    +
    73 #endif /* NTRU_RND_H */
    +
    int get_urnd_int(void)
    Definition: ntru_rnd.c:66
    + +
    NTRU parameters.
    +
    void ntru_get_rnd_tern_poly_num(fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
    Definition: ntru_rnd.c:86
    +
    int get_rnd_int(void)
    Definition: ntru_rnd.c:42
    +
    + - diff --git a/ntru__string_8c.html b/ntru__string_8c.html index 605c279..fa3abd9 100644 --- a/ntru__string_8c.html +++ b/ntru__string_8c.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.c File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,56 +64,75 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_string.c File Reference
    +
    ntru_string.c File Reference

    string type and operations More...

    -
    #include "ntru_string.h"
    -#include <stdio.h>
    +
    #include "ntru_string.h"
    +#include <stdio.h>
    Include dependency graph for ntru_string.c:
    - +

    Go to the source code of this file.

    - - - + + + +

    +

    Functions

    void prints (const string *print_string)
    void string_delete (string *del_string)
    void prints (const string *print_string)
     
    void string_delete (string *del_string)
     
    -

    Detailed Description

    +

    Detailed Description

    string type and operations

    Sets up a string type that does not suck like C strings and provides operations on it.

    Definition in file ntru_string.c.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    void prints void prints ( const string print_string)
    -
    -
    +

    Prints the given string to stdout.

    -
    Parameters:
    +
    Parameters
    print_stringthe print to string
    @@ -133,22 +143,21 @@ Functions
    - +
    - +
    void string_delete void string_delete ( string del_string)
    -
    -
    +

    Delete the inner structure of the string and frees the string itself from the heap. Must not be called on stack variables.

    -
    Parameters:
    +
    Parameters
    del_stringthe string to delete
    @@ -160,27 +169,11 @@ Functions
    - - - - -
    - -
    - - - + - diff --git a/ntru__string_8c__incl.dot b/ntru__string_8c__incl.dot deleted file mode 100644 index 0578fee..0000000 --- a/ntru__string_8c__incl.dot +++ /dev/null @@ -1,12 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_string.c",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru__string_8h.html",tooltip="header for ntru_string.c"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="stdio.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__string_8c__incl.map b/ntru__string_8c__incl.map new file mode 100644 index 0000000..02ef7fa --- /dev/null +++ b/ntru__string_8c__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/ntru__string_8c__incl.md5 b/ntru__string_8c__incl.md5 index 925a0d6..0f1cf58 100644 --- a/ntru__string_8c__incl.md5 +++ b/ntru__string_8c__incl.md5 @@ -1 +1 @@ -195e19e6637c9f6750988b397c0d4aef \ No newline at end of file +d1d454c868f196cbf04d1c0fffb79e19 \ No newline at end of file diff --git a/ntru__string_8c__incl.png b/ntru__string_8c__incl.png new file mode 100644 index 0000000..f179094 Binary files /dev/null and b/ntru__string_8c__incl.png differ diff --git a/ntru__string_8c_source.html b/ntru__string_8c_source.html index ebcdc5a..db6fefa 100644 --- a/ntru__string_8c_source.html +++ b/ntru__string_8c_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.c Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,65 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_string.c
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00029 #include "ntru_string.h"
    -00030 
    -00031 #include <stdio.h>
    -00032 
    -00033 
    -00034 /*------------------------------------------------------------------------*/
    -00035 
    -00036 void
    -00037 prints(const string *print_string)
    -00038 {
    -00039     for (size_t i = 0; i < print_string->len; i++)
    -00040         printf("%c", print_string->ptr[i]);
    -00041 }
    -00042 
    -00043 
    -00044 /*------------------------------------------------------------------------*/
    -00045 
    -00046 void
    -00047 string_delete(string *del_string)
    -00048 {
    -00049     free(del_string->ptr);
    -00050     free(del_string);
    -00051 }
    -00052 
    -00053 /*------------------------------------------------------------------------*/
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -140,13 +78,73 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_string.c
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    29 #include "ntru_string.h"
    +
    30 
    +
    31 #include <stdio.h>
    +
    32 
    +
    33 
    +
    34 /*------------------------------------------------------------------------*/
    +
    35 
    +
    36 void
    +
    37 prints(const string *print_string)
    +
    38 {
    +
    39  for (size_t i = 0; i < print_string->len; i++)
    +
    40  printf("%c", print_string->ptr[i]);
    +
    41 }
    +
    42 
    +
    43 
    +
    44 /*------------------------------------------------------------------------*/
    +
    45 
    +
    46 void
    +
    47 string_delete(string *del_string)
    +
    48 {
    +
    49  free(del_string->ptr);
    +
    50  free(del_string);
    +
    51 }
    +
    52 
    +
    53 /*------------------------------------------------------------------------*/
    +
    void string_delete(string *del_string)
    Definition: ntru_string.c:47
    +
    size_t len
    Definition: ntru_string.h:53
    +
    void prints(const string *print_string)
    Definition: ntru_string.c:37
    +
    header for ntru_string.c
    +
    char * ptr
    Definition: ntru_string.h:49
    +
    + - diff --git a/ntru__string_8h.html b/ntru__string_8h.html index f17fd68..077eae5 100644 --- a/ntru__string_8h.html +++ b/ntru__string_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,20 +64,38 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/src/ntru_string.h File Reference
    +
    ntru_string.h File Reference
    -

    header for ntru_string.c +

    header for ntru_string.c More...

    -
    #include <stdlib.h>
    +
    #include <stdlib.h>
    Include dependency graph for ntru_string.h:
    @@ -97,24 +106,30 @@ Include dependency graph for ntru_string.h:

    Go to the source code of this file.

    - - - + +

    +

    Data Structures

    struct  string

    +

    struct  string
     
    + - - + +

    Typedefs

    typedef struct string string

    +

    typedef struct string string
     
    + - - + + + +

    Functions

    void prints (const string *print_string)
    void string_delete (string *del_string)
    void prints (const string *print_string)
     
    void string_delete (string *del_string)
     
    -

    Detailed Description

    -

    header for ntru_string.c

    -

    Header for the external API of ntru_string.c.

    +

    Detailed Description

    +

    header for ntru_string.c

    +

    Header for the external API of ntru_string.c.

    Definition in file ntru_string.h.

    -

    Typedef Documentation

    - +

    Typedef Documentation

    +
    @@ -122,30 +137,28 @@ Functions
    typedef struct string string
    -
    -
    +

    Definition at line 35 of file ntru_string.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    void prints void prints ( const string print_string)
    -
    -
    +

    Prints the given string to stdout.

    -
    Parameters:
    +
    Parameters
    print_stringthe print to string
    @@ -156,22 +169,21 @@ Functions
    - +
    - +
    void string_delete void string_delete ( string del_string)
    -
    -
    +

    Delete the inner structure of the string and frees the string itself from the heap. Must not be called on stack variables.

    -
    Parameters:
    +
    Parameters
    del_stringthe string to delete
    @@ -183,27 +195,11 @@ Functions
    - - - - -
    - -
    - - - + - diff --git a/ntru__string_8h__incl.dot b/ntru__string_8h__incl.dot deleted file mode 100644 index f035e87..0000000 --- a/ntru__string_8h__incl.dot +++ /dev/null @@ -1,8 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/src/ntru_string.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="stdlib.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; -} diff --git a/ntru__string_8h__incl.map b/ntru__string_8h__incl.map new file mode 100644 index 0000000..c2f567a --- /dev/null +++ b/ntru__string_8h__incl.map @@ -0,0 +1,2 @@ + + diff --git a/ntru__string_8h__incl.md5 b/ntru__string_8h__incl.md5 index c80cc79..a735341 100644 --- a/ntru__string_8h__incl.md5 +++ b/ntru__string_8h__incl.md5 @@ -1 +1 @@ -326cca46266a4209d85a11f1f4fcaea3 \ No newline at end of file +ea5922f2b2050a1d27ead16c0d1a817b \ No newline at end of file diff --git a/ntru__string_8h__incl.png b/ntru__string_8h__incl.png new file mode 100644 index 0000000..651e47b Binary files /dev/null and b/ntru__string_8h__incl.png differ diff --git a/ntru__string_8h_source.html b/ntru__string_8h_source.html index e68a19c..6d287ad 100644 --- a/ntru__string_8h_source.html +++ b/ntru__string_8h_source.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.h Source File - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,64 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/src/ntru_string.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00028 #ifndef NTRU_STRING_H
    -00029 #define NTRU_STRING_H
    -00030 
    -00031 
    -00032 #include <stdlib.h>
    -00033 
    -00034 
    -00035 typedef struct string string;
    -00036 
    -00037 
    -00041 struct string {
    -00049     char *ptr;
    -00053     size_t len;
    -00054 };
    -00055 
    -00056 
    -00062 void
    -00063 prints(const string *print_string);
    -00064 
    -00073 void
    -00074 string_delete(string *del_string);
    -00075 
    -00076 
    -00077 #endif /* NTRU_STRING_H */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -139,13 +78,72 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    ntru_string.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    28 #ifndef NTRU_STRING_H
    +
    29 #define NTRU_STRING_H
    +
    30 
    +
    31 
    +
    32 #include <stdlib.h>
    +
    33 
    +
    34 
    +
    35 typedef struct string string;
    +
    36 
    +
    37 
    +
    41 struct string {
    +
    49  char *ptr;
    +
    53  size_t len;
    +
    54 };
    +
    55 
    +
    56 
    +
    62 void
    +
    63 prints(const string *print_string);
    +
    64 
    +
    73 void
    +
    74 string_delete(string *del_string);
    +
    75 
    +
    76 
    +
    77 #endif /* NTRU_STRING_H */
    +
    size_t len
    Definition: ntru_string.h:53
    +
    void string_delete(string *del_string)
    Definition: ntru_string.c:47
    +
    void prints(const string *print_string)
    Definition: ntru_string.c:37
    + +
    char * ptr
    Definition: ntru_string.h:49
    +
    + - diff --git a/open.png b/open.png index 7b35d2c..30f75c7 100644 Binary files a/open.png and b/open.png differ diff --git a/rnd_8h.html b/rnd_8h.html index df473ea..f3b0946 100644 --- a/rnd_8h.html +++ b/rnd_8h.html @@ -3,44 +3,35 @@ + post quantum cryptography: /home/travis/build/hasufell/pqc/include/rnd.h File Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,91 +64,110 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • + + + + +
    +
    + + +
    -
    /home/travis/build/hasufell/pqc/include/rnd.h File Reference
    +
    rnd.h File Reference

    public API, random polynomials More...

    -
    #include "ntru.h"
    -#include <fmpz_poly.h>
    -#include <fmpz.h>
    -#include <stdint.h>
    +
    #include "ntru.h"
    +#include <fmpz_poly.h>
    +#include <fmpz.h>
    +#include <stdint.h>
    Include dependency graph for rnd.h:
    - +

    Go to the source code of this file.

    - - - - + + + + + +

    +

    Functions

    int get_rnd_int (void)
    int get_urnd_int (void)
    void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
    int get_rnd_int (void)
     
    int get_urnd_int (void)
     
    void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
     
    -

    Detailed Description

    +

    Detailed Description

    public API, random polynomials

    This file holds the public API of generating random ternary polynomials of the pqc NTRU implementation and is meant to be installed on the client system.

    Definition in file rnd.h.

    -

    Function Documentation

    - +

    Function Documentation

    +
    - +
    int get_rnd_int int get_rnd_int ( void  )
    -
    -
    +

    Get a random integer from /dev/random.

    -
    Returns:
    random integer
    +
    Returns
    random integer

    Definition at line 42 of file ntru_rnd.c.

    - +
    - +
    int get_urnd_int int get_urnd_int ( void  )
    -
    -
    +

    Get a pseudo random integer from /dev/urandom.

    -
    Returns:
    pseudo-random integer.
    +
    Returns
    pseudo-random integer.

    Definition at line 66 of file ntru_rnd.c.

    - +
    - + @@ -192,10 +202,9 @@ Functions
    void ntru_get_rnd_tern_poly_num void ntru_get_rnd_tern_poly_num ( fmpz_poly_t  poly,
    -
    -
    +

    Get a random ternary polynomial with specified numbers of 1 coefficients and -1 coefficients.

    -
    Parameters:
    +
    Parameters
    @@ -211,27 +220,11 @@ Functions - - - - -
    - -
    - - - + - diff --git a/rnd_8h__incl.dot b/rnd_8h__incl.dot deleted file mode 100644 index 4a9694a..0000000 --- a/rnd_8h__incl.dot +++ /dev/null @@ -1,17 +0,0 @@ -digraph G -{ - edge [fontname="Helvetica",fontsize="10",labelfontname="Helvetica",labelfontsize="10"]; - node [fontname="Helvetica",fontsize="10",shape=record]; - Node1 [label="/home/travis/build/hasufell/pqc/include/rnd.h",height=0.2,width=0.4,color="black", fillcolor="grey75", style="filled" fontcolor="black"]; - Node1 -> Node2 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node2 [label="ntru.h",height=0.2,width=0.4,color="black", fillcolor="white", style="filled",URL="$ntru_8h.html",tooltip="public API, basic data types"]; - Node2 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node3 [label="fmpz_poly.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node4 [label="fmpz.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node2 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node5 [label="stdint.h",height=0.2,width=0.4,color="grey75", fillcolor="white", style="filled"]; - Node1 -> Node3 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node4 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; - Node1 -> Node5 [color="midnightblue",fontsize="10",style="solid",fontname="Helvetica"]; -} diff --git a/rnd_8h__incl.map b/rnd_8h__incl.map new file mode 100644 index 0000000..779c7ae --- /dev/null +++ b/rnd_8h__incl.map @@ -0,0 +1,3 @@ + + + diff --git a/rnd_8h__incl.md5 b/rnd_8h__incl.md5 index a55fa18..10ce7ba 100644 --- a/rnd_8h__incl.md5 +++ b/rnd_8h__incl.md5 @@ -1 +1 @@ -ecaa4ab2c69680f814503c866b1409b4 \ No newline at end of file +a2cb2322f4b55bf813f88333ff6b7900 \ No newline at end of file diff --git a/rnd_8h__incl.png b/rnd_8h__incl.png new file mode 100644 index 0000000..c65b787 Binary files /dev/null and b/rnd_8h__incl.png differ diff --git a/rnd_8h_source.html b/rnd_8h_source.html index e7c27bb..bd10ec9 100644 --- a/rnd_8h_source.html +++ b/rnd_8h_source.html @@ -3,44 +3,35 @@ +post quantum cryptography: /home/travis/build/hasufell/pqc/include/rnd.h Source File - - - - + + - + -
    - - +
    polythe resulting random polynomial [out]
    paramsthe NTRU context
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -73,66 +64,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Globals
  • -
    -
    -
    -
    /home/travis/build/hasufell/pqc/include/rnd.h
    -
    -
    -Go to the documentation of this file.
    00001 /*
    -00002  * Copyright (C) 2014 FH Bielefeld
    -00003  *
    -00004  * This file is part of a FH Bielefeld project.
    -00005  *
    -00006  * This library is free software; you can redistribute it and/or
    -00007  * modify it under the terms of the GNU Lesser General Public
    -00008  * License as published by the Free Software Foundation; either
    -00009  * version 2.1 of the License, or (at your option) any later version.
    -00010  *
    -00011  * This library is distributed in the hope that it will be useful,
    -00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    -00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    -00014  * Lesser General Public License for more details.
    -00015  *
    -00016  * You should have received a copy of the GNU Lesser General Public
    -00017  * License along with this library; if not, write to the Free Software
    -00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    -00019  * MA  02110-1301  USA
    -00020  */
    -00021 
    -00031 #ifndef PUBLIC_NTRU_RND_H_
    -00032 #define PUBLIC_NTRU_RND_H_
    -00033 
    -00034 
    -00035 #include "ntru.h"
    -00036 
    -00037 #include <fmpz_poly.h>
    -00038 #include <fmpz.h>
    -00039 #include <stdint.h>
    -00040 
    -00041 
    -00047 int
    -00048 get_rnd_int(void);
    -00049 
    -00055 int
    -00056 get_urnd_int(void);
    -00057 
    -00069 void
    -00070 ntru_get_rnd_tern_poly_num(fmpz_poly_t poly,
    -00071         const ntru_params *params,
    -00072         uint32_t num_ones,
    -00073         uint32_t num_neg_ones,
    -00074         int (*rnd_int)(void));
    -00075 
    -00076 
    -00077 #endif /* PUBLIC_NTRU_RND_H_ */
    -
    + All Data Structures Files Functions Variables Typedefs Macros Pages
    @@ -141,13 +78,74 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    - - + + +
    +
    +
    rnd.h
    +
    +
    +Go to the documentation of this file.
    1 /*
    +
    2  * Copyright (C) 2014 FH Bielefeld
    +
    3  *
    +
    4  * This file is part of a FH Bielefeld project.
    +
    5  *
    +
    6  * This library is free software; you can redistribute it and/or
    +
    7  * modify it under the terms of the GNU Lesser General Public
    +
    8  * License as published by the Free Software Foundation; either
    +
    9  * version 2.1 of the License, or (at your option) any later version.
    +
    10  *
    +
    11  * This library is distributed in the hope that it will be useful,
    +
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    14  * Lesser General Public License for more details.
    +
    15  *
    +
    16  * You should have received a copy of the GNU Lesser General Public
    +
    17  * License along with this library; if not, write to the Free Software
    +
    18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
    +
    19  * MA 02110-1301 USA
    +
    20  */
    +
    21 
    +
    31 #ifndef PUBLIC_NTRU_RND_H_
    +
    32 #define PUBLIC_NTRU_RND_H_
    +
    33 
    +
    34 
    +
    35 #include "ntru.h"
    +
    36 
    +
    37 #include <fmpz_poly.h>
    +
    38 #include <fmpz.h>
    +
    39 #include <stdint.h>
    +
    40 
    +
    41 
    +
    47 int
    +
    48 get_rnd_int(void);
    +
    49 
    +
    55 int
    +
    56 get_urnd_int(void);
    +
    57 
    +
    69 void
    +
    70 ntru_get_rnd_tern_poly_num(fmpz_poly_t poly,
    +
    71  const ntru_params *params,
    +
    72  uint32_t num_ones,
    +
    73  uint32_t num_neg_ones,
    +
    74  int (*rnd_int)(void));
    +
    75 
    +
    76 
    +
    77 #endif /* PUBLIC_NTRU_RND_H_ */
    +
    public API, basic data types
    + +
    int get_urnd_int(void)
    Definition: ntru_rnd.c:66
    +
    int get_rnd_int(void)
    Definition: ntru_rnd.c:42
    +
    void ntru_get_rnd_tern_poly_num(fmpz_poly_t poly, const ntru_params *params, uint32_t num_ones, uint32_t num_neg_ones, int(*rnd_int)(void))
    Definition: ntru_rnd.c:86
    +
    + - diff --git a/search/all_61.html b/search/all_0.html similarity index 89% rename from search/all_61.html rename to search/all_0.html index a3164d5..86e6c08 100644 --- a/search/all_61.html +++ b/search/all_0.html @@ -1,8 +1,9 @@ + - + diff --git a/search/all_61.js b/search/all_0.js similarity index 100% rename from search/all_61.js rename to search/all_0.js diff --git a/search/all_62.html b/search/all_1.html similarity index 89% rename from search/all_62.html rename to search/all_1.html index ee8871c..122fcbb 100644 --- a/search/all_62.html +++ b/search/all_1.html @@ -1,8 +1,9 @@ + - + diff --git a/search/all_62.js b/search/all_1.js similarity index 100% rename from search/all_62.js rename to search/all_1.js diff --git a/search/all_63.html b/search/all_2.html similarity index 89% rename from search/all_63.html rename to search/all_2.html index 56b5ad1..6850d19 100644 --- a/search/all_63.html +++ b/search/all_2.html @@ -1,8 +1,9 @@ + - + diff --git a/search/all_63.js b/search/all_2.js similarity index 100% rename from search/all_63.js rename to search/all_2.js diff --git a/search/all_64.html b/search/all_3.html similarity index 89% rename from search/all_64.html rename to search/all_3.html index b53ff08..914288c 100644 --- a/search/all_64.html +++ b/search/all_3.html @@ -1,8 +1,9 @@ + - + diff --git a/search/all_64.js b/search/all_3.js similarity index 100% rename from search/all_64.js rename to search/all_3.js diff --git a/search/all_4.html b/search/all_4.html new file mode 100644 index 0000000..47becb8 --- /dev/null +++ b/search/all_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_65.js b/search/all_4.js similarity index 100% rename from search/all_65.js rename to search/all_4.js diff --git a/search/all_5.html b/search/all_5.html new file mode 100644 index 0000000..b11c1d1 --- /dev/null +++ b/search/all_5.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_66.js b/search/all_5.js similarity index 100% rename from search/all_66.js rename to search/all_5.js diff --git a/search/all_6.html b/search/all_6.html new file mode 100644 index 0000000..a57d74f --- /dev/null +++ b/search/all_6.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_67.js b/search/all_6.js similarity index 100% rename from search/all_67.js rename to search/all_6.js diff --git a/search/all_65.html b/search/all_65.html deleted file mode 100644 index 66cc834..0000000 --- a/search/all_65.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_66.html b/search/all_66.html deleted file mode 100644 index 3d1f8b3..0000000 --- a/search/all_66.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_67.html b/search/all_67.html deleted file mode 100644 index 41a459a..0000000 --- a/search/all_67.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_69.html b/search/all_69.html deleted file mode 100644 index 1a00b55..0000000 --- a/search/all_69.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_6b.html b/search/all_6b.html deleted file mode 100644 index 571dadb..0000000 --- a/search/all_6b.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_6c.html b/search/all_6c.html deleted file mode 100644 index f6383cc..0000000 --- a/search/all_6c.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_6e.html b/search/all_6e.html deleted file mode 100644 index 1f92ee5..0000000 --- a/search/all_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_7.html b/search/all_7.html new file mode 100644 index 0000000..ecca251 --- /dev/null +++ b/search/all_7.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_69.js b/search/all_7.js similarity index 91% rename from search/functions_69.js rename to search/all_7.js index b5b3bb4..2c0ea97 100644 --- a/search/functions_69.js +++ b/search/all_7.js @@ -1,5 +1,6 @@ var searchData= [ ['import_5fpriv_5fkey',['import_priv_key',['../ntru__keypair_8c.html#a1f917ea6ef5302826c888e5c88e0869e',1,'import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a1f917ea6ef5302826c888e5c88e0869e',1,'import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a1f917ea6ef5302826c888e5c88e0869e',1,'import_priv_key(char const *const filename, fmpz_poly_t priv, fmpz_poly_t priv_inv, ntru_params *params): ntru_keypair.c']]], - ['import_5fpublic_5fkey',['import_public_key',['../ntru__keypair_8c.html#a4e2c6da04c55e8c1b6c447f4cc9f1d6f',1,'import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a4e2c6da04c55e8c1b6c447f4cc9f1d6f',1,'import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a4e2c6da04c55e8c1b6c447f4cc9f1d6f',1,'import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c']]] + ['import_5fpublic_5fkey',['import_public_key',['../ntru__keypair_8c.html#a4e2c6da04c55e8c1b6c447f4cc9f1d6f',1,'import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a4e2c6da04c55e8c1b6c447f4cc9f1d6f',1,'import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a4e2c6da04c55e8c1b6c447f4cc9f1d6f',1,'import_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c']]], + ['index_20page',['Index Page',['../index.html',1,'']]] ]; diff --git a/search/all_70.html b/search/all_70.html deleted file mode 100644 index 0340151..0000000 --- a/search/all_70.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_71.html b/search/all_71.html deleted file mode 100644 index b4dc1e6..0000000 --- a/search/all_71.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_72.html b/search/all_72.html deleted file mode 100644 index 0ab18d6..0000000 --- a/search/all_72.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_73.html b/search/all_73.html deleted file mode 100644 index 1ec8f17..0000000 --- a/search/all_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_77.html b/search/all_77.html deleted file mode 100644 index 73323d3..0000000 --- a/search/all_77.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/all_8.html b/search/all_8.html new file mode 100644 index 0000000..f8f8560 --- /dev/null +++ b/search/all_8.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_6b.js b/search/all_8.js similarity index 100% rename from search/all_6b.js rename to search/all_8.js diff --git a/search/all_9.html b/search/all_9.html new file mode 100644 index 0000000..cb525ab --- /dev/null +++ b/search/all_9.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_6c.js b/search/all_9.js similarity index 100% rename from search/all_6c.js rename to search/all_9.js diff --git a/search/all_a.html b/search/all_a.html new file mode 100644 index 0000000..393a236 --- /dev/null +++ b/search/all_a.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_6e.js b/search/all_a.js similarity index 100% rename from search/all_6e.js rename to search/all_a.js diff --git a/search/all_b.html b/search/all_b.html new file mode 100644 index 0000000..6d33464 --- /dev/null +++ b/search/all_b.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_70.js b/search/all_b.js similarity index 100% rename from search/all_70.js rename to search/all_b.js diff --git a/search/all_c.html b/search/all_c.html new file mode 100644 index 0000000..cbf7d06 --- /dev/null +++ b/search/all_c.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_71.js b/search/all_c.js similarity index 100% rename from search/all_71.js rename to search/all_c.js diff --git a/search/all_d.html b/search/all_d.html new file mode 100644 index 0000000..67a6960 --- /dev/null +++ b/search/all_d.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_72.js b/search/all_d.js similarity index 100% rename from search/all_72.js rename to search/all_d.js diff --git a/search/all_e.html b/search/all_e.html new file mode 100644 index 0000000..92ab0e3 --- /dev/null +++ b/search/all_e.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_73.js b/search/all_e.js similarity index 100% rename from search/all_73.js rename to search/all_e.js diff --git a/search/all_f.html b/search/all_f.html new file mode 100644 index 0000000..6ff4c97 --- /dev/null +++ b/search/all_f.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_77.js b/search/all_f.js similarity index 100% rename from search/all_77.js rename to search/all_f.js diff --git a/search/classes_0.html b/search/classes_0.html new file mode 100644 index 0000000..d2e0c9a --- /dev/null +++ b/search/classes_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/classes_6b.js b/search/classes_0.js similarity index 100% rename from search/classes_6b.js rename to search/classes_0.js diff --git a/search/classes_1.html b/search/classes_1.html new file mode 100644 index 0000000..b04aca3 --- /dev/null +++ b/search/classes_1.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/classes_6e.js b/search/classes_1.js similarity index 100% rename from search/classes_6e.js rename to search/classes_1.js diff --git a/search/classes_2.html b/search/classes_2.html new file mode 100644 index 0000000..ef9c9ed --- /dev/null +++ b/search/classes_2.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/classes_73.js b/search/classes_2.js similarity index 100% rename from search/classes_73.js rename to search/classes_2.js diff --git a/search/classes_6b.html b/search/classes_6b.html deleted file mode 100644 index f9c2dc8..0000000 --- a/search/classes_6b.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/classes_6e.html b/search/classes_6e.html deleted file mode 100644 index 44803ba..0000000 --- a/search/classes_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/classes_73.html b/search/classes_73.html deleted file mode 100644 index a1bf0b9..0000000 --- a/search/classes_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/defines_0.html b/search/defines_0.html new file mode 100644 index 0000000..6560632 --- /dev/null +++ b/search/defines_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/defines_61.js b/search/defines_0.js similarity index 100% rename from search/defines_61.js rename to search/defines_0.js diff --git a/search/defines_1.html b/search/defines_1.html new file mode 100644 index 0000000..65d9b1f --- /dev/null +++ b/search/defines_1.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/defines_63.js b/search/defines_1.js similarity index 100% rename from search/defines_63.js rename to search/defines_1.js diff --git a/search/defines_2.html b/search/defines_2.html new file mode 100644 index 0000000..03237b1 --- /dev/null +++ b/search/defines_2.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/defines_6e.js b/search/defines_2.js similarity index 100% rename from search/defines_6e.js rename to search/defines_2.js diff --git a/search/defines_3.html b/search/defines_3.html new file mode 100644 index 0000000..9e71a8a --- /dev/null +++ b/search/defines_3.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/defines_72.js b/search/defines_3.js similarity index 100% rename from search/defines_72.js rename to search/defines_3.js diff --git a/search/defines_4.html b/search/defines_4.html new file mode 100644 index 0000000..03de299 --- /dev/null +++ b/search/defines_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/defines_73.js b/search/defines_4.js similarity index 100% rename from search/defines_73.js rename to search/defines_4.js diff --git a/search/defines_61.html b/search/defines_61.html deleted file mode 100644 index 039f0b7..0000000 --- a/search/defines_61.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/defines_63.html b/search/defines_63.html deleted file mode 100644 index 35ff8ae..0000000 --- a/search/defines_63.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/defines_6e.html b/search/defines_6e.html deleted file mode 100644 index 5b7f68f..0000000 --- a/search/defines_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/defines_72.html b/search/defines_72.html deleted file mode 100644 index e6a82c4..0000000 --- a/search/defines_72.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/defines_73.html b/search/defines_73.html deleted file mode 100644 index 913ae48..0000000 --- a/search/defines_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/files_0.html b/search/files_0.html new file mode 100644 index 0000000..867c89d --- /dev/null +++ b/search/files_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/files_64.js b/search/files_0.js similarity index 100% rename from search/files_64.js rename to search/files_0.js diff --git a/search/files_1.html b/search/files_1.html new file mode 100644 index 0000000..72c034e --- /dev/null +++ b/search/files_1.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/files_65.js b/search/files_1.js similarity index 100% rename from search/files_65.js rename to search/files_1.js diff --git a/search/files_2.html b/search/files_2.html new file mode 100644 index 0000000..60b9f7f --- /dev/null +++ b/search/files_2.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/files_6b.js b/search/files_2.js similarity index 100% rename from search/files_6b.js rename to search/files_2.js diff --git a/search/files_3.html b/search/files_3.html new file mode 100644 index 0000000..e5bee19 --- /dev/null +++ b/search/files_3.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/files_6e.js b/search/files_3.js similarity index 100% rename from search/files_6e.js rename to search/files_3.js diff --git a/search/files_4.html b/search/files_4.html new file mode 100644 index 0000000..6d9793d --- /dev/null +++ b/search/files_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/files_72.js b/search/files_4.js similarity index 100% rename from search/files_72.js rename to search/files_4.js diff --git a/search/files_64.html b/search/files_64.html deleted file mode 100644 index 1a32bf8..0000000 --- a/search/files_64.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/files_65.html b/search/files_65.html deleted file mode 100644 index 1eadd1b..0000000 --- a/search/files_65.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/files_6b.html b/search/files_6b.html deleted file mode 100644 index fd26f57..0000000 --- a/search/files_6b.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/files_6e.html b/search/files_6e.html deleted file mode 100644 index 9e30d62..0000000 --- a/search/files_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/files_72.html b/search/files_72.html deleted file mode 100644 index 609fb48..0000000 --- a/search/files_72.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_0.html b/search/functions_0.html new file mode 100644 index 0000000..a3f28dc --- /dev/null +++ b/search/functions_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_61.js b/search/functions_0.js similarity index 100% rename from search/functions_61.js rename to search/functions_0.js diff --git a/search/functions_1.html b/search/functions_1.html new file mode 100644 index 0000000..abb1f12 --- /dev/null +++ b/search/functions_1.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_62.js b/search/functions_1.js similarity index 100% rename from search/functions_62.js rename to search/functions_1.js diff --git a/search/functions_2.html b/search/functions_2.html new file mode 100644 index 0000000..6cc194a --- /dev/null +++ b/search/functions_2.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_65.js b/search/functions_2.js similarity index 100% rename from search/functions_65.js rename to search/functions_2.js diff --git a/search/functions_3.html b/search/functions_3.html new file mode 100644 index 0000000..7a96590 --- /dev/null +++ b/search/functions_3.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_66.js b/search/functions_3.js similarity index 100% rename from search/functions_66.js rename to search/functions_3.js diff --git a/search/functions_4.html b/search/functions_4.html new file mode 100644 index 0000000..7c0a295 --- /dev/null +++ b/search/functions_4.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_67.js b/search/functions_4.js similarity index 100% rename from search/functions_67.js rename to search/functions_4.js diff --git a/search/functions_5.html b/search/functions_5.html new file mode 100644 index 0000000..6a71f6c --- /dev/null +++ b/search/functions_5.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/all_69.js b/search/functions_5.js similarity index 100% rename from search/all_69.js rename to search/functions_5.js diff --git a/search/functions_6.html b/search/functions_6.html new file mode 100644 index 0000000..0c3aa1c --- /dev/null +++ b/search/functions_6.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_6e.js b/search/functions_6.js similarity index 100% rename from search/functions_6e.js rename to search/functions_6.js diff --git a/search/functions_61.html b/search/functions_61.html deleted file mode 100644 index 7f39533..0000000 --- a/search/functions_61.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_62.html b/search/functions_62.html deleted file mode 100644 index def0606..0000000 --- a/search/functions_62.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_65.html b/search/functions_65.html deleted file mode 100644 index a77deba..0000000 --- a/search/functions_65.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_66.html b/search/functions_66.html deleted file mode 100644 index 319a531..0000000 --- a/search/functions_66.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_67.html b/search/functions_67.html deleted file mode 100644 index d0ab42a..0000000 --- a/search/functions_67.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_69.html b/search/functions_69.html deleted file mode 100644 index e204197..0000000 --- a/search/functions_69.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_6e.html b/search/functions_6e.html deleted file mode 100644 index d734dd0..0000000 --- a/search/functions_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_7.html b/search/functions_7.html new file mode 100644 index 0000000..115c503 --- /dev/null +++ b/search/functions_7.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_70.js b/search/functions_7.js similarity index 100% rename from search/functions_70.js rename to search/functions_7.js diff --git a/search/functions_70.html b/search/functions_70.html deleted file mode 100644 index c62125e..0000000 --- a/search/functions_70.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_72.html b/search/functions_72.html deleted file mode 100644 index a4336f7..0000000 --- a/search/functions_72.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_73.html b/search/functions_73.html deleted file mode 100644 index 774d577..0000000 --- a/search/functions_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_77.html b/search/functions_77.html deleted file mode 100644 index 8fe9755..0000000 --- a/search/functions_77.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/functions_8.html b/search/functions_8.html new file mode 100644 index 0000000..491e522 --- /dev/null +++ b/search/functions_8.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_72.js b/search/functions_8.js similarity index 100% rename from search/functions_72.js rename to search/functions_8.js diff --git a/search/functions_9.html b/search/functions_9.html new file mode 100644 index 0000000..401869a --- /dev/null +++ b/search/functions_9.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_73.js b/search/functions_9.js similarity index 100% rename from search/functions_73.js rename to search/functions_9.js diff --git a/search/functions_a.html b/search/functions_a.html new file mode 100644 index 0000000..27e7795 --- /dev/null +++ b/search/functions_a.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/functions_77.js b/search/functions_a.js similarity index 100% rename from search/functions_77.js rename to search/functions_a.js diff --git a/search/pages_0.html b/search/pages_0.html new file mode 100644 index 0000000..8ce1299 --- /dev/null +++ b/search/pages_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/pages_0.js b/search/pages_0.js new file mode 100644 index 0000000..1c9bef4 --- /dev/null +++ b/search/pages_0.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['index_20page',['Index Page',['../index.html',1,'']]] +]; diff --git a/search/search.css b/search/search.css index d18c1da..4d7612f 100644 --- a/search/search.css +++ b/search/search.css @@ -48,7 +48,7 @@ height:19px; background:url('search_m.png') repeat-x; border:none; - width:116px; + width:111px; margin-left:20px; padding-left:4px; color: #909090; @@ -236,3 +236,36 @@ DIV.searchresults { margin-left: 10px; margin-right: 10px; } + +/*---------------- External search page results */ + +.searchresult { + background-color: #F0F3F8; +} + +.pages b { + color: white; + padding: 5px 5px 3px 5px; + background-image: url("../tab_a.png"); + background-repeat: repeat-x; + text-shadow: 0 1px 1px #000000; +} + +.pages { + line-height: 17px; + margin-left: 4px; + text-decoration: none; +} + +.hl { + font-weight: bold; +} + +#searchresults { + margin-bottom: 20px; +} + +.searchpages { + margin-top: 10px; +} + diff --git a/search/search.js b/search/search.js index f7ac364..e1d3f17 100644 --- a/search/search.js +++ b/search/search.js @@ -7,13 +7,14 @@ var indexSectionsWithContent = { - 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101011010111100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000010010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110011101000010101100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000010001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + 0: "abcdefgiklnpqrsw", + 1: "kns", + 2: "deknr", + 3: "abefginprsw", + 4: "lnpq", + 5: "kns", + 6: "acnrs", + 7: "i" }; var indexSectionNames = @@ -24,7 +25,8 @@ var indexSectionNames = 3: "functions", 4: "variables", 5: "typedefs", - 6: "defines" + 6: "defines", + 7: "pages" }; function convertToId(search) @@ -34,7 +36,7 @@ function convertToId(search) { var c = search.charAt(i); var cn = c.charCodeAt(0); - if (c.match(/[a-z0-9]/)) + if (c.match(/[a-z0-9\u0080-\uFFFF]/)) { result+=c; } @@ -339,22 +341,20 @@ function SearchBox(name, resultsPath, inFrame, label) var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); var code = searchValue.toLowerCase().charCodeAt(0); - var hexCode; - if (code<16) + var idxChar = searchValue.substr(0, 1).toLowerCase(); + if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair { - hexCode="0"+code.toString(16); - } - else - { - hexCode=code.toString(16); + idxChar = searchValue.substr(0, 2); } var resultsPage; var resultsPageWithSearch; var hasResultsPage; - if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') + var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); + if (idx!=-1) { + var hexCode=idx.toString(16); resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; resultsPageWithSearch = resultsPage+'?'+escape(searchValue); hasResultsPage = true; diff --git a/search/typedefs_0.html b/search/typedefs_0.html new file mode 100644 index 0000000..5f65d74 --- /dev/null +++ b/search/typedefs_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/typedefs_6b.js b/search/typedefs_0.js similarity index 100% rename from search/typedefs_6b.js rename to search/typedefs_0.js diff --git a/search/typedefs_1.html b/search/typedefs_1.html new file mode 100644 index 0000000..da3bb7d --- /dev/null +++ b/search/typedefs_1.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/typedefs_6e.js b/search/typedefs_1.js similarity index 100% rename from search/typedefs_6e.js rename to search/typedefs_1.js diff --git a/search/typedefs_2.html b/search/typedefs_2.html new file mode 100644 index 0000000..5e6f193 --- /dev/null +++ b/search/typedefs_2.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/typedefs_73.js b/search/typedefs_2.js similarity index 100% rename from search/typedefs_73.js rename to search/typedefs_2.js diff --git a/search/typedefs_6b.html b/search/typedefs_6b.html deleted file mode 100644 index 823fd34..0000000 --- a/search/typedefs_6b.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/typedefs_6e.html b/search/typedefs_6e.html deleted file mode 100644 index ebbf394..0000000 --- a/search/typedefs_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/typedefs_73.html b/search/typedefs_73.html deleted file mode 100644 index 3f28c4d..0000000 --- a/search/typedefs_73.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/variables_0.html b/search/variables_0.html new file mode 100644 index 0000000..16be28c --- /dev/null +++ b/search/variables_0.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/variables_6c.js b/search/variables_0.js similarity index 100% rename from search/variables_6c.js rename to search/variables_0.js diff --git a/search/variables_1.html b/search/variables_1.html new file mode 100644 index 0000000..1e306bd --- /dev/null +++ b/search/variables_1.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/variables_6e.js b/search/variables_1.js similarity index 100% rename from search/variables_6e.js rename to search/variables_1.js diff --git a/search/variables_2.html b/search/variables_2.html new file mode 100644 index 0000000..938e165 --- /dev/null +++ b/search/variables_2.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/variables_70.js b/search/variables_2.js similarity index 100% rename from search/variables_70.js rename to search/variables_2.js diff --git a/search/variables_3.html b/search/variables_3.html new file mode 100644 index 0000000..7ca5d9b --- /dev/null +++ b/search/variables_3.html @@ -0,0 +1,26 @@ + + + + + + + + + +
    +
    Loading...
    +
    + +
    Searching...
    +
    No Matches
    + +
    + + diff --git a/search/variables_71.js b/search/variables_3.js similarity index 100% rename from search/variables_71.js rename to search/variables_3.js diff --git a/search/variables_6c.html b/search/variables_6c.html deleted file mode 100644 index 6016f5c..0000000 --- a/search/variables_6c.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/variables_6e.html b/search/variables_6e.html deleted file mode 100644 index 4cc41d5..0000000 --- a/search/variables_6e.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/variables_70.html b/search/variables_70.html deleted file mode 100644 index bc5c193..0000000 --- a/search/variables_70.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/search/variables_71.html b/search/variables_71.html deleted file mode 100644 index cceeff2..0000000 --- a/search/variables_71.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - -
    -
    Loading...
    -
    - -
    Searching...
    -
    No Matches
    - -
    - - diff --git a/structkeypair.html b/structkeypair.html index 248fce9..46d5afa 100644 --- a/structkeypair.html +++ b/structkeypair.html @@ -3,44 +3,35 @@ + post quantum cryptography: keypair Struct Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -74,7 +65,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Data Fields
  • + + + + +
    +
    + +
    @@ -82,62 +87,62 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    keypair Struct Reference
    - +

    #include <ntru_keypair.h>

    - - - - + + + + + +

    +

    Data Fields

    fmpz_poly_t priv
    fmpz_poly_t priv_inv
    fmpz_poly_t pub
    fmpz_poly_t priv
     
    fmpz_poly_t priv_inv
     
    fmpz_poly_t pub
     
    -

    Detailed Description

    +

    Detailed Description

    This struct holds the keypair, both private and public components.

    Definition at line 46 of file ntru_keypair.h.

    -

    Field Documentation

    - +

    Field Documentation

    +
    - +
    fmpz_poly_t keypair::privfmpz_poly_t keypair::priv
    -
    -
    +

    First part of the private key, a random polynom.

    Definition at line 51 of file ntru_keypair.h.

    - +
    - +
    fmpz_poly_t keypair::priv_invfmpz_poly_t keypair::priv_inv
    -
    -
    +

    Second part of the private key, the priv polynom inverted.

    Definition at line 56 of file ntru_keypair.h.

    - +
    - +
    fmpz_poly_t keypair::pubfmpz_poly_t keypair::pub
    -
    -
    +

    The public key, computed as: h = p * (Fq * g) mod q

    Definition at line 61 of file ntru_keypair.h.

    @@ -149,27 +154,11 @@ Data Fields
  • /home/travis/build/hasufell/pqc/include/keypair.h
  • - - - - -
    - -
    - - - + - diff --git a/structntru__params.html b/structntru__params.html index 587583b..aa9d91d 100644 --- a/structntru__params.html +++ b/structntru__params.html @@ -3,44 +3,35 @@ + post quantum cryptography: ntru_params Struct Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -74,7 +65,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Data Fields
  • + + + + +
    +
    + +
    @@ -82,62 +87,62 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    ntru_params Struct Reference
    - +

    #include <ntru_params.h>

    - - - - + + + + + +

    +

    Data Fields

    uint32_t N
    uint32_t q
    uint32_t p
    uint32_t N
     
    uint32_t q
     
    uint32_t p
     
    -

    Detailed Description

    +

    Detailed Description

    NTRU cryptosystem is specified by the following triple.

    Definition at line 43 of file ntru_params.h.

    -

    Field Documentation

    - +

    Field Documentation

    +
    - +
    uint32_t ntru_params::Nuint32_t ntru_params::N
    -
    -
    +

    maximal degree N - 1 for all polynomials

    Definition at line 48 of file ntru_params.h.

    - +
    - +
    uint32_t ntru_params::puint32_t ntru_params::p
    -
    -
    +

    small modulus

    Definition at line 56 of file ntru_params.h.

    - +
    - +
    uint32_t ntru_params::quint32_t ntru_params::q
    -
    -
    +

    large modulus

    Definition at line 52 of file ntru_params.h.

    @@ -149,27 +154,11 @@ Data Fields
  • /home/travis/build/hasufell/pqc/include/ntru.h
  • - - - - -
    - -
    - - - + - diff --git a/structstring.html b/structstring.html index 1a49232..e5fdd36 100644 --- a/structstring.html +++ b/structstring.html @@ -3,44 +3,35 @@ + post quantum cryptography: string Struct Reference - - - - + + - + -
    - - +
    - - - - -
    post quantum cryptography -
    Highly optimized implementation of the NTRUEncrypt algorithm
    - - + + @@ -74,7 +65,21 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
  • Data Fields
  • + + + + +
    +
    + +
    @@ -82,45 +87,45 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    string Struct Reference
    - +

    #include <ntru_string.h>

    - - - + + + +

    +

    Data Fields

    char * ptr
    size_t len
    char * ptr
     
    size_t len
     
    -

    Detailed Description

    +

    Detailed Description

    Represents a string.

    Definition at line 41 of file ntru_string.h.

    -

    Field Documentation

    - +

    Field Documentation

    +
    - +
    size_t string::lensize_t string::len
    -
    -
    +

    Length of the string.

    Definition at line 53 of file ntru_string.h.

    - +
    - +
    char * string::ptrchar * string::ptr
    -
    -
    +

    Pointer to the char array, holding the actual string. THIS IS NOT NULL TERMINATED (at least not necessarily, don't ever assume it).

    Definition at line 49 of file ntru_string.h.

    @@ -132,27 +137,11 @@ Data Fields
  • /home/travis/build/hasufell/pqc/include/ntru.h
  • - - - - -
    - -
    - - - + - diff --git a/sync_off.png b/sync_off.png new file mode 100644 index 0000000..3b443fc Binary files /dev/null and b/sync_off.png differ diff --git a/sync_on.png b/sync_on.png new file mode 100644 index 0000000..e08320f Binary files /dev/null and b/sync_on.png differ diff --git a/tab_a.png b/tab_a.png index 2d99ef2..3b725c4 100644 Binary files a/tab_a.png and b/tab_a.png differ diff --git a/tab_b.png b/tab_b.png index b2c3d2b..e2b4a86 100644 Binary files a/tab_b.png and b/tab_b.png differ diff --git a/tab_h.png b/tab_h.png index c11f48f..fd5cb70 100644 Binary files a/tab_h.png and b/tab_h.png differ diff --git a/tab_s.png b/tab_s.png index 978943a..ab478c9 100644 Binary files a/tab_s.png and b/tab_s.png differ diff --git a/tabs.css b/tabs.css index 2192056..9cf578f 100644 --- a/tabs.css +++ b/tabs.css @@ -3,6 +3,7 @@ width: 100%; z-index: 101; font-size: 13px; + font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; } .tabs2 {