summaryrefslogtreecommitdiff log msg author committer range
path: root/doc/theory.tex
blob: 83b7f8dd47a165394940480a222f6299ae147f72 (plain)
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303  \documentclass[]{article} \usepackage[left=2cm,top=2cm,right=2cm]{geometry} \usepackage{url} \begin{document} \title{Theory used by libgfshare} \author{Simon McVittie} \date{23rd April 2006} \maketitle \section{Introduction} libgfshare implements Shamir secret sharing [SHAMIR] over the field $GF(2^8)$, instead of $GF(p)$ for a prime $p$ as suggested by Shamir's paper. This document aims to prove the security and integrity of this scheme. Note that while I believe this document to be correct, I accept no responsibility for loss or damage caused by relying on the correctness of my proof. \section{Definitions} Let $F$ be a field with multiplicative identity 1 and additive identity 0. If $A = \{(a_1, b_1), \cdots, (a_n, b_n)\}$, with the $a_i$ distinct nonzero elements of F and the $b_i$ elements of $F$, indexed by $I = \{1,\cdots,n\}$, then define $P_A(x) = \sum_{j\in I} {b_j \prod_{k\in I, k\neq j} {(x-a_k)(a_j-a_k)^{-1}}}$ a polynomial of degree at most $n-1$. (By distinctness of the $a_i$, the inverses required exist.) This is the Lagrange interpolating polynomial for the points in $A$. \section{Lemma 1} Let $a_1,\cdots,a_t\in F$ be distinct and nonzero; let $b_1,\cdots,b_{t-1},c\in F$ be arbitrary. Then there exists $b_t\in F$ such that if $A = \{(a_1, b_1), \cdots, (a_t, b_t)\}$ then $P_A(0) = c$. \subsection{Proof} Let $I = \{1, \cdots, t\}$. We have $P_A(0) = \sum_{j\in I} {b_j \prod_{k\in I, k\neq j}{-a_k(a_j-a_k)^{-1}}} = \sum_{j\in I} {y_j \prod_{k\in I, k\neq j}{a_k(a_k-a_j)^{-1}}}$ Let $b_t = \left[c + \sum_{j\in I, j\neq t}{b_j\prod_{k\in I,k\neq j}{a_k(a_j-a_k)^{-1}}}\right] \left[\prod_{k\in I,k\neq t}{a_k^{-1}(a_k-a_t)}\right]$ Then $P_A(0) = \sum_{j\in I, j\neq t} {b_j \prod_{k\in I, k\neq j}{a_k(a_k-a_j)^{-1}}} + b_t \prod_{k\in I, k\neq t}{a_k(a_k-a_t)^{-1}}$$= \sum_{j\in I, j\neq t} {b_j \prod_{k\in I, k\neq j}{a_k(a_k-a_j)^{-1}}} - \sum_{j\in I, j\neq t} {b_j \prod_{k\in I, k\neq j}{a_k(a_k-a_j)^{-1}}} + c$$= c$ as required. \section{Lemma 2} For any $x_1,\cdots,x_t$ distinct and nonzero elements of $F$, and any $y_1,\cdots,y_t,u$ arbitrary elements of $F$, let $X = \left\{(x_1,y_1),\cdots,(x_t,y_t)\right\}$ and $U = \left\{(x_1,y_1),\cdots,(x_{t-1},y_{t-1}),(u,P_X(u))\right\}$ Then $P_X = P_U, i.e. P_X(x) = P_U(x)$ for all $x\in F$. \subsection{Proof} Let $S_{a,b} = \left\{(x_1,y_1),\cdots,(x_{t-1},y_{t-1}),(a,b)\right\}$. Then \[ P_{S_{a,b}}(x) = \sum_{j t$, then for every subset$B$of$B^\prime$with$|B| = t$,$P_B(0) = f$. \subsection{Proof} The second part is trivially implied by the first. Recall that$X = \left\{(x_1,y_1),\cdots,(x_t,y_t)\right\}$and that$P_X(0) = f$. If$B = X$the result is true. If not, repeatedly apply Lemma 2 to replace an element of$X$not in$B$with an element of$B$not in$X$, preserving the value of$P(0)$. \section{Theorem: With fewer than$t$pieces no information is gained} Let$C \subset\left\{(x_1,y_1),\cdots,(x_s,y_s)\right\}$with$|C|< t$. Then for each$d\in F$, there exists$D\supset C$,$|D| = t$, such that$d = P_D(0)$. (In other words, any$d\in F$remains a possible value for the secret, so an attacker with fewer than$t$shares has gained no information.) \subsection{Proof} Let$a_i$,$b_i$be such that$C = \left\{(a_1,b_1),\cdots,(a_n,b_n)\right\}$, some$n < t$. Choose arbitrary$a_{n+1},\cdots,a_{t}$and arbitrary$b_{n+1},\cdots,b_{t-1}$. Let$b_t$be chosen by applying Lemma 1 with$c := d$. Then by choice of$b_t$,$P_C(0) = d$as required. \section{Implementation in$GF(2^8)$} The program \texttt{test\_gfshare\_isfield}, compiled and run by \texttt{make check}, demonstrates that the calculations done by libgfshare are indeed performed in a field. \section{Attacks not addressed} This document has not addressed the following: - Attacks based on the use of a predictable or partially predictable pseudorandom number generator might be possible. - In the implementation used in libgfshare, the field$F\$ is the field of byte values, with addition being bitwise exclusive-or, and multiplication as usual; each byte of the secret is shared separately by applying this algorithm separately. This means that when a secret file is shared, the length in bytes of each share equals the length in bytes of the secret. If the length of the secret is itself secret, it should be padded to some standard length before sharing. \section{References} [SHAMIR] Adi Shamir, "How to share a secret", Communications of the ACM, 22(1), pp612--613, 1979. Available at \url{http://www.cs.tau.ac.il/~bchor/Shamir.html} \section{Copyright and disclaimer} Copyright 2006 Simon McVittie, \url{http://smcv.pseudorandom.co.uk/} Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \end{document}