diff --git a/.nojekyll b/.nojekyll deleted file mode 100644 index e69de29..0000000 diff --git a/annotated.html b/annotated.html new file mode 100644 index 0000000..ce9ddbe --- /dev/null +++ b/annotated.html @@ -0,0 +1,112 @@ + + + + + +post quantum cryptography: Data Structures + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
Data Structures
+
+
+
Here are the data structures with brief descriptions:
+ + + +
keypair
ntru_params
string
+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/bc_s.png b/bc_s.png new file mode 100644 index 0000000..e401862 Binary files /dev/null and b/bc_s.png differ diff --git a/classes.html b/classes.html new file mode 100644 index 0000000..9f907f9 --- /dev/null +++ b/classes.html @@ -0,0 +1,118 @@ + + + + + +post quantum cryptography: Data Structure Index + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
Data Structure Index
+
+
+
K | N | S
+ + + + + +
  K  
+
  N  
+
  S  
+
keypair   ntru_params   string   
+
K | N | S
+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/closed.png b/closed.png new file mode 100644 index 0000000..b7d4bd9 Binary files /dev/null and b/closed.png differ diff --git a/decrypt_8h.html b/decrypt_8h.html new file mode 100644 index 0000000..7e4f515 --- /dev/null +++ b/decrypt_8h.html @@ -0,0 +1,197 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/decrypt.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+Functions
+
+
/home/travis/build/hasufell/pqc/include/decrypt.h File Reference
+
+
+ +

public API, decryption +More...

+
#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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string* ntru_decrypt_string (const stringencr_msg,
const fmpz_poly_t priv_key,
const fmpz_poly_t priv_key_inv,
const ntru_paramsparams 
)
+
+
+

Decryption of a given encrypted string.

+
Parameters:
+ + + + + +
encr_msgthe encrypted message in the form of a string
priv_keythe polynom containing the private key to decrypt the message
priv_key_invthe inverse polynome to the private key
paramsthe ntru_params
+
+
+
Returns:
the decrypted string or NULL on failure
+

Decryption of a given encrypted string.

+
Parameters:
+ + + + + +
encr_msgthe encrypted message in the form of a string
priv_keythe polynom containing the private key to decrypt the message
priv_key_invthe inverse polynome to the private key
paramsthe ntru_params
+
+
+
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 new file mode 100644 index 0000000..477a69a --- /dev/null +++ b/decrypt_8h__incl.dot @@ -0,0 +1,16 @@ +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.md5 b/decrypt_8h__incl.md5 new file mode 100644 index 0000000..44e10bd --- /dev/null +++ b/decrypt_8h__incl.md5 @@ -0,0 +1 @@ +ec7cb992a1c085002004ee39f7a320d8 \ No newline at end of file diff --git a/decrypt_8h_source.html b/decrypt_8h_source.html new file mode 100644 index 0000000..bcc4e34 --- /dev/null +++ b/decrypt_8h_source.html @@ -0,0 +1,146 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/decrypt.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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
+ + +
+ +
+ + + + + + + diff --git a/doxygen.css b/doxygen.css new file mode 100644 index 0000000..cee0d06 --- /dev/null +++ b/doxygen.css @@ -0,0 +1,949 @@ +/* The standard CSS for doxygen */ + +body, table, div, p, dl { + font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif; + font-size: 13px; + line-height: 1.3; +} + +/* @group Heading Levels */ + +h1 { + font-size: 150%; +} + +.title { + font-size: 150%; + font-weight: bold; + margin: 10px 2px; +} + +h2 { + font-size: 120%; +} + +h3 { + font-size: 100%; +} + +dt { + font-weight: bold; +} + +div.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; +} + +p.startli, p.startdd, p.starttd { + margin-top: 2px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.qindex, div.navtab{ + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; +} + +div.qindex, div.navpath { + width: 100%; + line-height: 140%; +} + +div.navtab { + margin-right: 15px; +} + +/* @group Link Styling */ + +a { + color: #3D578C; + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: #4665A2; +} + +a:hover { + text-decoration: underline; +} + +a.qindex { + font-weight: bold; +} + +a.qindexHL { + font-weight: bold; + background-color: #9CAFD4; + color: #ffffff; + border: 1px double #869DCA; +} + +.contents a.qindexHL:visited { + color: #ffffff; +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.code, a.code:visited { + color: #4665A2; +} + +a.codeRef, a.codeRef:visited { + color: #4665A2; +} + +/* @end */ + +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%; +} + +div.ah { + background-color: black; + font-weight: bold; + color: #ffffff; + margin-bottom: 3px; + margin-top: 3px; + padding: 0.2em; + border: solid thin #333; + border-radius: 0.5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + box-shadow: 2px 2px 3px #999; + -webkit-box-shadow: 2px 2px 3px #999; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444)); + background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000); +} + +div.groupHeader { + margin-left: 16px; + margin-top: 12px; + font-weight: bold; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + background-color: white; + color: black; + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 8px; + margin-right: 8px; +} + +td.indexkey { + background-color: #EBEFF6; + font-weight: bold; + border: 1px solid #C4CFE5; + margin: 2px 0px 2px 0; + padding: 2px 10px; + white-space: nowrap; + vertical-align: top; +} + +td.indexvalue { + background-color: #EBEFF6; + border: 1px solid #C4CFE5; + padding: 2px 10px; + margin: 2px 0px; +} + +tr.memlist { + background-color: #EEF1F7; +} + +p.formulaDsp { + text-align: center; +} + +img.formulaDsp { + +} + +img.formulaInl { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; +} + +/* @group Code Colorization */ + +span.keyword { + color: #008000 +} + +span.keywordtype { + color: #604020 +} + +span.keywordflow { + color: #e08000 +} + +span.comment { + color: #800000 +} + +span.preprocessor { + color: #806020 +} + +span.stringliteral { + color: #002080 +} + +span.charliteral { + color: #008080 +} + +span.vhdldigit { + color: #ff00ff +} + +span.vhdlchar { + color: #000000 +} + +span.vhdlkeyword { + color: #700070 +} + +span.vhdllogic { + color: #ff0000 +} + +/* @end */ + +/* +.search { + color: #003399; + font-weight: bold; +} + +form.search { + margin-bottom: 0px; + margin-top: 0px; +} + +input.search { + font-size: 75%; + color: #000080; + font-weight: normal; + background-color: #e8eef2; +} +*/ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid #A3B4D7; +} + +th.dirtab { + background: #EBEFF6; + font-weight: bold; +} + +hr { + height: 0px; + border: none; + border-top: 1px solid #4A6AAA; +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight, +.memTemplItemLeft, .memTemplItemRight, .memTemplParams { + background-color: #F9FAFC; + border: none; + margin: 4px; + padding: 1px 0 0 8px; +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: #555; +} + +.memItemLeft, .memItemRight, .memTemplParams { + border-top: 1px solid #C4CFE5; +} + +.memItemLeft, .memTemplItemLeft { + white-space: nowrap; +} + +.memItemRight { + width: 100%; +} + +.memTemplParams { + color: #4665A2; + white-space: nowrap; +} + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtemplate { + font-size: 80%; + color: #4665A2; + font-weight: normal; + margin-left: 9px; +} + +.memnav { + background-color: #EBEFF6; + border: 1px solid #A3B4D7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; +} + +.memname { + white-space: nowrap; + font-weight: bold; + margin-left: 6px; +} + +.memproto, dl.reflist dt { + border-top: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 6px 0px 6px 0px; + 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; + +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid #A8B8D9; + border-left: 1px solid #A8B8D9; + border-right: 1px solid #A8B8D9; + padding: 2px 5px; + background-color: #FBFCFD; + border-top-width: 0; + /* opera specific markup */ + border-bottom-left-radius: 8px; + border-bottom-right-radius: 8px; + 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-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-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 { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; +} + +.paramname { + color: #602020; + white-space: nowrap; +} +.paramname em { + font-style: normal; +} + +.params, .retval, .exception, .tparams { + border-spacing: 6px 2px; +} + +.params .paramname, .retval .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir { + font-family: "courier new",courier,monospace; + vertical-align: top; +} + + + + +/* @end */ + +/* @group Directory (tree) */ + +/* for the tree view */ + +.ftvtree { + font-family: sans-serif; + margin: 0px; +} + +/* these are for tree view when used as main index */ + +.directory { + font-size: 9pt; + font-weight: bold; + margin: 5px; +} + +.directory h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +/* +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 p { + margin: 0px; + white-space: nowrap; +} + +.directory div { + display: none; + margin: 0px; +} + +.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-alt h3 { + margin: 0px; + margin-top: 1em; + font-size: 11pt; +} + +.directory-alt > h3 { + margin-top: 0; +} + +.directory-alt p { + margin: 0px; + white-space: nowrap; +} + +.directory-alt div { + display: none; + margin: 0px; +} + +.directory-alt img { + vertical-align: -30%; +} + +/* @end */ + +div.dynheader { + margin-top: 8px; +} + +address { + font-style: normal; + color: #2A3D61; +} + +table.doxtable { + border-collapse:collapse; +} + +table.doxtable td, table.doxtable th { + border: 1px solid #2D4068; + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: #374F7F; + color: #FFFFFF; + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; +} + +table.fieldtable { + width: 100%; + margin-bottom: 10px; + border: 1px solid #A8B8D9; + border-spacing: 0px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; + -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px; + -webkit-box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname { + white-space: nowrap; + border-right: 1px solid #A8B8D9; + border-bottom: 1px solid #A8B8D9; + vertical-align: top; +} + +.fieldtable td.fielddoc { + border-bottom: 1px solid #A8B8D9; + width: 100%; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-image:url('nav_f.png'); + background-repeat:repeat-x; + background-color: #E2E8F2; + font-size: 90%; + color: #253555; + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + -moz-border-radius-topleft: 4px; + -moz-border-radius-topright: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid #A8B8D9; +} + + +.tabsearch { + top: 0px; + left: 10px; + height: 36px; + background-image: url('tab_b.png'); + z-index: 101; + overflow: hidden; + font-size: 13px; +} + +.navpath ul +{ + font-size: 11px; + background-image:url('tab_b.png'); + background-repeat:repeat-x; + height:30px; + line-height:30px; + color:#8AA0CC; + border:solid 1px #C2CDE4; + overflow:hidden; + margin:0px; + padding:0px; +} + +.navpath li +{ + list-style-type:none; + float:left; + padding-left:10px; + padding-right:15px; + background-image:url('bc_s.png'); + background-repeat:no-repeat; + background-position:right; + color:#364D7C; +} + +.navpath li.navelem a +{ + height:32px; + display:block; + text-decoration: none; + outline: none; +} + +.navpath li.navelem a:hover +{ + color:#6884BD; +} + +.navpath li.footer +{ + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + color:#364D7C; + font-size: 8pt; +} + + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +div.ingroups +{ + margin-left: 5px; + font-size: 8pt; + padding-left: 5px; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + background-image:url('nav_h.png'); + background-repeat:repeat-x; + background-color: #F9FAFC; + margin: 0px; + border-bottom: 1px solid #C4CFE5; +} + +div.headertitle +{ + padding: 5px 5px 5px 7px; +} + +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 +{ + border-left:4px solid; + padding: 0 0 0 6px; +} + +dl.note +{ + border-color: #D0C000; +} + +dl.warning, dl.attention +{ + border-color: #FF0000; +} + +dl.pre, dl.post, dl.invariant +{ + border-color: #00D000; +} + +dl.deprecated +{ + border-color: #505050; +} + +dl.todo +{ + border-color: #00C0E0; +} + +dl.test +{ + border-color: #3030E0; +} + +dl.bug +{ + border-color: #C08050; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectname +{ + font: 300% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 2px 0px; +} + +#projectbrief +{ + font: 120% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font: 50% Tahoma, Arial,sans-serif; + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0px; + margin: 0px; + width: 100%; + border-bottom: 1px solid #5373B4; +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +div.zoom +{ + border: 1px solid #90A5CE; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:#334975; + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; +} + +dl.citelist dd { + margin:2px 0; + padding:5px 0; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + 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 new file mode 100644 index 0000000..635ed52 Binary files /dev/null and b/doxygen.png differ diff --git a/doxygen_8dox.html b/doxygen_8dox.html new file mode 100644 index 0000000..3f4ab57 --- /dev/null +++ b/doxygen_8dox.html @@ -0,0 +1,106 @@ + + + + + +post quantum cryptography: doxygen.dox File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
doxygen.dox File Reference
+
+
+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/encrypt_8h.html b/encrypt_8h.html new file mode 100644 index 0000000..9bc14af --- /dev/null +++ b/encrypt_8h.html @@ -0,0 +1,197 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/encrypt.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+Functions
+
+
/home/travis/build/hasufell/pqc/include/encrypt.h File Reference
+
+
+ +

public API, encryption +More...

+
#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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string* ntru_encrypt_string (const stringmsg,
const fmpz_poly_t pub_key,
const fmpz_poly_t rnd,
const ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
msgthe message
pub_keythe public key
rndthe random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1})
paramsntru_params the ntru context
+
+
+
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:
+ + + + + +
msgthe message
pub_keythe public key
rndthe random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1})
paramsntru_params the ntru context
+
+
+
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 new file mode 100644 index 0000000..fa7bec7 --- /dev/null +++ b/encrypt_8h__incl.dot @@ -0,0 +1,16 @@ +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.md5 b/encrypt_8h__incl.md5 new file mode 100644 index 0000000..e82dea2 --- /dev/null +++ b/encrypt_8h__incl.md5 @@ -0,0 +1 @@ +f9fe215186c65b1a48490e4808f402c4 \ No newline at end of file diff --git a/encrypt_8h_source.html b/encrypt_8h_source.html new file mode 100644 index 0000000..c290fd5 --- /dev/null +++ b/encrypt_8h_source.html @@ -0,0 +1,146 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/encrypt.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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
+ + +
+ +
+ + + + + + + diff --git a/files.html b/files.html new file mode 100644 index 0000000..53fb737 --- /dev/null +++ b/files.html @@ -0,0 +1,136 @@ + + + + + +post quantum cryptography: File List + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
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
+ + +
+ +
+ + + + + + + diff --git a/functions.html b/functions.html new file mode 100644 index 0000000..7e6327f --- /dev/null +++ b/functions.html @@ -0,0 +1,135 @@ + + + + + +post quantum cryptography: Data Fields + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + + +
+
+
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 new file mode 100644 index 0000000..2d6c229 --- /dev/null +++ b/functions_vars.html @@ -0,0 +1,135 @@ + + + + + +post quantum cryptography: Data Fields - Variables + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + + +
+
+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/globals.html b/globals.html new file mode 100644 index 0000000..3b692e3 --- /dev/null +++ b/globals.html @@ -0,0 +1,417 @@ + + + + + +post quantum cryptography: Globals + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + + + +
+
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- i -

+ + +

- k -

+ + +

- n -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- w -

+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/globals_defs.html b/globals_defs.html new file mode 100644 index 0000000..31be725 --- /dev/null +++ b/globals_defs.html @@ -0,0 +1,136 @@ + + + + + +post quantum cryptography: Globals + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + + +
+
+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/globals_func.html b/globals_func.html new file mode 100644 index 0000000..b41dbeb --- /dev/null +++ b/globals_func.html @@ -0,0 +1,371 @@ + + + + + +post quantum cryptography: Globals + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + + + +
+
+  + +

- a -

+ + +

- b -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- i -

+ + +

- n -

+ + +

- p -

+ + +

- r -

+ + +

- s -

+ + +

- w -

+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/globals_type.html b/globals_type.html new file mode 100644 index 0000000..af2cd7f --- /dev/null +++ b/globals_type.html @@ -0,0 +1,124 @@ + + + + + +post quantum cryptography: Globals + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + + +
+
+
+ +
+ All Data Structures Files Functions Variables Typedefs Defines
+ + +
+ +
+ + + + + + + diff --git a/graph_legend.dot b/graph_legend.dot new file mode 100644 index 0000000..f7e78c2 --- /dev/null +++ b/graph_legend.dot @@ -0,0 +1,22 @@ +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 new file mode 100644 index 0000000..51fd017 --- /dev/null +++ b/graph_legend.html @@ -0,0 +1,164 @@ + + + + + +post quantum cryptography: Graph Legend + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + +
+
+
+
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:

+
+ +
+

The boxes in the above graph 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 new file mode 100644 index 0000000..c0a4490 --- /dev/null +++ b/graph_legend.md5 @@ -0,0 +1 @@ +70d597617e34367275a35eeb8fb7ea07 \ No newline at end of file diff --git a/index.html b/index.html index 03f9801..a93a675 100644 --- a/index.html +++ b/index.html @@ -1 +1,134 @@ -My GitHub Page + + + + + +post quantum cryptography: Index Page + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + +
+
+
+
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
+ + +
+ +
+ + + + + + + diff --git a/installdox b/installdox new file mode 100755 index 0000000..edf5bbf --- /dev/null +++ b/installdox @@ -0,0 +1,112 @@ +#!/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 new file mode 100644 index 0000000..90b3a2b --- /dev/null +++ b/jquery.js @@ -0,0 +1,64 @@ +/* + * jQuery JavaScript Library v1.3.2 + * http://jquery.com/ + * + * Copyright (c) 2009 John Resig + * Dual licensed under the MIT and GPL licenses. + * http://docs.jquery.com/License + * + * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009) + * Revision: 6246 + */ +(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 + * 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=$(' +
+ + + + + + + diff --git a/keypair_8h__incl.dot b/keypair_8h__incl.dot new file mode 100644 index 0000000..dd60593 --- /dev/null +++ b/keypair_8h__incl.dot @@ -0,0 +1,19 @@ +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.md5 b/keypair_8h__incl.md5 new file mode 100644 index 0000000..5f88845 --- /dev/null +++ b/keypair_8h__incl.md5 @@ -0,0 +1 @@ +4303da91ade606bc2d885da5a117a4fa \ No newline at end of file diff --git a/keypair_8h_source.html b/keypair_8h_source.html new file mode 100644 index 0000000..31077d1 --- /dev/null +++ b/keypair_8h_source.html @@ -0,0 +1,181 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/keypair.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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_ */
+
+ + + + +
+ +
+ + + + + + + diff --git a/nav_f.png b/nav_f.png new file mode 100644 index 0000000..1b07a16 Binary files /dev/null and b/nav_f.png differ diff --git a/nav_h.png b/nav_h.png new file mode 100644 index 0000000..01f5fa6 Binary files /dev/null and b/nav_h.png differ diff --git a/ntru_8h.html b/ntru_8h.html new file mode 100644 index 0000000..f8171bb --- /dev/null +++ b/ntru_8h.html @@ -0,0 +1,503 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/ntru.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/include/ntru.h File Reference
+
+
+ +

public API, basic data types +More...

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

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + +

+Data Structures

struct  ntru_params
struct  string

+Typedefs

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)
+

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 struct ntru_params ntru_params
+
+
+ +

Definition at line 39 of file ntru.h.

+ +
+
+ +
+
+ + + + +
typedef struct string string
+
+
+ +

Definition at line 40 of file ntru.h.

+ +
+
+

Function Documentation

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

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

+
Parameters:
+ + +
polythe polynomial to delete
+
+
+ +

Definition at line 123 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
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:
+ + + +
polythe polynomial to delete
...follow up polynomials
+
+
+ +

Definition at line 149 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
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:
+ + +
poly_arraythe polynomial array
+
+
+ +

