diff options
Diffstat (limited to 'misc')
38 files changed, 0 insertions, 2689 deletions
diff --git a/misc/.gitignore b/misc/.gitignore deleted file mode 100644 index 2b475b4a..00000000 --- a/misc/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/*.pdf -/*.dvi -/*.log -/*.aux -/*.asc -/auto diff --git a/misc/Makefile b/misc/Makefile deleted file mode 100644 index 7ec86982..00000000 --- a/misc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# Nothing here is built or distributed by default. - -all: serpent-sbox3.pdf serpent-sbox4.pdf serpent-sbox5.pdf \ - serpent-sbox6.pdf serpent-sbox7.pdf \ - serpent-sbox0i.pdf serpent-sbox1i.pdf serpent-sbox2i.pdf \ - serpent-sbox3i.pdf serpent-sbox4i.pdf serpent-sbox5i.pdf - -%.pdf: %.dot - dot -Tpdf $< -o $@ diff --git a/misc/c89 b/misc/c89 deleted file mode 100755 index 0190ee88..00000000 --- a/misc/c89 +++ /dev/null @@ -1,16 +0,0 @@ -#! /bin/sh - -# GCC wrapper that passes -std=c89, and rejects all other -std flags - -for a in "$@" ; do - case "$a" in - -std=*) - echo "c89 wrapper: option $a rejected" >&2 - exit 1 - ;; - *) - ;; - esac -done - -gcc -std=c89 "$@" diff --git a/misc/ecc-formulas.tex b/misc/ecc-formulas.tex deleted file mode 100644 index bf06d110..00000000 --- a/misc/ecc-formulas.tex +++ /dev/null @@ -1,337 +0,0 @@ -\documentclass[a4paper]{article} -\usepackage[utf8]{inputenc} -\usepackage{amsmath} -\usepackage{url} - -\author{Niels Möller} -\title{Notes on ECC formulas} - -\begin{document} - -\maketitle - -\section{Weierstrass curve} - -Consider only the special case -\begin{equation*} - y^2 = x^3 - 3x + b \pmod{p} -\end{equation*} -See \url{http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html}. - -Affine formulas for duplication, $(x_2, y_2) = 2(x_1, y_1)$: -\begin{align*} - t &= (2y)^{-1} 3 (x_1^2 - 1) \\ - x_2 &= t^2 - 2 x_1 \\ - y_2 &= (x_1 - x_2) * t - y_1 -\end{align*} -Affine formulas for addition, $(x_3, y_3) = (x_1, y_1) + (x_2, -y_2)$: -\begin{align*} - t &= (x_2 - x_1)^{-1} (y_2 - y_1) \\ - x_3 &= t^2 - x_1 - x_2 \\ - y_3 &= (x_1 - x_3) t - y_1 -\end{align*} - -\section{Montgomery curve} - -Consider the special case -\begin{equation*} - y^2 = x^3 + b x^2 + x -\end{equation*} -See \url{http://www.hyperelliptic.org/EFD/g1p/auto-montgom.html}. - -Affine formulas for duplication, $(x_2, y_2) = 2(x_1, y_1)$: -\begin{align*} - t &= (2 y_1)^{-1} (3 x_1^2 + 2b x_1 + 1) \\ - x_2 &= t^2 - b - 2 x_1 \\ - y_2 &= (3 x_1 + b) t - t^3 - y_1 \\ - &= (3 x_1 + b - t^2) t - y_1 \\ - &= (x_1 - x_2) t - y_1 -\end{align*} -So the computation is very similar to the Weierstraß case, differing -only in the formula for $t$, and the $b$ term in $x_2$. - -Affine formulas for addition, $(x_3, y_3) = (x_1, y_1) + (x_2, -y_2)$: -\begin{align*} - t &= (x_2 - x_1)^{-1} (y_2 - y_1) \\ - x_3 &= t^2 - b - x_1 - x_2 \\ - y_3 &= (2 x_1 + x_2 + b) t - t^3 - y_1 \\ - &= (2 x_1 + x_2 + b - t^2) t - y_1 \\ - &= (x_1 - x_3) t - y_1 -\end{align*} -Again, very similar to the Weierstraß formulas, with only an -additional $b$ term in the formula for $x_3$. - -\subsection{Montgomery ladder} - -It's possible to do operations on a Montgomery curve in terms of the -$x$ coordinate only. Or, with homogeneous coordinates, use $X$ and $Z$ -with $x = X/Z$. - -For doubling, -\begin{align*} - x' &= (x^2 - z^2)^2 = (x-z)^2 (x+z)^2 \\ - t &= (x+z)^2 - (x-z)^2 \\ - z' &= 4 xz (x^2 + bzx + z^2) = t \left((x+z)^2 + b't\right) -\end{align*} -with $b' = (b-2)/4$. - -Addition is a bit trickier. If we have $x$ and $z$ for points $Q_1$, -$Q_2$ and $Q_3$, with $Q_3 = Q_1 + Q_3$, and $x_1, z_1 \neq 0$, we -get the coordinates for $Q_2 + Q_3$ as -\begin{align*} - x' &= 4 (x_2 x_3 - z_2 z_3)^2 z_1 = \left((x_2 - z_2)(x_3 + z_3) + - (x_2 + z_2)(x_3 - z_3)\right)^2 z_1 \\ - z' &= 4 (x_2 z_3 - z_2 x_3)^2 x_1 = \left((x_2 - z_2)(x_3 + z_3) - - (x_2 + z_2)(x_3 - z_3)\right)^2 x_1 -\end{align*} -Note that the doubling formula is symmetric in $Q_2$ and $Q_3$. Which -is consistent with negating of $Q_1$, which really is the negatiion of -the $y$-coordinate, which doesn't appear in the formula. - -This can be used for a binary ``Montgomery ladder'' to compute $n Q$ -for any $n$. If we have the points $Q$, $n Q$, and $(n+1) Q$, we can -compute the three points -\begin{align*} - (2n) Q &= 2 (nQ) && \text{doubling} \\ - (2n+1) Q &= (nQ) + (n+1)Q && \text{addition} \\ - (2n+2) Q &= 2((n+1) Q) && \text{doubling} -\end{align*} - -The following algorithm is suggested by dj (see -\url{http://www.ietf.org/mail-archive/web/cfrg/current/msg05004.html}. -\begin{verbatim} - x2,z2,x3,z3 = 1,0,x1,1 - for i in reversed(range(255)): - bit = 1 & (n >> i) - x2,x3 = cswap(x2,x3,bit) - z2,z3 = cswap(z2,z3,bit) - x3,z3 = ((x2*x3-z2*z3)^2,x1*(x2*z3-z2*x3)^2) - x2,z2 = ((x2^2-z2^2)^2,4*x2*z2*(x2^2+A*x2*z2+z2^2)) - x2,x3 = cswap(x2,x3,bit) - z2,z3 = cswap(z2,z3,bit) - return x2*z2^(p-2) -\end{verbatim} -It's not too hard to decipher this. The update for $x_2, z_2$ is the -doubling. The update for $x_3, z_3$ is an addition. - -If the bit is zero, we get $x_2', z_2'$ representing $Q_2' = 2 Q_2$, -and $x_3', z_3'$ representing $Q_3' = Q_2 + Q_3 = 2 Q_2 + Q_1$. - -What if the bit is set? For the doubling, we get it applied to $Q_3$ -instead, so we get $x_3', z_3'$ representing $Q_3' = 2 Q_3 = 2 Q_2 + 2 -Q_1$. For the add, the initial swap flips the sign of one of the -intermediate values, but the end result is the same, so we get $x_2', -z_2'$ representing $Q_2' = Q_2 + Q_3 = 2 Q_2 + Q_1$, as desired. - -Note that the initial conditional swap doesn't have to be a full swap; -if that's convenient in the implementation, a conditional assignment -should be sufficient to get the duplication formula appplied to the -right point. It looks like, in all cases, one will start by computing -$x_2 \pm z_2$ and $x_3 \pm z_3$, so maybe one can apply conditional -assignment to these values instead. - -\section{Edwards curve} - -For an Edwards curve, we consider the special case -\begin{equation*} - x^2 + y^2 = 1 + d x^2 y^2 -\end{equation*} -See \url{http://cr.yp.to/papers.html#newelliptic}. The neutral point is -$(0, 1)$. - -Affine formulas for addition, $(x_3, y_3) = (x_1, y_1) + (x_2, -y_2)$: -\begin{align*} - t &= d x_1 x_2 y_1 y_2 \\ - x_3 &= (1 + t)^{-1} (x_1 y_2 + y_1 x_2) \\ - y_3 &= (1 - t)^{-1} (y_1 y_2 - x_1 x_2) -\end{align*} -With homogeneous coordinates $(X_1, Y_1, Z_1)$ etc., D.~J.~Bernstein -suggests the formulas -\begin{align*} - A &= Z_1 Z_2 \\ - B &= A^2 \\ - C &= X_1 X_2 \\ - D &= Y_1 Y_2 \\ - E &= d C D \\ - F &= B - E \\ - G &= B + E \\ - X_3 &= A F [(X_1 + Y_1)(X_2 + Y_2) - C - D] \\ - Y_3 &= A G (D - C) \\ - Z_3 &= F G -\end{align*} -This works also for doubling, but a more efficient variant is -\begin{align*} - B &= (X_1 + Y_1)^2 \\ - C &= X_1^2 \\ - D &= Y_1^2 \\ - E &= C + D \\ - H &= Z_1^2 \\ - J &= E - 2H \\ - X_3 &= (B - E) J \\ - Y_3 &= E (C - D) \\ - Z_3 &= E J -\end{align*} - -\section{EdDSA} - -The EdDSA paper (\url{http://ed25519.cr.yp.to/ed25519-20110926.pdf}) -suggests using the twisted Edwards curve, -\begin{equation*} - -x^2 + y^2 = 1 + d' x^2 y^2 \pmod{p} -\end{equation*} -(For this we use $d' = -d$, with $d = (121665/121666) \bmod p$, where -$d$ is the same as in the curve25519 equivalence described below). -Assuming -1 has a square root modulo $p$, a point $(x, y)$ lies on -this curve if and only if $(\sqrt{-1} x, p)$ lies of the non-twisted -Edwards curve. The point addition formulas for the twisted Edwards -curve are -\begin{align*} - t &= d' x_1 x_2 y_1 y_2 \\ - x_3 &= (1 + t)^{-1} (x_1 y_2 + y_1 x_2) \\ - y_3 &= (1 - t)^{-1} (y_1 y_2 + x_1 x_2) -\end{align*} -or in terms of $d$ rather than $d'$, signs are switched as -\begin{align*} - t &= d x_1 x_2 y_1 y_2 \\ - x_3 &= (1 - t)^{-1} (x_1 y_2 + y_1 x_2) \\ - y_3 &= (1 + t)^{-1} (y_1 y_2 + x_1 x_2) -\end{align*} - -For the other formulas, it should be fine to just switch the sign of -terms involving $x_1 x_2$ or $x_1^2$. The paper suggests further -optimizations: For precomputed points, use the representation $(x-y, -x+y, dxy)$. And for temporary points, maintain an additional redundant -coordinate $T$, with $Z T = X Y$ (see -\url{http://eprint.iacr.org/2008/522.pdf}). - -According to djb, the formulas in Section 3.1 are the once to use, -because they are complete. See -\url{http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3}, -\begin{align*} - A &= (y_1 - x_1)(y_2 - x_2) \\ - B &= (y_1 + x_1)(y_2 + x_2) \\ - C &= 2 t_1 d' t_2 \\ - D &= 2 z_1 z_2 \\ - E &= B - A \\ - F &= D - C \\ - G &= D + C \\ - H &= B + A \\ - x_3 &= E F \\ - y_3 &= G H \\ - t_3 &= E H \\ - z_3 &= F G -\end{align*} - -In our notation $a = -1$, and the $d'$ above is $-d$. - -\subsection{Decompression} - -For EdDSA, points are represented by the $y$ coordinate and only the -low bit, or ``sign'' bit, of the $x$ coordinate. Then $x^2$ can be -computed as -\begin{align*} - x^2 &= (1-y^2) (d y^2 - 1)^{-1} \\ - &= 121666 (1-y^2) (121665 y^2 - 121666)^{-1} -\end{align*} -We then get $x$ from a square root, and we can use a trick of djb's to -avoid the inversion. - -\section{Curve25519} - -Curve25519 is defined as the Montgomery curve -\begin{equation*} - y^2 = x^3 + b x^2 + x \pmod p -\end{equation*} -with $b = 486662$ and $p = 2^{255} -19$. See -\url{http://cr.yp.to/ecdh/curve25519-20060209.pdf}. It is equivalent -to the Edwards curve -\begin{equation*} - u^2 + v^2 = 1 + d u^2 v^2 \pmod p -\end{equation*} -with $d = (121665/121666) \bmod p$. The equivalence is given by -mapping $P = (x,y)$ to $P' = (u, v)$, as follows. -\begin{itemize} -\item $P = \infty$ corresponds to $P' = (0, 1)$ -\item $P = (0, 0)$ corresponds to $P' = (0, -1)$ -\item Otherwise, for all other points on the curve. First note that $x - \neq -1$ (since then the right hand side is a not a quadratic - residue), and that $y \neq 0$ (since $y = 0$ and $x \neq 0$ implies - that $x^2 + bx + 1 = 0$, or $(x + b/2)^2 = (b/2)^2 - 1$, which also - isn't a quadratic residue). The correspondence is then given by - \begin{align*} - u &= \sqrt{b+2} \, x / y \\ - v &= (x-1) / (x+1) - \end{align*} -\end{itemize} - -The inverse transformation is -\begin{align*} - x &= (1+v) / (1-v) \\ - y &= \sqrt{b+2} \, x / u -\end{align*} -If the Edwards coordinates are represented using homogeneous -coordinates, $u = U/W$ and $v = V/W$, then -\begin{align*} - x &= \frac{W+V}{W-V} \\ - y &= \sqrt{b} \frac{(W+V) W}{(W-V) U} -\end{align*} -so we need to invert the value $(W-V) U$. - -\subsection{Transforms for the twisted Edwards Curve} - -If we use the twisted Edwards curve instead, let $\alpha = \sqrt{-1} -\pmod{p}$. Then we work with coordinates $(u', v)$, where $u' = \alpha -u$. The transform from Montgomery form $(x, y)$ is then -\begin{align*} - u &= (\alpha \sqrt{b+2}) \, x / y\\ - v &= (x-1) / (x+1) -\end{align*} -And the inverse transform is similarly -\begin{align*} - x &= (1+v) / (1-v) \\ - y &= (\alpha \sqrt{b+2}) \, x / u -\end{align*} -so it's just a change of the transform constant, effectively using -$\sqrt{-(b+2)}$ instead. - -\subsection{Coordinates outside of the base field} - -The curve25519 function is defined with an input point represented by -the $x$-coordinate only, and is specified as allowing any value. The -corresponding $y$ coordinate is given by -\begin{equation*} - y = \sqrt{x^3 + b x^2 + x} \pmod p -\end{equation*} -whenever this square root exists. But what if it doesn't? Then we work -with the curve over the extended field $F_{p^2}$. Let $n$ by any -non-square, then $(x^3 + b x^2 + x) n$ is a square, and we get the -$y = y' / \sqrt{n}$ with -\begin{equation*} - y' = \sqrt{(x^3 + b x^2 + x) n} -\end{equation*} -It happens that for all multiples of such a point, this same factor is -tacked on to all the $y$-coordinates, while all the $x$-coordinates -remain in the base field $F_p$. It's the ``twist'' curve $y'^2 / n = -x^3 + bx^2 + x$. On the corresponding Edwards curve, we -get $u = \sqrt{n} u'$ with -\begin{equation*} - u' = \sqrt{b+2} \, x / y' -\end{equation*} -and the addition formula -\begin{align*} - t &= d n u'_1 u'_2 v_1 v_2 \\ - u'_3 &= (1+t)^{-1}(u'_1v_2 + v_1 u'_2) \\ - v_3 &= (1-t)^{-1}(v_1 v_2 - n u'_1 u'_2) -\end{align*} -It seems a bit tricky to handle both types of point in a single -function without speed penalty, due to the conditional factor of $n$ -in the formula for $v_3$. -\end{document} - -%%% Local Variables: -%%% mode: latex -%%% TeX-master: t -%%% End: diff --git a/misc/ecc-ref.gp b/misc/ecc-ref.gp deleted file mode 100644 index d963e990..00000000 --- a/misc/ecc-ref.gp +++ /dev/null @@ -1,131 +0,0 @@ -/* Script for pari/gp. Run as gp -q ecc-ref.gp */ - -out(apriv, A, bpriv, B, S) = print( \ - "/* a_s */ \"", apriv, "\",\n", \ - "/* a_x */ \"", component(A[1], 2), "\",\n", \ - "/* a_y */ \"", component(A[2], 2), "\",\n", \ - "/* b_s */ \"", bpriv, "\",\n", \ - "/* b_x */ \"", component(B[1], 2), "\",\n", \ - "/* b_y */ \"", component(B[2], 2), "\",\n", \ - "/* s_x */ \"", component(S[1], 2), "\",\n", \ - "/* s_y */ \"", component(S[2], 2), "\","); - -p192 = 2^192 - 2^64 - 1; -b192 = 2455155546008943817740293915197451784769108058161191238065; -g = Mod([602046282375688656758213480587526111916698976636884684818, \ - 174050332293622031404857552280219410364023488927386650641], p192); -secp192 = ellinit(Mod([0,0,0,-3, b192], p192)); -q = 6277101735386680763835789423176059013767194773182842284081; -if (ellpow(secp192, g, q) != [0], error("secp192 parameter error")); - -a = 1+random(q-1); -b = 1+random(q-1); -A = ellpow(secp192, g, a); -B = ellpow(secp192, g, b); -S = ellpow(secp192, A, b); -if (S != ellpow(secp192, B, a), error("secp192 dh error")); -print("secp192"); -out(a, A, b, B, S); - -p224 = 2^224 - 2^96 + 1; -b224 = 18958286285566608000408668544493926415504680968679321075787234672564; -g = Mod([19277929113566293071110308034699488026831934219452440156649784352033,\ - 19926808758034470970197974370888749184205991990603949537637343198772], p224); - -secp224 = ellinit(Mod([0,0,0,-3, b224], p224)); -q = 26959946667150639794667015087019625940457807714424391721682722368061; -if (ellpow(secp224, g, q) != [0], error("secp224 parameter error")); - -a = 1+random(q-1); -b = 1+random(q-1); -A = ellpow(secp224, g, a); -B = ellpow(secp224, g, b); -S = ellpow(secp224, A, b); -if (S != ellpow(secp224, B, a), error("secp224 dh error")); -print("secp224"); -out(a, A, b, B, S); - -p256 = 2^256 - 2^224 + 2^192 + 2^96 - 1; -b256 = 41058363725152142129326129780047268409114441015993725554835256314039467401291; -g = Mod([48439561293906451759052585252797914202762949526041747995844080717082404635286,\ - 36134250956749795798585127919587881956611106672985015071877198253568414405109], p256); - -secp256 = ellinit(Mod([0,0,0,-3, b256], p256)); -q = 115792089210356248762697446949407573529996955224135760342422259061068512044369; -if (ellpow(secp256, g, q) != [0], error("secp256 parameter error")); - -a = 1+random(q-1); -b = 1+random(q-1); -A = ellpow(secp256, g, a); -B = ellpow(secp256, g, b); -S = ellpow(secp256, A, b); -if (S != ellpow(secp256, B, a), error("secp256 dh error")); -print("secp256"); -out(a, A, b, B, S); - -p384 = 2^384 - 2^128 - 2^96 + 2^32 - 1; -b384 = 27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575; -g = Mod([26247035095799689268623156744566981891852923491109213387815615900925518854738050089022388053975719786650872476732087,\ - 8325710961489029985546751289520108179287853048861315594709205902480503199884419224438643760392947333078086511627871], p384); - -secp384 = ellinit(Mod([0,0,0,-3, b384], p384)); -q = 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643; -if (ellpow(secp384, g, q) != [0], error("secp384 parameter error")); - -a = 1+random(q-1); -b = 1+random(q-1); -A = ellpow(secp384, g, a); -B = ellpow(secp384, g, b); -S = ellpow(secp384, A, b); -if (S != ellpow(secp384, B, a), error("secp384 dh error")); -print("secp384"); -out(a, A, b, B, S); - -p521 = 2^521 - 1; -b521 = 1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984; -g = Mod([2661740802050217063228768716723360960729859168756973147706671368418802944996427808491545080627771902352094241225065558662157113545570916814161637315895999846,\ - 3757180025770020463545507224491183603594455134769762486694567779615544477440556316691234405012945539562144444537289428522585666729196580810124344277578376784], p521); - -secp521 = ellinit(Mod([0,0,0,-3, b521], p521)); -q = 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449; -if (ellpow(secp521, g, q) != [0], error("secp521 parameter error")); - -a = 1+random(q-1); -b = 1+random(q-1); -A = ellpow(secp521, g, a); -B = ellpow(secp521, g, b); -S = ellpow(secp521, A, b); -if (S != ellpow(secp521, B, a), error("secp521 dh error")); -print("secp521"); -out(a, A, b, B, S); - -p25519 = 2^255 - 19; -b25519 = 486662; -x = Mod(9, p25519); -y = sqrt(x^3 + b25519*x^2 + x); -g = [x, y]; - -curve25519 = ellinit(Mod([0, b25519, 0, 1, 0], p25519)); -q = 2^252 + 27742317777372353535851937790883648493; -if (ellpow(curve25519, g, q) != [0], error("curve25519 parameter error")); - -a = 1+random(q-1); -b = 1+random(q-1); -A = ellpow(curve25519, g, a); -B = ellpow(curve25519, g, b); -S = ellpow(curve25519, A, b); -if (S != ellpow(curve25519, B, a), error("curve25519 dh error")); -print("curve25519"); -out(a, A, b, B, S); - -/* Convert point on curve25519 to a point on the twisted edwards curve */ -beta = -sqrt(Mod(-486664, p25519)); -ed25519(p) = [p[1] * beta / p[2], (p[1] - 1) / (p[1] + 1)]; - -Ae = ed25519(A); -Be = ed25519(B); -Se = ed25519(S); -print("ed25519"); -out(a, Ae, b, Be, Se); - -quit diff --git a/misc/nettle-2.0.tar.gz.directive b/misc/nettle-2.0.tar.gz.directive deleted file mode 100644 index 140b8fb3..00000000 --- a/misc/nettle-2.0.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.1 -directory: nettle -filename: nettle-2.0.tar.gz diff --git a/misc/nettle-2.1.tar.gz.directive b/misc/nettle-2.1.tar.gz.directive deleted file mode 100644 index 71a60162..00000000 --- a/misc/nettle-2.1.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.1 -directory: nettle -filename: nettle-2.1.tar.gz diff --git a/misc/nettle-2.2.tar.gz.directive b/misc/nettle-2.2.tar.gz.directive deleted file mode 100644 index 87cd8fb2..00000000 --- a/misc/nettle-2.2.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.1 -directory: nettle -filename: nettle-2.2.tar.gz diff --git a/misc/nettle-2.3.tar.gz.directive b/misc/nettle-2.3.tar.gz.directive deleted file mode 100644 index df6be5a5..00000000 --- a/misc/nettle-2.3.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.1 -directory: nettle -filename: nettle-2.3.tar.gz diff --git a/misc/nettle-2.4.tar.gz.directive b/misc/nettle-2.4.tar.gz.directive deleted file mode 100644 index a7e2c4d1..00000000 --- a/misc/nettle-2.4.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.1 -directory: nettle -filename: nettle-2.4.tar.gz diff --git a/misc/nettle-2.5.tar.gz.directive b/misc/nettle-2.5.tar.gz.directive deleted file mode 100644 index d6251e3f..00000000 --- a/misc/nettle-2.5.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.1 -directory: nettle -filename: nettle-2.5.tar.gz diff --git a/misc/nettle-3.1.1.tar.gz.directive b/misc/nettle-3.1.1.tar.gz.directive deleted file mode 100644 index c71bbf43..00000000 --- a/misc/nettle-3.1.1.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.2 -directory: nettle -filename: nettle-3.1.1.tar.gz diff --git a/misc/nettle-3.1.tar.gz.directive b/misc/nettle-3.1.tar.gz.directive deleted file mode 100644 index 2d00b8f5..00000000 --- a/misc/nettle-3.1.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.2 -directory: nettle -filename: nettle-3.1.tar.gz diff --git a/misc/nettle-3.2.tar.gz.directive b/misc/nettle-3.2.tar.gz.directive deleted file mode 100644 index ff13163e..00000000 --- a/misc/nettle-3.2.tar.gz.directive +++ /dev/null @@ -1,3 +0,0 @@ -version: 1.2 -directory: nettle -filename: nettle-3.2.tar.gz diff --git a/misc/plan.html b/misc/plan.html deleted file mode 100644 index 309f984f..00000000 --- a/misc/plan.html +++ /dev/null @@ -1,145 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> - <link rel="stylesheet" title="Default" - type="text/css" href="todo.css" media="all"/> - <meta http-equiv="Content-Type" - content="text/html; charset=utf-8"/> -<title>TODO for coming releases</title> -</head> -<body> - <h1> Nettle release plans </h1> - <p> This is an attempt at defining a development target for the next - release of Nettle, inspired by similar pages for recent GMP - releases. [Last updated 2017-11-19]</p> - <p class='should'> - This really ought to be done before release - </p> - <p class='wish'> - Try to get this done before release - </p> - <p class='done'> - Done! - </p> - <p class='postponed'> - Leave for some later release! - </p> - - <h1> Plans for nettle-3.4 </h1> - - <h2> Bug fixes </h2> - <p class='done'> Fix issues with sizes of objects like the - nettle_hashes array and the ecc_curve structs accidentally leaking - into the ABI. Fix by another level of indirection, with a function - call to return the start address. - </p> - - <h2> New features </h2> - <p class='postponed'> - Add larger "safe" curves, e.g., M-383, curve41417, curve448 and - E-521. (curve448 in progress, on its own branch). - </p> - - <p class='postponed'> - Add functions for converting ECC points to and from ANSI x9.62. - </p> - - <p class='postponed'> - Support for the Skein hash function. - </p> - - <p class='postponed'> - Support for more GOST standard algorithms. - </p> - - <p class='done'> - Support for CFB mode (patch by Dmitry Eremin-Solenikov posted on - the list). - </p> - - <h2> Optimizations </h2> - - <p class='postponed'> - Assembly optimizations for ARMv8 (64-bit). - </p> - <p class='postponed'> - Further optimizations of curve25519 and EdDSA, in particular, - - <a href='http://www.hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3'>more - efficient point addition</a>, using extended XYZT coordinates. - </p> - - <h2> Miscellaneous </h2> - <p class='postponed'> - Use more functions from GMP-6 and later, when available: - mpn_sec_add_1, mpn_sec_tabselect, mpn_sec_invert, mpn_cnd_swap, - ... - </p> - - <p class='done'> Change base16 and base64 interfaces to use char - for encoded data, and fix remaining pointer-signedness warnings. - </p> - - <h2> Documentation </h2> - - - <h2> Build system </h2> - <p class='postponed'> - Delete AX_CREATE_STDINT_H, use stdint.h unconditionally. - </p> - - <h2> Testing </h2> - <p> Since xenofarm isn't up and running, do some manual testing: - </p> - <ul> - <li class='done'> x86_64-linux-gnu</li> - <li class='done'> x86-linux-gnu</li> - <li class='done'> x86_64-freebsd</li> - <li class='done'> x86-w*ndows (using cross compiler and wine)</li> - <li class='done'> x86_64-w*ndows (using cross compiler and wine)</li> - <li class='done'> x86_64-w*ndows, native</li> - <li class='should'> x86-darwin (needs help from Nettle users)</li> - <li class='should'> x86_64-darwin (needs help from Nettle users)</li> - <li class='wish'> armv5-linux-gnu (qemu)</li> - <li class='done'> armv7el-linux-gnu (qemu)</li> - <li class='done'> armv7hf-linux-gnu (qemu)</li> - <li class='done'> armv8-linux-gnu (qemu)</li> - <li class='done'> ppc32-linux-gnu (qemu)</li> - <li class='done'> ppc64el-linux-gnu (qemu)</li> - <li class='done'> ppc64eb-linux-gnu (qemu)</li> - <li class='done'> mips32-linux-gnu</li> - <li class='done'> mips64eb-linux-gnu (qemu)</li> - <li class='done'> mips64el-linux-gnu (qemu)</li> - <li class='done'> s390x-linux-gnu (qemu)</li> - <li class='done'> m68k-linux-gnu (aranym)</li> - <li class='done'> alpha-linux-gnu (qemu)</li> - <li class='done'> hppa-linux-gnu (qemu)</li> - <li class='done'> sparc32-linux-gnu</li> - <li class='done'> sparc64-linux-gnu</li> - <li class='wish'> armv7-android </li> - </ul> - - <h1> Changes under consideration for later releases </h1> - - <p> These are some larger changes under consideration. </p> - - <h2> Interface changes </h2> - <p class='should'> - For Merkle-Damgaard hash functions, separate the state and the - buffering. E.g., when using them for HMAC keyed "inner" and - "outer" states, we now get three buffers but we only need one. - </p> - <p class='should'> - Reorganize private key operations. Need to support RSA with and - without blinding, and DSA according to spec and some deterministic - variant (like putty - or <a href='http://tools.ietf.org/html/rfc6979'>RFC6979</a>), and - possibly also smartcard versions where the private key is not - available to the library. And without an explosion of the number - of functions. - </p> -</body> -</html> diff --git a/misc/poly1305-gen-example.pike b/misc/poly1305-gen-example.pike deleted file mode 100755 index 8e5bfa21..00000000 --- a/misc/poly1305-gen-example.pike +++ /dev/null @@ -1,42 +0,0 @@ -#! /usr/bin/pike - -void write_little_endian(int x) { - for (int i = 0; i < 16; i++, x >>= 8) { - write("%02x", x & 0xff); - } -} - -int main (int argc, array(string) argv) { - int p = (1<<130) - 5; - int mask = 0x0ffffffc0ffffffc0ffffffc0fffffff; - - int digest = (argc > 1) ? (int) argv[1] % p : 0; - int r = random(1<<128) & mask; - int r2 = r*r%p; - - for (;;) { - int m0 = random(1<<128) | (1<<128); - /* We want m0 r^2 + m1 r = digest (mod p), or - - m1 = (digest - m0 r^2 ) r^-1 (mod p) - - To be a valid message, this must also satisfy (m1 >> 128) == 1 - */ - int m1 = r->invert(p) * (digest - m0 * r2) % p; - if ((m1 >> 128) == 1) { - write ("r = 0x%x\n", r); - write ("m0 = 0x%x\n", m0); - write ("m1 = 0x%x\n", m1); - write ("out = 0x%x\n\n", digest); - - write ("r = le "); write_little_endian(r); - write ("\nm0 = le "); write_little_endian(m0); - write ("\nm1 = le "); write_little_endian(m1); - write ("\nout = le "); write_little_endian(digest); - write("\n"); - if ((m0*r2 + m1*r) % p != digest) - error("inconsistent result"); - return 0; - } - } -} diff --git a/misc/serpent-sbox0i.dot b/misc/serpent-sbox0i.dot deleted file mode 100644 index 26225aa7..00000000 --- a/misc/serpent-sbox0i.dot +++ /dev/null @@ -1,46 +0,0 @@ -strict digraph sbox0i { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - t15 [label="\N\ny0\n1"]; - t02 [label="\N\ny2\n2"]; - t01 [label="\N\ny1\n3"]; - t05 [label="\N\ny2\n4"]; - t04 [label="\N\ny1\n5"]; - t03 [label="\N\nx2\n6"]; - t08 [label="\N\nx1\n7"]; - t06 [label="\N\ny1\n8"]; - t09 [label="\N\nx1\n9"]; - y1 [label="\N\n10", shape=box]; - t12 [label="\N\nx0\n11"]; - t13 [label="\N\nx0\n12"]; - t17 [label="\N\nx1\n13"]; - y2 [label="\N\n14", shape=box]; - t10 [label="\N\nx3\n15"]; - t14 [label="\N\nx3\n16"]; - y3 [label="\N\n17", shape=box]; - t18 [label="\N\nx1\n18"]; - y0 [label="\N\n19", shape=box]; - - x2 -> t01; x3 -> t01; // t01 = x2 ^ x3; - x0 -> t02; x1 -> t02; // t02 = x0 | x1; - x1 -> t03; x2 -> t03; // t03 = x1 | x2; - x2 -> t04; t01 -> t04; // t04 = x2 & t01; - t01 -> t05; t02 -> t05; // t05 = t02 ^ t01; - x0 -> t06; t04 -> t06; // t06 = x0 | t04; - t05 -> y2; // y2 = ~ t05; - x1 -> t08; x3 -> t08; // t08 = x1 ^ x3; - t03 -> t09; t08 -> t09; // t09 = t03 & t08; - x3 -> t10; y2 -> t10; // t10 = x3 | y2; - t06 -> y1; t09 -> y1; // y1 = t09 ^ t06; - x0 -> t12; t05 -> t12; // t12 = x0 | t05; - y1 -> t13; t12 -> t13; // t13 = y1 ^ t12; - t03 -> t14; t10 -> t14; // t14 = t03 ^ t10; - x0 -> t15; x2 -> t15; // t15 = x0 ^ x2; - t13 -> y3; t14 -> y3; // y3 = t14 ^ t13; - t05 -> t17; t13 -> t17; // t17 = t05 & t13; - t14 -> t18; t17 -> t18; // t18 = t14 | t17; - t15 -> y0; t18 -> y0; // y0 = t15 ^ t18; -} diff --git a/misc/serpent-sbox1i.dot b/misc/serpent-sbox1i.dot deleted file mode 100644 index b04cf75f..00000000 --- a/misc/serpent-sbox1i.dot +++ /dev/null @@ -1,46 +0,0 @@ -strict digraph sbox1i { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - // First get shortest path to t08 - t02 [label="\N\ny1\n1"]; - t04 [label="\N\ny1\n2"]; - t01 [label="\N\ny3\n3"]; - t05 [label="\N\ny0\n4"]; - t06 [label="\N\ny0\n5"]; - t08 [label="\N\nx1\n6"]; - - y3 [label="\N\n7", shape=box]; - t11 [label="\N\nx1\n8"]; - t03 [label="\N\ny2\n9"]; - t10 [label="\N\ny1\n10"]; - t07 [label="\N\ny2\n11"]; - t09 [label="\N\ny2\n12"]; - y2 [label="\N\n13", shape=box]; - y1 [label="\N\n14", shape=box]; - t15 [label="\N\ny0\n15"]; - t17 [label="\N\ny0\n16"]; - t14 [label="\N\nx0\n17"]; - y0 [label="\N\n18", shape=box]; - - x0 -> t01; x1 -> t01; // t01 = x0 ^ x1; - x1 -> t02; x3 -> t02; // t02 = x1 | x3; - x0 -> t03; x2 -> t03; // t03 = x0 & x2; - x2 -> t04; t02 -> t04; // t04 = x2 ^ t02; - x0 -> t05; t04 -> t05; // t05 = x0 | t04; - t01 -> t06; t05 -> t06; // t06 = t01 & t05; - x3 -> t07; t03 -> t07; // t07 = x3 | t03; - x1 -> t08; t06 -> t08; // t08 = x1 ^ t06; - t07 -> t09; t06 -> t09; // t09 = t07 ^ t06; - t04 -> t10; t03 -> t10; // t10 = t04 | t03; - x3 -> t11; t08 -> t11; // t11 = x3 & t08; - t09 -> y2; // y2 = ~ t09; - t10 -> y1; t11 -> y1; // y1 = t10 ^ t11; - x0 -> t14; y2 -> t14; // t14 = x0 | y2; - t06 -> t15; y1 -> t15; // t15 = t06 ^ y1; - t01 -> y3; t04 -> y3; // y3 = t01 ^ t04; - x2 -> t17; t15 -> t17; // t17 = x2 ^ t15; - t14 -> y0; t17 -> y0; // y0 = t14 ^ t17; -} diff --git a/misc/serpent-sbox2i.dot b/misc/serpent-sbox2i.dot deleted file mode 100644 index afeb2a39..00000000 --- a/misc/serpent-sbox2i.dot +++ /dev/null @@ -1,44 +0,0 @@ -strict digraph sbox2i { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - t01 [label="\N\ny0\n1"]; - t02 [label="\N\ny2\n2"]; - t04 [label="\N\ny1\n3"]; - y0 [label="\N\n4", shape=box]; - t07 [label="\N\ny1\n5"]; - t11 [label="\N\ny1\n6"]; - t08 [label="\N\nx3\n7"]; - t06 [label="\N\ny3\n8"]; - t12 [label="\N\ny2\n9"]; - y1 [label="\N\n10", shape=box]; - t09 [label="\N\ny3\n11"]; - t03 [label="\N\nx0\n12"]; - t10 [label="\N\nx0\n13"]; - y3 [label="\N\n14", shape=box]; - t15 [label="\N\nx2\n15"]; - t17 [label="\N\nx2\n16"]; - t16 [label="\N\ny2\n17"]; - y2 [label="\N\n18", shape=box]; - - x0 -> t01; x3 -> t01; // t01 = x0 ^ x3; - x2 -> t02; x3 -> t02; // t02 = x2 ^ x3; - x0 -> t03; x2 -> t03; // t03 = x0 & x2; - x1 -> t04; t02 -> t04; // t04 = x1 | t02; - t01 -> y0; t04 -> y0; // y0 = t01 ^ t04; - x0 -> t06; x2 -> t06; // t06 = x0 | x2; - x3 -> t07; y0 -> t07; // t07 = x3 | y0; - x3 -> t08; // t08 = ~ x3; - x1 -> t09; t06 -> t09; // t09 = x1 & t06; - t03 -> t10; t08 -> t10; // t10 = t08 | t03; - x1 -> t11; t07 -> t11; // t11 = x1 & t07; - t02 -> t12; t06 -> t12; // t12 = t06 & t02; - t09 -> y3; t10 -> y3; // y3 = t09 ^ t10; - t11 -> y1; t12 -> y1; // y1 = t12 ^ t11; - x2 -> t15; y3 -> t15; // t15 = x2 & y3; - y0 -> t16; y1 -> t16; // t16 = y0 ^ y1; - t10 -> t17; t15 -> t17; // t17 = t10 ^ t15; - t16 -> y2; t17 -> y2; // y2 = t16 ^ t17; -} diff --git a/misc/serpent-sbox3.dot b/misc/serpent-sbox3.dot deleted file mode 100644 index 7fef079f..00000000 --- a/misc/serpent-sbox3.dot +++ /dev/null @@ -1,20 +0,0 @@ -strict digraph sbox3 { - x0 -> t01; x2 -> t01; // t01 = x0 ^ x2; - x0 -> t02; x3 -> t02; // t02 = x0 | x3; - x0 -> t03; x3 -> t03; // t03 = x0 & x3; - t01 -> t04; t02 -> t04; // t04 = t01 & t02; - x1 -> t05; t03 -> t05; // t05 = x1 | t03; - x0 -> t06; x1 -> t06; // t06 = x0 & x1; - x3 -> t07; t04 -> t07; // t07 = x3 ^ t04; - x2 -> t08; t06 -> t08; // t08 = x2 | t06; - x1 -> t09; t07 -> t09; // t09 = x1 ^ t07; - x3 -> t10; t05 -> t10; // t10 = x3 & t05; - t02 -> t11; t10 -> t11; // t11 = t02 ^ t10; - t08 -> y3; t09 -> y3; // y3 = t08 ^ t09; - x3 -> t13; y3 -> t13; // t13 = x3 | y3; - x0 -> t14; t07 -> t14; // t14 = x0 | t07; - x1 -> t15; t13 -> t15; // t15 = x1 & t13; - t08 -> y2; t11 -> y2; // y2 = t08 ^ t11; - t14 -> y0; t15 -> y0; // y0 = t14 ^ t15; - t05 -> y1; t04 -> y1; // y1 = t05 ^ t04; -} diff --git a/misc/serpent-sbox3i.dot b/misc/serpent-sbox3i.dot deleted file mode 100644 index 7e236c3f..00000000 --- a/misc/serpent-sbox3i.dot +++ /dev/null @@ -1,42 +0,0 @@ -strict digraph sbox3i { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - t01 [label="\N\ny3\n1"]; - t07 [label="\N\ny0\n2"]; - t02 [label="\N\ny2\n3"]; - t03 [label="\N\ny1\n4"]; - y0 [label="\N\n5", shape=box]; - t05 [label="\N\nx3\n6"]; - t14 [label="\N\ny3\n7"]; - t04 [label="\N\ny2\n8"]; - t06 [label="\N\ny2\n9"]; - y2 [label="\N\n10", shape=box]; - t09 [label="\N\ny1\n11"]; - t11 [label="\N\nx3\n12"]; - t12 [label="\N\ny1\n13"]; - y1 [label="\N\n14", shape=box]; - t13 [label="\N\nx0\n15"]; - t16 [label="\N\nx0\n16"]; - y3 [label="\N\n17", shape=box]; - - x2 -> t01; x3 -> t01; // t01 = x2 | x3; - x0 -> t02; x3 -> t02; // t02 = x0 | x3; - x2 -> t03; t02 -> t03; // t03 = x2 ^ t02; - x1 -> t04; t02 -> t04; // t04 = x1 ^ t02; - x0 -> t05; x3 -> t05; // t05 = x0 ^ x3; - t04 -> t06; t03 -> t06; // t06 = t04 & t03; - x1 -> t07; t01 -> t07; // t07 = x1 & t01; - t05 -> y2; t06 -> y2; // y2 = t05 ^ t06; - x0 -> t09; t03 -> t09; // t09 = x0 ^ t03; - t07 -> y0; t03 -> y0; // y0 = t07 ^ t03; - y0 -> t11; t05 -> t11; // t11 = y0 | t05; - t09 -> t12; t11 -> t12; // t12 = t09 & t11; - x0 -> t13; y2 -> t13; // t13 = x0 & y2; - t01 -> t14; t05 -> t14; // t14 = t01 ^ t05; - x1 -> y1; t12 -> y1; // y1 = x1 ^ t12; - x1 -> t16; t13 -> t16; // t16 = x1 | t13; - t14 -> y3; t16 -> y3; // y3 = t14 ^ t16; -} diff --git a/misc/serpent-sbox4.dot b/misc/serpent-sbox4.dot deleted file mode 100644 index d3e15f85..00000000 --- a/misc/serpent-sbox4.dot +++ /dev/null @@ -1,56 +0,0 @@ -strict digraph sbox4 { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - t02 [label="\N\ny2\n1"]; - t01 [label="\N\ny3\n2"]; - - t03 [label="\N\ny2\n3"]; - t06 [label="\N\ny3\n4"]; - - t04 [label="\N\ny0\n5"]; - t05 [label="\N\nx3\n6"]; - t15 [label="\N\nx0\n7"]; - - t11 [label="\N\nx1\n8"]; - - t10 [label="\N\nx2\n9"]; - - y3 [shape=box, label="\N\n10"]; - - t13 [label="\N\ny2\n11"]; - - t08 [label="\N\ny1\n12"]; - - y2 [shape=box, label="\N\n13"]; - - t12 [label="\N\ny1\n14"]; - t16 [label="\N\ny1\n15"]; - y1 [shape=box, label="\N\n16"]; - - t09 [label="\N\ny0\n17"]; - t14 [label="\N\ny0\n18"]; - y0 [shape=box, label="\N\n19"]; - - x0 -> t01; x1 -> t01; // t01 = x0 | x1; - x1 -> t02; x2 -> t02; // t02 = x1 | x2; - x0 -> t03; t02 -> t03; // t03 = x0 ^ t02; - x1 -> t04; x3 -> t04; // t04 = x1 ^ x3; - x3 -> t05; t03 -> t05; // t05 = x3 | t03; - x3 -> t06; t01 -> t06; // t06 = x3 & t01; - t03 -> y3; t06 -> y3; // y3 = t03 ^ t06; - y3 -> t08; t04 -> t08; // t08 = y3 & t04; - t04 -> t09; t05 -> t09; // t09 = t04 & t05; - x2 -> t10; t06 -> t10; // t10 = x2 ^ t06; - x1 -> t11; x2 -> t11; // t11 = x1 & x2; - t04 -> t12; t08 -> t12; // t12 = t04 ^ t08; - t11 -> t13; t03 -> t13; // t13 = t11 | t03; - t10 -> t14; t09 -> t14; // t14 = t10 ^ t09; - x0 -> t15; t05 -> t15; // t15 = x0 & t05; - t11 -> t16; t12 -> t16; // t16 = t11 | t12; - t13 -> y2; t08 -> y2; // y2 = t13 ^ t08; - t15 -> y1; t16 -> y1; // y1 = t15 ^ t16; - t14 -> y0; // y0 = ~ t14; -} diff --git a/misc/serpent-sbox4i.dot b/misc/serpent-sbox4i.dot deleted file mode 100644 index 19c55986..00000000 --- a/misc/serpent-sbox4i.dot +++ /dev/null @@ -1,42 +0,0 @@ -strict digraph sbox4i { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - t05 [label="\N\ny1\n1"]; - t02 [label="\N\ny2\n2"]; - t04 [label="\N\ny2\n3"]; - t01 [label="\N\nx1\n4"]; - t15 [label="\N\ny0\n5"]; - t12 [label="\N\nx3\n6"]; - t07 [label="\N\ny2\n7"]; - y1 [label="\N\n8", shape=box]; - t10 [label="\N\ny2\n9"]; - t13 [label="\N\ny2\n10"]; - t03 [label="\N\nx0\n11"]; - y3 [label="\N\n12", shape=box]; - t06 [label="\N\nx0\n13"]; - t09 [label="\N\nx0\n14"]; - y0 [label="\N\n15", shape=box]; - t11 [label="\N\nx0\n16"]; - y2 [label="\N\n17", shape=box]; - - x1 -> t01; x3 -> t01; // t01 = x1 | x3; - x2 -> t02; x3 -> t02; // t02 = x2 | x3; - x0 -> t03; t01 -> t03; // t03 = x0 & t01; - x1 -> t04; t02 -> t04; // t04 = x1 ^ t02; - x2 -> t05; x3 -> t05; // t05 = x2 ^ x3; - t03 -> t06; t03 -> t06; // t06 = ~ t03; - x0 -> t07; t04 -> t07; // t07 = x0 & t04; - t05 -> y1; t07 -> y1; // y1 = t05 ^ t07; - y1 -> t09; t06 -> t09; // t09 = y1 | t06; - x0 -> t10; t07 -> t10; // t10 = x0 ^ t07; - t01 -> t11; t09 -> t11; // t11 = t01 ^ t09; - x3 -> t12; t04 -> t12; // t12 = x3 ^ t04; - x2 -> t13; t10 -> t13; // t13 = x2 | t10; - t03 -> y3; t12 -> y3; // y3 = t03 ^ t12; - x0 -> t15; t04 -> t15; // t15 = x0 ^ t04; - t11 -> y2; t13 -> y2; // y2 = t11 ^ t13; - t15 -> y0; t09 -> y0; // y0 = t15 ^ t09; -} diff --git a/misc/serpent-sbox5.dot b/misc/serpent-sbox5.dot deleted file mode 100644 index 8c8d3980..00000000 --- a/misc/serpent-sbox5.dot +++ /dev/null @@ -1,42 +0,0 @@ -strict digraph sbox5 { - x0 [shape=box]; - x1 [shape=box]; - x2 [shape=box]; - x3 [shape=box]; - - t02 [label="\N\ny0\n1"]; - t04 [label="\N\ny0\n2"]; - t01 [label="\N\nx2\n3"]; - t07 [label="\N\ny2\n4"]; - t03 [label="\N\nx0\n5"]; - t05 [label="\N\ny0\n6"]; - t11 [label="\N\ny3\n7"]; - t09 [label="\N\nx1\n8"]; - y0 [shape=box, label="\N\n9"]; - t12 [label="\N\nx0\n10"]; - t14 [label="\N\ny3\n11"]; - y3 [shape=box, label="\N\n12"]; - t08 [label="\N\ny1\n13"]; - t10 [label="\N\nx3\n14"]; - y1 [shape=box, label="\N\n15"]; - t13 [label="\N\ny2\n16"]; - y2 [shape=box, label="\N\n17"]; - - x1 -> t01; x3 -> t01; // t01 = x1 ^ x3; - x1 -> t02; x3 -> t02; // t02 = x1 | x3; - x0 -> t03; t01 -> t03; // t03 = x0 & t01; - x2 -> t04; t02 -> t04; // t04 = x2 ^ t02; - t03 -> t05; t04 -> t05; // t05 = t03 ^ t04; - t05 -> y0; // y0 = ~ t05; - x0 -> t07; t01 -> t07; // t07 = x0 ^ t01; - x3 -> t08; y0 -> t08; // t08 = x3 | y0; - x1 -> t09; t05 -> t09; // t09 = x1 | t05; - x3 -> t10; t08 -> t10; // t10 = x3 ^ t08; - x1 -> t11; t07 -> t11; // t11 = x1 | t07; - t03 -> t12; y0 -> t12; // t12 = t03 | y0; - t07 -> t13; t10 -> t13; // t13 = t07 | t10; - t01 -> t14; t11 -> t14; // t14 = t01 ^ t11; - t09 -> y2; t13 -> y2; // y2 = t09 ^ t13; - t07 -> y1; t08 -> y1; // y1 = t07 ^ t08; - t12 -> y3; t14 -> y3; // y3 = t12 ^ t14; -} diff --git a/misc/serpent-sbox5i.dot b/misc/serpent-sbox5i.dot deleted file mode 100644 index 40671543..00000000 --- a/misc/serpent-sbox5i.dot +++ /dev/null @@ -1,42 +0,0 @@ -strict digraph sbox5i { - x0 [shape=box, label="\N"]; - x1 [shape=box, label="\N"]; - x2 [shape=box, label="\N"]; - x3 [shape=box, label="\N"]; - - t01 [label="\N\ny1\n1"]; - t02 [label="\N\ny3\n2"]; - t04 [label="\N\ny0\n3"]; - t03 [label="\N\ny2\n4"]; - t16 [label="\N\nx3\n5"]; - y0 [label="\N\n6", shape=box]; - t05 [label="\N\nx2\n7"]; - t07 [label="\N\nx0\n8"]; - t09 [label="\N\nx2\n9"]; - t08 [label="\N\ny1\n10"]; - y1 [label="\N\n11", shape=box]; - t13 [label="\N\ny2\n12"]; - t15 [label="\N\ny2\n13"]; - y2 [label="\N\n14", shape=box]; - t10 [label="\N\nx1\n15"]; - t12 [label="\N\nx1\n16"]; - y3 [label="\N\n17", shape=box]; - - x0->t01; x3->t01;// t01 = x0 & x3; - x2->t02; t01->t02;// t02 = x2 ^ t01; - x0->t03; x3->t03;// t03 = x0 ^ x3; - x1->t04; t02->t04;// t04 = x1 & t02; - x0->t05; x2->t05;// t05 = x0 & x2; - t03->y0; t04->y0;// y0 = t03 ^ t04; - x0->t07; y0->t07;// t07 = x0 & y0; - t01->t08; y0->t08;// t08 = t01 ^ y0; - x1->t09; t05->t09;// t09 = x1 | t05; - x1 -> t10// t10 = ~ x1; - t08->y1; t09->y1;// y1 = t08 ^ t09; - t10->t12; t07->t12;// t12 = t10 | t07; - y0->t13; y1->t13;// t13 = y0 | y1; - t02->y3; t12->y3;// y3 = t02 ^ t12; - t02->t15; t13->t15;// t15 = t02 ^ t13; - x1->t16; x3->t16;// t16 = x1 ^ x3; - t16->y2; t15->y2;// y2 = t16 ^ t15; -} diff --git a/misc/serpent-sbox6.dot b/misc/serpent-sbox6.dot deleted file mode 100644 index 1ec3fc84..00000000 --- a/misc/serpent-sbox6.dot +++ /dev/null @@ -1,46 +0,0 @@ -strict digraph sbox6 { - x0 [shape=box]; - x1 [shape=box]; - x2 [shape=box]; - x3 [shape=box]; - - t03 [label="\N\ny0\n1"]; - t01 [label="\N\ny1\n2"]; - t09 [label="\N\ny2\n3"]; - t11 [label="\N\nx3\n4"]; - t12 [label="\N\nx3\n5"]; - t17 [label="\N\nx0\n6"]; - t05 [label="\N\ny3\n7"]; - t02 [label="\N\nx2\n8"]; - t07 [label="\N\ny3\n9"]; - t04 [label="\N\ny1\n10"]; - y1 [label="\N\n11", shape=box]; - t15 [label="\N\ny0\n12"]; - t08 [label="\N\nx1\n13"]; - t10 [label="\N\nx1\n14"]; - y3 [label="\N\n15", shape=box]; - t13 [label="\N\ny2\n16"]; - y2 [label="\N\n17", shape=box]; - t18 [label="\N\ny0\n18"]; - y0 [label="\N\n19", shape=box]; - - x0 -> t01; x3 -> t01; // t01 = x0 & x3; - x1 -> t02; x2 -> t02; // t02 = x1 ^ x2; - x0 -> t03; x3 -> t03; // t03 = x0 ^ x3; - t01 -> t04; t02 -> t04; // t04 = t01 ^ t02; - x1 -> t05; x2 -> t05; // t05 = x1 | x2; - t04 -> y1; // y1 = ~ t04; - t03 -> t07; t05 -> t07; // t07 = t03 & t05; - x1 -> t08; y1 -> t08; // t08 = x1 & y1; - x0 -> t09; x2 -> t09; // t09 = x0 | x2; - t07 -> t10; t08 -> t10; // t10 = t07 ^ t08; - x1 -> t11; x3 -> t11; // t11 = x1 | x3; - x2 -> t12; t11 -> t12; // t12 = x2 ^ t11; - t09 -> t13; t10 -> t13; // t13 = t09 ^ t10; - t13 -> y2; // y2 = ~ t13; - y1 -> t15; t03 -> t15; // t15 = y1 & t03; - t12 -> y3; t07 -> y3; // y3 = t12 ^ t07; - x0 -> t17; x1 -> t17; // t17 = x0 ^ x1; - y2 -> t18; t15 -> t18; // t18 = y2 ^ t15; - t17 -> y0; t18 -> y0; // y0 = t17 ^ t18; -} diff --git a/misc/serpent-sbox6i.dot b/misc/serpent-sbox6i.dot deleted file mode 100644 index a2fdbd37..00000000 --- a/misc/serpent-sbox6i.dot +++ /dev/null @@ -1,57 +0,0 @@ -strict digraph sbox6i { - x0 [shape=box]; - x1 [shape=box]; - x2 [shape=box]; - x3 [shape=box]; - - y0 [shape=box]; - y1 [shape=box]; - y2 [shape=box]; - y3 [shape=box]; - - // Get to y1 - t01 [label="\N\ny2\n1"]; - t02 [label="\N\nx2\n2"]; - t06 [label="\N\ny0\n3"]; - t08 [label="\N\ny1\n4"]; - y1 [label="\N\n5"]; - // Get to t05 - t03 [label="\N\ny3\n6"]; - t05 [label="\N\ny3\n7"]; - // Get to t07 - t16 [label="\N\nx3\n8"]; - t04 [label="\N\nx2\n9"]; - t07 [label="\N\nx2\n10"]; - // Get to y0 - t09 [label="\N\ny0\n11"]; - y0 [label="\N\n12"]; - // Get to y3 - t13 [label="\N\ny3\n13"]; - t15 [label="\N\ny3\n14"]; - t17 [label="\N\nx0\n15"]; - y3 [label="\N\n16"]; - // Get to y2 - t12 [label="\N\nx1\n17"]; - t14 [label="\N\ny2\n18"]; - y2 [label="\N\n19"]; - - x0 -> t01; x2 -> t01; // t01 = x0 ^ x2; - x2 -> t02; // t02 = ~ x2; - x1 -> t03; t01-> t03; // t03 = x1 & t01; - x1 -> t04; t02-> t04; // t04 = x1 | t02; - x3 -> t05; t03-> t05; // t05 = x3 | t03; - x1 -> t06; x3 -> t06; // t06 = x1 ^ x3; - x0 -> t07; t04-> t07; // t07 = x0 & t04; - x0 -> t08; t02-> t08; // t08 = x0 | t02; - t07 -> t09; t05-> t09; // t09 = t07 ^ t05; - t06 -> y1; t08-> y1; // y1 = t06 ^ t08; - t09 -> y0; // y0 = ~ t09; - x1 -> t12; y0 -> t12; // t12 = x1 & y0; - t01 -> t13; t05-> t13; // t13 = t01 & t05; - t01 -> t14; t12-> t14; // t14 = t01 ^ t12; - t07 -> t15; t13-> t15; // t15 = t07 ^ t13; - x3 -> t16; t02-> t16; // t16 = x3 | t02; - x0 -> t17; y1 -> t17; // t17 = x0 ^ y1; - t17 -> y3; t15-> y3; // y3 = t17 ^ t15; - t16 -> y2; t14-> y2; // y2 = t16 ^ t14; -} diff --git a/misc/serpent-sbox7.dot b/misc/serpent-sbox7.dot deleted file mode 100644 index 4fd4d1f2..00000000 --- a/misc/serpent-sbox7.dot +++ /dev/null @@ -1,60 +0,0 @@ -/* Can we get down to 8 registers? Possible strategy: - * - * Do what's needed to compute y3. At this point, we need to keep - * inputs, t01, t04, y3, so we only have one temporary left (and we - * discard t02, recomputing it frpm x3 when needed later. - * - * Compute y1: Discard t04. Use one register to compute t08 and t10. - * Use the other to compute t05 (then but t15 in x2), and t09. We can - * then get to y1, and have one spare register. - * - * Put t13 in x1. Use the spare register to compute t04 (again), t11, - * t16 and y2. The rest should be easy, y0 can be done in parallel - * with y2. - */ -strict digraph sbox6 { - x0 [shape=box]; - x1 [shape=box]; - x2 [shape=box]; - x3 [shape=box]; - - t01 [label="\N\ny0\n1"]; - t04 [label="\N\ny2\n2"]; - t06 [label="\N\ny3\n3"]; - t02 [label="\N\ny1,x3\n4,18"]; - t03 [label="\N\ny1\n5"]; - y3 [label="\N\n6", shape=box]; - t11 [label="\N\ny2\n7"]; - t08 [label="\N\ny1\n8"]; - t10 [label="\N\ny1\n9"]; - t05 [label="\N\nt\n10"]; - t15 [label="\N\nx2\n11"]; - t09 [label="\N\nt\n12"]; - y1 [label="\N\n13", shape=box]; - t13 [label="\N\nx1\n14"]; - t16 [label="\N\ny2\n15"]; - y2 [label="\N\n16", shape=box]; - t14 [label="\N\ny0\n17"]; - t17 [label="\N\ny0\n18"]; - y0 [label="\N\n19", shape=box]; - - x0 -> t01; x2 -> t01; // t01 = x0 & x2; - x3 -> t02; // t02 = ~ x3; - x0 -> t03; t02 -> t03; // t03 = x0 & t02; - x1 -> t04; t01 -> t04; // t04 = x1 | t01; - x0 -> t05; x1 -> t05; // t05 = x0 & x1; - x2 -> t06; t04 -> t06; // t06 = x2 ^ t04; - t03 -> y3; t06 -> y3; // y3 = t03 ^ t06; - x2 -> t08; y3 -> t08; // t08 = x2 | y3; - x3 -> t09; t05 -> t09; // t09 = x3 | t05; - x0 -> t10; t08 -> t10; // t10 = x0 ^ t08; - t04 -> t11; y3 -> t11; // t11 = t04 & y3; - t09 -> y1; t10 -> y1; // y1 = t09 ^ t10; - x1 -> t13; y1 -> t13; // t13 = x1 ^ y1; - t01 -> t14; y1 -> t14; // t14 = t01 ^ y1; - x2 -> t15; t05 -> t15; // t15 = x2 ^ t05; - t11 -> t16; t13 -> t16; // t16 = t11 | t13; - t02 -> t17; t14 -> t17; // t17 = t02 | t14; - t15 -> y0; t17 -> y0; // y0 = t15 ^ t17; - x0 -> y2; t16 -> y2; // y2 = x0 ^ t16; -} diff --git a/misc/serpent-sbox7i.dot b/misc/serpent-sbox7i.dot deleted file mode 100644 index 203583fa..00000000 --- a/misc/serpent-sbox7i.dot +++ /dev/null @@ -1,52 +0,0 @@ -strict digraph sbox7i { - x0 [shape=box]; - x1 [shape=box]; - x2 [shape=box]; - x3 [shape=box]; - - y0 [shape=box]; - y1 [shape=box]; - y2 [shape=box]; - y3 [shape=box]; - - // To get to y2, need to save t01 - // To get to y3, need to save t04, t01 - - t01 [label="\N\ny3\n1"]; - t10 [label="\N\ny2\n2"]; - t16 [label="\N\ny2\n3"]; - t11 [label="\N\ny1\n4"]; - t14 [label="\N\ny1\n5"]; - y2 [label="\N\n6"]; - t03 [label="\N\ny3\n7"]; - t02 [label="\N\ny0\n8"]; - t04 [label="\N\ny0\n9"]; - y3 [label="\N\n10"]; - t06 [label="\N\ny0\n11"]; - t07 [label="\N\ny1\n12"]; - t08 [label="\N\ny1\n13"]; - t09 [label="\N\ny1\n14"]; - t13 [label="\N\ny0\n15"]; - y1 [label="\N\n16"]; - t15 [label="\N\nx3\n17"]; - y0 [label="\N\n18"]; - - x0 -> t01; x1 -> t01; // t01 = x0 & x1; - x0 -> t02; x1 -> t02; // t02 = x0 | x1; - x2 -> t03; t01 -> t03; // t03 = x2 | t01; - x3 -> t04; t02 -> t04; // t04 = x3 & t02; - t03 -> y3; t04 -> y3; // y3 = t03 ^ t04; - x1 -> t06; t04 -> t06; // t06 = x1 ^ t04; - x3 -> t07; y3 -> t07; // t07 = x3 ^ y3; - t07 -> t08 // t08 = ~ t07; - t06 -> t09; t08 -> t09; // t09 = t06 | t08; - x1 -> t10; x3 -> t10; // t10 = x1 ^ x3; - x0 -> t11; x3 -> t11; // t11 = x0 | x3; - x0 -> y1; t09 -> y1; // y1 = x0 ^ t09; - x2 -> t13; t06 -> t13; // t13 = x2 ^ t06; - x2 -> t14; t11 -> t14; // t14 = x2 & t11; - x3 -> t15; y1 -> t15; // t15 = x3 | y1; - t01 -> t16; t10 -> t16; // t16 = t01 | t10; - t13 -> y0; t15 -> y0; // y0 = t13 ^ t15; - t14 -> y2; t16 -> y2; // y2 = t14 ^ t16; -} diff --git a/misc/todo.css b/misc/todo.css deleted file mode 100644 index f799e4e1..00000000 --- a/misc/todo.css +++ /dev/null @@ -1,67 +0,0 @@ -body { - background: rgb(255,255,255); - color: rgb(0,0,0); - margin-left: 10%; - margin-right: 10%; -} - -a { - color: rgb(50, 50, 100); -} - -a:visited { - color: rgb(0, 0, 0); -} - -a:hover { - color: rgb(140, 30, 30); -} - -h1 { - font-size: 200%; - font-weight: normal; - color: rgb(30, 30, 140); - text-align: left; -} - -h2 { - font-size: 150%; - font-weight: normal; - font-style: normal; - text-align: left; -} - -p { - margin-left: 2em; -} - -dt { - padding-top: 1ex; -} - -hr { - background: rgb(30, 30, 140); - border-style: none; - width: 80%; -} - -img { - border: thin black solid; - float: right; -} - -.done { - color: #00a000; -} - -.should { - color: red; -} - -.wish { - color: #808000; -} - -.postponed { - color: blue; -} diff --git a/misc/umac/.gitignore b/misc/umac/.gitignore deleted file mode 100644 index 0d20b648..00000000 --- a/misc/umac/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.pyc diff --git a/misc/umac/Makefile b/misc/umac/Makefile deleted file mode 100644 index 8a932c2d..00000000 --- a/misc/umac/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -all: vectors.out - -vectors.out: mkvectors umac.py rijndael.py - ./mkvectors > vectors.out diff --git a/misc/umac/mkvectors b/misc/umac/mkvectors deleted file mode 100755 index 50e3ab64..00000000 --- a/misc/umac/mkvectors +++ /dev/null @@ -1,90 +0,0 @@ -#! /bin/bash - -set -e - -vector () { - nonce="$1" - length="$2" - data="$3" - echo "nonce:" $nonce - echo "msg length:" $length - if [ $length != "`expr length "$data"`" ] ; then - echo "data (repeated):" $data - else - echo "data:" $data - fi - for tag_len in 32 64 96 128 ; do - tag=`python repeat.py "$data" "$length" | python umac.py "$tag_len" "$nonce"` - echo "tag$tag_len:" $tag - done - echo -} - -NONCE=bcdefghi - -# RFC 4418 test vectors -vector $NONCE 0 "" -vector $NONCE 3 "a" -vector $NONCE 1024 "a" -vector $NONCE 32768 "a" -vector $NONCE 1048576 "a" -vector $NONCE 33554432 "a" -vector $NONCE 3 "abc" -vector $nonce 1500 "abc" - -DATA=def -NONCE=bcdefghijklmnopq - -vector ${NONCE:0:1} 0 $DATA -vector ${NONCE:0:2} 1 $DATA -vector ${NONCE:0:3} 2 $DATA -vector ${NONCE:0:4} 3 $DATA -vector ${NONCE:0:5} 4 $DATA - -vector ${NONCE:0:6} 1020 $DATA -vector ${NONCE:0:7} 1021 $DATA -vector ${NONCE:0:8} 1022 $DATA -vector ${NONCE:0:9} 1023 $DATA -vector ${NONCE:0:10} 1024 $DATA -vector ${NONCE:0:11} 1025 $DATA -vector ${NONCE:0:12} 1026 $DATA -vector ${NONCE:0:13} 1027 $DATA - -vector ${NONCE:0:14} 2046 $DATA -vector ${NONCE:0:15} 2047 $DATA -vector ${NONCE:0:16} 2048 $DATA -vector ${NONCE:0:1} 2049 $DATA -vector ${NONCE:0:2} 2050 $DATA - -vector ${NONCE:0:3} 16777212 $DATA -vector ${NONCE:0:4} 16777213 $DATA -vector ${NONCE:0:5} 16777214 $DATA -vector ${NONCE:0:6} 16777215 $DATA -vector ${NONCE:0:7} 16777216 $DATA -vector ${NONCE:0:8} 16777217 $DATA - -vector ${NONCE:0:9} 16778239 $DATA -vector ${NONCE:0:10} 16778240 $DATA -vector ${NONCE:0:11} 16778241 $DATA -vector ${NONCE:0:12} 16778242 $DATA -vector ${NONCE:0:13} 16778243 $DATA -vector ${NONCE:0:14} 16778244 $DATA - -vector '#00000000000000000000000000000000' 4 zero -vector '#00000000000000000000000000000001' 4 zero -vector '#00000000000000000000000000000002' 4 zero -vector '#00000000000000000000000000000003' 4 zero -vector '#00000000000000000000000000000004' 4 zero -vector '#00000000000000000000000000000005' 4 zero - -vector 'a' 7 nonce-a -vector 'b' 7 nonce-a -vector 'c' 7 nonce-a -vector 'd' 7 nonce-a -vector 'e' 7 nonce-a - -vector '#beafcafe' 15 nonce-beaf-cafe -vector '#beafcaff' 15 nonce-beaf-cafe -vector '#beafcb00' 15 nonce-beaf-cafe -vector '#beafcb01' 15 nonce-beaf-cafe -vector '#beafcb02' 15 nonce-beaf-cafe diff --git a/misc/umac/repeat.py b/misc/umac/repeat.py deleted file mode 100644 index 0bcf52ef..00000000 --- a/misc/umac/repeat.py +++ /dev/null @@ -1,19 +0,0 @@ -import sys - -if len(sys.argv) < 3: - sys.stderr.write('Usage: repeat [string] [length]\n') - sys.exit(1) - -s = sys.argv[1] -length = int(sys.argv[2]) -if length > 0: - if length > 1024: - while len(s) < 1024: - s = s + s; - while length > len(s): - sys.stdout.write(s) - length -= len(s) - - sys.stdout.write(s[:length]) - - diff --git a/misc/umac/rijndael.py b/misc/umac/rijndael.py deleted file mode 100644 index fa025c6f..00000000 --- a/misc/umac/rijndael.py +++ /dev/null @@ -1,376 +0,0 @@ -""" -A pure python (slow) implementation of rijndael with a decent interface - -To include - - -from rijndael import rijndael - -To do a key setup - - -r = rijndael(key, block_size = 16) - -key must be a string of length 16, 24, or 32 -blocksize must be 16, 24, or 32. Default is 16 - -To use - - -ciphertext = r.encrypt(plaintext) -plaintext = r.decrypt(ciphertext) - -If any strings are of the wrong length a ValueError is thrown -""" - -# ported from the Java reference code by Bram Cohen, April 2001 -# this code is public domain, unless someone makes -# an intellectual property claim against the reference -# code, in which case it can be made public domain by -# deleting all the comments and renaming all the variables - -import copy -import string - -shifts = [[[0, 0], [1, 3], [2, 2], [3, 1]], - [[0, 0], [1, 5], [2, 4], [3, 3]], - [[0, 0], [1, 7], [3, 5], [4, 4]]] - -# [keysize][block_size] -num_rounds = {16: {16: 10, 24: 12, 32: 14}, 24: {16: 12, 24: 12, 32: 14}, 32: {16: 14, 24: 14, 32: 14}} - -A = [[1, 1, 1, 1, 1, 0, 0, 0], - [0, 1, 1, 1, 1, 1, 0, 0], - [0, 0, 1, 1, 1, 1, 1, 0], - [0, 0, 0, 1, 1, 1, 1, 1], - [1, 0, 0, 0, 1, 1, 1, 1], - [1, 1, 0, 0, 0, 1, 1, 1], - [1, 1, 1, 0, 0, 0, 1, 1], - [1, 1, 1, 1, 0, 0, 0, 1]] - -# produce log and alog tables, needed for multiplying in the -# field GF(2^m) (generator = 3) -alog = [1] -for i in xrange(255): - j = (alog[-1] << 1) ^ alog[-1] - if j & 0x100 != 0: - j ^= 0x11B - alog.append(j) - -log = [0] * 256 -for i in xrange(1, 255): - log[alog[i]] = i - -# multiply two elements of GF(2^m) -def mul(a, b): - if a == 0 or b == 0: - return 0 - return alog[(log[a & 0xFF] + log[b & 0xFF]) % 255] - -# substitution box based on F^{-1}(x) -box = [[0] * 8 for i in xrange(256)] -box[1][7] = 1 -for i in xrange(2, 256): - j = alog[255 - log[i]] - for t in xrange(8): - box[i][t] = (j >> (7 - t)) & 0x01 - -B = [0, 1, 1, 0, 0, 0, 1, 1] - -# affine transform: box[i] <- B + A*box[i] -cox = [[0] * 8 for i in xrange(256)] -for i in xrange(256): - for t in xrange(8): - cox[i][t] = B[t] - for j in xrange(8): - cox[i][t] ^= A[t][j] * box[i][j] - -# S-boxes and inverse S-boxes -S = [0] * 256 -Si = [0] * 256 -for i in xrange(256): - S[i] = cox[i][0] << 7 - for t in xrange(1, 8): - S[i] ^= cox[i][t] << (7-t) - Si[S[i] & 0xFF] = i - -# T-boxes -G = [[2, 1, 1, 3], - [3, 2, 1, 1], - [1, 3, 2, 1], - [1, 1, 3, 2]] - -AA = [[0] * 8 for i in xrange(4)] - -for i in xrange(4): - for j in xrange(4): - AA[i][j] = G[i][j] - AA[i][i+4] = 1 - -for i in xrange(4): - pivot = AA[i][i] - if pivot == 0: - t = i + 1 - while AA[t][i] == 0 and t < 4: - t += 1 - assert t != 4, 'G matrix must be invertible' - for j in xrange(8): - AA[i][j], AA[t][j] = AA[t][j], AA[i][j] - pivot = AA[i][i] - for j in xrange(8): - if AA[i][j] != 0: - AA[i][j] = alog[(255 + log[AA[i][j] & 0xFF] - log[pivot & 0xFF]) % 255] - for t in xrange(4): - if i != t: - for j in xrange(i+1, 8): - AA[t][j] ^= mul(AA[i][j], AA[t][i]) - AA[t][i] = 0 - -iG = [[0] * 4 for i in xrange(4)] - -for i in xrange(4): - for j in xrange(4): - iG[i][j] = AA[i][j + 4] - -def mul4(a, bs): - if a == 0: - return 0 - r = 0 - for b in bs: - r <<= 8 - if b != 0: - r = r | mul(a, b) - return r - -T1 = [] -T2 = [] -T3 = [] -T4 = [] -T5 = [] -T6 = [] -T7 = [] -T8 = [] -U1 = [] -U2 = [] -U3 = [] -U4 = [] - -for t in xrange(256): - s = S[t] - T1.append(mul4(s, G[0])) - T2.append(mul4(s, G[1])) - T3.append(mul4(s, G[2])) - T4.append(mul4(s, G[3])) - - s = Si[t] - T5.append(mul4(s, iG[0])) - T6.append(mul4(s, iG[1])) - T7.append(mul4(s, iG[2])) - T8.append(mul4(s, iG[3])) - - U1.append(mul4(t, iG[0])) - U2.append(mul4(t, iG[1])) - U3.append(mul4(t, iG[2])) - U4.append(mul4(t, iG[3])) - -# round constants -rcon = [1] -r = 1 -for t in xrange(1, 30): - r = mul(2, r) - rcon.append(r) - -del A -del AA -del pivot -del B -del G -del box -del log -del alog -del i -del j -del r -del s -del t -del mul -del mul4 -del cox -del iG - -class rijndael: - def __init__(self, key, block_size = 16): - if block_size != 16 and block_size != 24 and block_size != 32: - raise ValueError('Invalid block size: ' + str(block_size)) - if len(key) != 16 and len(key) != 24 and len(key) != 32: - raise ValueError('Invalid key size: ' + str(len(key))) - self.block_size = block_size - - ROUNDS = num_rounds[len(key)][block_size] - BC = block_size / 4 - # encryption round keys - Ke = [[0] * BC for i in xrange(ROUNDS + 1)] - # decryption round keys - Kd = [[0] * BC for i in xrange(ROUNDS + 1)] - ROUND_KEY_COUNT = (ROUNDS + 1) * BC - KC = len(key) / 4 - - # copy user material bytes into temporary ints - tk = [] - for i in xrange(0, KC): - tk.append((ord(key[i * 4]) << 24) | (ord(key[i * 4 + 1]) << 16) | - (ord(key[i * 4 + 2]) << 8) | ord(key[i * 4 + 3])) - - # copy values into round key arrays - t = 0 - j = 0 - while j < KC and t < ROUND_KEY_COUNT: - Ke[t / BC][t % BC] = tk[j] - Kd[ROUNDS - (t / BC)][t % BC] = tk[j] - j += 1 - t += 1 - tt = 0 - rconpointer = 0 - while t < ROUND_KEY_COUNT: - # extrapolate using phi (the round key evolution function) - tt = tk[KC - 1] - tk[0] ^= (S[(tt >> 16) & 0xFF] & 0xFF) << 24 ^ \ - (S[(tt >> 8) & 0xFF] & 0xFF) << 16 ^ \ - (S[ tt & 0xFF] & 0xFF) << 8 ^ \ - (S[(tt >> 24) & 0xFF] & 0xFF) ^ \ - (rcon[rconpointer] & 0xFF) << 24 - rconpointer += 1 - if KC != 8: - for i in xrange(1, KC): - tk[i] ^= tk[i-1] - else: - for i in xrange(1, KC / 2): - tk[i] ^= tk[i-1] - tt = tk[KC / 2 - 1] - tk[KC / 2] ^= (S[ tt & 0xFF] & 0xFF) ^ \ - (S[(tt >> 8) & 0xFF] & 0xFF) << 8 ^ \ - (S[(tt >> 16) & 0xFF] & 0xFF) << 16 ^ \ - (S[(tt >> 24) & 0xFF] & 0xFF) << 24 - for i in xrange(KC / 2 + 1, KC): - tk[i] ^= tk[i-1] - # copy values into round key arrays - j = 0 - while j < KC and t < ROUND_KEY_COUNT: - Ke[t / BC][t % BC] = tk[j] - Kd[ROUNDS - (t / BC)][t % BC] = tk[j] - j += 1 - t += 1 - # inverse MixColumn where needed - for r in xrange(1, ROUNDS): - for j in xrange(BC): - tt = Kd[r][j] - Kd[r][j] = U1[(tt >> 24) & 0xFF] ^ \ - U2[(tt >> 16) & 0xFF] ^ \ - U3[(tt >> 8) & 0xFF] ^ \ - U4[ tt & 0xFF] - self.Ke = Ke - self.Kd = Kd - - def encrypt(self, plaintext): - if len(plaintext) != self.block_size: - raise ValueError('wrong block length, expected ' + str(self.block_size) + ' got ' + str(len(plaintext))) - Ke = self.Ke - - BC = self.block_size / 4 - ROUNDS = len(Ke) - 1 - if BC == 4: - SC = 0 - elif BC == 6: - SC = 1 - else: - SC = 2 - s1 = shifts[SC][1][0] - s2 = shifts[SC][2][0] - s3 = shifts[SC][3][0] - a = [0] * BC - # temporary work array - t = [] - # plaintext to ints + key - for i in xrange(BC): - t.append((ord(plaintext[i * 4 ]) << 24 | - ord(plaintext[i * 4 + 1]) << 16 | - ord(plaintext[i * 4 + 2]) << 8 | - ord(plaintext[i * 4 + 3]) ) ^ Ke[0][i]) - # apply round transforms - for r in xrange(1, ROUNDS): - for i in xrange(BC): - a[i] = (T1[(t[ i ] >> 24) & 0xFF] ^ - T2[(t[(i + s1) % BC] >> 16) & 0xFF] ^ - T3[(t[(i + s2) % BC] >> 8) & 0xFF] ^ - T4[ t[(i + s3) % BC] & 0xFF] ) ^ Ke[r][i] - t = copy.copy(a) - # last round is special - result = [] - for i in xrange(BC): - tt = Ke[ROUNDS][i] - result.append((S[(t[ i ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF) - result.append((S[(t[(i + s1) % BC] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF) - result.append((S[(t[(i + s2) % BC] >> 8) & 0xFF] ^ (tt >> 8)) & 0xFF) - result.append((S[ t[(i + s3) % BC] & 0xFF] ^ tt ) & 0xFF) - return string.join(map(chr, result), '') - - def decrypt(self, ciphertext): - if len(ciphertext) != self.block_size: - raise ValueError('wrong block length, expected ' + str(self.block_size) + ' got ' + str(len(ciphertext))) - Kd = self.Kd - - BC = self.block_size / 4 - ROUNDS = len(Kd) - 1 - if BC == 4: - SC = 0 - elif BC == 6: - SC = 1 - else: - SC = 2 - s1 = shifts[SC][1][1] - s2 = shifts[SC][2][1] - s3 = shifts[SC][3][1] - a = [0] * BC - # temporary work array - t = [0] * BC - # ciphertext to ints + key - for i in xrange(BC): - t[i] = (ord(ciphertext[i * 4 ]) << 24 | - ord(ciphertext[i * 4 + 1]) << 16 | - ord(ciphertext[i * 4 + 2]) << 8 | - ord(ciphertext[i * 4 + 3]) ) ^ Kd[0][i] - # apply round transforms - for r in xrange(1, ROUNDS): - for i in xrange(BC): - a[i] = (T5[(t[ i ] >> 24) & 0xFF] ^ - T6[(t[(i + s1) % BC] >> 16) & 0xFF] ^ - T7[(t[(i + s2) % BC] >> 8) & 0xFF] ^ - T8[ t[(i + s3) % BC] & 0xFF] ) ^ Kd[r][i] - t = copy.copy(a) - # last round is special - result = [] - for i in xrange(BC): - tt = Kd[ROUNDS][i] - result.append((Si[(t[ i ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF) - result.append((Si[(t[(i + s1) % BC] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF) - result.append((Si[(t[(i + s2) % BC] >> 8) & 0xFF] ^ (tt >> 8)) & 0xFF) - result.append((Si[ t[(i + s3) % BC] & 0xFF] ^ tt ) & 0xFF) - return string.join(map(chr, result), '') - -def encrypt(key, block): - return rijndael(key, len(block)).encrypt(block) - -def decrypt(key, block): - return rijndael(key, len(block)).decrypt(block) - -def test(): - def t(kl, bl): - b = 'b' * bl - r = rijndael('a' * kl, bl) - assert r.decrypt(r.encrypt(b)) == b - t(16, 16) - t(16, 24) - t(16, 32) - t(24, 16) - t(24, 24) - t(24, 32) - t(32, 16) - t(32, 24) - t(32, 32) diff --git a/misc/umac/umac.py b/misc/umac/umac.py deleted file mode 100644 index 577dd51b..00000000 --- a/misc/umac/umac.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- coding: utf-8 -*- - -# Reference implementation from -# http://fastcrypto.org/umac/2004/src/rijndael.py, hacked a bit by -# Nikos Mavrogiannopoulos and Niels Möller to accept command line -# arguments. - -import rijndael -import struct -import fileinput -import sys -import binascii - -if len(sys.argv) < 3: - sys.stderr.write('Usage: umac [taglen] [nonce]\n') - sys.exit(1) - -taglen = int(sys.argv[1]) -nonce = sys.argv[2] - -""" -*** Experimental Python code for verifying test-vectors. -*** Veriosn 0.01 (16 March 2006) - Hereby placed in public domain. -*** Use at your own risk. No warranties, implied or otherwise. - -- Update only works on 1024 byte blocks. Call repeatedly for longer. -- Final only works on final blocks of length 1...8192 bits. -- Hash of empty-string is done via single call to final. -""" - -# Constants -MP64 = 0x01ffffff01ffffffL # Polynomial key masks -MP128 = 0x01ffffff01ffffff01ffffff01ffffffL -M32 = 0xffffffffL # Bit masks -M64 = 0xffffffffffffffffL -P36 = 0xffffffffbL # Prime numbers -P64 = 0xffffffffffffffc5L -P128 = 0xffffffffffffffffffffffffffffff61L -T64 = 0xffffffff00000000L # Polynomial test values -T128 = 0xffffffff000000000000000000000000L - -def nh(key,data,bitlength): - a = 0 - for i in xrange(len(data)//8): - for j in xrange(4): - a += (((data[8*i+j ] + key[8*i+j ]) & M32) * - ((data[8*i+j+4] + key[8*i+j+4]) & M32)) - return (a+bitlength) & M64 # mod 2^^64 - -class umac: - def __init__(self, umacKey, tagLength = 64): - self.taglen = tagLength/8 - self.iters = iters = max(1, min(4,tagLength//32)) - # setup keys - def kdf(kdfCipher, index, numbytes): - ct = [ kdfCipher.encrypt('%s%s%s%s' % ('\x00' * 7, chr(index), '\x00' * 7, chr(i+1))) for i in xrange((numbytes+15)//16) ] - return (''.join(ct))[ : numbytes] - - kdfCipher = rijndael.rijndael(umacKey) - self.pdfCipher = rijndael.rijndael(kdf(kdfCipher,0,len(umacKey))) - # L1Key is a sequence of tuples, each (32-bit * 256) - L1Key = kdf(kdfCipher, 1, 1024 + (iters - 1) * 16) - self.L1Key = [ struct.unpack('>256I', L1Key[16*i:16*i+1024]) for i in xrange(iters) ] - # L2Key is a sequence of tuples, each (64-bit, 128-bit) - L2Key = kdf(kdfCipher, 2, iters * 24) - L2Key = [ struct.unpack('>3Q', L2Key[24*i:24*(i+1)]) for i in xrange(iters) ] - self.L2Key = [ (L2Key[i][0] & MP64, ((L2Key[i][1] << 64) + L2Key[i][2]) & MP128) for i in xrange(iters) ] - # L3Key is a sequence of tuples, each ( [64-bit * 8], 32-bit ) - tmp1 = kdf(kdfCipher, 3, iters * 64) - tmp1 = [ struct.unpack('>8Q', tmp1[64*i:64*(i+1)]) for i in xrange(iters) ] - tmp1 = [ map(lambda x : x % (2**36 - 5), i) for i in tmp1 ] - tmp2 = kdf(kdfCipher, 4, iters * 4) - tmp2 = struct.unpack('>%sI' % str(iters), tmp2) - self.L3Key = zip(tmp1, tmp2) - # Setup empty lists to accumulate L1Hash outputs - self.L1Out = [ list() for i in xrange(iters) ] # A sequence of empty lists - self.L3Out = list() - - def uhashUpdate(self, inString): - data = struct.unpack('<256I', inString) # To big-endian, 256 * 32-bits - for i in xrange(self.iters): - self.L1Out[i].append(nh(self.L1Key[i], data, 8192)) - - def uhashFinal(self, inString, bitlength): - # Pad to 32-byte multiple and unpack to tuple of 32-bit values - if len(inString) == 0: toAppend = 32 - else: toAppend = (32 - (len(inString) % 32)) % 32 - data = '%s%s' % (inString, '\x00' * toAppend) - data = struct.unpack('<%sI' % str(len(data)//4), data) - # Do three-level hash, iter times - for i in xrange(self.iters): - # L1 Hash - self.L1Out[i].append(nh(self.L1Key[i], data, bitlength)) - # L2 Hash - if len(self.L1Out[0]) == 1: - L2Out = self.L1Out[i][0] - else: - loPoly = self.L1Out[i][ : 2**14] - hiPoly = self.L1Out[i][2**14 : ] - for j in xrange(len(loPoly)-1,-1,-1): - if loPoly[j] >= T64: - loPoly[j] = [P64-1, loPoly[j] - 59] - L2Out = reduce(lambda x, y : (x * self.L2Key[i][0] + y) % P64, loPoly, 1) - if (len(hiPoly) > 0): - hiPoly.append(0x8000000000000000L) - if (len(hiPoly) % 2 == 1): - hiPoly.append(0) - hiPoly = [ (hiPoly[j] << 64) + hiPoly[j+1] for j in xrange(0,len(hiPoly),2) ] - hiPoly.insert(0,L2Out) - for j in xrange(len(hiPoly)-1,-1,-1): - if hiPoly[j] >= T128: - hiPoly[j] = [P128-1, hiPoly[j] - 159] - L2Out = reduce(lambda x, y : (x * self.L2Key[i][1] + y) % P128, hiPoly, 1) - #L3 Hash - a,res = L2Out,0; - for j in xrange(7,-1,-1): - res += (a & 0xffff) * self.L3Key[i][0][j] - a >>= 16 - self.L3Out.append(((res % P36) & M32) ^ self.L3Key[i][1]) - - def umacUpdate(self, inString): - self.uhashUpdate(inString) - - def umacFinal(self, inString, bitlength, nonce): - self.uhashFinal(inString, bitlength) - # Generate pad - mask = [None, 3, 1, 0, 0] - nlen = len(nonce) - old = ord(nonce[nlen-1]) - idx = old & mask[self.iters] - pt = '%s%s%s' % (nonce[0:nlen-1], chr(old - idx), '\x00' * (16-nlen)) - pad = struct.unpack('>4I', self.pdfCipher.encrypt(pt)) - result = [ hex(self.L3Out[i] ^ pad[self.iters*idx+i]).rstrip("L").lstrip("0x").zfill(8) for i in xrange(self.iters) ] - self.L1Out = [ list() for i in xrange(self.iters) ] # A sequence of empty lists - self.L3Out = list() - return result - -if nonce[0] == "#": - nonce = binascii.unhexlify(nonce[1:]) - -u = umac('abcdefghijklmnop', taglen) - -last_block = sys.stdin.read(1024) -if len(last_block) == 1024: - while True: - block = sys.stdin.read(1024) - if len(block) == 0: - break; - u.umacUpdate(last_block) - last_block = block; - -tag = u.umacFinal(last_block, 8*len(last_block), nonce) - -print ''.join(tag) diff --git a/misc/umac/vectors.out b/misc/umac/vectors.out deleted file mode 100644 index c1d1e90f..00000000 --- a/misc/umac/vectors.out +++ /dev/null @@ -1,432 +0,0 @@ -nonce: bcdefghi -msg length: 0 -data: -tag32: 113145fb -tag64: 6e155fad26900be1 -tag96: 32fedb100c79ad58f07ff764 -tag128: 32fedb100c79ad58f07ff7643cc60465 - -nonce: bcdefghi -msg length: 3 -data (repeated): a -tag32: 3b91d102 -tag64: 44b5cb542f220104 -tag96: 185e4fe905cba7bd85e4c2dc -tag128: 185e4fe905cba7bd85e4c2dc3d117d8d - -nonce: bcdefghi -msg length: 1024 -data (repeated): a -tag32: 599b350b -tag64: 26bf2f5d60118bd9 -tag96: 7a54abe04af82d60fb298c3c -tag128: 7a54abe04af82d60fb298c3cbd195bcb - -nonce: bcdefghi -msg length: 32768 -data (repeated): a -tag32: 58dcf532 -tag64: 27f8ef643b0d118d -tag96: 7b136bd911e4b734286ef2be -tag128: 7b136bd911e4b734286ef2be501f2c3c - -nonce: bcdefghi -msg length: 1048576 -data (repeated): a -tag32: db6364d1 -tag64: a4477e87e9f55853 -tag96: f8acfa3ac31cfeea047f7b11 -tag128: f8acfa3ac31cfeea047f7b115b03bef5 - -nonce: bcdefghi -msg length: 33554432 -data (repeated): a -tag32: 85ee5cae -tag64: faca46f856e9b45f -tag96: a621c2457c0012e64f3fdae9 -tag128: a621c2457c0012e64f3fdae9e7e1870c - -nonce: bcdefghi -msg length: 3 -data: abc -tag32: abf3a3a0 -tag64: d4d7b9f6bd4fbfcf -tag96: 883c3d4b97a61976ffcf2323 -tag128: 883c3d4b97a61976ffcf232308cba5a5 - -nonce: bcdefghi -msg length: 1500 -data (repeated): abc -tag32: abeb3c8b -tag64: d4cf26ddefd5c01a -tag96: 8824a260c53c66a36c9260a6 -tag128: 8824a260c53c66a36c9260a62cb83aa1 - -nonce: b -msg length: 0 -data (repeated): def -tag32: 3a58486b -tag64: 9e38f67da91a08d9 -tag96: 9e38f67da91a08d9c980f4db -tag128: 9e38f67da91a08d9c980f4db4089c877 - -nonce: bc -msg length: 1 -data (repeated): def -tag32: d86b1512 -tag64: fb0e207971b8e66a -tag96: ef406c2ec70d0222f59e860e -tag128: ef406c2ec70d0222f59e860eabb79ed0 - -nonce: bcd -msg length: 2 -data (repeated): def -tag32: 1ae6e02d -tag64: 1ae6e02d73aa9ab2 -tag96: 1ae6e02d73aa9ab2a27fb89e -tag128: 1ae6e02d73aa9ab2a27fb89e014dc07b - -nonce: bcde -msg length: 3 -data: def -tag32: e8c1eb59 -tag64: c81cf22342e84302 -tag96: 82626d0d575e01038e5e2cc6 -tag128: 82626d0d575e01038e5e2cc6408216f5 - -nonce: bcdef -msg length: 4 -data (repeated): def -tag32: 8950f0d3 -tag64: aba003e7bd673cc3 -tag96: aba003e7bd673cc368ba8513 -tag128: aba003e7bd673cc368ba8513cecf2e7c - -nonce: bcdefg -msg length: 1020 -data (repeated): def -tag32: 7412167c -tag64: f98828a161bb4ae3 -tag96: d8b4811f747d588d7a913360 -tag128: d8b4811f747d588d7a913360960de7cf - -nonce: bcdefgh -msg length: 1021 -data (repeated): def -tag32: 2d54936b -tag64: 2d54936be5bff72d -tag96: 2d54936be5bff72d2e105236 -tag128: 2d54936be5bff72d2e1052361163b474 - -nonce: bcdefghi -msg length: 1022 -data (repeated): def -tag32: 53ca8dd2 -tag64: 2cee9784556387b3 -tag96: 700513397f8a210a98938d3e -tag128: 700513397f8a210a98938d3e7ac3bd88 - -nonce: bcdefghij -msg length: 1023 -data (repeated): def -tag32: 26cc58df -tag64: 24ac4284ca371f42 -tag96: 24ac4284ca371f4280f60bd2 -tag128: 24ac4284ca371f4280f60bd274633d67 - -nonce: bcdefghijk -msg length: 1024 -data (repeated): def -tag32: 3cada45a -tag64: 64c6a0fd14615a76 -tag96: abc223116cedd2db5af365e6 -tag128: abc223116cedd2db5af365e641a97539 - -nonce: bcdefghijkl -msg length: 1025 -data (repeated): def -tag32: 93251e18 -tag64: 93251e18e56bbdc4 -tag96: 93251e18e56bbdc457de556f -tag128: 93251e18e56bbdc457de556f95c59931 - -nonce: bcdefghijklm -msg length: 1026 -data (repeated): def -tag32: 24a4c3ab -tag64: 5d98bd8dfaf16352 -tag96: c1298672e52386753383a15e -tag128: c1298672e52386753383a15ed58c0e42 - -nonce: bcdefghijklmn -msg length: 1027 -data (repeated): def -tag32: e7e98945 -tag64: 5b0557c9fdcf661b -tag96: 5b0557c9fdcf661b1758efc6 -tag128: 5b0557c9fdcf661b1758efc603516ebe - -nonce: bcdefghijklmno -msg length: 2046 -data (repeated): def -tag32: e12ddc9f -tag64: 65e85d47447c2277 -tag96: 16bb5183017826ed47c9995c -tag128: 16bb5183017826ed47c9995c1e5834f3 - -nonce: bcdefghijklmnop -msg length: 2047 -data (repeated): def -tag32: 34d723a6 -tag64: 34d723a6cb1676d3 -tag96: 34d723a6cb1676d3547a5064 -tag128: 34d723a6cb1676d3547a5064dc5b0a37 - -nonce: bcdefghijklmnopq -msg length: 2048 -data (repeated): def -tag32: 21fd8802 -tag64: 3968d5d0af147884 -tag96: 84565620def1e3a614d274e8 -tag128: 84565620def1e3a614d274e87626f215 - -nonce: b -msg length: 2049 -data (repeated): def -tag32: 097e5abd -tag64: ad1ee4ab606061c5 -tag96: ad1ee4ab606061c55e0d2ecf -tag128: ad1ee4ab606061c55e0d2ecfee59940a - -nonce: bc -msg length: 2050 -data (repeated): def -tag32: a03a7fe9 -tag64: 835f4a8242100055 -tag96: 971106d5f4a5e41dce40a917 -tag128: 971106d5f4a5e41dce40a91704cfe1f3 - -nonce: bcd -msg length: 16777212 -data (repeated): def -tag32: 7ef41cf3 -tag64: 7ef41cf351960aaf -tag96: 7ef41cf351960aaf729bb19f -tag128: 7ef41cf351960aaf729bb19fcee7d8c4 - -nonce: bcde -msg length: 16777213 -data (repeated): def -tag32: 8bf81932 -tag64: ab250048807ff640 -tag96: e15b9f6695c9b441de035e9b -tag128: e15b9f6695c9b441de035e9b10b8ac32 - -nonce: bcdef -msg length: 16777214 -data (repeated): def -tag32: ddb2f0ab -tag64: ff42039fcfe1248e -tag96: ff42039fcfe1248e36c19efe -tag128: ff42039fcfe1248e36c19efed14d7140 - -nonce: bcdefg -msg length: 16777215 -data (repeated): def -tag32: e67ad507 -tag64: 6be0ebda623d76df -tag96: 4adc426477fb64b1ce5afd76 -tag128: 4adc426477fb64b1ce5afd76d505f048 - -nonce: bcdefgh -msg length: 16777216 -data (repeated): def -tag32: 42d8562a -tag64: 42d8562a224a9e9a -tag96: 42d8562a224a9e9a75c2f85d -tag128: 42d8562a224a9e9a75c2f85d39462d07 - -nonce: bcdefghi -msg length: 16777217 -data (repeated): def -tag32: 486b138d -tag64: 374f09dbb0b84b88 -tag96: 6ba48d669a51ed3195ebc2aa -tag128: 6ba48d669a51ed3195ebc2aa562ee71b - -nonce: bcdefghij -msg length: 16778239 -data (repeated): def -tag32: 850cb2c5 -tag64: 876ca89ed045777b -tag96: 876ca89ed045777bf7efa793 -tag128: 876ca89ed045777bf7efa7934e1758c2 - -nonce: bcdefghijk -msg length: 16778240 -data (repeated): def -tag32: b9fc4f81 -tag64: e1974b26fb35f2c6 -tag96: 2e93c8ca83b97a6b1a21082e -tag128: 2e93c8ca83b97a6b1a21082e2a4c540d - -nonce: bcdefghijkl -msg length: 16778241 -data (repeated): def -tag32: ffced8f2 -tag64: ffced8f2494d85bf -tag96: ffced8f2494d85bf0cb39408 -tag128: ffced8f2494d85bf0cb39408ddfe0295 - -nonce: bcdefghijklm -msg length: 16778242 -data (repeated): def -tag32: 1c99c5fb -tag64: 65a5bbdda3b85368 -tag96: f9148022bc6ab64f019e9db8 -tag128: f9148022bc6ab64f019e9db83704c17b - -nonce: bcdefghijklmn -msg length: 16778243 -data (repeated): def -tag32: ec304be9 -tag64: 50dc9565fbfc4884 -tag96: 50dc9565fbfc48844a4be344 -tag128: 50dc9565fbfc48844a4be34403804605 - -nonce: bcdefghijklmno -msg length: 16778244 -data (repeated): def -tag32: 8034e26f -tag64: 04f163b7c2d5d849 -tag96: 77a26f7387d1dcd39378a322 -tag128: 77a26f7387d1dcd39378a3220652cff7 - -nonce: #00000000000000000000000000000000 -msg length: 4 -data: zero -tag32: a0e94011 -tag64: a0e940111c9c2cd5 -tag96: a0e940111c9c2cd5fa59090e -tag128: a0e940111c9c2cd5fa59090e3ac2061f - -nonce: #00000000000000000000000000000001 -msg length: 4 -data: zero -tag32: 8c6fea51 -tag64: 6d8971434be8ee41 -tag96: cbbf18b799fd0f4afb9216e5 -tag128: cbbf18b799fd0f4afb9216e52a89f247 - -nonce: #00000000000000000000000000000002 -msg length: 4 -data: zero -tag32: 6d897143 -tag64: c9c9aef87e2be502 -tag96: c9c9aef87e2be50237716af8 -tag128: c9c9aef87e2be50237716af8e24f8959 - -nonce: #00000000000000000000000000000003 -msg length: 4 -data: zero -tag32: db1b28c5 -tag64: a0a112b593656107 -tag96: d6e96ef461f54d1c85aa66cb -tag128: d6e96ef461f54d1c85aa66cbd76ca336 - -nonce: #00000000000000000000000000000004 -msg length: 4 -data: zero -tag32: a75e23b7 -tag64: a75e23b7d419e03a -tag96: a75e23b7d419e03a02d55ebf -tag128: a75e23b7d419e03a02d55ebf1ba62824 - -nonce: #00000000000000000000000000000005 -msg length: 4 -data: zero -tag32: 44ea26be -tag64: 950526f26a8cc07a -tag96: 2e63031d182a59b84f148d9a -tag128: 2e63031d182a59b84f148d9a91de70a3 - -nonce: a -msg length: 7 -data: nonce-a -tag32: 81b4ac24 -tag64: b7e8aad0da6e7f99 -tag96: d7604bffb5e368da5fe564da -tag128: d7604bffb5e368da5fe564da0068d2cc - -nonce: b -msg length: 7 -data: nonce-a -tag32: b7e8aad0 -tag64: 138814c6a03bdadf -tag96: 138814c6a03bdadff7f1666e -tag128: 138814c6a03bdadff7f1666e1bd881aa - -nonce: c -msg length: 7 -data: nonce-a -tag32: f70246fe -tag64: fb77dd1cd4c7074f -tag96: 86a016d9e67957c8ab5ebb78 -tag128: 86a016d9e67957c8ab5ebb78a673e4e9 - -nonce: d -msg length: 7 -data: nonce-a -tag32: 0595f0bf -tag64: 0595f0bf8585c7e2 -tag96: 0595f0bf8585c7e28dfab005 -tag128: 0595f0bf8585c7e28dfab00598d4e612 - -nonce: e -msg length: 7 -data: nonce-a -tag32: a8e9fe85 -tag64: 817c0b7757cb60f7 -tag96: 3266ec16a9d85b4f0dc74ec8 -tag128: 3266ec16a9d85b4f0dc74ec8272238a9 - -nonce: #beafcafe -msg length: 15 -data: nonce-beaf-cafe -tag32: f19d9dc1 -tag64: 9e878413aa079032 -tag96: 9e878413aa0790329604f3b6 -tag128: 9e878413aa0790329604f3b6ae980e58 - -nonce: #beafcaff -msg length: 15 -data: nonce-beaf-cafe -tag32: 4604a56a -tag64: 9cfd7af0bb107748 -tag96: f2b2dd5dab08bb3bc5e9a83e -tag128: f2b2dd5dab08bb3bc5e9a83e1b4ab2e7 - -nonce: #beafcb00 -msg length: 15 -data: nonce-beaf-cafe -tag32: 4ba9420e -tag64: 4ba9420e55b6ba13 -tag96: 4ba9420e55b6ba137d03443f -tag128: 4ba9420e55b6ba137d03443f6ee01734 - -nonce: #beafcb01 -msg length: 15 -data: nonce-beaf-cafe -tag32: da86ff71 -tag64: 77facd797b686e24 -tag96: 2721ca2e1bcda53a54ae65e0 -tag128: 2721ca2e1bcda53a54ae65e0da139c0d - -nonce: #beafcb02 -msg length: 15 -data: nonce-beaf-cafe -tag32: 77facd79 -tag64: 9000c0de4f5f7236 -tag96: 9000c0de4f5f7236b81ae1a5 -tag128: 9000c0de4f5f7236b81ae1a52e78a821 - diff --git a/misc/xenofarm.sh b/misc/xenofarm.sh deleted file mode 100755 index 7ded9fda..00000000 --- a/misc/xenofarm.sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh - -# Driver the xenofarm test compilation. Used together with -# nettle-server.pike, source-transform.sh and result-parser.pike in -# the nettle xenofarm project. - -# Loosely based on the xenofarm.sh script in lsh and lyskom-server. - -# Copyright 2002, 2003, 2012 Niels Möller -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - -cfgargs= -makeargs= -MAKE=make - -while [ $# -gt 0 ] -do - case "$1" in - --cfg) shift; cfgargs="$1"; shift;; - --make) shift; makeargs="$1"; shift;; - --make-program) shift; MAKE="$1"; shift;; - *) echo $0: unsupported argument $1 >&2; exit 1;; - esac -done - -pfx=`pwd`/pfx - -cfgargs="-C --with-include-path=$pfx/include:/usr/local/include --with-lib-path=$pfx/lib:/usr/local/lib --prefix=$pfx $cfgargs" - -# Fix PATH for system where the default environment is broken - -# We may need /usr/ccs/bin for ar -if type ar >/dev/null ; then : ; else - if [ -x /usr/ccs/bin/ar ] ; then - PATH="$PATH:/usr/ccs/bin" - fi -fi - -# Export new value -export PATH - -# Are we using GNU make? If not, nettle's dependency tracking won't work. -cfgdepargs='' - -if $MAKE --version 2>/dev/null | grep GNU >/dev/null ; then : ; else - cfgdepargs='--disable-dependency-tracking' -fi - -rm -rf r -mkdir r -exec > r/shlog.txt 2>&1 - -BASE=`echo nettle-*.tar.gz | sed 's/.tar.gz$//'` -VERS=`echo "$BASE" | sed 's/^nettle-//'` - -timeecho () { - # FIXME: Don't depend on GNU date - echo `LC_ALL=C TZ=UTC date '+%Y-%m-%d %H:%M:%S'`: "$@" -} - -log () { - echo "$@" >> r/mainlog.txt - date >> r/mainlog.txt -} - -logstart () { - log "BEGIN $1" -} - -logpass () { - log "PASS" -} - -logfail () { - log "FAIL" -} - -logwarn () { - log "WARN $1" -} - -dotask() { - important="$1" - task="$2" - warnfunc="$3" - cmd="$4" - var=${5:-status} - var_value=`eval echo '${'$var'}'` - if test $var_value = good - then - logstart $task - timeecho Begin $task - if sh -c "$cmd" > r/${task}log.txt 2>&1 - then - if [ -z "$warnfunc" ] - then - logpass - else - $warnfunc - fi - else - timeecho FAIL: $task - if [ $important = 1 ] - then - eval $var=${task}-failed - fi - logfail - fi - else - echo status $var_value makes it impossible/unnecessary to perform this step \ - > r/${task}log.txt - fi -} - -cfgwarn () { - logfile="r/${task}log.txt" - warnfile="r/${task}warn.txt" - egrep -i 'warning|\(w\)' "$logfile" \ - > "$warnfile" - warnings=`wc -l < $warnfile` - if test $warnings -gt 0 - then - logwarn $warnings - else - rm "$warnfile" - logpass - fi -} - -makewarn () { - logfile="r/${task}log.txt" - warnfile="r/${task}warn.txt" - # Use sed -e /RX/d to get rid of selected warnings. - egrep -i 'warning|\(w\)' "$logfile" \ - > "$warnfile" - warnings=`wc -l < $warnfile` - if test $warnings -gt 0 - then - logwarn $warnings - else - rm "$warnfile" - logpass - fi -} - -ckprgwarn () { - logfile="r/${task}log.txt" - warnfile="r/${task}warn.txt" - failfile="r/${task}fail.txt" - - egrep -i 'warning|\(w\)|error' "$logfile" \ - > "$warnfile" - warnings=`wc -l < $warnfile` - if test $warnings -gt 0 - then - egrep -i 'error' "$warnfile" \ - > "$failfile" - if test `wc -l < $failfile` -gt 0 - then - logfail - else - rm "$failfile" - logwarn $warnings - fi - else - rm "$warnfile" - logpass - fi -} - - -status=good - -echo 'FORMAT 2' > r/mainlog.txt - -dotask 1 "unzip" "" "gzip -d $BASE.tar.gz" -dotask 1 "unpack" "" "tar xf $BASE.tar" -dotask 1 "cfg" "cfgwarn" \ - "cd $BASE && ./configure $cfgargs $cfgdepargs" -dotask 1 "make" "makewarn" "cd $BASE && $MAKE $makeargs" - -# -# "make check" requirements -# - -dotask 1 "ckprg" "" "cd $BASE && $MAKE check" - -dotask 1 "install" "" "cd $BASE && $MAKE install" - -find pfx -type f -print | sort > r/installedfiles.txt -if test `wc -l < r/installedfiles.txt` -eq 0 -then - rm r/installedfiles.txt -fi - -# Collect stuff. - -timeecho Collecting results - -cp $BASE/config.cache r/configcache.txt -cp $BASE/config.log r/configlog.txt -cp $BASE/config.h r/config-h.txt - -find $BASE -name core -print > r/corefiles.txt -if test `wc -l < r/corefiles.txt` -eq 0 -then - rm r/corefiles.txt -fi - -env > r/environ.txt -echo $PATH > r/path.txt -makeinfo --version > r/makeinfo.txt -type makeinfo >> r/makeinfo.txt 2>&1 - -$MAKE --version > r/makeversion.txt 2>&1 -type $MAKE >> r/makeversion.txt - -ls -lR $pfx > r/pfxcontents.txt - -cp buildid.txt r/buildid.txt - -(cd r && tar cf - *) > xenofarm_result.tar -gzip -1 xenofarm_result.tar - -exit 0 |