Definition at line 131 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void poly_draw (const fmpz_poly_t poly)
+
+
+

Draws a polynomial to stdout.

+
Parameters:
+ + +
polydraw this
+
+
+ +

Definition at line 574 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void poly_draw_pretty (const fmpz_poly_t poly)
+
+
+

Draws a polynomial to stdout, in pretty format.

+
Parameters:
+ + +
polydraw this
+
+
+ +

Definition at line 583 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void poly_new (fmpz_poly_t new_poly,
int const *const c,
const size_t len 
)
+
+
+

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:
+ + + + +
new_polythe polynomial to initialize and fill with coefficients [out]
carray of polynomial coefficients, can be NULL
lensize of the coefficient array, can be 0
+
+
+
Returns:
newly allocated polynomial pointer, must be freed with fmpz_poly_clear()
+ +

Definition at line 110 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void prints (const stringprint_string)
+
+
+

Prints the given string to stdout.

+
Parameters:
+ + +
print_stringthe print to string
+
+
+ +

Definition at line 37 of file ntru_string.c.

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

Reads a file and returns a newly allocated string.

+
Parameters:
+ + +
filenamefile to open
+
+
+
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:
+ + +
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)
+ +

Definition at line 50 of file ntru_file.c.

+ +
+
+ +
+
+ + + + + + + + +
void string_delete (stringdel_string)
+
+
+

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

+
Parameters:
+ + +
del_stringthe string to delete
+
+
+ +

Definition at line 47 of file ntru_string.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void write_file (string const * wstring,
char const *const filename 
)
+
+
+

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

+
Parameters:
+ + + +
wstringthe string to write to the file
filenamethe name of the file to write to
+
+
+

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

+
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
+ +

Definition at line 107 of file ntru_file.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru_8h__incl.dot b/ntru_8h__incl.dot new file mode 100644 index 0000000..5a3741d --- /dev/null +++ b/ntru_8h__incl.dot @@ -0,0 +1,12 @@ +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.md5 b/ntru_8h__incl.md5 new file mode 100644 index 0000000..326e880 --- /dev/null +++ b/ntru_8h__incl.md5 @@ -0,0 +1 @@ +512dd154d90a38f15b27224cf5c624d1 \ No newline at end of file diff --git a/ntru_8h_source.html b/ntru_8h_source.html new file mode 100644 index 0000000..3412ebe --- /dev/null +++ b/ntru_8h_source.html @@ -0,0 +1,186 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/ntru.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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_ */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__ascii__poly_8c.html b/ntru__ascii__poly_8c.html new file mode 100644 index 0000000..910a04b --- /dev/null +++ b/ntru__ascii__poly_8c.html @@ -0,0 +1,295 @@ + + + + + +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
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + +
fmpz_poly_t* ascii_bin_to_bin_poly (const char * to_poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
to_polythe string to get into binary polynomial format
paramsthe NTRUEncrypt context
+
+
+
Returns:
newly allocated array of binary polynomials
+ +

Definition at line 81 of file ntru_ascii_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
fmpz_poly_t** ascii_to_bin_poly_arr (const stringto_poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
to_polythe string to get into binary polynomial format
paramsthe NTRUEncrypt context
+
+
+
Returns:
newly allocated array of binary polynomials
+ +

Definition at line 101 of file ntru_ascii_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
fmpz_poly_t** base64_to_poly_arr (const stringto_poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
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
+ +

Definition at line 146 of file ntru_ascii_poly.c.

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

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

+

As in: 90 => "10110101"

+
Parameters:
+ + +
valuethe integer to convert
+
+
+
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 new file mode 100644 index 0000000..e288410 --- /dev/null +++ b/ntru__ascii__poly_8c__incl.dot @@ -0,0 +1,49 @@ +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.md5 b/ntru__ascii__poly_8c__incl.md5 new file mode 100644 index 0000000..1767536 --- /dev/null +++ b/ntru__ascii__poly_8c__incl.md5 @@ -0,0 +1 @@ +a44d09273de9c60d0e0582d08fae85fa \ No newline at end of file diff --git a/ntru__ascii__poly_8c_source.html b/ntru__ascii__poly_8c_source.html new file mode 100644 index 0000000..9c0732b --- /dev/null +++ b/ntru__ascii__poly_8c_source.html @@ -0,0 +1,299 @@ + + + + + +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
+
+
+ + + + + +
+
+
+
/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 }
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__ascii__poly_8h.html b/ntru__ascii__poly_8h.html new file mode 100644 index 0000000..9a63aaa --- /dev/null +++ b/ntru__ascii__poly_8h.html @@ -0,0 +1,259 @@ + + + + + +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
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_ascii_poly.h File Reference
+
+
+ +

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 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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + +
fmpz_poly_t* ascii_bin_to_bin_poly (const char * to_poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
to_polythe string to get into binary polynomial format
paramsthe NTRUEncrypt context
+
+
+
Returns:
newly allocated array of binary polynomials
+ +

Definition at line 81 of file ntru_ascii_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
fmpz_poly_t** ascii_to_bin_poly_arr (const stringto_poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
to_polythe string to get into binary polynomial format
paramsthe NTRUEncrypt context
+
+
+
Returns:
newly allocated array of binary polynomials
+ +

Definition at line 101 of file ntru_ascii_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
fmpz_poly_t** base64_to_poly_arr (const stringto_poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
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
+ +

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 new file mode 100644 index 0000000..ce1109b --- /dev/null +++ b/ntru__ascii__poly_8h__incl.dot @@ -0,0 +1,21 @@ +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.md5 b/ntru__ascii__poly_8h__incl.md5 new file mode 100644 index 0000000..22ed0cf --- /dev/null +++ b/ntru__ascii__poly_8h__incl.md5 @@ -0,0 +1 @@ +eeb812a91fe6b7412ad0dddfa4530952 \ No newline at end of file diff --git a/ntru__ascii__poly_8h_source.html b/ntru__ascii__poly_8h_source.html new file mode 100644 index 0000000..b9222da --- /dev/null +++ b/ntru__ascii__poly_8h_source.html @@ -0,0 +1,150 @@ + + + + + +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
+
+
+ + + + + +
+
+
+
/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_ */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__common_8h.html b/ntru__common_8h.html new file mode 100644 index 0000000..cbde136 --- /dev/null +++ b/ntru__common_8h.html @@ -0,0 +1,163 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_common.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_common.h File Reference
+
+
+ +

common macros/functions +More...

+
#include <stdlib.h>
+
+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
+

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

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

Definition at line 38 of file ntru_common.h.

+ +
+
+ +
+
+ + + + +
#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 new file mode 100644 index 0000000..9b13edb --- /dev/null +++ b/ntru__common_8h__incl.dot @@ -0,0 +1,8 @@ +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.md5 b/ntru__common_8h__incl.md5 new file mode 100644 index 0000000..c975c8b --- /dev/null +++ b/ntru__common_8h__incl.md5 @@ -0,0 +1 @@ +387a14e03c762904414073faf13de234 \ No newline at end of file diff --git a/ntru__common_8h_source.html b/ntru__common_8h_source.html new file mode 100644 index 0000000..342cfa8 --- /dev/null +++ b/ntru__common_8h_source.html @@ -0,0 +1,139 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_common.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__decrypt_8c.html b/ntru__decrypt_8c.html new file mode 100644 index 0000000..f7a45c7 --- /dev/null +++ b/ntru__decrypt_8c.html @@ -0,0 +1,252 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

Detailed Description

+

NTRU decryption.

+

This file handles the NTRU decryption algorithm.

+ +

Definition in file ntru_decrypt.c.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + + +
encr_msgencrypted polynom with maximum length of N from the given context
priv_keythe polynom containing the private key to decrypt the message
priv_key_invthe inverse polynome to the private key
out_ternthe resulting ternary polynom [out]
paramsthe ntru_params
+
+
+ +

Definition at line 46 of file ntru_decrypt.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string* ntru_decrypt_string (const stringencr_msg,
const fmpz_poly_t priv_key,
const fmpz_poly_t priv_key_inv,
const ntru_paramsparams 
)
+
+
+

Decryption of a given encrypted string.

+
Parameters:
+ + + + + +
encr_msgthe encrypted message in the form of a string
priv_keythe polynom containing the private key to decrypt the message
priv_key_invthe inverse polynome to the private key
paramsthe ntru_params
+
+
+
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 new file mode 100644 index 0000000..1a937f2 --- /dev/null +++ b/ntru__decrypt_8c__incl.dot @@ -0,0 +1,56 @@ +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.md5 b/ntru__decrypt_8c__incl.md5 new file mode 100644 index 0000000..4c08d37 --- /dev/null +++ b/ntru__decrypt_8c__incl.md5 @@ -0,0 +1 @@ +7dbd28d16ee280fd2e4a31ed4f916592 \ No newline at end of file diff --git a/ntru__decrypt_8c_source.html b/ntru__decrypt_8c_source.html new file mode 100644 index 0000000..cdfdad3 --- /dev/null +++ b/ntru__decrypt_8c_source.html @@ -0,0 +1,223 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__decrypt_8h.html b/ntru__decrypt_8h.html new file mode 100644 index 0000000..fc17b03 --- /dev/null +++ b/ntru__decrypt_8h.html @@ -0,0 +1,247 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_decrypt.h File Reference
+
+
+ +

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 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)
+

Detailed Description

+

header for ntru_decrypt.c

+

Header for the external API of ntru_decrypt.c.

+ +

Definition in file ntru_decrypt.h.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + + +
encr_msgencrypted polynom with maximum length of N from the given context
priv_keythe polynom containing the private key to decrypt the message
priv_key_invthe inverse polynome to the private key
out_ternthe resulting ternary polynom [out]
paramsthe ntru_params
+
+
+ +

Definition at line 46 of file ntru_decrypt.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string* ntru_decrypt_string (const stringencr_msg,
const fmpz_poly_t priv_key,
const fmpz_poly_t priv_key_inv,
const ntru_paramsparams 
)
+
+
+

Decryption of a given encrypted string.

+
Parameters:
+ + + + + +
encr_msgthe encrypted message in the form of a string
priv_keythe polynom containing the private key to decrypt the message
priv_key_invthe inverse polynome to the private key
paramsthe ntru_params
+
+
+
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 new file mode 100644 index 0000000..bdb6d70 --- /dev/null +++ b/ntru__decrypt_8h__incl.dot @@ -0,0 +1,30 @@ +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.md5 b/ntru__decrypt_8h__incl.md5 new file mode 100644 index 0000000..0699f68 --- /dev/null +++ b/ntru__decrypt_8h__incl.md5 @@ -0,0 +1 @@ +5e60f3f7ddf44d6bc8445e25e29c3343 \ No newline at end of file diff --git a/ntru__decrypt_8h_source.html b/ntru__decrypt_8h_source.html new file mode 100644 index 0000000..baa23c2 --- /dev/null +++ b/ntru__decrypt_8h_source.html @@ -0,0 +1,155 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_decrypt.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__encrypt_8c.html b/ntru__encrypt_8c.html new file mode 100644 index 0000000..0d87a29 --- /dev/null +++ b/ntru__encrypt_8c.html @@ -0,0 +1,257 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

Detailed Description

+

NTRU encryption.

+

This file handles the NTRU encryption algorithm.

+ +

Definition in file ntru_encrypt.c.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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_paramsparams 
)
+
+
+

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:
+ + + + + + +
msg_ternthe message to encrypt, in ternary format
pub_keythe public key
rndthe random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1})
outthe output poly which is in the range {0, q-1} (not ternary!) [out]
paramsntru_params the ntru context
+
+
+ +

Definition at line 46 of file ntru_encrypt.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string* ntru_encrypt_string (const stringmsg,
const fmpz_poly_t pub_key,
const fmpz_poly_t rnd,
const ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
msgthe message
pub_keythe public key
rndthe random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1})
paramsntru_params the ntru context
+
+
+
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 new file mode 100644 index 0000000..7eb101e --- /dev/null +++ b/ntru__encrypt_8c__incl.dot @@ -0,0 +1,58 @@ +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.md5 b/ntru__encrypt_8c__incl.md5 new file mode 100644 index 0000000..9780356 --- /dev/null +++ b/ntru__encrypt_8c__incl.md5 @@ -0,0 +1 @@ +99d0879ce83c16c396109da391990130 \ No newline at end of file diff --git a/ntru__encrypt_8c_source.html b/ntru__encrypt_8c_source.html new file mode 100644 index 0000000..eac195c --- /dev/null +++ b/ntru__encrypt_8c_source.html @@ -0,0 +1,205 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__encrypt_8h.html b/ntru__encrypt_8h.html new file mode 100644 index 0000000..8952883 --- /dev/null +++ b/ntru__encrypt_8h.html @@ -0,0 +1,252 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

Detailed Description

+

header for encrypt.c

+

Header for the internal API of ntru_encrypt.c.

+ +

Definition in file ntru_encrypt.h.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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_paramsparams 
)
+
+
+

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:
+ + + + + + +
msg_ternthe message to encrypt, in ternary format
pub_keythe public key
rndthe random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1})
outthe output poly which is in the range {0, q-1} (not ternary!) [out]
paramsntru_params the ntru context
+
+
+ +

Definition at line 46 of file ntru_encrypt.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
string* ntru_encrypt_string (const stringmsg,
const fmpz_poly_t pub_key,
const fmpz_poly_t rnd,
const ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
msgthe message
pub_keythe public key
rndthe random poly (should have relatively small coefficients, but not restricted to {-1, 0, 1})
paramsntru_params the ntru context
+
+
+
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 new file mode 100644 index 0000000..9ac35dc --- /dev/null +++ b/ntru__encrypt_8h__incl.dot @@ -0,0 +1,30 @@ +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.md5 b/ntru__encrypt_8h__incl.md5 new file mode 100644 index 0000000..cc542d0 --- /dev/null +++ b/ntru__encrypt_8h__incl.md5 @@ -0,0 +1 @@ +0c16aafbff376266fd942e48b12d9d11 \ No newline at end of file diff --git a/ntru__encrypt_8h_source.html b/ntru__encrypt_8h_source.html new file mode 100644 index 0000000..e4e8b54 --- /dev/null +++ b/ntru__encrypt_8h_source.html @@ -0,0 +1,156 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_encrypt.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__err_8h.html b/ntru__err_8h.html new file mode 100644 index 0000000..2a0f527 --- /dev/null +++ b/ntru__err_8h.html @@ -0,0 +1,221 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_err.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/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.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__err_8h_source.html b/ntru__err_8h_source.html new file mode 100644 index 0000000..64844bc --- /dev/null +++ b/ntru__err_8h_source.html @@ -0,0 +1,159 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_err.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__file_8c.html b/ntru__file_8c.html new file mode 100644 index 0000000..a467896 --- /dev/null +++ b/ntru__file_8c.html @@ -0,0 +1,230 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 dependency graph for ntru_file.c:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + +

+Defines

#define STD_FILE_BUF   4096

+Functions

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

Detailed Description

+

file operations

+

Allows operations on files, such as reading and writing.

+ +

Definition in file ntru_file.c.

+

Define Documentation

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

Definition at line 44 of file ntru_file.c.

+ +
+
+

Function Documentation

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

Reads a file and returns a newly allocated string.

+
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)
+ +

Definition at line 50 of file ntru_file.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool write_file (string const * wstring,
char const *const filename 
)
+
+
+

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

+
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
+ +

Definition at line 107 of file ntru_file.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__file_8c__incl.dot b/ntru__file_8c__incl.dot new file mode 100644 index 0000000..09a55c4 --- /dev/null +++ b/ntru__file_8c__incl.dot @@ -0,0 +1,35 @@ +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.md5 b/ntru__file_8c__incl.md5 new file mode 100644 index 0000000..01c8303 --- /dev/null +++ b/ntru__file_8c__incl.md5 @@ -0,0 +1 @@ +3f5614474a6bac84c8ead4a69185b1d7 \ No newline at end of file diff --git a/ntru__file_8c_source.html b/ntru__file_8c_source.html new file mode 100644 index 0000000..8691414 --- /dev/null +++ b/ntru__file_8c_source.html @@ -0,0 +1,228 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__file_8h.html b/ntru__file_8h.html new file mode 100644 index 0000000..9b94f34 --- /dev/null +++ b/ntru__file_8h.html @@ -0,0 +1,200 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_file.h File Reference
+
+
+ +

header for ntru_file.c +More...

+
#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)
+

Detailed Description

+

header for ntru_file.c

+

Header for the external API of ntru_file.c.

+ +

Definition in file ntru_file.h.

+

Function Documentation

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

Reads a file and returns a newly allocated string.

+
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)
+ +

Definition at line 50 of file ntru_file.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
bool write_file (string const * wstring,
char const *const filename 
)
+
+
+

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

+
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
+ +

Definition at line 107 of file ntru_file.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__file_8h__incl.dot b/ntru__file_8h__incl.dot new file mode 100644 index 0000000..2032919 --- /dev/null +++ b/ntru__file_8h__incl.dot @@ -0,0 +1,15 @@ +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.md5 b/ntru__file_8h__incl.md5 new file mode 100644 index 0000000..4b663fe --- /dev/null +++ b/ntru__file_8h__incl.md5 @@ -0,0 +1 @@ +f2ffeaf3ebe24d90c8c312a86c034e9e \ No newline at end of file diff --git a/ntru__file_8h_source.html b/ntru__file_8h_source.html new file mode 100644 index 0000000..98fe49b --- /dev/null +++ b/ntru__file_8h_source.html @@ -0,0 +1,145 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_file.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__keypair_8c.html b/ntru__keypair_8c.html new file mode 100644 index 0000000..57641b5 --- /dev/null +++ b/ntru__keypair_8c.html @@ -0,0 +1,408 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void export_priv_key (char const *const filename,
fmpz_poly_t priv,
ntru_paramsparams 
)
+
+
+

Export the private key to a file.

+
Parameters:
+ + + + +
filenamethe file to save the private key into
privthe private key
paramsthe NTRU context
+
+
+ +

Definition at line 111 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void export_public_key (char const *const filename,
fmpz_poly_t pub,
ntru_paramsparams 
)
+
+
+

Export the public key to a file.

+
Parameters:
+ + + + +
filenamethe file to save the public key into
pubthe public key
paramsthe NTRU context
+
+
+ +

Definition at line 96 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void import_priv_key (char const *const filename,
fmpz_poly_t priv,
fmpz_poly_t priv_inv,
ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
filenamethe file to get the private key from
privwhere to save the private key [out]
priv_invwhere to save the inverse of the private key [out]
paramsthe NTRU context
+
+
+ +

Definition at line 157 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void import_public_key (char const *const filename,
fmpz_poly_t pub,
ntru_paramsparams 
)
+
+
+

Import the public key from a file.

+
Parameters:
+ + + + +
filenamethe file to get the public key from
pubwhere to save the public key [out]
paramsthe NTRU context
+
+
+ +

Definition at line 132 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool ntru_create_keypair (fmpz_poly_t f,
fmpz_poly_t g,
keypairpair,
ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
fa random polynomial
ga random polynomial
pairstore private and public components here [out]
paramsthe NTRU context
+
+
+
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 (keypairpair)
+
+
+

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

+
Parameters:
+ + +
pairthe pair to free the inner structure of
+
+
+ +

Definition at line 197 of file ntru_keypair.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__keypair_8c__incl.dot b/ntru__keypair_8c__incl.dot new file mode 100644 index 0000000..c0a354f --- /dev/null +++ b/ntru__keypair_8c__incl.dot @@ -0,0 +1,60 @@ +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.md5 b/ntru__keypair_8c__incl.md5 new file mode 100644 index 0000000..2e25ee0 --- /dev/null +++ b/ntru__keypair_8c__incl.md5 @@ -0,0 +1 @@ +19384e450a717a8c3944d423527b302d \ No newline at end of file diff --git a/ntru__keypair_8c_source.html b/ntru__keypair_8c_source.html new file mode 100644 index 0000000..f0e3536 --- /dev/null +++ b/ntru__keypair_8c_source.html @@ -0,0 +1,303 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__keypair_8h.html b/ntru__keypair_8h.html new file mode 100644 index 0000000..30e389c --- /dev/null +++ b/ntru__keypair_8h.html @@ -0,0 +1,425 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_keypair.h File Reference
+
+
+ +

header for ntru_keypair.c +More...

+
#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

+Typedefs

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)
+

Detailed Description

+

header for ntru_keypair.c

+

Header for internal API of ntru_keypair.c.

+ +

Definition in file ntru_keypair.h.

+

Typedef Documentation

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

Definition at line 39 of file ntru_keypair.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void export_priv_key (char const *const filename,
fmpz_poly_t priv,
ntru_paramsparams 
)
+
+
+

Export the private key to a file.

+
Parameters:
+ + + + +
filenamethe file to save the private key into
privthe private key
paramsthe NTRU context
+
+
+ +

Definition at line 111 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void export_public_key (char const *const filename,
fmpz_poly_t pub,
ntru_paramsparams 
)
+
+
+

Export the public key to a file.

+
Parameters:
+ + + + +
filenamethe file to save the public key into
pubthe public key
paramsthe NTRU context
+
+
+ +

Definition at line 96 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void import_priv_key (char const *const filename,
fmpz_poly_t priv,
fmpz_poly_t priv_inv,
ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
filenamethe file to get the private key from
privwhere to save the private key [out]
priv_invwhere to save the inverse of the private key [out]
paramsthe NTRU context
+
+
+ +

Definition at line 157 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void import_public_key (char const *const filename,
fmpz_poly_t pub,
ntru_paramsparams 
)
+
+
+

Import the public key from a file.

+
Parameters:
+ + + + +
filenamethe file to get the public key from
pubwhere to save the public key [out]
paramsthe NTRU context
+
+
+ +

Definition at line 132 of file ntru_keypair.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool ntru_create_keypair (fmpz_poly_t f,
fmpz_poly_t g,
keypairpair,
ntru_paramsparams 
)
+
+
+

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

+
Parameters:
+ + + + + +
fa random polynomial
ga random polynomial
pairstore private and public components here [out]
paramsthe NTRU context
+
+
+
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 (keypairpair)
+
+
+

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

+
Parameters:
+ + +
pairthe pair to free the inner structure of
+
+
+ +

Definition at line 197 of file ntru_keypair.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__keypair_8h__incl.dot b/ntru__keypair_8h__incl.dot new file mode 100644 index 0000000..040a90e --- /dev/null +++ b/ntru__keypair_8h__incl.dot @@ -0,0 +1,16 @@ +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.md5 b/ntru__keypair_8h__incl.md5 new file mode 100644 index 0000000..fe135fa --- /dev/null +++ b/ntru__keypair_8h__incl.md5 @@ -0,0 +1 @@ +b563620bbeef40262ba6bb0f04338e05 \ No newline at end of file diff --git a/ntru__keypair_8h_source.html b/ntru__keypair_8h_source.html new file mode 100644 index 0000000..aa2b0de --- /dev/null +++ b/ntru__keypair_8h_source.html @@ -0,0 +1,181 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_keypair.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__mem_8c.html b/ntru__mem_8c.html new file mode 100644 index 0000000..8bfdb4e --- /dev/null +++ b/ntru__mem_8c.html @@ -0,0 +1,200 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_mem.c File Reference
+
+
+ +

memory management +More...

+
#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)
+

Detailed Description

+

memory management

+

This file provides functions for memory management.

+ +

Definition in file ntru_mem.c.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
void* ntru_calloc (size_t nmemb,
size_t size 
)
+
+
+

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

+
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
+ +

Definition at line 56 of file ntru_mem.c.

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

Allocate memory of size and return a void pointer.

+
Parameters:
+ + +
sizeof the memory to allocate in bytes
+
+
+
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 new file mode 100644 index 0000000..eea2119 --- /dev/null +++ b/ntru__mem_8c__incl.dot @@ -0,0 +1,13 @@ +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.md5 b/ntru__mem_8c__incl.md5 new file mode 100644 index 0000000..35be7fb --- /dev/null +++ b/ntru__mem_8c__incl.md5 @@ -0,0 +1 @@ +e0ec6745fb39c92ebf752eca5cb5d782 \ No newline at end of file diff --git a/ntru__mem_8c_source.html b/ntru__mem_8c_source.html new file mode 100644 index 0000000..64ab6ee --- /dev/null +++ b/ntru__mem_8c_source.html @@ -0,0 +1,170 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__mem_8h.html b/ntru__mem_8h.html new file mode 100644 index 0000000..8c206c4 --- /dev/null +++ b/ntru__mem_8h.html @@ -0,0 +1,242 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_mem.h File Reference
+
+
+ +

header for ntru_mem.c +More...

+
#include <stdlib.h>
+
+Include dependency graph for ntru_mem.h:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + +

+Defines

#define REALLOC(ptr, size)

+Functions

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.

+ +

Definition in file ntru_mem.h.

+

Define Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + +
#define REALLOC( ptr,
 size 
)
+
+
+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

+ +
+
+ + + + + + + + + + + + + + + + + + +
void* ntru_calloc (size_t nmemb,
size_t size 
)
+
+
+

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

+
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
+ +

Definition at line 56 of file ntru_mem.c.

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

Allocate memory of size and return a void pointer.

+
Parameters:
+ + +
sizeof the memory to allocate in bytes
+
+
+
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 new file mode 100644 index 0000000..38506e0 --- /dev/null +++ b/ntru__mem_8h__incl.dot @@ -0,0 +1,8 @@ +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.md5 b/ntru__mem_8h__incl.md5 new file mode 100644 index 0000000..a15927d --- /dev/null +++ b/ntru__mem_8h__incl.md5 @@ -0,0 +1 @@ +3452728e2a5e42b766e2e73bbd8432b8 \ No newline at end of file diff --git a/ntru__mem_8h_source.html b/ntru__mem_8h_source.html new file mode 100644 index 0000000..b6ef1ef --- /dev/null +++ b/ntru__mem_8h_source.html @@ -0,0 +1,153 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_mem.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__params_8h.html b/ntru__params_8h.html new file mode 100644 index 0000000..104c75c --- /dev/null +++ b/ntru__params_8h.html @@ -0,0 +1,151 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_params.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_params.h File Reference
+
+
+ +

NTRU parameters. +More...

+
#include <stdint.h>
+
+Include dependency graph for ntru_params.h:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + +

+Data Structures

struct  ntru_params

+Typedefs

typedef struct ntru_params ntru_params
+

Detailed Description

+

NTRU parameters.

+

This file defines the ntru_params and related data types.

+ +

Definition in file ntru_params.h.

+

Typedef Documentation

+ +
+
+ + + + +
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 new file mode 100644 index 0000000..b0b5351 --- /dev/null +++ b/ntru__params_8h__incl.dot @@ -0,0 +1,8 @@ +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.md5 b/ntru__params_8h__incl.md5 new file mode 100644 index 0000000..2bbf370 --- /dev/null +++ b/ntru__params_8h__incl.md5 @@ -0,0 +1 @@ +fa96686c8369bd3430304d00772b916a \ No newline at end of file diff --git a/ntru__params_8h_source.html b/ntru__params_8h_source.html new file mode 100644 index 0000000..83d1959 --- /dev/null +++ b/ntru__params_8h_source.html @@ -0,0 +1,145 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_params.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__poly_8c.html b/ntru__poly_8c.html new file mode 100644 index 0000000..225723e --- /dev/null +++ b/ntru__poly_8c.html @@ -0,0 +1,777 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void fmpz_add_n (fmpz_t f,
const fmpz_t g,
const fmpz_t h 
)
+
+
+

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

+ +

Definition at line 222 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int fmpz_cmp_si_n (const fmpz_t f,
slong g 
)
+
+
+

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

+
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
+ +

Definition at line 93 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int fmpz_invmod_ui (fmpz_t f,
const fmpz_t g,
const uint32_t mod 
)
+
+
+

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

+
Parameters:
+ + + + +
fresult [out]
gthe inverse
modthe modulo
+
+
+ +

Definition at line 210 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void fmpz_poly_mod (fmpz_poly_t a,
const uint32_t mod 
)
+
+
+

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:
+ + + +
athe polynom to apply the modulus to
modthe modulus
+
+
+ +

Definition at line 182 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void fmpz_poly_mod_unsigned (fmpz_poly_t a,
const uint32_t mod 
)
+
+
+

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:
+ + + +
athe polynom to apply the modulus to
modthe modulus
+
+
+ +

Definition at line 166 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void fmpz_poly_set_coeff_fmpz_n (fmpz_poly_t poly,
slong n,
const fmpz_t x 
)
+
+
+

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:
+ + + + +
polythe polynom we want to change a coefficient of
nthe coefficient we want to set
xthe value to assign to the coefficient
+
+
+ +

Definition at line 198 of file ntru_poly.c.

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

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

+
Parameters:
+ + +
polythe polynomial to delete
+
+
+ +

Definition at line 123 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
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:
+ + + +
polythe polynomial to delete
...follow up polynomials
+
+
+ +

Definition at line 149 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
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:
+ + +
poly_arraythe polynomial array
+
+
+ +

Definition at line 131 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void poly_draw (const fmpz_poly_t poly)
+
+
+

Draws a polynomial to stdout.

+
Parameters:
+ + +
polydraw this
+
+
+ +

Definition at line 574 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void poly_draw_pretty (const fmpz_poly_t poly)
+
+
+

Draws a polynomial to stdout, in pretty format.

+
Parameters:
+ + +
polydraw this
+
+
+ +

Definition at line 583 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool poly_inverse_poly_p (const fmpz_poly_t a,
fmpz_poly_t Fp,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
apolynomial to invert
Fppolynomial [out]
paramsNTRU parameters
+
+
+
Returns:
true if invertible, false if not
+ +

Definition at line 409 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool poly_inverse_poly_q (const fmpz_poly_t a,
fmpz_poly_t Fq,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
apolynomial to invert (is allowed to be the same as param Fq)
Fqpolynomial [out]
paramsNTRU parameters
+
+
+
Returns:
true if invertible, false if not
+ +

Definition at line 297 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
static void poly_mod2_to_modq (const fmpz_poly_t a,
fmpz_poly_t Fq,
const ntru_paramsparams 
) [static]
+
+
+

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

+
Parameters:
+ + + + +
apolynomial to invert
Fqpolynomial [out]
paramsNTRU parameters
+
+
+ +

Definition at line 63 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void poly_new (fmpz_poly_t new_poly,
int const *const c,
const size_t len 
)
+
+
+

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:
+ + + + +
new_polythe polynomial to initialize and fill with coefficients [out]
carray of polynomial coefficients, can be NULL
lensize of the coefficient array, can be 0
+
+
+
Returns:
newly allocated polynomial pointer, must be freed with fmpz_poly_clear()
+ +

Definition at line 110 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void poly_starmultiply (const fmpz_poly_t a,
const fmpz_poly_t b,
fmpz_poly_t c,
const ntru_paramsparams,
uint32_t modulus 
)
+
+
+

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

+
Parameters:
+ + + + + + +
apolynom to multiply (can be the same as c)
bpolynom to multiply
cpolynom [out]
paramsNTRU parameters
moduluswhether we use p or q
+
+
+ +

Definition at line 239 of file ntru_poly.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__poly_8c__incl.dot b/ntru__poly_8c__incl.dot new file mode 100644 index 0000000..10505c8 --- /dev/null +++ b/ntru__poly_8c__incl.dot @@ -0,0 +1,39 @@ +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.md5 b/ntru__poly_8c__incl.md5 new file mode 100644 index 0000000..cae12c7 --- /dev/null +++ b/ntru__poly_8c__incl.md5 @@ -0,0 +1 @@ +cf2b10a3d4d39122f153cf5ffd964630 \ No newline at end of file diff --git a/ntru__poly_8c_source.html b/ntru__poly_8c_source.html new file mode 100644 index 0000000..3b7c36f --- /dev/null +++ b/ntru__poly_8c_source.html @@ -0,0 +1,679 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__poly_8h.html b/ntru__poly_8h.html new file mode 100644 index 0000000..873362e --- /dev/null +++ b/ntru__poly_8h.html @@ -0,0 +1,727 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_poly.h File Reference
+
+
+ +

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 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)
+

Detailed Description

+

header for ntru_poly.c

+

Header for the internal API of ntru_poly.c.

+ +

Definition in file ntru_poly.h.

+

Function Documentation

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void fmpz_add_n (fmpz_t f,
const fmpz_t g,
const fmpz_t h 
)
+
+
+

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

+ +

Definition at line 222 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
int fmpz_cmp_si_n (const fmpz_t f,
slong g 
)
+
+
+

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

+
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
+ +

Definition at line 93 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
int fmpz_invmod_ui (fmpz_t f,
const fmpz_t g,
const uint32_t mod 
)
+
+
+

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

+
Parameters:
+ + + + +
fresult [out]
gthe inverse
modthe modulo
+
+
+ +

Definition at line 210 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void fmpz_poly_mod (fmpz_poly_t a,
const uint32_t mod 
)
+
+
+

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:
+ + + +
athe polynom to apply the modulus to
modthe modulus
+
+
+ +

Definition at line 182 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
void fmpz_poly_mod_unsigned (fmpz_poly_t a,
const uint32_t mod 
)
+
+
+

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:
+ + + +
athe polynom to apply the modulus to
modthe modulus
+
+
+ +

Definition at line 166 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void fmpz_poly_set_coeff_fmpz_n (fmpz_poly_t poly,
slong n,
const fmpz_t x 
)
+
+
+

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:
+ + + + +
polythe polynom we want to change a coefficient of
nthe coefficient we want to set
xthe value to assign to the coefficient
+
+
+ +

Definition at line 198 of file ntru_poly.c.

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

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

+
Parameters:
+ + +
polythe polynomial to delete
+
+
+ +

Definition at line 123 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
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:
+ + + +
polythe polynomial to delete
...follow up polynomials
+
+
+ +

Definition at line 149 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
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:
+ + +
poly_arraythe polynomial array
+
+
+ +

Definition at line 131 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void poly_draw (const fmpz_poly_t poly)
+
+
+

Draws a polynomial to stdout.

+
Parameters:
+ + +
polydraw this
+
+
+ +

Definition at line 574 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + +
void poly_draw_pretty (const fmpz_poly_t poly)
+
+
+

Draws a polynomial to stdout, in pretty format.

+
Parameters:
+ + +
polydraw this
+
+
+ +

Definition at line 583 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool poly_inverse_poly_p (const fmpz_poly_t a,
fmpz_poly_t Fp,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
apolynomial to invert
Fppolynomial [out]
paramsNTRU parameters
+
+
+
Returns:
true if invertible, false if not
+ +

Definition at line 409 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
bool poly_inverse_poly_q (const fmpz_poly_t a,
fmpz_poly_t Fq,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
apolynomial to invert (is allowed to be the same as param Fq)
Fqpolynomial [out]
paramsNTRU parameters
+
+
+
Returns:
true if invertible, false if not
+ +

Definition at line 297 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
void poly_new (fmpz_poly_t new_poly,
int const *const c,
const size_t len 
)
+
+
+

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:
+ + + + +
new_polythe polynomial to initialize and fill with coefficients [out]
carray of polynomial coefficients, can be NULL
lensize of the coefficient array, can be 0
+
+
+
Returns:
newly allocated polynomial pointer, must be freed with fmpz_poly_clear()
+ +

Definition at line 110 of file ntru_poly.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void poly_starmultiply (const fmpz_poly_t a,
const fmpz_poly_t b,
fmpz_poly_t c,
const ntru_paramsparams,
uint32_t modulus 
)
+
+
+

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

+
Parameters:
+ + + + + + +
apolynom to multiply (can be the same as c)
bpolynom to multiply
cpolynom [out]
paramsNTRU parameters
moduluswhether we use p or q
+
+
+ +

Definition at line 239 of file ntru_poly.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__poly_8h__incl.dot b/ntru__poly_8h__incl.dot new file mode 100644 index 0000000..4414695 --- /dev/null +++ b/ntru__poly_8h__incl.dot @@ -0,0 +1,21 @@ +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.md5 b/ntru__poly_8h__incl.md5 new file mode 100644 index 0000000..551d2eb --- /dev/null +++ b/ntru__poly_8h__incl.md5 @@ -0,0 +1 @@ +9b93babc2fcd24b4d52e7c54c1f7574e \ No newline at end of file diff --git a/ntru__poly_8h_source.html b/ntru__poly_8h_source.html new file mode 100644 index 0000000..deb5871 --- /dev/null +++ b/ntru__poly_8h_source.html @@ -0,0 +1,204 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_poly.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__poly__ascii_8c.html b/ntru__poly__ascii_8c.html new file mode 100644 index 0000000..d8fa1e5 --- /dev/null +++ b/ntru__poly__ascii_8c.html @@ -0,0 +1,440 @@ + + + + + +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
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
string* bin_poly_arr_to_ascii (const fmpz_poly_t ** bin_poly_arr,
const uint32_t poly_c,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
bin_poly_arrthe array of polynomials
poly_cthe amount of polynomials in bin_poly_arr
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 143 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
string* bin_poly_to_ascii (const fmpz_poly_t poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
polythe binary polynomial to convert
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 114 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + +
static string * get_bin_arr_to_ascii (const char * binary_rep) [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:
+ + +
binary_repthe binary representation of multiple integers concatenated
+
+
+
Returns:
string of corresponding ascii-chars, newly allocated
+ +

Definition at line 69 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
string* poly_arr_to_ascii (const fmpz_poly_t ** poly_array,
const uint32_t poly_c,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
poly_arraythe array of polynomials
poly_cthe amount of polynomials in poly_arr
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 203 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
string* poly_arr_to_base64 (const fmpz_poly_t ** poly_arr,
const uint32_t poly_c,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
poly_arrthe array of polynomials
poly_cthe amount of polynomials in poly_arr
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 264 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
string* poly_to_ascii (const fmpz_poly_t poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
polythe polynomial to convert
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 180 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
string* poly_to_base64 (const fmpz_poly_t poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
polythe polynomial to convert
paramsthe NTRU parameters
+
+
+
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 new file mode 100644 index 0000000..004812b --- /dev/null +++ b/ntru__poly__ascii_8c__incl.dot @@ -0,0 +1,49 @@ +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.md5 b/ntru__poly__ascii_8c__incl.md5 new file mode 100644 index 0000000..d222b4d --- /dev/null +++ b/ntru__poly__ascii_8c__incl.md5 @@ -0,0 +1 @@ +9fcf17a21bcd353f4c16d617d3d52467 \ No newline at end of file diff --git a/ntru__poly__ascii_8c_source.html b/ntru__poly__ascii_8c_source.html new file mode 100644 index 0000000..a8fa80a --- /dev/null +++ b/ntru__poly__ascii_8c_source.html @@ -0,0 +1,372 @@ + + + + + +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
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__poly__ascii_8h.html b/ntru__poly__ascii_8h.html new file mode 100644 index 0000000..4003b5c --- /dev/null +++ b/ntru__poly__ascii_8h.html @@ -0,0 +1,402 @@ + + + + + +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
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_poly_ascii.h File Reference
+
+
+ +

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 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)
+

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

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
string* bin_poly_arr_to_ascii (const fmpz_poly_t ** bin_poly_arr,
const uint32_t poly_c,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
bin_poly_arrthe array of polynomials
poly_cthe amount of polynomials in bin_poly_arr
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 143 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
string* bin_poly_to_ascii (const fmpz_poly_t poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
polythe binary polynomial to convert
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 114 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
string* poly_arr_to_ascii (const fmpz_poly_t ** poly_array,
const uint32_t poly_c,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
poly_arraythe array of polynomials
poly_cthe amount of polynomials in poly_arr
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 203 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
string* poly_arr_to_base64 (const fmpz_poly_t ** poly_arr,
const uint32_t poly_c,
const ntru_paramsparams 
)
+
+
+

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:
+ + + + +
poly_arrthe array of polynomials
poly_cthe amount of polynomials in poly_arr
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 264 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
string* poly_to_ascii (const fmpz_poly_t poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
polythe polynomial to convert
paramsthe NTRU parameters
+
+
+
Returns:
the real string, newly allocated
+ +

Definition at line 180 of file ntru_poly_ascii.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
string* poly_to_base64 (const fmpz_poly_t poly,
const ntru_paramsparams 
)
+
+
+

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:
+ + + +
polythe polynomial to convert
paramsthe NTRU parameters
+
+
+
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 new file mode 100644 index 0000000..34db180 --- /dev/null +++ b/ntru__poly__ascii_8h__incl.dot @@ -0,0 +1,21 @@ +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.md5 b/ntru__poly__ascii_8h__incl.md5 new file mode 100644 index 0000000..e99459f --- /dev/null +++ b/ntru__poly__ascii_8h__incl.md5 @@ -0,0 +1 @@ +6aaf2e6e55206c8741aae7f9a2c4a990 \ No newline at end of file diff --git a/ntru__poly__ascii_8h_source.html b/ntru__poly__ascii_8h_source.html new file mode 100644 index 0000000..d4755bf --- /dev/null +++ b/ntru__poly__ascii_8h_source.html @@ -0,0 +1,168 @@ + + + + + +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
+
+
+ + + + + +
+
+
+
/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_ */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__rnd_8c.html b/ntru__rnd_8c.html new file mode 100644 index 0000000..347a124 --- /dev/null +++ b/ntru__rnd_8c.html @@ -0,0 +1,241 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/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 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))
+

Detailed Description

+

random polynomials

+

This file allows generation of random polynomials.

+ +

Definition in file ntru_rnd.c.

+

Function Documentation

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

Get a random integer from /dev/random.

+
Returns:
random integer
+ +

Definition at line 42 of file ntru_rnd.c.

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

Get a pseudo random integer from /dev/urandom.

+
Returns:
pseudo-random integer.
+ +

Definition at line 66 of file ntru_rnd.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly,
const ntru_paramsparams,
uint32_t num_ones,
uint32_t num_neg_ones,
int(*)(void) rnd_int 
)
+
+
+

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

+
Parameters:
+ + + + + + +
polythe resulting random polynomial [out]
paramsthe NTRU context
num_onesthe number of 1 coefficients
num_neg_onesthe number of -1 coefficients
rnd_intfunction callback which should return a random integer
+
+
+ +

Definition at line 86 of file ntru_rnd.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__rnd_8c__incl.dot b/ntru__rnd_8c__incl.dot new file mode 100644 index 0000000..9351953 --- /dev/null +++ b/ntru__rnd_8c__incl.dot @@ -0,0 +1,33 @@ +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.md5 b/ntru__rnd_8c__incl.md5 new file mode 100644 index 0000000..8100cdf --- /dev/null +++ b/ntru__rnd_8c__incl.md5 @@ -0,0 +1 @@ +b23b0fd1fd1fe2e7b4622e7dff6c8195 \ No newline at end of file diff --git a/ntru__rnd_8c_source.html b/ntru__rnd_8c_source.html new file mode 100644 index 0000000..8ee5dd2 --- /dev/null +++ b/ntru__rnd_8c_source.html @@ -0,0 +1,212 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__rnd_8h.html b/ntru__rnd_8h.html new file mode 100644 index 0000000..a148020 --- /dev/null +++ b/ntru__rnd_8h.html @@ -0,0 +1,236 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_rnd.h File Reference
+
+
+ +

header for ntru_rnd.c +More...

+
#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))
+

Detailed Description

+

header for ntru_rnd.c

+

Header for the internal API of ntru_rnd.c.

+ +

Definition in file ntru_rnd.h.

+

Function Documentation

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

Get a random integer from /dev/random.

+
Returns:
random integer
+ +

Definition at line 42 of file ntru_rnd.c.

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

Get a pseudo random integer from /dev/urandom.

+
Returns:
pseudo-random integer.
+ +

Definition at line 66 of file ntru_rnd.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly,
const ntru_paramsparams,
uint32_t num_ones,
uint32_t num_neg_ones,
int(*)(void) rnd_int 
)
+
+
+

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

+
Parameters:
+ + + + + + +
polythe resulting random polynomial [out]
paramsthe NTRU context
num_onesthe number of 1 coefficients
num_neg_onesthe number of -1 coefficients
rnd_intfunction callback which should return a random integer
+
+
+ +

Definition at line 86 of file ntru_rnd.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__rnd_8h__incl.dot b/ntru__rnd_8h__incl.dot new file mode 100644 index 0000000..35004fa --- /dev/null +++ b/ntru__rnd_8h__incl.dot @@ -0,0 +1,14 @@ +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.md5 b/ntru__rnd_8h__incl.md5 new file mode 100644 index 0000000..573417e --- /dev/null +++ b/ntru__rnd_8h__incl.md5 @@ -0,0 +1 @@ +0568aa53021b7e286e0fea45a123f5ca \ No newline at end of file diff --git a/ntru__rnd_8h_source.html b/ntru__rnd_8h_source.html new file mode 100644 index 0000000..0325d0c --- /dev/null +++ b/ntru__rnd_8h_source.html @@ -0,0 +1,152 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_rnd.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__string_8c.html b/ntru__string_8c.html new file mode 100644 index 0000000..605c279 --- /dev/null +++ b/ntru__string_8c.html @@ -0,0 +1,186 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.c File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_string.c File Reference
+
+
+ +

string type and operations +More...

+
#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)
+

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

+ +
+
+ + + + + + + + +
void prints (const stringprint_string)
+
+
+

Prints the given string to stdout.

+
Parameters:
+ + +
print_stringthe print to string
+
+
+ +

Definition at line 37 of file ntru_string.c.

+ +
+
+ +
+
+ + + + + + + + +
void string_delete (stringdel_string)
+
+
+

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

+
Parameters:
+ + +
del_stringthe string to delete
+
+
+ +

Definition at line 47 of file ntru_string.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__string_8c__incl.dot b/ntru__string_8c__incl.dot new file mode 100644 index 0000000..0578fee --- /dev/null +++ b/ntru__string_8c__incl.dot @@ -0,0 +1,12 @@ +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.md5 b/ntru__string_8c__incl.md5 new file mode 100644 index 0000000..925a0d6 --- /dev/null +++ b/ntru__string_8c__incl.md5 @@ -0,0 +1 @@ +195e19e6637c9f6750988b397c0d4aef \ No newline at end of file diff --git a/ntru__string_8c_source.html b/ntru__string_8c_source.html new file mode 100644 index 0000000..ebcdc5a --- /dev/null +++ b/ntru__string_8c_source.html @@ -0,0 +1,152 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.c Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 /*------------------------------------------------------------------------*/
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__string_8h.html b/ntru__string_8h.html new file mode 100644 index 0000000..f17fd68 --- /dev/null +++ b/ntru__string_8h.html @@ -0,0 +1,209 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/src/ntru_string.h File Reference
+
+
+ +

header for ntru_string.c +More...

+
#include <stdlib.h>
+
+Include dependency graph for ntru_string.h:
+
+
+ + +
+
+

Go to the source code of this file.

+ + + + + + + + +

+Data Structures

struct  string

+Typedefs

typedef struct string string

+Functions

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.

+ +

Definition in file ntru_string.h.

+

Typedef Documentation

+ +
+
+ + + + +
typedef struct string string
+
+
+ +

Definition at line 35 of file ntru_string.h.

+ +
+
+

Function Documentation

+ +
+
+ + + + + + + + +
void prints (const stringprint_string)
+
+
+

Prints the given string to stdout.

+
Parameters:
+ + +
print_stringthe print to string
+
+
+ +

Definition at line 37 of file ntru_string.c.

+ +
+
+ +
+
+ + + + + + + + +
void string_delete (stringdel_string)
+
+
+

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

+
Parameters:
+ + +
del_stringthe string to delete
+
+
+ +

Definition at line 47 of file ntru_string.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/ntru__string_8h__incl.dot b/ntru__string_8h__incl.dot new file mode 100644 index 0000000..f035e87 --- /dev/null +++ b/ntru__string_8h__incl.dot @@ -0,0 +1,8 @@ +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.md5 b/ntru__string_8h__incl.md5 new file mode 100644 index 0000000..c80cc79 --- /dev/null +++ b/ntru__string_8h__incl.md5 @@ -0,0 +1 @@ +326cca46266a4209d85a11f1f4fcaea3 \ No newline at end of file diff --git a/ntru__string_8h_source.html b/ntru__string_8h_source.html new file mode 100644 index 0000000..e68a19c --- /dev/null +++ b/ntru__string_8h_source.html @@ -0,0 +1,151 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/src/ntru_string.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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 */
+
+ + + + +
+ +
+ + + + + + + diff --git a/open.png b/open.png new file mode 100644 index 0000000..7b35d2c Binary files /dev/null and b/open.png differ diff --git a/rnd_8h.html b/rnd_8h.html new file mode 100644 index 0000000..df473ea --- /dev/null +++ b/rnd_8h.html @@ -0,0 +1,237 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/rnd.h File Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
/home/travis/build/hasufell/pqc/include/rnd.h File Reference
+
+
+ +

public API, random polynomials +More...

+
#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))
+

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

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

Get a random integer from /dev/random.

+
Returns:
random integer
+ +

Definition at line 42 of file ntru_rnd.c.

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

Get a pseudo random integer from /dev/urandom.

+
Returns:
pseudo-random integer.
+ +

Definition at line 66 of file ntru_rnd.c.

+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void ntru_get_rnd_tern_poly_num (fmpz_poly_t poly,
const ntru_paramsparams,
uint32_t num_ones,
uint32_t num_neg_ones,
int(*)(void) rnd_int 
)
+
+
+

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

+
Parameters:
+ + + + + + +
polythe resulting random polynomial [out]
paramsthe NTRU context
num_onesthe number of 1 coefficients
num_neg_onesthe number of -1 coefficients
rnd_intfunction callback which should return a random integer
+
+
+ +

Definition at line 86 of file ntru_rnd.c.

+ +
+
+
+ + + + +
+ +
+ + + + + + + diff --git a/rnd_8h__incl.dot b/rnd_8h__incl.dot new file mode 100644 index 0000000..4a9694a --- /dev/null +++ b/rnd_8h__incl.dot @@ -0,0 +1,17 @@ +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.md5 b/rnd_8h__incl.md5 new file mode 100644 index 0000000..a55fa18 --- /dev/null +++ b/rnd_8h__incl.md5 @@ -0,0 +1 @@ +ecaa4ab2c69680f814503c866b1409b4 \ No newline at end of file diff --git a/rnd_8h_source.html b/rnd_8h_source.html new file mode 100644 index 0000000..e7c27bb --- /dev/null +++ b/rnd_8h_source.html @@ -0,0 +1,153 @@ + + + + + +post quantum cryptography: /home/travis/build/hasufell/pqc/include/rnd.h Source File + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+
+
/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_ */
+
+ + + + +
+ +
+ + + + + + + diff --git a/search/all_61.html b/search/all_61.html new file mode 100644 index 0000000..a3164d5 --- /dev/null +++ b/search/all_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_61.js b/search/all_61.js new file mode 100644 index 0000000..342804e --- /dev/null +++ b/search/all_61.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['ascii_5fbin_5fto_5fbin_5fpoly',['ascii_bin_to_bin_poly',['../ntru__ascii__poly_8c.html#aa5d0d4abdb2ce837a0a3b6e478c8f1a9',1,'ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params): ntru_ascii_poly.c'],['../ntru__ascii__poly_8h.html#aa5d0d4abdb2ce837a0a3b6e478c8f1a9',1,'ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params): ntru_ascii_poly.c']]], + ['ascii_5fbits',['ASCII_BITS',['../ntru__common_8h.html#a8d370c21bcf662e586397e764aba95e1',1,'ntru_common.h']]], + ['ascii_5fto_5fbin_5fpoly_5farr',['ascii_to_bin_poly_arr',['../ntru__ascii__poly_8c.html#a3237071bca2489c3b2efd46e674e0805',1,'ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c'],['../ntru__ascii__poly_8h.html#a3237071bca2489c3b2efd46e674e0805',1,'ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c']]] +]; diff --git a/search/all_62.html b/search/all_62.html new file mode 100644 index 0000000..ee8871c --- /dev/null +++ b/search/all_62.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_62.js b/search/all_62.js new file mode 100644 index 0000000..fcb635e --- /dev/null +++ b/search/all_62.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['base64_5fto_5fpoly_5farr',['base64_to_poly_arr',['../ntru__ascii__poly_8c.html#a8460cd27ad4562f560bb304609a3e06d',1,'base64_to_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c'],['../ntru__ascii__poly_8h.html#a8460cd27ad4562f560bb304609a3e06d',1,'base64_to_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c']]], + ['bin_5fpoly_5farr_5fto_5fascii',['bin_poly_arr_to_ascii',['../ntru__poly__ascii_8c.html#ab9464c96c3ebec6ee716c604fdc4ad21',1,'bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#ab9464c96c3ebec6ee716c604fdc4ad21',1,'bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c']]], + ['bin_5fpoly_5fto_5fascii',['bin_poly_to_ascii',['../ntru__poly__ascii_8c.html#a0d86ab2dede39b332d4149e16b2046b8',1,'bin_poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#a0d86ab2dede39b332d4149e16b2046b8',1,'bin_poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c']]] +]; diff --git a/search/all_63.html b/search/all_63.html new file mode 100644 index 0000000..56b5ad1 --- /dev/null +++ b/search/all_63.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_63.js b/search/all_63.js new file mode 100644 index 0000000..dbb85e2 --- /dev/null +++ b/search/all_63.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['char_5fsize',['CHAR_SIZE',['../ntru__common_8h.html#a22c7f61c2f0fa6b1943548e838055cec',1,'ntru_common.h']]] +]; diff --git a/search/all_64.html b/search/all_64.html new file mode 100644 index 0000000..b53ff08 --- /dev/null +++ b/search/all_64.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_64.js b/search/all_64.js new file mode 100644 index 0000000..609a56f --- /dev/null +++ b/search/all_64.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['decrypt_2eh',['decrypt.h',['../decrypt_8h.html',1,'']]], + ['doxygen_2edox',['doxygen.dox',['../doxygen_8dox.html',1,'']]] +]; diff --git a/search/all_65.html b/search/all_65.html new file mode 100644 index 0000000..66cc834 --- /dev/null +++ b/search/all_65.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_65.js b/search/all_65.js new file mode 100644 index 0000000..d222bc6 --- /dev/null +++ b/search/all_65.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['encrypt_2eh',['encrypt.h',['../encrypt_8h.html',1,'']]], + ['export_5fpriv_5fkey',['export_priv_key',['../ntru__keypair_8c.html#afa29f14a14486d3f6b979ee900d7e738',1,'export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#afa29f14a14486d3f6b979ee900d7e738',1,'export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#afa29f14a14486d3f6b979ee900d7e738',1,'export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params): ntru_keypair.c']]], + ['export_5fpublic_5fkey',['export_public_key',['../ntru__keypair_8c.html#a41741ed660cb806c47335f66055e1bdd',1,'export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a41741ed660cb806c47335f66055e1bdd',1,'export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a41741ed660cb806c47335f66055e1bdd',1,'export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c']]] +]; diff --git a/search/all_66.html b/search/all_66.html new file mode 100644 index 0000000..3d1f8b3 --- /dev/null +++ b/search/all_66.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_66.js b/search/all_66.js new file mode 100644 index 0000000..dfec881 --- /dev/null +++ b/search/all_66.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['fmpz_5fadd_5fn',['fmpz_add_n',['../ntru__poly_8c.html#ad2a11e832808ef1cfee0eed1cc02f4b9',1,'fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h): ntru_poly.c'],['../ntru__poly_8h.html#ad2a11e832808ef1cfee0eed1cc02f4b9',1,'fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h): ntru_poly.c']]], + ['fmpz_5fcmp_5fsi_5fn',['fmpz_cmp_si_n',['../ntru__poly_8c.html#aaaac83ec72414aa208832442657c3520',1,'fmpz_cmp_si_n(const fmpz_t f, slong g): ntru_poly.c'],['../ntru__poly_8h.html#aaaac83ec72414aa208832442657c3520',1,'fmpz_cmp_si_n(const fmpz_t f, slong g): ntru_poly.c']]], + ['fmpz_5finvmod_5fui',['fmpz_invmod_ui',['../ntru__poly_8c.html#a59da1b7962829af8f18d58c05f588606',1,'fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod): ntru_poly.c'],['../ntru__poly_8h.html#a59da1b7962829af8f18d58c05f588606',1,'fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod): ntru_poly.c']]], + ['fmpz_5fpoly_5fmod',['fmpz_poly_mod',['../ntru__poly_8c.html#a7c4f5e96355518dc97a23da8f34b661a',1,'fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod): ntru_poly.c'],['../ntru__poly_8h.html#a7c4f5e96355518dc97a23da8f34b661a',1,'fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod): ntru_poly.c']]], + ['fmpz_5fpoly_5fmod_5funsigned',['fmpz_poly_mod_unsigned',['../ntru__poly_8c.html#ae7d0d8364dba689df3fb4904610634cc',1,'fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod): ntru_poly.c'],['../ntru__poly_8h.html#ae7d0d8364dba689df3fb4904610634cc',1,'fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod): ntru_poly.c']]], + ['fmpz_5fpoly_5fset_5fcoeff_5ffmpz_5fn',['fmpz_poly_set_coeff_fmpz_n',['../ntru__poly_8c.html#ab1f966fe680d1ce7c19c8c812d1932a7',1,'fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n, const fmpz_t x): ntru_poly.c'],['../ntru__poly_8h.html#ab1f966fe680d1ce7c19c8c812d1932a7',1,'fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n, const fmpz_t x): ntru_poly.c']]] +]; diff --git a/search/all_67.html b/search/all_67.html new file mode 100644 index 0000000..41a459a --- /dev/null +++ b/search/all_67.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_67.js b/search/all_67.js new file mode 100644 index 0000000..ae0b615 --- /dev/null +++ b/search/all_67.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['get_5fbin_5farr_5fto_5fascii',['get_bin_arr_to_ascii',['../ntru__poly__ascii_8c.html#afd3f036287b4f62846c1a236426d73e1',1,'ntru_poly_ascii.c']]], + ['get_5fint_5fto_5fbin_5fstr',['get_int_to_bin_str',['../ntru__ascii__poly_8c.html#a2d2f760b6a98bd87248c1d3e120a665b',1,'ntru_ascii_poly.c']]], + ['get_5frnd_5fint',['get_rnd_int',['../ntru__rnd_8c.html#ad85ebfb1cb4b4942942213b750812cf0',1,'get_rnd_int(void): ntru_rnd.c'],['../ntru__rnd_8h.html#ad85ebfb1cb4b4942942213b750812cf0',1,'get_rnd_int(void): ntru_rnd.c'],['../rnd_8h.html#ad85ebfb1cb4b4942942213b750812cf0',1,'get_rnd_int(void): ntru_rnd.c']]], + ['get_5furnd_5fint',['get_urnd_int',['../ntru__rnd_8c.html#a99e4820cab7157eb1e16109e21dac81f',1,'get_urnd_int(void): ntru_rnd.c'],['../ntru__rnd_8h.html#a99e4820cab7157eb1e16109e21dac81f',1,'get_urnd_int(void): ntru_rnd.c'],['../rnd_8h.html#a99e4820cab7157eb1e16109e21dac81f',1,'get_urnd_int(void): ntru_rnd.c']]] +]; diff --git a/search/all_69.html b/search/all_69.html new file mode 100644 index 0000000..1a00b55 --- /dev/null +++ b/search/all_69.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_69.js b/search/all_69.js new file mode 100644 index 0000000..b5b3bb4 --- /dev/null +++ b/search/all_69.js @@ -0,0 +1,5 @@ +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']]] +]; diff --git a/search/all_6b.html b/search/all_6b.html new file mode 100644 index 0000000..571dadb --- /dev/null +++ b/search/all_6b.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6b.js b/search/all_6b.js new file mode 100644 index 0000000..d6f0d75 --- /dev/null +++ b/search/all_6b.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['keypair',['keypair',['../structkeypair.html',1,'keypair'],['../ntru__keypair_8h.html#aacfc9254c7939584924ab9d27ba6f504',1,'keypair(): ntru_keypair.h'],['../keypair_8h.html#aacfc9254c7939584924ab9d27ba6f504',1,'keypair(): keypair.h']]], + ['keypair_2eh',['keypair.h',['../keypair_8h.html',1,'']]] +]; diff --git a/search/all_6c.html b/search/all_6c.html new file mode 100644 index 0000000..f6383cc --- /dev/null +++ b/search/all_6c.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6c.js b/search/all_6c.js new file mode 100644 index 0000000..097a1e6 --- /dev/null +++ b/search/all_6c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['len',['len',['../structstring.html#aa6bcf0353fd5cf2f374a9b1dd0e4a73a',1,'string']]] +]; diff --git a/search/all_6e.html b/search/all_6e.html new file mode 100644 index 0000000..1f92ee5 --- /dev/null +++ b/search/all_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_6e.js b/search/all_6e.js new file mode 100644 index 0000000..d860054 --- /dev/null +++ b/search/all_6e.js @@ -0,0 +1,42 @@ +var searchData= +[ + ['n',['N',['../structntru__params.html#afb8425ee3db2b917b3c4e8d9b75bd3ff',1,'ntru_params']]], + ['ntru_2eh',['ntru.h',['../ntru_8h.html',1,'']]], + ['ntru_5fabort',['NTRU_ABORT',['../ntru__err_8h.html#ab0f71521e9bc99beab8ece52bb00341a',1,'ntru_err.h']]], + ['ntru_5fabort_5fdebug',['NTRU_ABORT_DEBUG',['../ntru__err_8h.html#a5d4dd1c1539c408c0dcd915750e8f224',1,'ntru_err.h']]], + ['ntru_5fascii_5fpoly_2ec',['ntru_ascii_poly.c',['../ntru__ascii__poly_8c.html',1,'']]], + ['ntru_5fascii_5fpoly_2eh',['ntru_ascii_poly.h',['../ntru__ascii__poly_8h.html',1,'']]], + ['ntru_5fcalloc',['ntru_calloc',['../ntru__mem_8c.html#a37e0be4fd8d0b677a41c8287ef47885c',1,'ntru_calloc(size_t nmemb, size_t size): ntru_mem.c'],['../ntru__mem_8h.html#a37e0be4fd8d0b677a41c8287ef47885c',1,'ntru_calloc(size_t nmemb, size_t size): ntru_mem.c']]], + ['ntru_5fcommon_2eh',['ntru_common.h',['../ntru__common_8h.html',1,'']]], + ['ntru_5fcreate_5fkeypair',['ntru_create_keypair',['../ntru__keypair_8c.html#a6873d41211a92c4f6b0074ef34ae1743',1,'ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a6873d41211a92c4f6b0074ef34ae1743',1,'ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a6873d41211a92c4f6b0074ef34ae1743',1,'ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params): ntru_keypair.c']]], + ['ntru_5fdecrypt_2ec',['ntru_decrypt.c',['../ntru__decrypt_8c.html',1,'']]], + ['ntru_5fdecrypt_2eh',['ntru_decrypt.h',['../ntru__decrypt_8h.html',1,'']]], + ['ntru_5fdecrypt_5fpoly',['ntru_decrypt_poly',['../ntru__decrypt_8c.html#a41c72f59e37a3c6ef6790eb909555d76',1,'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): ntru_decrypt.c'],['../ntru__decrypt_8h.html#a8108219b815b18d63672bbc45e76ca31',1,'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): ntru_decrypt.c']]], + ['ntru_5fdecrypt_5fstring',['ntru_decrypt_string',['../ntru__decrypt_8c.html#aa9cc61eec0c119e48762f6078a14527b',1,'ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params): ntru_decrypt.c'],['../ntru__decrypt_8h.html#aa9cc61eec0c119e48762f6078a14527b',1,'ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params): ntru_decrypt.c'],['../decrypt_8h.html#aa9cc61eec0c119e48762f6078a14527b',1,'ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params): ntru_decrypt.c']]], + ['ntru_5fdelete_5fkeypair',['ntru_delete_keypair',['../ntru__keypair_8c.html#a5279c4990bc22bb9e735fe36372a6786',1,'ntru_delete_keypair(keypair *pair): ntru_keypair.c'],['../ntru__keypair_8h.html#a5279c4990bc22bb9e735fe36372a6786',1,'ntru_delete_keypair(keypair *pair): ntru_keypair.c'],['../keypair_8h.html#a5279c4990bc22bb9e735fe36372a6786',1,'ntru_delete_keypair(keypair *pair): ntru_keypair.c']]], + ['ntru_5fencrypt_2ec',['ntru_encrypt.c',['../ntru__encrypt_8c.html',1,'']]], + ['ntru_5fencrypt_2eh',['ntru_encrypt.h',['../ntru__encrypt_8h.html',1,'']]], + ['ntru_5fencrypt_5fpoly',['ntru_encrypt_poly',['../ntru__encrypt_8c.html#a0156453c7cab7cf3da259beb1daf914b',1,'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): ntru_encrypt.c'],['../ntru__encrypt_8h.html#a9063450af4b523d202c7628dbac70e68',1,'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): ntru_encrypt.c']]], + ['ntru_5fencrypt_5fstring',['ntru_encrypt_string',['../ntru__encrypt_8c.html#a0bb47c0fa0dd4a4cfa0c0f7a722fd554',1,'ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params): ntru_encrypt.c'],['../ntru__encrypt_8h.html#a0bb47c0fa0dd4a4cfa0c0f7a722fd554',1,'ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params): ntru_encrypt.c'],['../encrypt_8h.html#a0bb47c0fa0dd4a4cfa0c0f7a722fd554',1,'ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params): ntru_encrypt.c']]], + ['ntru_5ferr_2eh',['ntru_err.h',['../ntru__err_8h.html',1,'']]], + ['ntru_5ffile_2ec',['ntru_file.c',['../ntru__file_8c.html',1,'']]], + ['ntru_5ffile_2eh',['ntru_file.h',['../ntru__file_8h.html',1,'']]], + ['ntru_5fget_5frnd_5ftern_5fpoly_5fnum',['ntru_get_rnd_tern_poly_num',['../ntru__rnd_8c.html#a916a55c609c172ae4e48896032b36e47',1,'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)): ntru_rnd.c'],['../ntru__rnd_8h.html#a916a55c609c172ae4e48896032b36e47',1,'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)): ntru_rnd.c'],['../rnd_8h.html#a916a55c609c172ae4e48896032b36e47',1,'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)): ntru_rnd.c']]], + ['ntru_5fkeypair_2ec',['ntru_keypair.c',['../ntru__keypair_8c.html',1,'']]], + ['ntru_5fkeypair_2eh',['ntru_keypair.h',['../ntru__keypair_8h.html',1,'']]], + ['ntru_5fmalloc',['ntru_malloc',['../ntru__mem_8c.html#a020790bf8b201fde92395cf975c0c691',1,'ntru_malloc(size_t size): ntru_mem.c'],['../ntru__mem_8h.html#a020790bf8b201fde92395cf975c0c691',1,'ntru_malloc(size_t size): ntru_mem.c']]], + ['ntru_5fmem_2ec',['ntru_mem.c',['../ntru__mem_8c.html',1,'']]], + ['ntru_5fmem_2eh',['ntru_mem.h',['../ntru__mem_8h.html',1,'']]], + ['ntru_5fparams',['ntru_params',['../structntru__params.html',1,'ntru_params'],['../ntru__params_8h.html#a2f326c88fc033eca78a47ee8d387c592',1,'ntru_params(): ntru_params.h'],['../ntru_8h.html#a2f326c88fc033eca78a47ee8d387c592',1,'ntru_params(): ntru.h']]], + ['ntru_5fparams_2eh',['ntru_params.h',['../ntru__params_8h.html',1,'']]], + ['ntru_5fpoly_2ec',['ntru_poly.c',['../ntru__poly_8c.html',1,'']]], + ['ntru_5fpoly_2eh',['ntru_poly.h',['../ntru__poly_8h.html',1,'']]], + ['ntru_5fpoly_5fascii_2ec',['ntru_poly_ascii.c',['../ntru__poly__ascii_8c.html',1,'']]], + ['ntru_5fpoly_5fascii_2eh',['ntru_poly_ascii.h',['../ntru__poly__ascii_8h.html',1,'']]], + ['ntru_5frnd_2ec',['ntru_rnd.c',['../ntru__rnd_8c.html',1,'']]], + ['ntru_5frnd_2eh',['ntru_rnd.h',['../ntru__rnd_8h.html',1,'']]], + ['ntru_5fstring_2ec',['ntru_string.c',['../ntru__string_8c.html',1,'']]], + ['ntru_5fstring_2eh',['ntru_string.h',['../ntru__string_8h.html',1,'']]], + ['ntru_5fwarn',['NTRU_WARN',['../ntru__err_8h.html#a8b2647533f0e1a6f81e08e8315674d55',1,'ntru_err.h']]], + ['ntru_5fwarn_5fdebug',['NTRU_WARN_DEBUG',['../ntru__err_8h.html#abcb6d051074ab3a58c5e9764f927753c',1,'ntru_err.h']]] +]; diff --git a/search/all_70.html b/search/all_70.html new file mode 100644 index 0000000..0340151 --- /dev/null +++ b/search/all_70.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_70.js b/search/all_70.js new file mode 100644 index 0000000..6d7a891 --- /dev/null +++ b/search/all_70.js @@ -0,0 +1,23 @@ +var searchData= +[ + ['p',['p',['../structntru__params.html#a41b368825e1eb126604e13e8f549ec8f',1,'ntru_params']]], + ['poly_5farr_5fto_5fascii',['poly_arr_to_ascii',['../ntru__poly__ascii_8c.html#afa141976b665b94c0db9912bc50de4a1',1,'poly_arr_to_ascii(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#afa141976b665b94c0db9912bc50de4a1',1,'poly_arr_to_ascii(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c']]], + ['poly_5farr_5fto_5fbase64',['poly_arr_to_base64',['../ntru__poly__ascii_8c.html#a0dc14698073df2e46e6540cbff870fc7',1,'poly_arr_to_base64(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#a16163cc57631a0965577cb0f89365ca0',1,'poly_arr_to_base64(const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c']]], + ['poly_5fdelete',['poly_delete',['../ntru__poly_8c.html#a27ff2116f70bcbf5028219adcae4c5f0',1,'poly_delete(fmpz_poly_t poly): ntru_poly.c'],['../ntru__poly_8h.html#a27ff2116f70bcbf5028219adcae4c5f0',1,'poly_delete(fmpz_poly_t poly): ntru_poly.c'],['../ntru_8h.html#a27ff2116f70bcbf5028219adcae4c5f0',1,'poly_delete(fmpz_poly_t poly): ntru_poly.c']]], + ['poly_5fdelete_5fall',['poly_delete_all',['../ntru__poly_8c.html#a83297bc2ab5b6e7ce42553570dd8268f',1,'poly_delete_all(fmpz_poly_t poly,...): ntru_poly.c'],['../ntru__poly_8h.html#a83297bc2ab5b6e7ce42553570dd8268f',1,'poly_delete_all(fmpz_poly_t poly,...): ntru_poly.c'],['../ntru_8h.html#a83297bc2ab5b6e7ce42553570dd8268f',1,'poly_delete_all(fmpz_poly_t poly,...): ntru_poly.c']]], + ['poly_5fdelete_5farray',['poly_delete_array',['../ntru__poly_8c.html#a3f53c63383ff301b20dcede0783869a7',1,'poly_delete_array(fmpz_poly_t **poly_array): ntru_poly.c'],['../ntru__poly_8h.html#a3f53c63383ff301b20dcede0783869a7',1,'poly_delete_array(fmpz_poly_t **poly_array): ntru_poly.c'],['../ntru_8h.html#a3f53c63383ff301b20dcede0783869a7',1,'poly_delete_array(fmpz_poly_t **poly_array): ntru_poly.c']]], + ['poly_5fdraw',['poly_draw',['../ntru__poly_8c.html#a80a8ce0f2944bc3df94291ef2f781498',1,'poly_draw(const fmpz_poly_t poly): ntru_poly.c'],['../ntru__poly_8h.html#a80a8ce0f2944bc3df94291ef2f781498',1,'poly_draw(const fmpz_poly_t poly): ntru_poly.c'],['../ntru_8h.html#a80a8ce0f2944bc3df94291ef2f781498',1,'poly_draw(const fmpz_poly_t poly): ntru_poly.c']]], + ['poly_5fdraw_5fpretty',['poly_draw_pretty',['../ntru__poly_8c.html#aec098d00160d2d502eb1f8a7c3fa5453',1,'poly_draw_pretty(const fmpz_poly_t poly): ntru_poly.c'],['../ntru__poly_8h.html#aec098d00160d2d502eb1f8a7c3fa5453',1,'poly_draw_pretty(const fmpz_poly_t poly): ntru_poly.c'],['../ntru_8h.html#aec098d00160d2d502eb1f8a7c3fa5453',1,'poly_draw_pretty(const fmpz_poly_t poly): ntru_poly.c']]], + ['poly_5finverse_5fpoly_5fp',['poly_inverse_poly_p',['../ntru__poly_8c.html#ae77b2014df42e5ed612206d5930ac608',1,'poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params): ntru_poly.c'],['../ntru__poly_8h.html#ae77b2014df42e5ed612206d5930ac608',1,'poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params): ntru_poly.c']]], + ['poly_5finverse_5fpoly_5fq',['poly_inverse_poly_q',['../ntru__poly_8c.html#ace66beb516186e52f9b5b1ed8a397849',1,'poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params): ntru_poly.c'],['../ntru__poly_8h.html#ace66beb516186e52f9b5b1ed8a397849',1,'poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params): ntru_poly.c']]], + ['poly_5fmod2_5fto_5fmodq',['poly_mod2_to_modq',['../ntru__poly_8c.html#a891af13dc4355c9fab9ca3fafcac8054',1,'ntru_poly.c']]], + ['poly_5fnew',['poly_new',['../ntru__poly_8c.html#a20f86085d5eb5372fd25dc270069d38c',1,'poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len): ntru_poly.c'],['../ntru__poly_8h.html#a20f86085d5eb5372fd25dc270069d38c',1,'poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len): ntru_poly.c'],['../ntru_8h.html#a20f86085d5eb5372fd25dc270069d38c',1,'poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len): ntru_poly.c']]], + ['poly_5fstarmultiply',['poly_starmultiply',['../ntru__poly_8c.html#ae96f479ddd97af709a0ed50817fd3fb3',1,'poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus): ntru_poly.c'],['../ntru__poly_8h.html#ae96f479ddd97af709a0ed50817fd3fb3',1,'poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus): ntru_poly.c']]], + ['poly_5fto_5fascii',['poly_to_ascii',['../ntru__poly__ascii_8c.html#aa4d233591b7e51d6cf787edd3bfa91e2',1,'poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#aa4d233591b7e51d6cf787edd3bfa91e2',1,'poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c']]], + ['poly_5fto_5fbase64',['poly_to_base64',['../ntru__poly__ascii_8c.html#a4ba0179e3ae0d5e721ff8429a8265e80',1,'poly_to_base64(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#a4ba0179e3ae0d5e721ff8429a8265e80',1,'poly_to_base64(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c']]], + ['prints',['prints',['../ntru__string_8c.html#a55d4ce182c335ff6cca360909a7be395',1,'prints(const string *print_string): ntru_string.c'],['../ntru__string_8h.html#a55d4ce182c335ff6cca360909a7be395',1,'prints(const string *print_string): ntru_string.c'],['../ntru_8h.html#a55d4ce182c335ff6cca360909a7be395',1,'prints(const string *print_string): ntru_string.c']]], + ['priv',['priv',['../structkeypair.html#a9e9805ad001216da53f2c57accb288e1',1,'keypair']]], + ['priv_5finv',['priv_inv',['../structkeypair.html#a9e63f1d275b91c9d9716fb4069461799',1,'keypair']]], + ['ptr',['ptr',['../structstring.html#afd608f62303958cea6f1f7afdec1e282',1,'string']]], + ['pub',['pub',['../structkeypair.html#afa635c70f233d0b7449b4a17513646c4',1,'keypair']]] +]; diff --git a/search/all_71.html b/search/all_71.html new file mode 100644 index 0000000..b4dc1e6 --- /dev/null +++ b/search/all_71.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_71.js b/search/all_71.js new file mode 100644 index 0000000..0dbc610 --- /dev/null +++ b/search/all_71.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['q',['q',['../structntru__params.html#a29680750bda49dc93e61a752b2f2a0f7',1,'ntru_params']]] +]; diff --git a/search/all_72.html b/search/all_72.html new file mode 100644 index 0000000..0ab18d6 --- /dev/null +++ b/search/all_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_72.js b/search/all_72.js new file mode 100644 index 0000000..6216110 --- /dev/null +++ b/search/all_72.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['read_5ffile',['read_file',['../ntru__file_8c.html#a348c2a56837571f410d44631abc09dc4',1,'read_file(char const *const filename): ntru_file.c'],['../ntru__file_8h.html#a348c2a56837571f410d44631abc09dc4',1,'read_file(char const *const filename): ntru_file.c'],['../ntru_8h.html#a348c2a56837571f410d44631abc09dc4',1,'read_file(char const *const filename): ntru_file.c']]], + ['realloc',['REALLOC',['../ntru__mem_8h.html#a718b6446905826d711cb7ef00808bb4e',1,'ntru_mem.h']]], + ['rnd_2eh',['rnd.h',['../rnd_8h.html',1,'']]] +]; diff --git a/search/all_73.html b/search/all_73.html new file mode 100644 index 0000000..1ec8f17 --- /dev/null +++ b/search/all_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_73.js b/search/all_73.js new file mode 100644 index 0000000..0b1f896 --- /dev/null +++ b/search/all_73.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['std_5ffile_5fbuf',['STD_FILE_BUF',['../ntru__file_8c.html#a15651456278c8f50777dfe104f492951',1,'ntru_file.c']]], + ['string',['string',['../structstring.html',1,'string'],['../ntru__string_8h.html#a63e2e3ee7db5274c6a3929edfc07c6c9',1,'string(): ntru_string.h'],['../ntru_8h.html#a63e2e3ee7db5274c6a3929edfc07c6c9',1,'string(): ntru.h']]], + ['string_5fdelete',['string_delete',['../ntru__string_8c.html#ac1b5f66fbbbdfc7901357ddcfec52e5a',1,'string_delete(string *del_string): ntru_string.c'],['../ntru__string_8h.html#ac1b5f66fbbbdfc7901357ddcfec52e5a',1,'string_delete(string *del_string): ntru_string.c'],['../ntru_8h.html#ac1b5f66fbbbdfc7901357ddcfec52e5a',1,'string_delete(string *del_string): ntru_string.c']]] +]; diff --git a/search/all_77.html b/search/all_77.html new file mode 100644 index 0000000..73323d3 --- /dev/null +++ b/search/all_77.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/all_77.js b/search/all_77.js new file mode 100644 index 0000000..0f707cd --- /dev/null +++ b/search/all_77.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['write_5ffile',['write_file',['../ntru__file_8c.html#a1f8eef5ea12c77ed2491d96864eb0d43',1,'write_file(string const *wstring, char const *const filename): ntru_file.c'],['../ntru__file_8h.html#a1f8eef5ea12c77ed2491d96864eb0d43',1,'write_file(string const *wstring, char const *const filename): ntru_file.c'],['../ntru_8h.html#af2a0fc4dd4109749d8f3100a913cc304',1,'write_file(string const *wstring, char const *const filename): ntru_file.c']]] +]; diff --git a/search/classes_6b.html b/search/classes_6b.html new file mode 100644 index 0000000..f9c2dc8 --- /dev/null +++ b/search/classes_6b.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_6b.js b/search/classes_6b.js new file mode 100644 index 0000000..92c18ab --- /dev/null +++ b/search/classes_6b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['keypair',['keypair',['../structkeypair.html',1,'']]] +]; diff --git a/search/classes_6e.html b/search/classes_6e.html new file mode 100644 index 0000000..44803ba --- /dev/null +++ b/search/classes_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_6e.js b/search/classes_6e.js new file mode 100644 index 0000000..60f3a7e --- /dev/null +++ b/search/classes_6e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['ntru_5fparams',['ntru_params',['../structntru__params.html',1,'']]] +]; diff --git a/search/classes_73.html b/search/classes_73.html new file mode 100644 index 0000000..a1bf0b9 --- /dev/null +++ b/search/classes_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/classes_73.js b/search/classes_73.js new file mode 100644 index 0000000..0b3b4b1 --- /dev/null +++ b/search/classes_73.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['string',['string',['../structstring.html',1,'']]] +]; diff --git a/search/close.png b/search/close.png new file mode 100644 index 0000000..9342d3d Binary files /dev/null and b/search/close.png differ diff --git a/search/defines_61.html b/search/defines_61.html new file mode 100644 index 0000000..039f0b7 --- /dev/null +++ b/search/defines_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/defines_61.js b/search/defines_61.js new file mode 100644 index 0000000..adccf1d --- /dev/null +++ b/search/defines_61.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['ascii_5fbits',['ASCII_BITS',['../ntru__common_8h.html#a8d370c21bcf662e586397e764aba95e1',1,'ntru_common.h']]] +]; diff --git a/search/defines_63.html b/search/defines_63.html new file mode 100644 index 0000000..35ff8ae --- /dev/null +++ b/search/defines_63.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/defines_63.js b/search/defines_63.js new file mode 100644 index 0000000..dbb85e2 --- /dev/null +++ b/search/defines_63.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['char_5fsize',['CHAR_SIZE',['../ntru__common_8h.html#a22c7f61c2f0fa6b1943548e838055cec',1,'ntru_common.h']]] +]; diff --git a/search/defines_6e.html b/search/defines_6e.html new file mode 100644 index 0000000..5b7f68f --- /dev/null +++ b/search/defines_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/defines_6e.js b/search/defines_6e.js new file mode 100644 index 0000000..134a711 --- /dev/null +++ b/search/defines_6e.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['ntru_5fabort',['NTRU_ABORT',['../ntru__err_8h.html#ab0f71521e9bc99beab8ece52bb00341a',1,'ntru_err.h']]], + ['ntru_5fabort_5fdebug',['NTRU_ABORT_DEBUG',['../ntru__err_8h.html#a5d4dd1c1539c408c0dcd915750e8f224',1,'ntru_err.h']]], + ['ntru_5fwarn',['NTRU_WARN',['../ntru__err_8h.html#a8b2647533f0e1a6f81e08e8315674d55',1,'ntru_err.h']]], + ['ntru_5fwarn_5fdebug',['NTRU_WARN_DEBUG',['../ntru__err_8h.html#abcb6d051074ab3a58c5e9764f927753c',1,'ntru_err.h']]] +]; diff --git a/search/defines_72.html b/search/defines_72.html new file mode 100644 index 0000000..e6a82c4 --- /dev/null +++ b/search/defines_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/defines_72.js b/search/defines_72.js new file mode 100644 index 0000000..0083cc9 --- /dev/null +++ b/search/defines_72.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['realloc',['REALLOC',['../ntru__mem_8h.html#a718b6446905826d711cb7ef00808bb4e',1,'ntru_mem.h']]] +]; diff --git a/search/defines_73.html b/search/defines_73.html new file mode 100644 index 0000000..913ae48 --- /dev/null +++ b/search/defines_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/defines_73.js b/search/defines_73.js new file mode 100644 index 0000000..a37dd70 --- /dev/null +++ b/search/defines_73.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['std_5ffile_5fbuf',['STD_FILE_BUF',['../ntru__file_8c.html#a15651456278c8f50777dfe104f492951',1,'ntru_file.c']]] +]; diff --git a/search/files_64.html b/search/files_64.html new file mode 100644 index 0000000..1a32bf8 --- /dev/null +++ b/search/files_64.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_64.js b/search/files_64.js new file mode 100644 index 0000000..609a56f --- /dev/null +++ b/search/files_64.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['decrypt_2eh',['decrypt.h',['../decrypt_8h.html',1,'']]], + ['doxygen_2edox',['doxygen.dox',['../doxygen_8dox.html',1,'']]] +]; diff --git a/search/files_65.html b/search/files_65.html new file mode 100644 index 0000000..1eadd1b --- /dev/null +++ b/search/files_65.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_65.js b/search/files_65.js new file mode 100644 index 0000000..8b87812 --- /dev/null +++ b/search/files_65.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['encrypt_2eh',['encrypt.h',['../encrypt_8h.html',1,'']]] +]; diff --git a/search/files_6b.html b/search/files_6b.html new file mode 100644 index 0000000..fd26f57 --- /dev/null +++ b/search/files_6b.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_6b.js b/search/files_6b.js new file mode 100644 index 0000000..353d4f2 --- /dev/null +++ b/search/files_6b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['keypair_2eh',['keypair.h',['../keypair_8h.html',1,'']]] +]; diff --git a/search/files_6e.html b/search/files_6e.html new file mode 100644 index 0000000..9e30d62 --- /dev/null +++ b/search/files_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_6e.js b/search/files_6e.js new file mode 100644 index 0000000..11e19e9 --- /dev/null +++ b/search/files_6e.js @@ -0,0 +1,27 @@ +var searchData= +[ + ['ntru_2eh',['ntru.h',['../ntru_8h.html',1,'']]], + ['ntru_5fascii_5fpoly_2ec',['ntru_ascii_poly.c',['../ntru__ascii__poly_8c.html',1,'']]], + ['ntru_5fascii_5fpoly_2eh',['ntru_ascii_poly.h',['../ntru__ascii__poly_8h.html',1,'']]], + ['ntru_5fcommon_2eh',['ntru_common.h',['../ntru__common_8h.html',1,'']]], + ['ntru_5fdecrypt_2ec',['ntru_decrypt.c',['../ntru__decrypt_8c.html',1,'']]], + ['ntru_5fdecrypt_2eh',['ntru_decrypt.h',['../ntru__decrypt_8h.html',1,'']]], + ['ntru_5fencrypt_2ec',['ntru_encrypt.c',['../ntru__encrypt_8c.html',1,'']]], + ['ntru_5fencrypt_2eh',['ntru_encrypt.h',['../ntru__encrypt_8h.html',1,'']]], + ['ntru_5ferr_2eh',['ntru_err.h',['../ntru__err_8h.html',1,'']]], + ['ntru_5ffile_2ec',['ntru_file.c',['../ntru__file_8c.html',1,'']]], + ['ntru_5ffile_2eh',['ntru_file.h',['../ntru__file_8h.html',1,'']]], + ['ntru_5fkeypair_2ec',['ntru_keypair.c',['../ntru__keypair_8c.html',1,'']]], + ['ntru_5fkeypair_2eh',['ntru_keypair.h',['../ntru__keypair_8h.html',1,'']]], + ['ntru_5fmem_2ec',['ntru_mem.c',['../ntru__mem_8c.html',1,'']]], + ['ntru_5fmem_2eh',['ntru_mem.h',['../ntru__mem_8h.html',1,'']]], + ['ntru_5fparams_2eh',['ntru_params.h',['../ntru__params_8h.html',1,'']]], + ['ntru_5fpoly_2ec',['ntru_poly.c',['../ntru__poly_8c.html',1,'']]], + ['ntru_5fpoly_2eh',['ntru_poly.h',['../ntru__poly_8h.html',1,'']]], + ['ntru_5fpoly_5fascii_2ec',['ntru_poly_ascii.c',['../ntru__poly__ascii_8c.html',1,'']]], + ['ntru_5fpoly_5fascii_2eh',['ntru_poly_ascii.h',['../ntru__poly__ascii_8h.html',1,'']]], + ['ntru_5frnd_2ec',['ntru_rnd.c',['../ntru__rnd_8c.html',1,'']]], + ['ntru_5frnd_2eh',['ntru_rnd.h',['../ntru__rnd_8h.html',1,'']]], + ['ntru_5fstring_2ec',['ntru_string.c',['../ntru__string_8c.html',1,'']]], + ['ntru_5fstring_2eh',['ntru_string.h',['../ntru__string_8h.html',1,'']]] +]; diff --git a/search/files_72.html b/search/files_72.html new file mode 100644 index 0000000..609fb48 --- /dev/null +++ b/search/files_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/files_72.js b/search/files_72.js new file mode 100644 index 0000000..d9e3f10 --- /dev/null +++ b/search/files_72.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['rnd_2eh',['rnd.h',['../rnd_8h.html',1,'']]] +]; diff --git a/search/functions_61.html b/search/functions_61.html new file mode 100644 index 0000000..7f39533 --- /dev/null +++ b/search/functions_61.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_61.js b/search/functions_61.js new file mode 100644 index 0000000..5981a30 --- /dev/null +++ b/search/functions_61.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['ascii_5fbin_5fto_5fbin_5fpoly',['ascii_bin_to_bin_poly',['../ntru__ascii__poly_8c.html#aa5d0d4abdb2ce837a0a3b6e478c8f1a9',1,'ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params): ntru_ascii_poly.c'],['../ntru__ascii__poly_8h.html#aa5d0d4abdb2ce837a0a3b6e478c8f1a9',1,'ascii_bin_to_bin_poly(const char *to_poly, const ntru_params *params): ntru_ascii_poly.c']]], + ['ascii_5fto_5fbin_5fpoly_5farr',['ascii_to_bin_poly_arr',['../ntru__ascii__poly_8c.html#a3237071bca2489c3b2efd46e674e0805',1,'ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c'],['../ntru__ascii__poly_8h.html#a3237071bca2489c3b2efd46e674e0805',1,'ascii_to_bin_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c']]] +]; diff --git a/search/functions_62.html b/search/functions_62.html new file mode 100644 index 0000000..def0606 --- /dev/null +++ b/search/functions_62.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_62.js b/search/functions_62.js new file mode 100644 index 0000000..fcb635e --- /dev/null +++ b/search/functions_62.js @@ -0,0 +1,6 @@ +var searchData= +[ + ['base64_5fto_5fpoly_5farr',['base64_to_poly_arr',['../ntru__ascii__poly_8c.html#a8460cd27ad4562f560bb304609a3e06d',1,'base64_to_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c'],['../ntru__ascii__poly_8h.html#a8460cd27ad4562f560bb304609a3e06d',1,'base64_to_poly_arr(const string *to_poly, const ntru_params *params): ntru_ascii_poly.c']]], + ['bin_5fpoly_5farr_5fto_5fascii',['bin_poly_arr_to_ascii',['../ntru__poly__ascii_8c.html#ab9464c96c3ebec6ee716c604fdc4ad21',1,'bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#ab9464c96c3ebec6ee716c604fdc4ad21',1,'bin_poly_arr_to_ascii(const fmpz_poly_t **bin_poly_arr, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c']]], + ['bin_5fpoly_5fto_5fascii',['bin_poly_to_ascii',['../ntru__poly__ascii_8c.html#a0d86ab2dede39b332d4149e16b2046b8',1,'bin_poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#a0d86ab2dede39b332d4149e16b2046b8',1,'bin_poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c']]] +]; diff --git a/search/functions_65.html b/search/functions_65.html new file mode 100644 index 0000000..a77deba --- /dev/null +++ b/search/functions_65.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_65.js b/search/functions_65.js new file mode 100644 index 0000000..843aa97 --- /dev/null +++ b/search/functions_65.js @@ -0,0 +1,5 @@ +var searchData= +[ + ['export_5fpriv_5fkey',['export_priv_key',['../ntru__keypair_8c.html#afa29f14a14486d3f6b979ee900d7e738',1,'export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#afa29f14a14486d3f6b979ee900d7e738',1,'export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#afa29f14a14486d3f6b979ee900d7e738',1,'export_priv_key(char const *const filename, fmpz_poly_t priv, ntru_params *params): ntru_keypair.c']]], + ['export_5fpublic_5fkey',['export_public_key',['../ntru__keypair_8c.html#a41741ed660cb806c47335f66055e1bdd',1,'export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a41741ed660cb806c47335f66055e1bdd',1,'export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a41741ed660cb806c47335f66055e1bdd',1,'export_public_key(char const *const filename, fmpz_poly_t pub, ntru_params *params): ntru_keypair.c']]] +]; diff --git a/search/functions_66.html b/search/functions_66.html new file mode 100644 index 0000000..319a531 --- /dev/null +++ b/search/functions_66.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_66.js b/search/functions_66.js new file mode 100644 index 0000000..dfec881 --- /dev/null +++ b/search/functions_66.js @@ -0,0 +1,9 @@ +var searchData= +[ + ['fmpz_5fadd_5fn',['fmpz_add_n',['../ntru__poly_8c.html#ad2a11e832808ef1cfee0eed1cc02f4b9',1,'fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h): ntru_poly.c'],['../ntru__poly_8h.html#ad2a11e832808ef1cfee0eed1cc02f4b9',1,'fmpz_add_n(fmpz_t f, const fmpz_t g, const fmpz_t h): ntru_poly.c']]], + ['fmpz_5fcmp_5fsi_5fn',['fmpz_cmp_si_n',['../ntru__poly_8c.html#aaaac83ec72414aa208832442657c3520',1,'fmpz_cmp_si_n(const fmpz_t f, slong g): ntru_poly.c'],['../ntru__poly_8h.html#aaaac83ec72414aa208832442657c3520',1,'fmpz_cmp_si_n(const fmpz_t f, slong g): ntru_poly.c']]], + ['fmpz_5finvmod_5fui',['fmpz_invmod_ui',['../ntru__poly_8c.html#a59da1b7962829af8f18d58c05f588606',1,'fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod): ntru_poly.c'],['../ntru__poly_8h.html#a59da1b7962829af8f18d58c05f588606',1,'fmpz_invmod_ui(fmpz_t f, const fmpz_t g, const uint32_t mod): ntru_poly.c']]], + ['fmpz_5fpoly_5fmod',['fmpz_poly_mod',['../ntru__poly_8c.html#a7c4f5e96355518dc97a23da8f34b661a',1,'fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod): ntru_poly.c'],['../ntru__poly_8h.html#a7c4f5e96355518dc97a23da8f34b661a',1,'fmpz_poly_mod(fmpz_poly_t a, const uint32_t mod): ntru_poly.c']]], + ['fmpz_5fpoly_5fmod_5funsigned',['fmpz_poly_mod_unsigned',['../ntru__poly_8c.html#ae7d0d8364dba689df3fb4904610634cc',1,'fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod): ntru_poly.c'],['../ntru__poly_8h.html#ae7d0d8364dba689df3fb4904610634cc',1,'fmpz_poly_mod_unsigned(fmpz_poly_t a, const uint32_t mod): ntru_poly.c']]], + ['fmpz_5fpoly_5fset_5fcoeff_5ffmpz_5fn',['fmpz_poly_set_coeff_fmpz_n',['../ntru__poly_8c.html#ab1f966fe680d1ce7c19c8c812d1932a7',1,'fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n, const fmpz_t x): ntru_poly.c'],['../ntru__poly_8h.html#ab1f966fe680d1ce7c19c8c812d1932a7',1,'fmpz_poly_set_coeff_fmpz_n(fmpz_poly_t poly, slong n, const fmpz_t x): ntru_poly.c']]] +]; diff --git a/search/functions_67.html b/search/functions_67.html new file mode 100644 index 0000000..d0ab42a --- /dev/null +++ b/search/functions_67.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_67.js b/search/functions_67.js new file mode 100644 index 0000000..ae0b615 --- /dev/null +++ b/search/functions_67.js @@ -0,0 +1,7 @@ +var searchData= +[ + ['get_5fbin_5farr_5fto_5fascii',['get_bin_arr_to_ascii',['../ntru__poly__ascii_8c.html#afd3f036287b4f62846c1a236426d73e1',1,'ntru_poly_ascii.c']]], + ['get_5fint_5fto_5fbin_5fstr',['get_int_to_bin_str',['../ntru__ascii__poly_8c.html#a2d2f760b6a98bd87248c1d3e120a665b',1,'ntru_ascii_poly.c']]], + ['get_5frnd_5fint',['get_rnd_int',['../ntru__rnd_8c.html#ad85ebfb1cb4b4942942213b750812cf0',1,'get_rnd_int(void): ntru_rnd.c'],['../ntru__rnd_8h.html#ad85ebfb1cb4b4942942213b750812cf0',1,'get_rnd_int(void): ntru_rnd.c'],['../rnd_8h.html#ad85ebfb1cb4b4942942213b750812cf0',1,'get_rnd_int(void): ntru_rnd.c']]], + ['get_5furnd_5fint',['get_urnd_int',['../ntru__rnd_8c.html#a99e4820cab7157eb1e16109e21dac81f',1,'get_urnd_int(void): ntru_rnd.c'],['../ntru__rnd_8h.html#a99e4820cab7157eb1e16109e21dac81f',1,'get_urnd_int(void): ntru_rnd.c'],['../rnd_8h.html#a99e4820cab7157eb1e16109e21dac81f',1,'get_urnd_int(void): ntru_rnd.c']]] +]; diff --git a/search/functions_69.html b/search/functions_69.html new file mode 100644 index 0000000..e204197 --- /dev/null +++ b/search/functions_69.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_69.js b/search/functions_69.js new file mode 100644 index 0000000..b5b3bb4 --- /dev/null +++ b/search/functions_69.js @@ -0,0 +1,5 @@ +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']]] +]; diff --git a/search/functions_6e.html b/search/functions_6e.html new file mode 100644 index 0000000..d734dd0 --- /dev/null +++ b/search/functions_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_6e.js b/search/functions_6e.js new file mode 100644 index 0000000..55c449e --- /dev/null +++ b/search/functions_6e.js @@ -0,0 +1,12 @@ +var searchData= +[ + ['ntru_5fcalloc',['ntru_calloc',['../ntru__mem_8c.html#a37e0be4fd8d0b677a41c8287ef47885c',1,'ntru_calloc(size_t nmemb, size_t size): ntru_mem.c'],['../ntru__mem_8h.html#a37e0be4fd8d0b677a41c8287ef47885c',1,'ntru_calloc(size_t nmemb, size_t size): ntru_mem.c']]], + ['ntru_5fcreate_5fkeypair',['ntru_create_keypair',['../ntru__keypair_8c.html#a6873d41211a92c4f6b0074ef34ae1743',1,'ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params): ntru_keypair.c'],['../ntru__keypair_8h.html#a6873d41211a92c4f6b0074ef34ae1743',1,'ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params): ntru_keypair.c'],['../keypair_8h.html#a6873d41211a92c4f6b0074ef34ae1743',1,'ntru_create_keypair(fmpz_poly_t f, fmpz_poly_t g, keypair *pair, ntru_params *params): ntru_keypair.c']]], + ['ntru_5fdecrypt_5fpoly',['ntru_decrypt_poly',['../ntru__decrypt_8c.html#a41c72f59e37a3c6ef6790eb909555d76',1,'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): ntru_decrypt.c'],['../ntru__decrypt_8h.html#a8108219b815b18d63672bbc45e76ca31',1,'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): ntru_decrypt.c']]], + ['ntru_5fdecrypt_5fstring',['ntru_decrypt_string',['../ntru__decrypt_8c.html#aa9cc61eec0c119e48762f6078a14527b',1,'ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params): ntru_decrypt.c'],['../ntru__decrypt_8h.html#aa9cc61eec0c119e48762f6078a14527b',1,'ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params): ntru_decrypt.c'],['../decrypt_8h.html#aa9cc61eec0c119e48762f6078a14527b',1,'ntru_decrypt_string(const string *encr_msg, const fmpz_poly_t priv_key, const fmpz_poly_t priv_key_inv, const ntru_params *params): ntru_decrypt.c']]], + ['ntru_5fdelete_5fkeypair',['ntru_delete_keypair',['../ntru__keypair_8c.html#a5279c4990bc22bb9e735fe36372a6786',1,'ntru_delete_keypair(keypair *pair): ntru_keypair.c'],['../ntru__keypair_8h.html#a5279c4990bc22bb9e735fe36372a6786',1,'ntru_delete_keypair(keypair *pair): ntru_keypair.c'],['../keypair_8h.html#a5279c4990bc22bb9e735fe36372a6786',1,'ntru_delete_keypair(keypair *pair): ntru_keypair.c']]], + ['ntru_5fencrypt_5fpoly',['ntru_encrypt_poly',['../ntru__encrypt_8c.html#a0156453c7cab7cf3da259beb1daf914b',1,'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): ntru_encrypt.c'],['../ntru__encrypt_8h.html#a9063450af4b523d202c7628dbac70e68',1,'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): ntru_encrypt.c']]], + ['ntru_5fencrypt_5fstring',['ntru_encrypt_string',['../ntru__encrypt_8c.html#a0bb47c0fa0dd4a4cfa0c0f7a722fd554',1,'ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params): ntru_encrypt.c'],['../ntru__encrypt_8h.html#a0bb47c0fa0dd4a4cfa0c0f7a722fd554',1,'ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params): ntru_encrypt.c'],['../encrypt_8h.html#a0bb47c0fa0dd4a4cfa0c0f7a722fd554',1,'ntru_encrypt_string(const string *msg, const fmpz_poly_t pub_key, const fmpz_poly_t rnd, const ntru_params *params): ntru_encrypt.c']]], + ['ntru_5fget_5frnd_5ftern_5fpoly_5fnum',['ntru_get_rnd_tern_poly_num',['../ntru__rnd_8c.html#a916a55c609c172ae4e48896032b36e47',1,'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)): ntru_rnd.c'],['../ntru__rnd_8h.html#a916a55c609c172ae4e48896032b36e47',1,'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)): ntru_rnd.c'],['../rnd_8h.html#a916a55c609c172ae4e48896032b36e47',1,'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)): ntru_rnd.c']]], + ['ntru_5fmalloc',['ntru_malloc',['../ntru__mem_8c.html#a020790bf8b201fde92395cf975c0c691',1,'ntru_malloc(size_t size): ntru_mem.c'],['../ntru__mem_8h.html#a020790bf8b201fde92395cf975c0c691',1,'ntru_malloc(size_t size): ntru_mem.c']]] +]; diff --git a/search/functions_70.html b/search/functions_70.html new file mode 100644 index 0000000..c62125e --- /dev/null +++ b/search/functions_70.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_70.js b/search/functions_70.js new file mode 100644 index 0000000..47967da --- /dev/null +++ b/search/functions_70.js @@ -0,0 +1,18 @@ +var searchData= +[ + ['poly_5farr_5fto_5fascii',['poly_arr_to_ascii',['../ntru__poly__ascii_8c.html#afa141976b665b94c0db9912bc50de4a1',1,'poly_arr_to_ascii(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#afa141976b665b94c0db9912bc50de4a1',1,'poly_arr_to_ascii(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c']]], + ['poly_5farr_5fto_5fbase64',['poly_arr_to_base64',['../ntru__poly__ascii_8c.html#a0dc14698073df2e46e6540cbff870fc7',1,'poly_arr_to_base64(const fmpz_poly_t **poly_array, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#a16163cc57631a0965577cb0f89365ca0',1,'poly_arr_to_base64(const fmpz_poly_t **poly_arr, const uint32_t poly_c, const ntru_params *params): ntru_poly_ascii.c']]], + ['poly_5fdelete',['poly_delete',['../ntru__poly_8c.html#a27ff2116f70bcbf5028219adcae4c5f0',1,'poly_delete(fmpz_poly_t poly): ntru_poly.c'],['../ntru__poly_8h.html#a27ff2116f70bcbf5028219adcae4c5f0',1,'poly_delete(fmpz_poly_t poly): ntru_poly.c'],['../ntru_8h.html#a27ff2116f70bcbf5028219adcae4c5f0',1,'poly_delete(fmpz_poly_t poly): ntru_poly.c']]], + ['poly_5fdelete_5fall',['poly_delete_all',['../ntru__poly_8c.html#a83297bc2ab5b6e7ce42553570dd8268f',1,'poly_delete_all(fmpz_poly_t poly,...): ntru_poly.c'],['../ntru__poly_8h.html#a83297bc2ab5b6e7ce42553570dd8268f',1,'poly_delete_all(fmpz_poly_t poly,...): ntru_poly.c'],['../ntru_8h.html#a83297bc2ab5b6e7ce42553570dd8268f',1,'poly_delete_all(fmpz_poly_t poly,...): ntru_poly.c']]], + ['poly_5fdelete_5farray',['poly_delete_array',['../ntru__poly_8c.html#a3f53c63383ff301b20dcede0783869a7',1,'poly_delete_array(fmpz_poly_t **poly_array): ntru_poly.c'],['../ntru__poly_8h.html#a3f53c63383ff301b20dcede0783869a7',1,'poly_delete_array(fmpz_poly_t **poly_array): ntru_poly.c'],['../ntru_8h.html#a3f53c63383ff301b20dcede0783869a7',1,'poly_delete_array(fmpz_poly_t **poly_array): ntru_poly.c']]], + ['poly_5fdraw',['poly_draw',['../ntru__poly_8c.html#a80a8ce0f2944bc3df94291ef2f781498',1,'poly_draw(const fmpz_poly_t poly): ntru_poly.c'],['../ntru__poly_8h.html#a80a8ce0f2944bc3df94291ef2f781498',1,'poly_draw(const fmpz_poly_t poly): ntru_poly.c'],['../ntru_8h.html#a80a8ce0f2944bc3df94291ef2f781498',1,'poly_draw(const fmpz_poly_t poly): ntru_poly.c']]], + ['poly_5fdraw_5fpretty',['poly_draw_pretty',['../ntru__poly_8c.html#aec098d00160d2d502eb1f8a7c3fa5453',1,'poly_draw_pretty(const fmpz_poly_t poly): ntru_poly.c'],['../ntru__poly_8h.html#aec098d00160d2d502eb1f8a7c3fa5453',1,'poly_draw_pretty(const fmpz_poly_t poly): ntru_poly.c'],['../ntru_8h.html#aec098d00160d2d502eb1f8a7c3fa5453',1,'poly_draw_pretty(const fmpz_poly_t poly): ntru_poly.c']]], + ['poly_5finverse_5fpoly_5fp',['poly_inverse_poly_p',['../ntru__poly_8c.html#ae77b2014df42e5ed612206d5930ac608',1,'poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params): ntru_poly.c'],['../ntru__poly_8h.html#ae77b2014df42e5ed612206d5930ac608',1,'poly_inverse_poly_p(const fmpz_poly_t a, fmpz_poly_t Fp, const ntru_params *params): ntru_poly.c']]], + ['poly_5finverse_5fpoly_5fq',['poly_inverse_poly_q',['../ntru__poly_8c.html#ace66beb516186e52f9b5b1ed8a397849',1,'poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params): ntru_poly.c'],['../ntru__poly_8h.html#ace66beb516186e52f9b5b1ed8a397849',1,'poly_inverse_poly_q(const fmpz_poly_t a, fmpz_poly_t Fq, const ntru_params *params): ntru_poly.c']]], + ['poly_5fmod2_5fto_5fmodq',['poly_mod2_to_modq',['../ntru__poly_8c.html#a891af13dc4355c9fab9ca3fafcac8054',1,'ntru_poly.c']]], + ['poly_5fnew',['poly_new',['../ntru__poly_8c.html#a20f86085d5eb5372fd25dc270069d38c',1,'poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len): ntru_poly.c'],['../ntru__poly_8h.html#a20f86085d5eb5372fd25dc270069d38c',1,'poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len): ntru_poly.c'],['../ntru_8h.html#a20f86085d5eb5372fd25dc270069d38c',1,'poly_new(fmpz_poly_t new_poly, int const *const c, const size_t len): ntru_poly.c']]], + ['poly_5fstarmultiply',['poly_starmultiply',['../ntru__poly_8c.html#ae96f479ddd97af709a0ed50817fd3fb3',1,'poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus): ntru_poly.c'],['../ntru__poly_8h.html#ae96f479ddd97af709a0ed50817fd3fb3',1,'poly_starmultiply(const fmpz_poly_t a, const fmpz_poly_t b, fmpz_poly_t c, const ntru_params *params, uint32_t modulus): ntru_poly.c']]], + ['poly_5fto_5fascii',['poly_to_ascii',['../ntru__poly__ascii_8c.html#aa4d233591b7e51d6cf787edd3bfa91e2',1,'poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#aa4d233591b7e51d6cf787edd3bfa91e2',1,'poly_to_ascii(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c']]], + ['poly_5fto_5fbase64',['poly_to_base64',['../ntru__poly__ascii_8c.html#a4ba0179e3ae0d5e721ff8429a8265e80',1,'poly_to_base64(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c'],['../ntru__poly__ascii_8h.html#a4ba0179e3ae0d5e721ff8429a8265e80',1,'poly_to_base64(const fmpz_poly_t poly, const ntru_params *params): ntru_poly_ascii.c']]], + ['prints',['prints',['../ntru__string_8c.html#a55d4ce182c335ff6cca360909a7be395',1,'prints(const string *print_string): ntru_string.c'],['../ntru__string_8h.html#a55d4ce182c335ff6cca360909a7be395',1,'prints(const string *print_string): ntru_string.c'],['../ntru_8h.html#a55d4ce182c335ff6cca360909a7be395',1,'prints(const string *print_string): ntru_string.c']]] +]; diff --git a/search/functions_72.html b/search/functions_72.html new file mode 100644 index 0000000..a4336f7 --- /dev/null +++ b/search/functions_72.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_72.js b/search/functions_72.js new file mode 100644 index 0000000..f48853a --- /dev/null +++ b/search/functions_72.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['read_5ffile',['read_file',['../ntru__file_8c.html#a348c2a56837571f410d44631abc09dc4',1,'read_file(char const *const filename): ntru_file.c'],['../ntru__file_8h.html#a348c2a56837571f410d44631abc09dc4',1,'read_file(char const *const filename): ntru_file.c'],['../ntru_8h.html#a348c2a56837571f410d44631abc09dc4',1,'read_file(char const *const filename): ntru_file.c']]] +]; diff --git a/search/functions_73.html b/search/functions_73.html new file mode 100644 index 0000000..774d577 --- /dev/null +++ b/search/functions_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_73.js b/search/functions_73.js new file mode 100644 index 0000000..5f73b94 --- /dev/null +++ b/search/functions_73.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['string_5fdelete',['string_delete',['../ntru__string_8c.html#ac1b5f66fbbbdfc7901357ddcfec52e5a',1,'string_delete(string *del_string): ntru_string.c'],['../ntru__string_8h.html#ac1b5f66fbbbdfc7901357ddcfec52e5a',1,'string_delete(string *del_string): ntru_string.c'],['../ntru_8h.html#ac1b5f66fbbbdfc7901357ddcfec52e5a',1,'string_delete(string *del_string): ntru_string.c']]] +]; diff --git a/search/functions_77.html b/search/functions_77.html new file mode 100644 index 0000000..8fe9755 --- /dev/null +++ b/search/functions_77.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/functions_77.js b/search/functions_77.js new file mode 100644 index 0000000..0f707cd --- /dev/null +++ b/search/functions_77.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['write_5ffile',['write_file',['../ntru__file_8c.html#a1f8eef5ea12c77ed2491d96864eb0d43',1,'write_file(string const *wstring, char const *const filename): ntru_file.c'],['../ntru__file_8h.html#a1f8eef5ea12c77ed2491d96864eb0d43',1,'write_file(string const *wstring, char const *const filename): ntru_file.c'],['../ntru_8h.html#af2a0fc4dd4109749d8f3100a913cc304',1,'write_file(string const *wstring, char const *const filename): ntru_file.c']]] +]; diff --git a/search/mag_sel.png b/search/mag_sel.png new file mode 100644 index 0000000..81f6040 Binary files /dev/null and b/search/mag_sel.png differ diff --git a/search/nomatches.html b/search/nomatches.html new file mode 100644 index 0000000..b1ded27 --- /dev/null +++ b/search/nomatches.html @@ -0,0 +1,12 @@ + + + + + + + +
+
No Matches
+
+ + diff --git a/search/search.css b/search/search.css new file mode 100644 index 0000000..d18c1da --- /dev/null +++ b/search/search.css @@ -0,0 +1,238 @@ +/*---------------- Search Box */ + +#FSearchBox { + float: left; +} + +#MSearchBox { + white-space : nowrap; + position: absolute; + float: none; + display: inline; + margin-top: 8px; + right: 0px; + width: 170px; + z-index: 102; + background-color: white; +} + +#MSearchBox .left +{ + display:block; + position:absolute; + left:10px; + width:20px; + height:19px; + background:url('search_l.png') no-repeat; + background-position:right; +} + +#MSearchSelect { + display:block; + position:absolute; + width:20px; + height:19px; +} + +.left #MSearchSelect { + left:4px; +} + +.right #MSearchSelect { + right:5px; +} + +#MSearchField { + display:block; + position:absolute; + height:19px; + background:url('search_m.png') repeat-x; + border:none; + width:116px; + margin-left:20px; + padding-left:4px; + color: #909090; + outline: none; + font: 9pt Arial, Verdana, sans-serif; +} + +#FSearchBox #MSearchField { + margin-left:15px; +} + +#MSearchBox .right { + display:block; + position:absolute; + right:10px; + top:0px; + width:20px; + height:19px; + background:url('search_r.png') no-repeat; + background-position:left; +} + +#MSearchClose { + display: none; + position: absolute; + top: 4px; + background : none; + border: none; + margin: 0px 4px 0px 0px; + padding: 0px 0px; + outline: none; +} + +.left #MSearchClose { + left: 6px; +} + +.right #MSearchClose { + right: 2px; +} + +.MSearchBoxActive #MSearchField { + color: #000000; +} + +/*---------------- Search filter selection */ + +#MSearchSelectWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #90A5CE; + background-color: #F9FAFC; + z-index: 1; + padding-top: 4px; + padding-bottom: 4px; + -moz-border-radius: 4px; + -webkit-border-top-left-radius: 4px; + -webkit-border-top-right-radius: 4px; + -webkit-border-bottom-left-radius: 4px; + -webkit-border-bottom-right-radius: 4px; + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); +} + +.SelectItem { + font: 8pt Arial, Verdana, sans-serif; + padding-left: 2px; + padding-right: 12px; + border: 0px; +} + +span.SelectionMark { + margin-right: 4px; + font-family: monospace; + outline-style: none; + text-decoration: none; +} + +a.SelectItem { + display: block; + outline-style: none; + color: #000000; + text-decoration: none; + padding-left: 6px; + padding-right: 12px; +} + +a.SelectItem:focus, +a.SelectItem:active { + color: #000000; + outline-style: none; + text-decoration: none; +} + +a.SelectItem:hover { + color: #FFFFFF; + background-color: #3D578C; + outline-style: none; + text-decoration: none; + cursor: pointer; + display: block; +} + +/*---------------- Search results window */ + +iframe#MSearchResults { + width: 60ex; + height: 15em; +} + +#MSearchResultsWindow { + display: none; + position: absolute; + left: 0; top: 0; + border: 1px solid #000; + background-color: #EEF1F7; +} + +/* ----------------------------------- */ + + +#SRIndex { + clear:both; + padding-bottom: 15px; +} + +.SREntry { + font-size: 10pt; + padding-left: 1ex; +} + +.SRPage .SREntry { + font-size: 8pt; + padding: 1px 5px; +} + +body.SRPage { + margin: 5px 2px; +} + +.SRChildren { + padding-left: 3ex; padding-bottom: .5em +} + +.SRPage .SRChildren { + display: none; +} + +.SRSymbol { + font-weight: bold; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRScope { + display: block; + color: #425E97; + font-family: Arial, Verdana, sans-serif; + text-decoration: none; + outline: none; +} + +a.SRSymbol:focus, a.SRSymbol:active, +a.SRScope:focus, a.SRScope:active { + text-decoration: underline; +} + +span.SRScope { + padding-left: 4px; +} + +.SRPage .SRStatus { + padding: 2px 5px; + font-size: 8pt; + font-style: italic; +} + +.SRResult { + display: none; +} + +DIV.searchresults { + margin-left: 10px; + margin-right: 10px; +} diff --git a/search/search.js b/search/search.js new file mode 100644 index 0000000..f7ac364 --- /dev/null +++ b/search/search.js @@ -0,0 +1,807 @@ +// Search script generated by doxygen +// Copyright (C) 2009 by Dimitri van Heesch. + +// The code in this file is loosly based on main.js, part of Natural Docs, +// which is Copyright (C) 2003-2008 Greg Valure +// Natural Docs is licensed under the GPL. + +var indexSectionsWithContent = +{ + 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101011010111100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110000010010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000110011101000010101100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101000000000010001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" +}; + +var indexSectionNames = +{ + 0: "all", + 1: "classes", + 2: "files", + 3: "functions", + 4: "variables", + 5: "typedefs", + 6: "defines" +}; + +function convertToId(search) +{ + var result = ''; + for (i=0;i do a search + { + this.Search(); + } + } + + this.OnSearchSelectKey = function(evt) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==40 && this.searchIndex0) // Up + { + this.searchIndex--; + this.OnSelectItem(this.searchIndex); + } + else if (e.keyCode==13 || e.keyCode==27) + { + this.OnSelectItem(this.searchIndex); + this.CloseSelectionWindow(); + this.DOMSearchField().focus(); + } + return false; + } + + // --------- Actions + + // Closes the results window. + this.CloseResultsWindow = function() + { + this.DOMPopupSearchResultsWindow().style.display = 'none'; + this.DOMSearchClose().style.display = 'none'; + this.Activate(false); + } + + this.CloseSelectionWindow = function() + { + this.DOMSearchSelectWindow().style.display = 'none'; + } + + // Performs a search. + this.Search = function() + { + this.keyTimeout = 0; + + // strip leading whitespace + var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); + + var code = searchValue.toLowerCase().charCodeAt(0); + var hexCode; + if (code<16) + { + hexCode="0"+code.toString(16); + } + else + { + hexCode=code.toString(16); + } + + var resultsPage; + var resultsPageWithSearch; + var hasResultsPage; + + if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1') + { + resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html'; + resultsPageWithSearch = resultsPage+'?'+escape(searchValue); + hasResultsPage = true; + } + else // nothing available for this search term + { + resultsPage = this.resultsPath + '/nomatches.html'; + resultsPageWithSearch = resultsPage; + hasResultsPage = false; + } + + window.frames.MSearchResults.location = resultsPageWithSearch; + var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); + + if (domPopupSearchResultsWindow.style.display!='block') + { + var domSearchBox = this.DOMSearchBox(); + this.DOMSearchClose().style.display = 'inline'; + if (this.insideFrame) + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + domPopupSearchResultsWindow.style.position = 'relative'; + domPopupSearchResultsWindow.style.display = 'block'; + var width = document.body.clientWidth - 8; // the -8 is for IE :-( + domPopupSearchResultsWindow.style.width = width + 'px'; + domPopupSearchResults.style.width = width + 'px'; + } + else + { + var domPopupSearchResults = this.DOMPopupSearchResults(); + var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; + var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; + domPopupSearchResultsWindow.style.display = 'block'; + left -= domPopupSearchResults.offsetWidth; + domPopupSearchResultsWindow.style.top = top + 'px'; + domPopupSearchResultsWindow.style.left = left + 'px'; + } + } + + this.lastSearchValue = searchValue; + this.lastResultsPage = resultsPage; + } + + // -------- Activation Functions + + // Activates or deactivates the search panel, resetting things to + // their default values if necessary. + this.Activate = function(isActive) + { + if (isActive || // open it + this.DOMPopupSearchResultsWindow().style.display == 'block' + ) + { + this.DOMSearchBox().className = 'MSearchBoxActive'; + + var searchField = this.DOMSearchField(); + + if (searchField.value == this.searchLabel) // clear "Search" term upon entry + { + searchField.value = ''; + this.searchActive = true; + } + } + else if (!isActive) // directly remove the panel + { + this.DOMSearchBox().className = 'MSearchBoxInactive'; + this.DOMSearchField().value = this.searchLabel; + this.searchActive = false; + this.lastSearchValue = '' + this.lastResultsPage = ''; + } + } +} + +// ----------------------------------------------------------------------- + +// The class that handles everything on the search results page. +function SearchResults(name) +{ + // The number of matches from the last run of . + this.lastMatchCount = 0; + this.lastKey = 0; + this.repeatOn = false; + + // Toggles the visibility of the passed element ID. + this.FindChildElement = function(id) + { + var parentElement = document.getElementById(id); + var element = parentElement.firstChild; + + while (element && element!=parentElement) + { + if (element.nodeName == 'DIV' && element.className == 'SRChildren') + { + return element; + } + + if (element.nodeName == 'DIV' && element.hasChildNodes()) + { + element = element.firstChild; + } + else if (element.nextSibling) + { + element = element.nextSibling; + } + else + { + do + { + element = element.parentNode; + } + while (element && element!=parentElement && !element.nextSibling); + + if (element && element!=parentElement) + { + element = element.nextSibling; + } + } + } + } + + this.Toggle = function(id) + { + var element = this.FindChildElement(id); + if (element) + { + if (element.style.display == 'block') + { + element.style.display = 'none'; + } + else + { + element.style.display = 'block'; + } + } + } + + // Searches for the passed string. If there is no parameter, + // it takes it from the URL query. + // + // Always returns true, since other documents may try to call it + // and that may or may not be possible. + this.Search = function(search) + { + if (!search) // get search word from URL + { + search = window.location.search; + search = search.substring(1); // Remove the leading '?' + search = unescape(search); + } + + search = search.replace(/^ +/, ""); // strip leading spaces + search = search.replace(/ +$/, ""); // strip trailing spaces + search = search.toLowerCase(); + search = convertToId(search); + + var resultRows = document.getElementsByTagName("div"); + var matches = 0; + + var i = 0; + while (i < resultRows.length) + { + var row = resultRows.item(i); + if (row.className == "SRResult") + { + var rowMatchName = row.id.toLowerCase(); + rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' + + if (search.length<=rowMatchName.length && + rowMatchName.substr(0, search.length)==search) + { + row.style.display = 'block'; + matches++; + } + else + { + row.style.display = 'none'; + } + } + i++; + } + document.getElementById("Searching").style.display='none'; + if (matches == 0) // no results + { + document.getElementById("NoMatches").style.display='block'; + } + else // at least one result + { + document.getElementById("NoMatches").style.display='none'; + } + this.lastMatchCount = matches; + return true; + } + + // return the first item with index index or higher that is visible + this.NavNext = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index++; + } + return focusItem; + } + + this.NavPrev = function(index) + { + var focusItem; + while (1) + { + var focusName = 'Item'+index; + focusItem = document.getElementById(focusName); + if (focusItem && focusItem.parentNode.parentNode.style.display=='block') + { + break; + } + else if (!focusItem) // last element + { + break; + } + focusItem=null; + index--; + } + return focusItem; + } + + this.ProcessKeys = function(e) + { + if (e.type == "keydown") + { + this.repeatOn = false; + this.lastKey = e.keyCode; + } + else if (e.type == "keypress") + { + if (!this.repeatOn) + { + if (this.lastKey) this.repeatOn = true; + return false; // ignore first keypress after keydown + } + } + else if (e.type == "keyup") + { + this.lastKey = 0; + this.repeatOn = false; + } + return this.lastKey!=0; + } + + this.Nav = function(evt,itemIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + var newIndex = itemIndex-1; + var focusItem = this.NavPrev(newIndex); + if (focusItem) + { + var child = this.FindChildElement(focusItem.parentNode.parentNode.id); + if (child && child.style.display == 'block') // children visible + { + var n=0; + var tmpElem; + while (1) // search for last child + { + tmpElem = document.getElementById('Item'+newIndex+'_c'+n); + if (tmpElem) + { + focusItem = tmpElem; + } + else // found it! + { + break; + } + n++; + } + } + } + if (focusItem) + { + focusItem.focus(); + } + else // return focus to search field + { + parent.document.getElementById("MSearchField").focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = itemIndex+1; + var focusItem; + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem && elem.style.display == 'block') // children visible + { + focusItem = document.getElementById('Item'+itemIndex+'_c0'); + } + if (!focusItem) focusItem = this.NavNext(newIndex); + if (focusItem) focusItem.focus(); + } + else if (this.lastKey==39) // Right + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'block'; + } + else if (this.lastKey==37) // Left + { + var item = document.getElementById('Item'+itemIndex); + var elem = this.FindChildElement(item.parentNode.parentNode.id); + if (elem) elem.style.display = 'none'; + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } + + this.NavChild = function(evt,itemIndex,childIndex) + { + var e = (evt) ? evt : window.event; // for IE + if (e.keyCode==13) return true; + if (!this.ProcessKeys(e)) return false; + + if (this.lastKey==38) // Up + { + if (childIndex>0) + { + var newIndex = childIndex-1; + document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); + } + else // already at first child, jump to parent + { + document.getElementById('Item'+itemIndex).focus(); + } + } + else if (this.lastKey==40) // Down + { + var newIndex = childIndex+1; + var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); + if (!elem) // last child, jump to parent next parent + { + elem = this.NavNext(itemIndex+1); + } + if (elem) + { + elem.focus(); + } + } + else if (this.lastKey==27) // Escape + { + parent.searchBox.CloseResultsWindow(); + parent.document.getElementById("MSearchField").focus(); + } + else if (this.lastKey==13) // Enter + { + return true; + } + return false; + } +} + +function setKeyActions(elem,action) +{ + elem.setAttribute('onkeydown',action); + elem.setAttribute('onkeypress',action); + elem.setAttribute('onkeyup',action); +} + +function setClassAttr(elem,attr) +{ + elem.setAttribute('class',attr); + elem.setAttribute('className',attr); +} + +function createResults() +{ + var results = document.getElementById("SRResults"); + for (var e=0; e + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/typedefs_6b.js b/search/typedefs_6b.js new file mode 100644 index 0000000..0e89730 --- /dev/null +++ b/search/typedefs_6b.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['keypair',['keypair',['../ntru__keypair_8h.html#aacfc9254c7939584924ab9d27ba6f504',1,'keypair(): ntru_keypair.h'],['../keypair_8h.html#aacfc9254c7939584924ab9d27ba6f504',1,'keypair(): keypair.h']]] +]; diff --git a/search/typedefs_6e.html b/search/typedefs_6e.html new file mode 100644 index 0000000..ebbf394 --- /dev/null +++ b/search/typedefs_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/typedefs_6e.js b/search/typedefs_6e.js new file mode 100644 index 0000000..ee6f24b --- /dev/null +++ b/search/typedefs_6e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['ntru_5fparams',['ntru_params',['../ntru__params_8h.html#a2f326c88fc033eca78a47ee8d387c592',1,'ntru_params(): ntru_params.h'],['../ntru_8h.html#a2f326c88fc033eca78a47ee8d387c592',1,'ntru_params(): ntru.h']]] +]; diff --git a/search/typedefs_73.html b/search/typedefs_73.html new file mode 100644 index 0000000..3f28c4d --- /dev/null +++ b/search/typedefs_73.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/typedefs_73.js b/search/typedefs_73.js new file mode 100644 index 0000000..9ae8184 --- /dev/null +++ b/search/typedefs_73.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['string',['string',['../ntru__string_8h.html#a63e2e3ee7db5274c6a3929edfc07c6c9',1,'string(): ntru_string.h'],['../ntru_8h.html#a63e2e3ee7db5274c6a3929edfc07c6c9',1,'string(): ntru.h']]] +]; diff --git a/search/variables_6c.html b/search/variables_6c.html new file mode 100644 index 0000000..6016f5c --- /dev/null +++ b/search/variables_6c.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_6c.js b/search/variables_6c.js new file mode 100644 index 0000000..097a1e6 --- /dev/null +++ b/search/variables_6c.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['len',['len',['../structstring.html#aa6bcf0353fd5cf2f374a9b1dd0e4a73a',1,'string']]] +]; diff --git a/search/variables_6e.html b/search/variables_6e.html new file mode 100644 index 0000000..4cc41d5 --- /dev/null +++ b/search/variables_6e.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_6e.js b/search/variables_6e.js new file mode 100644 index 0000000..20c1422 --- /dev/null +++ b/search/variables_6e.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['n',['N',['../structntru__params.html#afb8425ee3db2b917b3c4e8d9b75bd3ff',1,'ntru_params']]] +]; diff --git a/search/variables_70.html b/search/variables_70.html new file mode 100644 index 0000000..bc5c193 --- /dev/null +++ b/search/variables_70.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_70.js b/search/variables_70.js new file mode 100644 index 0000000..3237746 --- /dev/null +++ b/search/variables_70.js @@ -0,0 +1,8 @@ +var searchData= +[ + ['p',['p',['../structntru__params.html#a41b368825e1eb126604e13e8f549ec8f',1,'ntru_params']]], + ['priv',['priv',['../structkeypair.html#a9e9805ad001216da53f2c57accb288e1',1,'keypair']]], + ['priv_5finv',['priv_inv',['../structkeypair.html#a9e63f1d275b91c9d9716fb4069461799',1,'keypair']]], + ['ptr',['ptr',['../structstring.html#afd608f62303958cea6f1f7afdec1e282',1,'string']]], + ['pub',['pub',['../structkeypair.html#afa635c70f233d0b7449b4a17513646c4',1,'keypair']]] +]; diff --git a/search/variables_71.html b/search/variables_71.html new file mode 100644 index 0000000..cceeff2 --- /dev/null +++ b/search/variables_71.html @@ -0,0 +1,25 @@ + + + + + + + + +
+
Loading...
+
+ +
Searching...
+
No Matches
+ +
+ + diff --git a/search/variables_71.js b/search/variables_71.js new file mode 100644 index 0000000..0dbc610 --- /dev/null +++ b/search/variables_71.js @@ -0,0 +1,4 @@ +var searchData= +[ + ['q',['q',['../structntru__params.html#a29680750bda49dc93e61a752b2f2a0f7',1,'ntru_params']]] +]; diff --git a/structkeypair.html b/structkeypair.html new file mode 100644 index 0000000..248fce9 --- /dev/null +++ b/structkeypair.html @@ -0,0 +1,175 @@ + + + + + +post quantum cryptography: keypair Struct Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
keypair Struct Reference
+
+
+ +

#include <ntru_keypair.h>

+ + + + + +

+Data Fields

fmpz_poly_t priv
fmpz_poly_t priv_inv
fmpz_poly_t pub
+

Detailed Description

+

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

+ +

Definition at line 46 of file ntru_keypair.h.

+

Field Documentation

+ +
+
+ + + + +
fmpz_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_inv
+
+
+

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

+ +

Definition at line 56 of file ntru_keypair.h.

+ +
+
+ +
+
+ + + + +
fmpz_poly_t keypair::pub
+
+
+

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

+ +

Definition at line 61 of file ntru_keypair.h.

+ +
+
+
The documentation for this struct was generated from the following files: +
+ + + + +
+ +
+ + + + + + + diff --git a/structntru__params.html b/structntru__params.html new file mode 100644 index 0000000..587583b --- /dev/null +++ b/structntru__params.html @@ -0,0 +1,175 @@ + + + + + +post quantum cryptography: ntru_params Struct Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
ntru_params Struct Reference
+
+
+ +

#include <ntru_params.h>

+ + + + + +

+Data Fields

uint32_t N
uint32_t q
uint32_t p
+

Detailed Description

+

NTRU cryptosystem is specified by the following triple.

+ +

Definition at line 43 of file ntru_params.h.

+

Field Documentation

+ +
+
+ + + + +
uint32_t ntru_params::N
+
+
+

maximal degree N - 1 for all polynomials

+ +

Definition at line 48 of file ntru_params.h.

+ +
+
+ +
+
+ + + + +
uint32_t ntru_params::p
+
+
+

small modulus

+ +

Definition at line 56 of file ntru_params.h.

+ +
+
+ +
+
+ + + + +
uint32_t ntru_params::q
+
+
+

large modulus

+ +

Definition at line 52 of file ntru_params.h.

+ +
+
+
The documentation for this struct was generated from the following files:
    +
  • /home/travis/build/hasufell/pqc/src/ntru_params.h
  • +
  • /home/travis/build/hasufell/pqc/include/ntru.h
  • +
+
+ + + + +
+ +
+ + + + + + + diff --git a/structstring.html b/structstring.html new file mode 100644 index 0000000..1a49232 --- /dev/null +++ b/structstring.html @@ -0,0 +1,158 @@ + + + + + +post quantum cryptography: string Struct Reference + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + +
+
post quantum cryptography + +
+
Highly optimized implementation of the NTRUEncrypt algorithm
+
+
+ + + + + +
+
+ +
+
string Struct Reference
+
+
+ +

#include <ntru_string.h>

+ + + + +

+Data Fields

char * ptr
size_t len
+

Detailed Description

+

Represents a string.

+ +

Definition at line 41 of file ntru_string.h.

+

Field Documentation

+ +
+
+ + + + +
size_t string::len
+
+
+

Length of the string.

+ +

Definition at line 53 of file ntru_string.h.

+ +
+
+ +
+
+ + + + +
char * 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.

+ +
+
+
The documentation for this struct was generated from the following files:
    +
  • /home/travis/build/hasufell/pqc/src/ntru_string.h
  • +
  • /home/travis/build/hasufell/pqc/include/ntru.h
  • +
+
+ + + + +
+ +
+ + + + + + + diff --git a/tab_a.png b/tab_a.png new file mode 100644 index 0000000..2d99ef2 Binary files /dev/null and b/tab_a.png differ diff --git a/tab_b.png b/tab_b.png new file mode 100644 index 0000000..b2c3d2b Binary files /dev/null and b/tab_b.png differ diff --git a/tab_h.png b/tab_h.png new file mode 100644 index 0000000..c11f48f Binary files /dev/null and b/tab_h.png differ diff --git a/tab_s.png b/tab_s.png new file mode 100644 index 0000000..978943a Binary files /dev/null and b/tab_s.png differ diff --git a/tabs.css b/tabs.css new file mode 100644 index 0000000..2192056 --- /dev/null +++ b/tabs.css @@ -0,0 +1,59 @@ +.tabs, .tabs2, .tabs3 { + background-image: url('tab_b.png'); + width: 100%; + z-index: 101; + font-size: 13px; +} + +.tabs2 { + font-size: 10px; +} +.tabs3 { + font-size: 9px; +} + +.tablist { + margin: 0; + padding: 0; + display: table; +} + +.tablist li { + float: left; + display: table-cell; + background-image: url('tab_b.png'); + line-height: 36px; + list-style: none; +} + +.tablist a { + display: block; + padding: 0 20px; + font-weight: bold; + background-image:url('tab_s.png'); + background-repeat:no-repeat; + background-position:right; + color: #283A5D; + text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9); + text-decoration: none; + outline: none; +} + +.tabs3 .tablist a { + padding: 0 10px; +} + +.tablist a:hover { + background-image: url('tab_h.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); + text-decoration: none; +} + +.tablist li.current a { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +}