call (void)fputs("0x", stdout)
else
if $arg0 == 8
- call (void)fputs("0", stdout)
+ call (void)fputs("0", stdout)
else
- if $arg0 != 10
- call (void)fputs("$arg0:", stdout)
- end
+ if $arg0 != 10
+ call (void)fputs("$arg0:", stdout)
+ end
end
end
call (void)mp_writefile($arg1, stdout, $arg0)
## it under the terms of the GNU Library General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
-##
+##
## Catacomb 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 Library General Public License for more details.
-##
+##
## You should have received a copy of the GNU Library General Public
## License along with Catacomb; if not, write to the Free
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
$(srcdir)/gengctab gccipher gcipher >gciphertab.c.new \
"lit(join(`ciphers', `-', `cipher_modes')) \
lit(join(`hashes', `-', `_(mgf)')) \
- rc4 seal"
+ rc4 seal"
mv gciphertab.c.new gciphertab.c
gmactab.c: gengctab
$(srcdir)/gengctab gcmac gmac >gmactab.c.new \
- "lit(join(`hashes', `-', `_(hmac)'))"
+ "lit(join(`hashes', `-', `_(hmac)'))"
mv gmactab.c.new gmactab.c
ghashtab.c: gengctab
patsubst(LIBCAT_SRC, `\.c\>', `.o'): \
mptypes.h primetab.h
patsubst(MP_SOURCES, `\.c\>', `.lo'): mplimits.h
-
+
dsig_SOURCES = dsig.c
cookie_SOURCES = cookie.c
catcrypt_SOURCES = catcrypt.c
pixie_CFLAGS = $(AM_CFLAGS)
mkphrase_SOURCES = mkphrase.c
bittest_SOURCES = bittest.c
-bittest_LDADD =
+bittest_LDADD =
define(`emit', `
patsubst(_item, `[^a-zA-Z0-9]', `_')_mktab_SOURCES = _item`'-mktab.c
Catacomb
-
+
Catacomb is a cryptographic library. It covers quite a lot of
the `standard' cryptographic primitives, although there's plenty
of scope for improvement, implementing more block ciphers and
hostile implementation can, undetectably, leak bits of your
private key in each signed message. This works by carefully
choosing a supposedly random parameter to the signature
- function.
+ function.
Once your adversary has acquired a few signed messages, which
shouldn't be too hard, he can recover either your entire key, or
There are a number of block ciphers implemented, all with
extremely similar interfaces. However, block ciphers aren't
actually at all pleasant to use directly. They're really
- intended to be used only by higher-level `modes'.
+ intended to be used only by higher-level `modes'.
Anyway, I'll take Bruce Schneier's Blowfish as an example.
The `type' Simply N if specific macros for handling blocks
of the appropriate width have been written, or X
if the macros should use a loop instead.
-
+
The `endianness'
Either `B' for big-endian, or `L' for little-
endian.
-
+
The `width' The cipher's block size in bits.
This simple interface is thoroughly inconvenient for general
value x R^{-1} mod m. That doesn't sound very useful, does it?
Things start looking more hopeful when you multiply your inputs
- by R. (There's a clever way of doing that: see below.) To
+ by R. (There's a clever way of doing that: see below.) To
compute xy mod m, you can first calculate xR and yR, multiply
them together to get xyR^2, and do a Montgomery reduction to get
xyR^2 R^{-1} mod m. Then the R^{-1} cancels one of the Rs and
reproduce my results exactly using the publicly available
DIEHARD distribution and the code supplied. If you do actually
want them, send me some mail and I'll send you a 60K tar.gz
- file by (approximate) return.
+ file by (approximate) return.
-- [mdw]
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
const key_fetchdef bbs_privfetch[] = {
{ "n", offsetof(bbs_priv, n), KENC_MP, 0 },
{ "private", 0, KENC_STRUCT, priv },
- { 0, 0, 0, 0 }
+ { 0, 0, 0, 0 }
};
/* --- @bbs_pubfree@, @bbs_privfree@ --- *
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Returns: If it worked OK, @PGEN_DONE@, otherwise @PGEN_ABORT@.
*
* Use: Finds two prime numbers %$p'$% and %$q'$% such that both are
- * congruent to %$3 \bmod 4$%, and $(p - 1)/2$% and
+ * congruent to %$3 \bmod 4$%, and $(p - 1)/2$% and
* %$(q - 1)/2$% have no common factors. The product %$n = pq$%
* is eminently suitable for use as a modulus in a Blum-Blum-
* Shub pseudorandom bit generator.
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* steps. The @...n@ versions take an @unsigned long@ argument;
* the non-@...n@ versions a multiprecision integer. If @n@ is
* negative then the generator is stepped in the reverse
- * direction.
+ * direction.
*/
static void ff(bbs *b, const bbs_priv *bp, mp *n)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
switch (op) {
case GRAND_CHECK:
switch (va_arg(ap, unsigned)) {
- case GRAND_CHECK:
- case GRAND_SEEDINT:
- case GRAND_SEEDUINT32:
- case GRAND_SEEDMP:
+ case GRAND_CHECK:
+ case GRAND_SEEDINT:
+ case GRAND_SEEDUINT32:
+ case GRAND_SEEDMP:
case GRAND_SEEDRAND:
case BBS_SET:
case BBS_STEP:
case BBS_REWN:
case BBS_MOD:
case BBS_STATE:
- rc = 1;
- break;
- default:
- rc = 0;
- break;
+ rc = 1;
+ break;
+ default:
+ rc = 0;
+ break;
}
break;
case GRAND_SEEDINT: {
/* --- @bbs_rand@ --- *
*
- * Arguments: @mp *m@ = modulus
+ * Arguments: @mp *m@ = modulus
* @mp *x@ = initial seed
*
- * Returns: Pointer to a generic generator.
+ * Returns: Pointer to a generic generator.
*
- * Use: Constructs a generic generator interface over a
+ * Use: Constructs a generic generator interface over a
* Blum-Blum-Shub generator.
*/
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* steps. The @...n@ versions take an @unsigned long@ argument;
* the non-@...n@ versions a multiprecision integer. If @n@ is
* negative then the generator is stepped in the reverse
- * direction.
+ * direction.
*/
extern void bbs_ff(bbs */*b*/, const bbs_priv */*bp*/, mp */*n*/);
* Returns: If it worked OK, @PGEN_DONE@, otherwise @PGEN_ABORT@.
*
* Use: Finds two prime numbers %$p'$% and %$q'$% such that both are
- * congruent to %$3 \bmod 4$%, and $(p - 1)/2$% and
+ * congruent to %$3 \bmod 4$%, and $(p - 1)/2$% and
* %$(q - 1)/2$% have no common factors. The product %$n = pq$%
* is eminently suitable for use as a modulus in a Blum-Blum-
* Shub pseudorandom bit generator.
/* --- @bbs_rand@ --- *
*
- * Arguments: @mp *m@ = modulus
+ * Arguments: @mp *m@ = modulus
* @mp *x@ = initial seed
*
- * Returns: Pointer to a generic generator.
+ * Returns: Pointer to a generic generator.
*
- * Use: Constructs a generic generator interface over a
+ * Use: Constructs a generic generator interface over a
* Blum-Blum-Shub generator.
*/
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2002 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2002 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#ifdef TEST_RIG
#include <string.h>
-
+
#include <mLib/quis.h>
#include <mLib/testrig.h>
if (memcmp(b.buf, v[2].buf, PRE##_BLKSZ)) { \
ok = 0; \
printf("\nfail encryption:" \
- "\n\tkey = "); \
+ "\n\tkey = "); \
type_hex.dump(&v[0], stdout); \
printf("\n\tplaintext = "); type_hex.dump(&v[1], stdout); \
printf("\n\texpected = "); type_hex.dump(&v[2], stdout); \
if (memcmp(b.buf, v[1].buf, PRE##_BLKSZ)) { \
ok = 0; \
printf("\nfail decryption:" \
- "\n\tkey = "); \
+ "\n\tkey = "); \
type_hex.dump(&v[0], stdout); \
printf("\n\tciphertext = "); type_hex.dump(&v[2], stdout); \
printf("\n\texpected = "); type_hex.dump(&v[1], stdout); \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
unsigned max = 32 * n;
size_t step = n / 60;
- fputs("[ ]\r[",
+ fputs("[ ]\r[",
stderr);
#define EMIT(z) do { \
\\\n\
{ ", stdout);
else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
x ^= *r; \
y ^= ((k->s0[U8(x >> 24)] + \
k->s1[U8(x >> 16)]) ^ \
- k->s2[U8(x >> 8)]) + \
- k->s3[U8(x >> 0)]; \
+ k->s2[U8(x >> 8)]) + \
+ k->s3[U8(x >> 0)]; \
} while (0)
#define EBLK(k, a, b, c, d) do { \
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
e = a.e;
if (a.x == b.x) {
if (a.y != b.y) {
- return (0);
+ return (0);
}
alpha = (3 * a.x^2 + e.a) * minv(2 * a.y, e.p) % e.p;
} else
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#define Z_e U8(Z_cdef >> 8)
#define Z_f U8(Z_cdef >> 0)
-#define SK(w, x, y, z) \
+#define SK(w, x, y, z) \
cast_sk[0][w] ^ cast_sk[1][x] ^ cast_sk[2][y] ^ cast_sk[3][z]
i = 0;
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# it under the terms of the GNU Library General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
-#
+#
# Catacomb 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 Library General Public License for more details.
-#
+#
# You should have received a copy of the GNU Library General Public
# License along with Catacomb; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
.B catcrypt
command deals with both signing and key-encapsulation keys. (Note that
.B catcrypt
-uses signing keys in the same way as
+uses signing keys in the same way as
.BR catsign (1).)
.SS "Key-encapsulation keys"
(Key encapsulation is a means of transmitting a short, known, random
.B rsapkcs1
This is almost the same as the RSASSA-PKCS1-v1_5 algorithm described in
RFC3447; the difference is that the hash is left bare rather than being
-wrapped in a DER-encoded
+wrapped in a DER-encoded
.B DigestInfo
structure. This doesn't affect security since the key can only be used
with the one hash function anyway, and dropping the DER wrapping permits
to generate the key.
.TP
.B dsa
-This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
+This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
.B dsa
algorithm of the
.B key add
.BR sha .
.hP \*o
For
-.BR kcdsa
+.BR kcdsa
and
.BR eckcdsa ,
the default hash function is
attribute.
.TP
.B enc
-The encodings which can be applied to encrypted messages; see
+The encodings which can be applied to encrypted messages; see
.B ENCODINGS
above.
.SS encrypt
.BI "WARN " reason
.B catcrypt
encountered a situation which may or may not invalidate the decryption.
-.TP
+.TP
.BI "OK " message
Decryption was successful. This is only produced if main output is
being sent somewhere other than standard output.
.B Warning!
All output written has been checked for authenticity. However, output
can fail madway through for many reasons, and the resulting message may
-therefore be truncated. Don't rely on the output being complete until
+therefore be truncated. Don't rely on the output being complete until
.B OK
is printed or
.B catcrypt decrypt
command encodes an input file according to one of the encodings
described above in
.BR ENCODINGS .
-The input is read from the
+The input is read from the
.I file
given on the command line, or from standard input if none is specified.
Options provided are:
command decodes an input file encoded according to one of the encodings
described above in
.BR ENCODINGS .
-The input is read from the
+The input is read from the
.I file
given on the command line, or from standard input if none is specified.
Options provided are:
i.e., assuming we're encoding in PEM format, start processing input
between
.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
-and
+and
.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
lines. Without this option,
.B catcrypt
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{ "sign-key", OPTF_ARGREQ, 0, 's' },
{ "armour", 0, 0, 'a' },
{ "armor", 0, 0, 'a' },
- { "format", OPTF_ARGREQ, 0, 'f' },
- { "output", OPTF_ARGREQ, 0, 'o' },
+ { "format", OPTF_ARGREQ, 0, 'f' },
+ { "output", OPTF_ARGREQ, 0, 'o' },
{ "nocheck", 0, 0, 'C' },
{ 0, 0, 0, 0 }
};
buf_init(&b, d.buf, d.len);
BSTEP(&b, d.len);
chunk_write(e, &b);
- }
+ }
/* --- Now do the main crypto --- */
{ "verbose", 0, 0, 'v' },
{ "quiet", 0, 0, 'q' },
{ "nocheck", 0, 0, 'C' },
- { "format", OPTF_ARGREQ, 0, 'f' },
- { "output", OPTF_ARGREQ, 0, 'o' },
+ { "format", OPTF_ARGREQ, 0, 'f' },
+ { "output", OPTF_ARGREQ, 0, 'o' },
{ 0, 0, 0, 0 }
};
i = mdwopt(argc, argv, "abf:o:qvC", opt, 0, 0, 0);
die(EXIT_FAILURE, "error unbuffering output: %s", strerror(errno));
}
if (ofp && (fflush(ofp) || ferror(ofp) || fclose(ofp)))
- die(EXIT_FAILURE, "error writing output: %s", strerror(errno));
+ die(EXIT_FAILURE, "error writing output: %s", strerror(errno));
e->ops->decdone(e);
if (verb && ofp != stdout)
.RB [ \-t
.IR time ]
.br
-
+
.RB [ \-o
.IR output ]
.RI [ file
.RB [ \-F
.IR format ]
.br
-
+
.RB [ \-m
.IR file ]
.RB [ \-o
.B catsign
command deals with signing keys. (Note that
.B catsign
-uses signing keys in the same way as
+uses signing keys in the same way as
.BR catcrypt (1).)
.PP
A
.B rsapkcs1
This is almost the same as the RSASSA-PKCS1-v1_5 algorithm described in
RFC3447; the difference is that the hash is left bare rather than being
-wrapped in a DER-encoded
+wrapped in a DER-encoded
.B DigestInfo
structure. This doesn't affect security since the key can only be used
with the one hash function anyway, and dropping the DER wrapping permits
to generate the key.
.TP
.B dsa
-This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
+This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
.B dsa
algorithm of the
.B key add
.BR sha .
.hP \*o
For
-.BR kcdsa
+.BR kcdsa
and
.BR eckcdsa ,
the default hash function is
attribute.
.TP
.B enc
-The encodings which can be applied to encrypted messages; see
+The encodings which can be applied to encrypted messages; see
.B ENCODINGS
above.
.SS sign
about the signature and the signed message.
.PP
The first non-option argument is the name of the file containing the
-signature data; this may be omitted or
+signature data; this may be omitted or
.RB ` \- '
to indicate that the signature be read from standard input. The second
non-option argument, if any, is the name of the file to read the message
.B Warning!
All output written has been checked for authenticity. However, output
can fail madway through for many reasons, and the resulting message may
-therefore be truncated. Don't rely on the output being complete until
+therefore be truncated. Don't rely on the output being complete until
.B OK
is printed or
.B catsign verify
does not require any cryptographic operations.
.PP
The first non-option argument is the name of the file containing the
-signature data; this may be omitted or
+signature data; this may be omitted or
.RB ` \- '
to indicate that the signature be read from standard input. The second
non-option argument, if any, is the name of the file to read the message
command encodes an input file according to one of the encodings
described above in
.BR ENCODINGS .
-The input is read from the
+The input is read from the
.I file
given on the command line, or from standard input if none is specified.
Options provided are:
command decodes an input file encoded according to one of the encodings
described above in
.BR ENCODINGS .
-The input is read from the
+The input is read from the
.I file
given on the command line, or from standard input if none is specified.
Options provided are:
i.e., assuming we're encoding in PEM format, start processing input
between
.BI "\-\-\-\-\-BEGIN " label "\-\-\-\-\-"
-and
+and
.BI "\-\-\-\-\-END " label "\-\-\-\-\-"
lines. Without this option,
.B catsign
* (c) 2005 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (m->fp && !(m->f & F_NOCLOSE)) {
if (ferror(m->fp) || fclose(m->fp))
die(EXIT_FAILURE, "error closing message file: %s", strerror(errno));
- }
+ }
}
static void mc_endwrite(msgcanon *m, const encops *eops, enc **ee)
if (m->fp && !(m->f & F_NOCLOSE)) {
if (fflush(m->fp) || ferror(m->fp) || fclose(m->fp))
die(EXIT_FAILURE, "error closing message file: %s", strerror(errno));
- }
+ }
}
/*----- Signature reading and writing -------------------------------------*/
int i;
char bb[MSGBUFSZ];
size_t n;
- dstr d = DSTR_INIT;
+ dstr d = DSTR_INIT;
const encops *eo;
msgcanon mc_in = MC_INIT, mc_out = MC_INIT;
enc *e;
case 'C': v.f |= F_NOCHECK; break;
case 't':
if (strcmp(optarg, "always") == 0) t_fresh = 0;
- else if ((t_fresh = get_date(optarg, 0)) < 0)
+ else if ((t_fresh = get_date(optarg, 0)) < 0)
die(EXIT_FAILURE, "bad freshness time");
break;
case 'q': if (v.verb > 0) v.verb--; break;
if (dd.len != s.kh.len || memcmp(dd.buf, s.kh.buf, dd.len) != 0) {
if (v.verb) printf("FAIL key hash mismatch\n");
exit(EXIT_FAILURE);
- }
+ }
/* --- Now a merry dance --- */
die(EXIT_FAILURE, "error unbuffering output: %s", strerror(errno));
}
if (ofp && (fflush(ofp) || ferror(ofp) || fclose(ofp)))
- die(EXIT_FAILURE, "error writing output: %s", strerror(errno));
+ die(EXIT_FAILURE, "error writing output: %s", strerror(errno));
/* --- Tidy up --- */
sig_destroy(&s);
dstr_destroy(&d);
dstr_destroy(&dd);
- return (0);
+ return (0);
}
/*----- Reformatting ------------------------------------------------------*/
{ "embed", 0, 0, 'E' },
{ "format-in", OPTF_ARGREQ, 0, 'f' },
{ "format-out", OPTF_ARGREQ, 0, 'F' },
- { "message", OPTF_ARGREQ, 0, 'm' },
- { "output", OPTF_ARGREQ, 0, 'o' },
+ { "message", OPTF_ARGREQ, 0, 'm' },
+ { "output", OPTF_ARGREQ, 0, 'o' },
{ 0, 0, 0, 0 }
};
i = mdwopt(argc, argv, "f:F:m:o:aADE", opt, 0, 0, 0);
if (((s.f ^ v.f) & v.m) != 0)
moan("boundary string inconsistent with contents (ignoring)");
-
+
mcsetup_read(&mc_in, s.f, &ie, dfn);
/* --- Prepare the output stuff --- */
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
BLKC_STORE(PRE, b, ctx->iv); \
if (d) { \
for (i = 0; i < sz; i++) \
- d[i] = b[i] ^ (s ? s[i] : 0); \
+ d[i] = b[i] ^ (s ? s[i] : 0); \
} \
memmove(b, b + sz, PRE##_BLKSZ - sz); \
memcpy(b + PRE##_BLKSZ - sz, d, sz); \
if (memcmp(pt, text, sizeof(text)) == 0) { \
done++; \
if (sizeof(text) < 40 || done % 8 == 0) \
- fputc('.', stdout); \
+ fputc('.', stdout); \
if (done % 480 == 0) \
- fputs("\n\t", stdout); \
+ fputs("\n\t", stdout); \
fflush(stdout); \
} else { \
printf("\nError (sz = %lu)\n", (unsigned long)sz); \
status = 1; \
printf("\tplaintext = "); hexdump(text, sz); \
- printf(", "); hexdump(text + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(text + sz, rest); \
+ fputc('\n', stdout); \
printf("\tciphertext = "); hexdump(ct, sz); \
- printf(", "); hexdump(ct + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(ct + sz, rest); \
+ fputc('\n', stdout); \
printf("\trecovered text = "); hexdump(pt, sz); \
- printf(", "); hexdump(pt + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(pt + sz, rest); \
+ fputc('\n', stdout); \
fputc('\n', stdout); \
} \
if (sz < 63) \
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
static int bin_read(enc *e, void *p, size_t sz)
{
size_t n;
-
+
if (!sz) return (0);
n = fread(p, 1, sz, e->fp);
if (!n || ferror(e->fp)) return (-1);
pem_encdone, pem_decdone,
pem_destroy },
{ 0 }
-};
+};
/* --- @getenc@ --- *
*
enc *e = eo->initenc(fp, msg);
e->ops = eo;
e->fp = fp;
- return (e);
+ return (e);
}
/* --- @initdec@ --- *
for (;;) {
static const struct option opt[] = {
- { "format", OPTF_ARGREQ, 0, 'f' },
- { "boundary", OPTF_ARGREQ, 0, 'b' },
- { "output", OPTF_ARGREQ, 0, 'o' },
+ { "format", OPTF_ARGREQ, 0, 'f' },
+ { "boundary", OPTF_ARGREQ, 0, 'b' },
+ { "output", OPTF_ARGREQ, 0, 'o' },
{ 0, 0, 0, 0 }
};
i = mdwopt(argc, argv, "f:b:o:", opt, 0, 0, 0);
for (;;) {
static const struct option opt[] = {
- { "format", OPTF_ARGREQ, 0, 'f' },
- { "boundary", OPTF_ARGREQ, 0, 'b' },
- { "output", OPTF_ARGREQ, 0, 'o' },
+ { "format", OPTF_ARGREQ, 0, 'f' },
+ { "boundary", OPTF_ARGREQ, 0, 'b' },
+ { "output", OPTF_ARGREQ, 0, 'o' },
{ 0, 0, 0, 0 }
};
i = mdwopt(argc, argv, "f:b:o:", opt, 0, 0, 0);
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
ge *y;
} dh_encctx;
-static dh_encctx *dh_doinit(key *k, const gprime_param *gp, mp *y,
+static dh_encctx *dh_doinit(key *k, const gprime_param *gp, mp *y,
group *(*makegroup)(const gprime_param *),
const char *what)
{
ge *y = G_CREATE(de->g);
size_t n = de->g->noctets;
buf b;
-
+
G_EXP(de->g, x, de->g->g, r);
G_EXP(de->g, y, de->y, r);
dstr_ensure(d, n);
die(EXIT_FAILURE, "encryption scheme (KDF) `%s' not found in key `%s'",
q, t.buf);
}
-
+
dstr_reset(&d);
if ((q = key_getattr(0, k, "mac")) == 0) {
dstr_putf(&d, "%s-hmac", kk->h->name);
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
pss_encode, &rs->p);
if (!m) return (-1);
n = mp_octets(rs->rp.rp->n); dstr_ensure(d, n); mp_storeb(m, d->buf, n);
- d->len += n; mp_drop(m);
+ d->len += n; mp_drop(m);
return (0);
}
GH_DESTROY(s->h);
if (!s->ops->kf)
key_drop(s->kd);
- else {
+ else {
key_fetchdone(s->kp);
xfree(s->kd);
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
c = findcmd(cmds, *argv);
fprintf(fp, "Usage: %s [-OPTIONS] %s\n", QUIS, c->usage);
if (c->help) {
- fputc('\n', fp);
+ fputc('\n', fp);
pquis(fp, c->help);
}
argv++;
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
const sigops *verifyops;
const gchash *ch;
};
-
+
extern const struct sigtab sigtab[];
/* --- Data encoding --- */
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
break; \
if (s) { \
BLKC_XLOAD(PRE, iv, s); \
- s += PRE##_BLKSZ; \
+ s += PRE##_BLKSZ; \
} \
if (d) { \
- BLKC_STORE(PRE, d, iv); \
- d += PRE##_BLKSZ; \
+ BLKC_STORE(PRE, d, iv); \
+ d += PRE##_BLKSZ; \
} \
sz -= PRE##_BLKSZ; \
} \
if (memcmp(pt, text, sizeof(text)) == 0) { \
done++; \
if (sizeof(text) < 40 || done % 8 == 0) \
- fputc('.', stdout); \
+ fputc('.', stdout); \
if (done % 480 == 0) \
- fputs("\n\t", stdout); \
+ fputs("\n\t", stdout); \
fflush(stdout); \
} else { \
printf("\nError (sz = %lu)\n", (unsigned long)sz); \
status = 1; \
printf("\tplaintext = "); hexdump(text, sz); \
- printf(", "); hexdump(text + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(text + sz, rest); \
+ fputc('\n', stdout); \
printf("\tciphertext = "); hexdump(ct, sz); \
- printf(", "); hexdump(ct + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(ct + sz, rest); \
+ fputc('\n', stdout); \
printf("\trecovered text = "); hexdump(pt, sz); \
- printf(", "); hexdump(pt + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(pt + sz, rest); \
+ fputc('\n', stdout); \
fputc('\n', stdout); \
} \
if (sz < 63) \
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
dnl it under the terms of the GNU Library General Public License as
dnl published by the Free Software Foundation; either version 2 of the
dnl License, or (at your option) any later version.
-dnl
+dnl
dnl Catacomb is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU Library General Public License for more details.
-dnl
+dnl
dnl You should have received a copy of the GNU Library General Public
dnl License along with Catacomb; if not, write to the Free
dnl Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
[catacomb_cv_freewheel=no])])
if test "$catacomb_cv_freewheel" = "yes"; then
AC_DEFINE([USE_FREEWHEEL], [1],
- [Define if you want to use the freewheel noise generator.])
+ [Define if you want to use the freewheel noise generator.])
fi
dnl --- Support for the passphrase pixie ---
dnl --- Debugging things ---
-AC_ARG_ENABLE([mpw],
- [AS_HELP_STRING([--enable-mpw],
- [force small-width mp digits])],
- [case "$enableval" in
- y*|t*|short)
- AC_DEFINE([FORCE_MPW_SHORT], [1],
- [Define to force small-width mp digits.])
- ;;
- cussid)
- AC_DEFINE([FORCE_MPW_CUSSID], [1],
- [Define to force strange-width mp digits.])
- ;;
- esac])
+AC_ARG_ENABLE([mpw],
+ [AS_HELP_STRING([--enable-mpw],
+ [force small-width mp digits])],
+ [case "$enableval" in
+ y*|t*|short)
+ AC_DEFINE([FORCE_MPW_SHORT], [1],
+ [Define to force small-width mp digits.])
+ ;;
+ cussid)
+ AC_DEFINE([FORCE_MPW_CUSSID], [1],
+ [Define to force strange-width mp digits.])
+ ;;
+ esac])
dnl --- Done ---
.B verify
command if the cookie is to be accepted as valid. The data will usually
be some way of identifying the cookie's recipient, e.g., an email
-address.
+address.
.PP
The generated cookie is written to standard output, followed by a
newline. Cookies are not architecture-specific.
* (c) 1999 Mark Wooding
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* 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.
- *
+ *
* Catacomb 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 Catacomb; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
dstr d = DSTR_INIT;
octet buf[COOKIE_SZ];
base64_ctx b;
-
+
/* --- Various useful flag bits --- */
#define f_bogus 1u
case 'm':
if (!(minbits = atoi(optarg)) || minbits % 8)
die(EXIT_FAILURE, "bad number of bits: `%s'", optarg);
- break;
+ break;
/* --- Miscellaneous flags --- */
case 'v':
v++;
break;
-
+
/* --- Other things are bogus --- */
default:
#undef f_bogus
#undef f_forever
-}
+}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{ \
uint32 n[PRE##_BLKSZ / 4]; \
\
- for (;;) { \
+ for (;;) { \
pre##_eblk(&ctx->ctx, ctx->n, n); \
BLKC_STEP(PRE, ctx->n); \
if (sz < PRE##_BLKSZ) \
if (memcmp(pt, text, sizeof(text)) == 0) { \
done++; \
if (sizeof(text) < 40 || done % 8 == 0) \
- fputc('.', stdout); \
+ fputc('.', stdout); \
if (done % 480 == 0) \
- fputs("\n\t", stdout); \
+ fputs("\n\t", stdout); \
fflush(stdout); \
} else { \
printf("\nError (sz = %lu)\n", (unsigned long)sz); \
status = 1; \
printf("\tplaintext = "); hexdump(text, sz); \
- printf(", "); hexdump(text + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(text + sz, rest); \
+ fputc('\n', stdout); \
printf("\tciphertext = "); hexdump(ct, sz); \
- printf(", "); hexdump(ct + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(ct + sz, rest); \
+ fputc('\n', stdout); \
printf("\trecovered text = "); hexdump(pt, sz); \
- printf(", "); hexdump(pt + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(pt + sz, rest); \
+ fputc('\n', stdout); \
fputc('\n', stdout); \
} \
if (sz < 63) \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
down a spiral staircase, and died. The king ordered dressmakers to attach\n\
safety warnings to long dresses.\n\
\n\
-And the wizard? Who cares?\n\
+And the wizard? Who cares?\n\
"
# define TEXT STORY STORY
#endif
case $setuid in
true)
echo "Installing /usr/bin/pixie setuid-root."
- dpkg-statoverride --add --update root root 4755 /usr/bin/pixie
+ dpkg-statoverride --add --update root root 4755 /usr/bin/pixie
;;
false)
echo "Making /usr/bin/pixie non-setuid."
d=`pwd`; cd ..; dpkg-source -i -b $$d/deb-build/=deb=/*
rm -rf deb-build/=deb=
-.PHONY: binary binary-arch binary-indep clean install source
+.PHONY: binary binary-arch binary-indep clean install source
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
for (j = 0; j < 64; j++) {
printf("%s0x%08lx", sep, ss[j]);
if (j % 4 == 3)
- sep = ", \\\n ";
+ sep = ", \\\n ";
else
sep = ", ";
}
- printf(" }%s \\\n", i == 7 ? "" : ",");
+ printf(" }%s \\\n", i == 7 ? "" : ",");
}
fputs("\
}\n\
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
*/
static const char pc1[] = {
- 0, 0, 0, 0,
+ 0, 0, 0, 0,
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
- 10, 2, 59, 51, 43, 35, 27,
+ 10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
- 0, 0, 0, 0,
+ 0, 0, 0, 0,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
- 14, 6, 61, 53, 45, 37, 29,
+ 14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4
};
*/
static const char pc2[] = {
- 0, 0, 3 + 4, 28 + 4, 15 + 4, 6 + 4, 21 + 4, 10 + 4, /* S-box 2 */
- 0, 0, 16 + 4, 7 + 4, 27 + 4, 20 + 4, 13 + 4, 2 + 4, /* S-box 4 */
- 0, 0, 30 + 8, 40 + 8, 51 + 8, 45 + 8, 33 + 8, 48 + 8, /* S-box 6 */
- 0, 0, 46 + 8, 42 + 8, 50 + 8, 36 + 8, 29 + 8, 32 + 8, /* S-box 8 */
- 0, 0, 14 + 4, 17 + 4, 11 + 4, 24 + 4, 1 + 4, 5 + 4, /* S-box 1 */
- 0, 0, 23 + 4, 19 + 4, 12 + 4, 4 + 4, 26 + 4, 8 + 4, /* S-box 3 */
- 0, 0, 41 + 8, 52 + 8, 31 + 8, 37 + 8, 47 + 8, 55 + 8, /* S-box 5 */
- 0, 0, 44 + 8, 49 + 8, 39 + 8, 56 + 8, 34 + 8, 53 + 8 /* S-box 7 */
+ 0, 0, 3 + 4, 28 + 4, 15 + 4, 6 + 4, 21 + 4, 10 + 4, /* S-box 2 */
+ 0, 0, 16 + 4, 7 + 4, 27 + 4, 20 + 4, 13 + 4, 2 + 4, /* S-box 4 */
+ 0, 0, 30 + 8, 40 + 8, 51 + 8, 45 + 8, 33 + 8, 48 + 8, /* S-box 6 */
+ 0, 0, 46 + 8, 42 + 8, 50 + 8, 36 + 8, 29 + 8, 32 + 8, /* S-box 8 */
+ 0, 0, 14 + 4, 17 + 4, 11 + 4, 24 + 4, 1 + 4, 5 + 4, /* S-box 1 */
+ 0, 0, 23 + 4, 19 + 4, 12 + 4, 4 + 4, 26 + 4, 8 + 4, /* S-box 3 */
+ 0, 0, 41 + 8, 52 + 8, 31 + 8, 37 + 8, 47 + 8, 55 + 8, /* S-box 5 */
+ 0, 0, 44 + 8, 49 + 8, 39 + 8, 56 + 8, 34 + 8, 53 + 8 /* S-box 7 */
};
/* --- @v@ --- *
KSZ_ASSERT(des, sz);
des_expand(buf, sz, &x, &y);
-
+
/* --- Permute using the pointless PC1 --- */
permute(pc1, x, y, ka);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Returns: ---
*
* Use: Initializes a DES key buffer. The key buffer may have length
- * 7, 8, 14, 16, 21, or 24. These correspond to one, two or
- * three DES keys, either packed or unpacked (i.e., still
- * containing parity bits).
+ * 7, 8, 14, 16, 21, or 24. These correspond to one, two or
+ * three DES keys, either packed or unpacked (i.e., still
+ * containing parity bits).
*/
void des3_init(des3_ctx *k, const void *buf, size_t sz)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/*----- S-box table -------------------------------------------------------*/
#define DESX_S { \
- 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, \
- 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, \
- 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, \
- 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, \
- 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, \
- 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, \
- 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, \
- 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, \
- 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, \
- 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, \
- 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, \
- 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, \
- 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, \
- 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, \
- 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, \
- 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, \
- 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, \
- 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, \
- 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, \
- 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, \
- 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, \
- 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, \
- 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, \
- 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, \
- 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, \
- 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, \
- 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, \
- 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, \
- 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, \
- 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, \
- 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, \
- 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab, \
+ 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, \
+ 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, \
+ 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, \
+ 0xf7, 0xcb, 0x45, 0x9b, 0x31, 0xbb, 0x21, 0x5a, \
+ 0x41, 0x9f, 0xe1, 0xd9, 0x4a, 0x4d, 0x9e, 0xda, \
+ 0xa0, 0x68, 0x2c, 0xc3, 0x27, 0x5f, 0x80, 0x36, \
+ 0x3e, 0xee, 0xfb, 0x95, 0x1a, 0xfe, 0xce, 0xa8, \
+ 0x34, 0xa9, 0x13, 0xf0, 0xa6, 0x3f, 0xd8, 0x0c, \
+ 0x78, 0x24, 0xaf, 0x23, 0x52, 0xc1, 0x67, 0x17, \
+ 0xf5, 0x66, 0x90, 0xe7, 0xe8, 0x07, 0xb8, 0x60, \
+ 0x48, 0xe6, 0x1e, 0x53, 0xf3, 0x92, 0xa4, 0x72, \
+ 0x8c, 0x08, 0x15, 0x6e, 0x86, 0x00, 0x84, 0xfa, \
+ 0xf4, 0x7f, 0x8a, 0x42, 0x19, 0xf6, 0xdb, 0xcd, \
+ 0x14, 0x8d, 0x50, 0x12, 0xba, 0x3c, 0x06, 0x4e, \
+ 0xec, 0xb3, 0x35, 0x11, 0xa1, 0x88, 0x8e, 0x2b, \
+ 0x94, 0x99, 0xb7, 0x71, 0x74, 0xd3, 0xe4, 0xbf, \
+ 0x3a, 0xde, 0x96, 0x0e, 0xbc, 0x0a, 0xed, 0x77, \
+ 0xfc, 0x37, 0x6b, 0x03, 0x79, 0x89, 0x62, 0xc6, \
+ 0xd7, 0xc0, 0xd2, 0x7c, 0x6a, 0x8b, 0x22, 0xa3, \
+ 0x5b, 0x05, 0x5d, 0x02, 0x75, 0xd5, 0x61, 0xe3, \
+ 0x18, 0x8f, 0x55, 0x51, 0xad, 0x1f, 0x0b, 0x5e, \
+ 0x85, 0xe5, 0xc2, 0x57, 0x63, 0xca, 0x3d, 0x6c, \
+ 0xb4, 0xc5, 0xcc, 0x70, 0xb2, 0x91, 0x59, 0x0d, \
+ 0x47, 0x20, 0xc8, 0x4f, 0x58, 0xe0, 0x01, 0xe2, \
+ 0x16, 0x38, 0xc4, 0x6f, 0x3b, 0x0f, 0x65, 0x46, \
+ 0xbe, 0x7e, 0x2d, 0x7b, 0x82, 0xf9, 0x40, 0xb5, \
+ 0x1d, 0x73, 0xf8, 0xeb, 0x26, 0xc7, 0x87, 0x97, \
+ 0x25, 0x54, 0xb1, 0x28, 0xaa, 0x98, 0x9d, 0xa5, \
+ 0x64, 0x6d, 0x7a, 0xd4, 0x10, 0x81, 0x44, 0xef, \
+ 0x49, 0xd6, 0xae, 0x2e, 0xdd, 0x76, 0x5c, 0x2f, \
+ 0xa7, 0x1c, 0xc9, 0x09, 0x69, 0x9a, 0x83, 0xcf, \
+ 0x29, 0x39, 0xb9, 0xe9, 0x4c, 0xff, 0x43, 0xab, \
}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
mangle(b, b + 8);
mangle(b, q);
k->posta = LOAD32(b + 0);
- k->postb = LOAD32(b + 4);
+ k->postb = LOAD32(b + 4);
}
}
}
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{ "g", offsetof(dh_priv, dp.g), KENC_MP, 0 },
{ "y", offsetof(dh_priv, y), KENC_MP, 0 },
{ "private", 0, KENC_STRUCT, priv },
- { 0, 0, 0, 0 }
+ { 0, 0, 0, 0 }
};
/* --- @dh_paramfree@, @dh_pubfree@, @dh_privfree@ --- *
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2006 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* @unsigned flags@ = other generation flags
* @unsigned steps@ = number of steps to go
* @grand *r@ = random number source
- * @pgen_proc *oev@ = outer event handler function
- * @void *oec@ = argument for the outer event handler
- * @pgen_proc *iev@ = inner event handler function
- * @void *iec@ = argument for the inner event handler
- * @size_t *nf@, @mp ***f@ = output array for factors
+ * @pgen_proc *oev@ = outer event handler function
+ * @void *oec@ = argument for the outer event handler
+ * @pgen_proc *iev@ = inner event handler function
+ * @void *iec@ = argument for the inner event handler
+ * @size_t *nf@, @mp ***f@ = output array for factors
*
* Returns: @PGEN_DONE@ if it worked, @PGEN_ABORT@ if it didn't.
*
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
typedef gprime_param dh_param; /* Group parameters */
typedef struct dh_pub {
- dh_param dp; /* Shared parameters */
+ dh_param dp; /* Shared parameters */
mp *y; /* Public key */
} dh_pub;
* @unsigned flags@ = other generation flags
* @unsigned steps@ = number of steps to go
* @grand *r@ = random number source
- * @pgen_proc *oev@ = outer event handler function
- * @void *oec@ = argument for the outer event handler
- * @pgen_proc *iev@ = inner event handler function
- * @void *iec@ = argument for the inner event handler
- * @size_t *nf@, @mp ***f@ = output array for factors
+ * @pgen_proc *oev@ = outer event handler function
+ * @void *oec@ = argument for the outer event handler
+ * @pgen_proc *iev@ = inner event handler function
+ * @void *iec@ = argument for the inner event handler
+ * @size_t *nf@, @mp ***f@ = output array for factors
*
* Returns: @PGEN_DONE@ if it worked, @PGEN_ABORT@ if it didn't.
*
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
fputs("\nseed_in = ", stderr); type_hex.dump(&v[0], stderr);
fprintf(stderr, "\nl = %lu", l);
fputs("\nseed_out = ", stderr); type_hex.dump(&v[2], stderr);
- fprintf(stderr, "\ncount = %lu", n);
- fputs("\n q = ", stderr); mp_writefile(q, stderr, 16);
- fputs("\n p = ", stderr); mp_writefile(p, stderr, 16);
- fputs("\n g = ", stderr); mp_writefile(g, stderr, 16);
+ fprintf(stderr, "\ncount = %lu", n);
+ fputs("\n q = ", stderr); mp_writefile(q, stderr, 16);
+ fputs("\n p = ", stderr); mp_writefile(p, stderr, 16);
+ fputs("\n g = ", stderr); mp_writefile(g, stderr, 16);
if (!rc) {
dstr d;
d.buf = ds.p; d.len = ds.sz;
fputs("\nds.seed = ", stderr); type_hex.dump(&d, stderr);
- fprintf(stderr, "\nds.count = %u", ds.count);
+ fprintf(stderr, "\nds.count = %u", ds.count);
fputs("\ndp.q = ", stderr); mp_writefile(dp.q, stderr, 16);
fputs("\ndp.p = ", stderr); mp_writefile(dp.p, stderr, 16);
fputs("\ndp.g = ", stderr); mp_writefile(dp.g, stderr, 16);
fputs("\nseed_in = ", stderr); type_hex.dump(&v[0], stderr);
fprintf(stderr, "\nl = %lu", l);
fputs("\nseed_out = ", stderr); type_hex.dump(&v[2], stderr);
- fprintf(stderr, "\ncount = %lu", n);
- fputs("\n q = ", stderr); mp_writefile(q, stderr, 16);
- fputs("\n p = ", stderr); mp_writefile(p, stderr, 16);
- fputs("\n g = ", stderr); mp_writefile(g, stderr, 16);
+ fprintf(stderr, "\ncount = %lu", n);
+ fputs("\n q = ", stderr); mp_writefile(q, stderr, 16);
+ fputs("\n p = ", stderr); mp_writefile(p, stderr, 16);
+ fputs("\n g = ", stderr); mp_writefile(g, stderr, 16);
fputc('\n', stderr);
ok = 0;
}
static test_chunk tests[] = {
{ "gen", verify,
{ &type_hex, &type_ulong, &type_hex, &type_ulong,
- &type_mp, &type_mp, &type_mp, 0 } },
+ &type_mp, &type_mp, &type_mp, 0 } },
{ 0, 0, { 0 } }
};
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
fputs("\ns = ", stderr); mp_writefile(m, stderr, 16);
mp_drop(m);
}
-
+
fputc('\n', stderr);
ok = 0;
}
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#ifndef CATACOMB_MP_H
# include "mp.h"
#endif
-
+
#ifndef CATACOMB_PGEN_H
# include "pgen.h"
#endif
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
.B rsapkcs1
This is almost the same as the RSASSA-PKCS1-v1_5 algorithm described in
RFC3447; the difference is that the hash is left bare rather than being
-wrapped in a DER-encoded
+wrapped in a DER-encoded
.B DigestInfo
structure. This doesn't affect security since the key can only be used
with the one hash function anyway, and dropping the DER wrapping permits
to generate the key.
.TP
.B dsa
-This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
+This is the DSA algorithm described in FIPS180-1 and FIPS180-2. Use the
.B dsa
algorithm of the
.B key add
.BR sha .
.hP \*o
For
-.BR kcdsa
+.BR kcdsa
and
.BR eckcdsa ,
the default hash function is
.TP
.BI "BAD " reason
The signature is bad: some file had the wrong hash or the signature is
-invalid.
+invalid.
.TP
.BI "WARN " reason
.B dsig
The signature verified correctly.
.TP
.BI "INFO " note
-Any other information.
+Any other information.
.PP
The information written at the various verbosity levels is as follows.
.hP 0.
.TP
.BR "date: " (3)
The date the signature was made. In a text file, this has the form
-.IB yyyy-mm-dd
+.IB yyyy-mm-dd
.IB hh:mm:ss
.IR timezone ;
in a binary file, it's a 64-bit integer representing the POSIX time.
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (fp && !bin)
bwrite(b, fp);
}
-
+
/*----- Static variables --------------------------------------------------*/
static const char *keyring = "keyring";
if (!sz)
break;
}
-}
+}
/*----- Signature generation ----------------------------------------------*/
binit(&b); b.tag = T_IDENT;
dstr_putf(&b.d, "%s, Catacomb version " VERSION, QUIS);
bemit(&b, ofp, 0, f & f_bin);
-
+
breset(&b); b.tag = T_KEYID; b.k = k->id;
bemit(&b, ofp, 0, f & f_bin);
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{
field *f = c->f;
mp *y, *u, *v;
-
+
if (F_ZEROP(f, x))
y = F_SQRT(f, MP_NEW, c->b);
else {
dx = F_ADD(f, dx, dx, c->a); /* %$a + \lambda^2 + \lambda$% */
dx = F_ADD(f, dx, dx, a->x); /* %$a + \lambda^2 + \lambda + x_0$% */
dx = F_ADD(f, dx, dx, b->x);
- /* %$x' = a + \lambda^2 + \lambda + x_0 + x_1$% */
+ /* %$x' = a + \lambda^2 + \lambda + x_0 + x_1$% */
} else if (!MP_EQ(a->y, b->y) || F_ZEROP(f, a->x)) {
EC_SETINF(d);
return (d);
dx = F_ADD(f, dx, dx, c->a); /* %$x' = a + \lambda^2 + \lambda$% */
dy = MP_NEW;
}
-
+
dy = F_ADD(f, dy, a->x, dx); /* %$ x + x' $% */
dy = F_MUL(f, dy, dy, lambda); /* %$ (x + x') \lambda$% */
dy = F_ADD(f, dy, dy, a->y); /* %$ (x + x') \lambda + y$% */
{
ec t = EC_INIT;
int rc;
-
+
c->ops->fix(c, &t, p);
rc = eccheck(c, &t);
EC_DESTROY(&t);
g.x = MP(0x0311103c17167564ace77ccb09c681f886ba54ee8);
g.y = MP(0x333ac13c6447f2e67613bf7009daf98c87bb50c7f);
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
ec_mul(c, &d, &g, r);
if (EC_ATINF(&d)) {
fprintf(stderr, "zero too early\n");
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
(d).x = MP_COPY((p).x); \
(d).y = MP_COPY((p).y); \
(d).z = (p).z ? MP_COPY((p).z) : MP_NEW; \
-} while (0)
+} while (0)
#define EXP_DROP(x) EC_DESTROY(&(x))
#define EXP_MUL(a, x) EC_ADD(c, &(a), &(a), &(x))
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{ "curve", offsetof(ec_pub, cstr), KENC_STRING, 0 },
{ "p", offsetof(ec_pub, p), KENC_EC, 0 },
{ "private", 0, KENC_STRUCT, priv },
- { 0, 0, 0, 0 }
+ { 0, 0, 0, 0 }
};
/* --- @ec_paramfree@, @ec_pubfree@, @ec_privfree@ --- *
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
ec_infofromdata(ei, ee->data);
goto found;
}
- }
+ }
if ((c = ec_curveparse(qd)) == 0) goto fail;
qd_delim(qd, ';'); if (!ec_ptparse(qd, &g)) goto fail;
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
q = F_MUL(f, MP_NEW, p, u); /* %$t w^2$% */
u = F_MUL(f, u, p, w); /* %$w^3$% */
p = F_MUL(f, p, u, s); /* %$m w^3$% */
-
+
dx = F_SQR(f, u, r); /* %$r^2$% */
dx = F_SUB(f, dx, dx, q); /* %$x' = r^2 - t w^2$% */
{
ec t = EC_INIT;
int rc;
-
+
c->ops->fix(c, &t, p);
rc = eccheck(c, &t);
EC_DESTROY(&t);
f = field_niceprime(p);
c = ec_primeproj(f, a, b);
-
+
g.x = MP(0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7);
g.y = MP(0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f);
- for (i = 0; i < n; i++) {
+ for (i = 0; i < n; i++) {
ec_mul(c, &d, &g, r);
if (EC_ATINF(&d)) {
fprintf(stderr, "zero too early\n");
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (EC_ATINF(a))
fputs("inf", fp);
else {
- fputs("0x", fp);
+ fputs("0x", fp);
mp_writefile(a->x, fp, 16);
fputs(", 0x", fp);
mp_writefile(a->y, fp, 16);
if (r != c) {
fprintf(stderr, "check failed");
fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr);
- fprintf(stderr, "\n a = "); ecdodump(a, stderr);
- fprintf(stderr, "\n r = %d", r);
- fprintf(stderr, "\n c = %d", c);
+ fprintf(stderr, "\n a = "); ecdodump(a, stderr);
+ fprintf(stderr, "\n r = %d", r);
+ fprintf(stderr, "\n c = %d", c);
fprintf(stderr, "\n");
ok = 0;
}
if (!EC_EQ(r, &c)) {
fprintf(stderr, "mul failed");
fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr);
- fprintf(stderr, "\n a = "); ecdodump(a, stderr);
- fprintf(stderr, "\n n = "); mp_writefile(n, stderr, 10);
- fprintf(stderr, "\n r = "); ecdodump(r, stderr);
- fprintf(stderr, "\n c = "); ecdodump(&c, stderr);
+ fprintf(stderr, "\n a = "); ecdodump(a, stderr);
+ fprintf(stderr, "\n n = "); mp_writefile(n, stderr, 10);
+ fprintf(stderr, "\n r = "); ecdodump(r, stderr);
+ fprintf(stderr, "\n c = "); ecdodump(&c, stderr);
fprintf(stderr, "\n");
ok = 0;
}
if (!EC_EQ(r, &c)) {
fprintf(stderr, "find failed");
fprintf(stderr, "\ncurve = "); type_ecurve.dump(v, stderr);
- fprintf(stderr, "\n x = "); mp_writefile(x, stderr, 16);
- fprintf(stderr, "\n r = "); ecdodump(r, stderr);
- fprintf(stderr, "\n c = "); ecdodump(&c, stderr);
+ fprintf(stderr, "\n x = "); mp_writefile(x, stderr, 16);
+ fprintf(stderr, "\n r = "); ecdodump(r, stderr);
+ fprintf(stderr, "\n c = "); ecdodump(&c, stderr);
fprintf(stderr, "\n");
ok = 0;
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
do x = F_RAND(c->f, x, r); while (!EC_FIND(c, d, x));
mp_drop(x);
if (grand_range(r, 2)) EC_NEG(c, d, d);
- return (EC_OUT(c, d, d));
+ return (EC_OUT(c, d, d));
}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (memcmp(pt, text, sizeof(text)) == 0) { \
done++; \
if (sizeof(text) < 40 || done % 8 == 0) \
- fputc('.', stdout); \
+ fputc('.', stdout); \
if (done % 480 == 0) \
- fputs("\n\t", stdout); \
+ fputs("\n\t", stdout); \
fflush(stdout); \
} else { \
printf("\nError (sz = %lu)\n", (unsigned long)sz); \
status = 1; \
printf("\tplaintext = "); hexdump(text, sz); \
- printf(", "); hexdump(text + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(text + sz, rest); \
+ fputc('\n', stdout); \
printf("\tciphertext = "); hexdump(ct, sz); \
- printf(", "); hexdump(ct + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(ct + sz, rest); \
+ fputc('\n', stdout); \
printf("\trecovered text = "); hexdump(pt, sz); \
- printf(", "); hexdump(pt + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(pt + sz, rest); \
+ fputc('\n', stdout); \
fputc('\n', stdout); \
} \
next: \
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#endif
/*----- Header files ------------------------------------------------------*/
-
+
#include "ec.h"
/*----- Data structures ---------------------------------------------------*/
b 0x54678621b190cfce282ade219d5b3a065e3f4b3ffdebb29b
r 0x4000000000000000000000009cf2d6e3901dac4c32eec65d
h 2
- gx 0x5a2c69a32e8638e51ccefaad05350a978457cb5fb6df994a
+ gx 0x5a2c69a32e8638e51ccefaad05350a978457cb5fb6df994a
gy 0x0f32fe0fa0e902f19b17d363c269f4f5cfe8087618569954
# ansi-c2pnb208v1 has an unacceptable cofactor; and 208 isn't prime anyway
r 0x01000000000000000000000000000013e974e72f8a6922031d2603cfe0d7
h 2
gx 0x18b863524b3cdfefb94f2784e0b116faac54404bc9162a363bab84a14c5
- gy 0x04925df77bd8b8ff1a5ff519417822bfedf2bbd752644292c98c7af6e02
+ gy 0x04925df77bd8b8ff1a5ff519417822bfedf2bbd752644292c98c7af6e02
curve nist-k283n binnorm
p 0x800000000000000000000000000000000000000000000000000000000000000000010a1
gx 0x3ab9593f8db09fc188f1d7c4ac9fcc3e57fcd3bdb15024b212c70229de5fcd92eb0ea60
gy 0x2118c4755e7345cd8f603ef93b98b106fe8854ffeb9a3b304634cc83a0e759f0c2686b1
curve nist-b283n binnorm
- p 0x800000000000000000000000000000000000000000000000000000000000000000010a1
+ p 0x800000000000000000000000000000000000000000000000000000000000000000010a1
beta 0x31e0ed791c3282dc5624a720818049d053e8c7ab8663792bc1d792eba9867fc7b317a99
a 0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
b 0x157261b894739fb5a13503f55f0b3f10c5601166633102201138cc180c0206bdafbc951
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
for (i = 0; i < e->n; i++) {
x = (x << 1) | ((e->s[i].w >> (MPW_BITS - 1)) & 1u);
e->s[i].w <<= 1;
- }
+ }
e->b--;
return (x);
}
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
mpw w;
size_t len;
const mpw *v;
-} exp_simulscan;
+} exp_simulscan;
typedef struct exp_simul {
unsigned b;
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
typedef struct fctx_niceprime {
field f;
mpreduce r;
-} fctx_niceprime;
+} fctx_niceprime;
typedef struct fctx_binpoly {
field f;
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if ((m = qd_getmp(qd)) == 0) goto done;
qd_delim(qd, ',');
if ((b = qd_getmp(qd)) == 0) goto done;
- f = field_binnorm(m, b);
+ f = field_binnorm(m, b);
break;
default:
goto done;
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* * `prime', `niceprime', `binpoly', or `binnorm'
* * an optional `:'
* * the field modulus
- * * for `binnorm', an optional `,' and the beta value
+ * * for `binnorm', an optional `,' and the beta value
*/
extern field *field_parse(qd_parse */*qd*/);
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
}
}
-
+
if (r >= 26)
rc |= FIPSTEST_LONGRUNS;
if (r > 6)
111 > f[0][5] || f[0][5] > 201 || 111 > f[1][5] || f[1][5] > 201)
rc |= FIPSTEST_RUNS;
- return (rc);
+ return (rc);
}
/* --- @fipstest@ --- *
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
static void gmexp(group *gg, ec *d, const group_expfactor *f, size_t n) {
gctx_ec *g = (gctx_ec *)gg; size_t i;
- ec_mulfactor *ff = xmalloc(n * sizeof(ec_mulfactor));
+ ec_mulfactor *ff = xmalloc(n * sizeof(ec_mulfactor));
for (i = 0; i < n; i++) { ff[i].base = *f[i].base; ff[i].exp = f[i].exp; }
ec_immul(g->ei.c, d, ff, n); xfree(ff);
}
rc = EC_CHECK(g->ei.c, &t); if (!rc) EC_COPY(d, &t); EC_DESTROY(&t);
return (rc);
}
-
+
static int gtobuf(group *gg, buf *b, ec *x) {
gctx_ec *g = (gctx_ec *)gg; ec t = EC_INIT; int rc;
EC_OUT(g->ei.c, &t, x); rc = buf_putec(b, &t); EC_DESTROY(&t); return (rc);
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Returns: ---
*
* Use: Does any final thing that DSA wants to do when hashing a
- * message. (Actually, there's nothing.) The hashing context
+ * message. (Actually, there's nothing.) The hashing context
* isn't finalized.
*/
}
static void showmp(const char *p, mp *x, int r) {
- fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
+ fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
putc('\n', stderr);
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Returns: ---
*
* Use: Does any final thing that DSA wants to do when hashing a
- * message. (Actually, there's nothing.) The hashing context
+ * message. (Actually, there's nothing.) The hashing context
* isn't finalized.
*/
* (c) 2006 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
\n",
stdout);
dogen();
-
+
for (i = 0; tab[i].name; i++) {
if (tab[i].min) {
printf("#define MP_%s_MIN (&mp_limits[%d])\n",
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{
if (!MP_EQ(expect, result)) {
fprintf(stderr, "\n*** %s failed", op);
- fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 16);
- fputs("\n*** b = ", stderr); mp_writefile(b, stderr, 16);
+ fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 16);
+ fputs("\n*** b = ", stderr); mp_writefile(b, stderr, 16);
fputs("\n*** result = ", stderr); mp_writefile(result, stderr, 16);
fputs("\n*** expect = ", stderr); mp_writefile(expect, stderr, 16);
fputc('\n', stderr);
if (r != c) {
ok = 0;
fprintf(stderr, "\n*** irred failed");
- fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 16);
- fprintf(stderr, "\n*** r = %d\n", r);
- fprintf(stderr, "*** c = %d\n", c);
+ fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 16);
+ fprintf(stderr, "\n*** r = %d\n", r);
+ fprintf(stderr, "*** c = %d\n", c);
}
mp_drop(a);
assert(mparena_count(MPARENA_GLOBAL) == 0);
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
gf_gcd(&gg, &xx, &yy, a, b);
if (!MP_EQ(x, xx)) {
fputs("\n*** gf_gcd(x) failed", stderr);
- fputs("\na = ", stderr); mp_writefile(a, stderr, 16);
- fputs("\nb = ", stderr); mp_writefile(b, stderr, 16);
+ fputs("\na = ", stderr); mp_writefile(a, stderr, 16);
+ fputs("\nb = ", stderr); mp_writefile(b, stderr, 16);
fputs("\nexpect = ", stderr); mp_writefile(x, stderr, 16);
fputs("\nresult = ", stderr); mp_writefile(xx, stderr, 16);
fputc('\n', stderr);
}
if (!MP_EQ(y, yy)) {
fputs("\n*** gf_gcd(y) failed", stderr);
- fputs("\na = ", stderr); mp_writefile(a, stderr, 16);
- fputs("\nb = ", stderr); mp_writefile(b, stderr, 16);
+ fputs("\na = ", stderr); mp_writefile(a, stderr, 16);
+ fputs("\nb = ", stderr); mp_writefile(b, stderr, 16);
fputs("\nexpect = ", stderr); mp_writefile(y, stderr, 16);
fputs("\nresult = ", stderr); mp_writefile(yy, stderr, 16);
fputc('\n', stderr);
if (!MP_EQ(g, gg)) {
fputs("\n*** gf_gcd(gcd) failed", stderr);
- fputs("\na = ", stderr); mp_writefile(a, stderr, 16);
- fputs("\nb = ", stderr); mp_writefile(b, stderr, 16);
+ fputs("\na = ", stderr); mp_writefile(a, stderr, 16);
+ fputs("\nb = ", stderr); mp_writefile(b, stderr, 16);
fputs("\nexpect = ", stderr); mp_writefile(g, stderr, 16);
fputs("\nresult = ", stderr); mp_writefile(gg, stderr, 16);
fputc('\n', stderr);
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* words to demonstrate what I'm talking about.
*
* xxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- * 001ppppp pppppppp pppppppp pppppppp
- * |<rp>|
- * |<------------ bp ------------->|
- * |<------------ nw --------------->|
+ * 001ppppp pppppppp pppppppp pppppppp
+ * |<rp>|
+ * |<------------ bp ------------->|
+ * |<------------ nw --------------->|
*
* The trick of taking whole words off of @X@ stops working when there are
* only @nw@ words left. Then we have to mask off the bottom bits of @w@
/* --- @gfreduce_exp@ --- *
*
* Arguments: @gfreduce *gr@ = pointer to reduction context
- * @mp *d@ = fake destination
- * @mp *a@ = base
- * @mp *e@ = exponent
+ * @mp *d@ = fake destination
+ * @mp *a@ = base
+ * @mp *e@ = exponent
*
- * Returns: Result, %$a^e \bmod m$%.
+ * Returns: Result, %$a^e \bmod m$%.
*/
mp *gfreduce_exp(gfreduce *gr, mp *d, mp *a, mp *e)
ok = 0;
}
gfreduce_destroy(&rr);
- mp_drop(p); mp_drop(x);
+ mp_drop(p); mp_drop(x);
assert(mparena_count(MPARENA_GLOBAL) == 0);
return (ok);
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @gfreduce_exp@ --- *
*
* Arguments: @gfreduce *gr@ = pointer to reduction context
- * @mp *d@ = fake destination
- * @mp *a@ = base
- * @mp *e@ = exponent
+ * @mp *d@ = fake destination
+ * @mp *a@ = base
+ * @mp *e@ = exponent
*
- * Returns: Result, %$a^e \bmod m$%.
+ * Returns: Result, %$a^e \bmod m$%.
*/
extern mp *gfreduce_exp(gfreduce */*gr*/, mp */*d*/, mp */*a*/, mp */*e*/);
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
exit(EXIT_FAILURE);
}
- return (0);
+ return (0);
}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#include <mLib/alloc.h>
#include <mLib/testrig.h>
-#define ALLOC(v, vl, sz) do { \
- size_t _sz = (sz); \
- mpw *_vv = xmalloc(MPWS(_sz)); \
- mpw *_vvl = _vv + _sz; \
- (v) = _vv; \
- (vl) = _vvl; \
+#define ALLOC(v, vl, sz) do { \
+ size_t _sz = (sz); \
+ mpw *_vv = xmalloc(MPWS(_sz)); \
+ mpw *_vvl = _vv + _sz; \
+ (v) = _vv; \
+ (vl) = _vvl; \
} while (0)
-#define LOAD(v, vl, d) do { \
- const dstr *_d = (d); \
- mpw *_v, *_vl; \
- ALLOC(_v, _vl, MPW_RQ(_d->len)); \
- mpx_loadb(_v, _vl, _d->buf, _d->len); \
- (v) = _v; \
- (vl) = _vl; \
+#define LOAD(v, vl, d) do { \
+ const dstr *_d = (d); \
+ mpw *_v, *_vl; \
+ ALLOC(_v, _vl, MPW_RQ(_d->len)); \
+ mpx_loadb(_v, _vl, _d->buf, _d->len); \
+ (v) = _v; \
+ (vl) = _vl; \
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
gfx_kmul(d, dl, a, al, b, bl, s, sl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** mul failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
return;
aa >>= MPW_BITS;
bb -= MPW_BITS;
- }
+ }
a >>= 8;
if (b <= 8)
break;
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
+
static void dumpmp(const char *msg, const mpw *v, const mpw *vl)
{
fputs(msg, stderr);
gfx_sqr(d, dl, a, al);
if (!mpx_ueq(d, dl, b, bl)) {
fprintf(stderr, "\n*** vsqr failed\n");
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", b, bl);
dumpmp(" result", d, dl);
ok = 0;
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @gfx_div@ --- *
*
* Arguments: @mpw *qv, *qvl@ = quotient vector base and limit
- * @mpw *rv, *rvl@ = dividend/remainder vector base and limit
- * @const mpw *dv, *dvl@ = divisor vector base and limit
+ * @mpw *rv, *rvl@ = dividend/remainder vector base and limit
+ * @const mpw *dv, *dvl@ = divisor vector base and limit
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Performs division on polynomials over %$\gf{2}$%.
+ * Use: Performs division on polynomials over %$\gf{2}$%.
*/
void gfx_div(mpw *qv, mpw *qvl, mpw *rv, mpw *rvl,
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
+
static void dumpmp(const char *msg, const mpw *v, const mpw *vl)
{
fputs(msg, stderr);
gfx_add(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** vadd failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
gfx_mul(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** vmul failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @gfx_div@ --- *
*
* Arguments: @mpw *qv, *qvl@ = quotient vector base and limit
- * @mpw *rv, *rvl@ = dividend/remainder vector base and limit
- * @const mpw *dv, *dvl@ = divisor vector base and limit
+ * @mpw *rv, *rvl@ = dividend/remainder vector base and limit
+ * @const mpw *dv, *dvl@ = divisor vector base and limit
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Performs division on polynomials over %$\gf{2}$%.
+ * Use: Performs division on polynomials over %$\gf{2}$%.
*/
extern void gfx_div(mpw */*qv*/, mpw */*qvl*/, mpw */*rv*/, mpw */*rvl*/,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# define GH_HASHBUF64_B(h, p, sz) GH_HASHBUF_((h), (p), (sz), 64_B)
#endif
-#define GH_HASHSTR_(h, p, W) do { \
+#define GH_HASHSTR_(h, p, W) do { \
const char *p_ = (p); GH_HASHBUF_((h), p_, strlen(p_), W); \
} while (0)
#define GH_HASHSTR8(h, p) GH_HASHSTR_((h), (p), 8)
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Returns: ---
*
* Use: Does any final thing that KCDSA wants to do when hashing a
- * message. (Actually, there's nothing.) The hashing context
+ * message. (Actually, there's nothing.) The hashing context
* isn't finalized.
*/
}
static void showmp(const char *p, mp *x, int r) {
- fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
+ fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
putc('\n', stderr);
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* Returns: ---
*
* Use: Does any final thing that KCDSA wants to do when hashing a
- * message. (Actually, there's nothing.) The hashing context
+ * message. (Actually, there's nothing.) The hashing context
* isn't finalized.
*/
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- Generator-specific operations --- */
-#define GRAND_SPECIFIC(ch) ((unsigned)(ch) << 8)
+#define GRAND_SPECIFIC(ch) ((unsigned)(ch) << 8)
};
#define GRAND_BADOP assert(((void)"bad grand_misc op", 0))
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Trivial IP Encryption (TrIPE).
*
* 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.
- *
+ *
* TrIPE 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 TrIPE; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
mp_writefile(q->x, stderr, 16); fputs(", ", stderr);
mp_writefile(q->x, stderr, 16); putchar('\n');
}
-}
+}
static void showmp(const char *p, mp *x, int r) {
- fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
+ fprintf(stderr, "*** %s = ", p); mp_writefile(x, stderr, r);
putc('\n', stderr);
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
*/
#define ROUND(f, ss, k, \
- i0, i1, i2, i3, i4, i5, i6, i7, \
+ i0, i1, i2, i3, i4, i5, i6, i7, \
i8, i9, i10, i11, i12, i13, i14, i15) do { \
FF(f, a, b, c, d, e, buf[ i8]^buf[ i9]^buf[i10]^buf[i11], 5, ss, k); \
- FF(f, e, a, b, c, d, buf[ i0], 11, ss, k); \
- FF(f, d, e, a, b, c, buf[ i1], 7, ss, k); \
- FF(f, c, d, e, a, b, buf[ i2], 15, ss, k); \
- FF(f, b, c, d, e, a, buf[ i3], 6, ss, k); \
+ FF(f, e, a, b, c, d, buf[ i0], 11, ss, k); \
+ FF(f, d, e, a, b, c, buf[ i1], 7, ss, k); \
+ FF(f, c, d, e, a, b, buf[ i2], 15, ss, k); \
+ FF(f, b, c, d, e, a, buf[ i3], 6, ss, k); \
FF(f, a, b, c, d, e, buf[i12]^buf[i13]^buf[i14]^buf[i15], 13, ss, k); \
- FF(f, e, a, b, c, d, buf[ i4], 8, ss, k); \
- FF(f, d, e, a, b, c, buf[ i5], 14, ss, k); \
- FF(f, c, d, e, a, b, buf[ i6], 7, ss, k); \
- FF(f, b, c, d, e, a, buf[ i7], 12, ss, k); \
+ FF(f, e, a, b, c, d, buf[ i4], 8, ss, k); \
+ FF(f, d, e, a, b, c, buf[ i5], 14, ss, k); \
+ FF(f, c, d, e, a, b, buf[ i6], 7, ss, k); \
+ FF(f, b, c, d, e, a, buf[ i7], 12, ss, k); \
FF(f, a, b, c, d, e, buf[ i0]^buf[ i1]^buf[ i2]^buf[ i3], 9, ss, k); \
- FF(f, e, a, b, c, d, buf[ i8], 11, ss, k); \
- FF(f, d, e, a, b, c, buf[ i9], 8, ss, k); \
- FF(f, c, d, e, a, b, buf[i10], 15, ss, k); \
- FF(f, b, c, d, e, a, buf[i11], 6, ss, k); \
+ FF(f, e, a, b, c, d, buf[ i8], 11, ss, k); \
+ FF(f, d, e, a, b, c, buf[ i9], 8, ss, k); \
+ FF(f, c, d, e, a, b, buf[i10], 15, ss, k); \
+ FF(f, b, c, d, e, a, buf[i11], 6, ss, k); \
FF(f, a, b, c, d, e, buf[ i4]^buf[ i5]^buf[ i6]^buf[ i7], 12, ss, k); \
- FF(f, e, a, b, c, d, buf[i12], 9, ss, k); \
- FF(f, d, e, a, b, c, buf[i13], 14, ss, k); \
- FF(f, c, d, e, a, b, buf[i14], 5, ss, k); \
- FF(f, b, c, d, e, a, buf[i15], 13, ss, k); \
+ FF(f, e, a, b, c, d, buf[i12], 9, ss, k); \
+ FF(f, d, e, a, b, c, buf[i13], 14, ss, k); \
+ FF(f, c, d, e, a, b, buf[i14], 5, ss, k); \
+ FF(f, b, c, d, e, a, buf[i15], 13, ss, k); \
} while (0)
ROUND(F, 10, 0x00000000,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
ROUND(G, 17, 0x5a827999,
- 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0);
+ 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0);
ROUND(H, 25, 0x6ed9eba1,
- 12, 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3);
+ 12, 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3);
ROUND(G, 30, 0x8f1bbcdc,
- 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5, 0, 11, 6, 1, 12);
+ 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5, 0, 11, 6, 1, 12);
/* --- Update the chaining variables --- */
void has160_set(has160_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->e = LOAD32_L(p + 16);
ctx->off = 0;
{
octet *p = hash;
HASH_MD5STRENGTH(HAS160, has160, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
}
unsigned long has160_state(has160_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
return (ctx->nl | ((ctx->nh << 16) << 16));
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
to represent hashes in the output. This is not interoperable with other
programs, but it's handy, e.g., for building sha1 URNs. The encodings
recognized are
-.B hex
+.B hex
(the default),
.B base64
and
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
if (pp)
*pp = (char *)p;
- return (i);
+ return (i);
}
/* --- Base64 encoding --- */
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* use, as specified in RFC2104. \
*/ \
\
-extern void pre##_hmacinit(pre##_mackey */*key*/, \
+extern void pre##_hmacinit(pre##_mackey */*key*/, \
const void */*k*/, size_t /*sz*/); \
\
/* --- @pre_sslmacinit@ --- * \
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
p = d->buf + n;
STORE16(p, k->e & KF_ENCMASK);
d->len += 4;
-
+
for (nks = 0, sym_mkiter(&i, &k->u.s);
(ks = sym_next(&i)) != 0;
nks++);
xfree(ksv);
}
if (!rc)
- d->len = n;
+ d->len = n;
else {
p = d->buf + n + 2;
n = d->len - n - 4;
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
void key_split(key_data **kk)
{
key_data *k = *kk;
-
+
if (k->ref == 1)
return;
switch (k->e & KF_ENCMASK) {
key_drop(ks->k);
if (!stealp) KEY_INCREF(kd);
ks->k = kd;
- }
+ }
}
void key_structset(key_data *k, const char *tag, key_data *kd)
*
* Returns: Nonzero return code from function, or zero.
*
- * Use: Runs a function over all the leaves of a key.
+ * Use: Runs a function over all the leaves of a key.
*/
int key_do(key_data *k, const key_filter *kf, dstr *d,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (_k->ref == 0) \
key_destroy(_k); \
} while (0)
-
+
extern void key_drop(key_data */*k*/);
/* --- @key_do@ --- *
*
* Returns: Nonzero return code from function, or zero.
*
- * Use: Runs a function over all the leaves of a key.
+ * Use: Runs a function over all the leaves of a key.
*/
extern int key_do(key_data */*k*/, const key_filter */*kf*/, dstr */*d*/,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#undef ENTRY
"Unknown error code"
};
-
+
unsigned e = -err;
if (e >= N(tab))
e = N(tab) - 1;
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
key_unpackdone(kp);
if (kps->name)
xfree(kps);
-}
+}
/*----- That's all, folks -------------------------------------------------*/
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
dstr_destroy(&n_old);
dstr_destroy(&n_older);
return (rc);
-
+
/* --- Failure during write of new data --- *
*
* Clean up the new file and return. These errors can never cause
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
*
* There are currently six fields of interest:
*
- * * The key's identification (id, tag and type).
- * * The actual key data itself.
- * * The key expiry time.
- * * The key deletion time.
- * * The attributes field.
- * * Any further comments.
+ * * The key's identification (id, tag and type).
+ * * The actual key data itself.
+ * * The key expiry time.
+ * * The key deletion time.
+ * * The attributes field.
+ * * Any further comments.
*
* All but the last field can contain no spaces.
*/
goto skip_3;
}
}
-
+
/* --- Parse up the attributes, if specified --- */
sym_create(&k->a);
f->f |= KF_MODIFIED;
}
}
-
+
return (e);
}
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
GH_HASHSTR16(h, v[i]->p);
}
xfree(v);
- }
+ }
done:
dstr_destroy(&d);
return (rc);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
*
* Use: Writes a key in a textual encoding.
*/
-
+
int key_write(key_data *k, dstr *d, const key_filter *kf)
{
int rc = 0;
.IR p ;
the default size is 1024 bits.
.IP
-If no
+If no
.I q
size is selected using the
.B \-B
-option and the Lim-Lee prime options are disabled, then
+option and the Lim-Lee prime options are disabled, then
.I p
is chosen to be a `safe' prime (i.e.,
.IR p \ =\ 2 q \ +\ 1,
option (or 256 bits, if no setting was given).
.IP
If the
-.B \-K
+.B \-K
option was given, KCDSA-style Lim-Lee primes are selected: the
parameters are chosen such that
.IR p \ =\ 2\ q\ v \ +\ 1,
where
-.IR p,
+.IR p,
.I q
and
.I v
the two field-element parameters
.I a
and
-.IR b
+.IR b
which define the elliptic curve
.IR E ,
separated by an optional
.RB ` , ';
an optional
.RB ` ; ';
-the
+the
.IR x -
and
.IR y -coordinates
.RB ` : ';
the order
.I r
-of the group generated by
+of the group generated by
.IR G ;
an optional
.RB ` * ';
-and the
+and the
.I cofactor
.I h
=
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
typedef struct key {
/* --- Hashtable management --- */
-
+
hash_base _b; /* Symbol table data */
struct key *next; /* Next key of the same type */
* qualified by the names of subkeys, separated by dots. Hence,
* a qualified tag is ID|TAG[.TAG...]. The various result
* pointers can be null to indicate that the result isn't
- * interesting.
+ * interesting.
*/
extern int key_qtag(key_file */*f*/, const char */*tag*/,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
va_end(ap);
rc = kc->func ? kc->func(sev, d.buf, kc->p) : 0;
dstr_destroy(&d);
- return (rc);
+ return (rc);
}
/* --- @keycheck_init@ --- *
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
.I P
and the plaintext be
.IR m .
-A 160-bit nonce
+A 160-bit nonce
.I N
is chosen at random. Let
-.IR K \ =\ N \ ||\ K .
+.IR K \ =\ N \ ||\ K .
Generate 320 bits of output from RIPEMD-160 in
MGF1 mode with seed
.IR K ;
giving the ciphertext
.IR y\*(us0\*(ue .
Let \*(*t be the 160-bit tag obtained from RIPEMD-160 in HMAC mode on
-the message
-.I y\*(us0\*(ue
+the message
+.I y\*(us0\*(ue
and with key
.IR K\*(usT\*(ue .
The ciphertext is then
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
const struct seedalg { const char *p; grand *(*gen)(const void *, size_t); }
seedtab[] = {
- { "dsarand", dsarand_create },
- { "rmd128-mgf", rmd128_mgfrand },
- { "rmd160-mgf", rmd160_mgfrand },
- { "rmd256-mgf", rmd256_mgfrand },
- { "rmd320-mgf", rmd320_mgfrand },
- { "sha-mgf", sha_mgfrand },
- { "sha224-mgf", sha224_mgfrand },
- { "sha256-mgf", sha256_mgfrand },
- { "sha384-mgf", sha384_mgfrand },
- { "sha512-mgf", sha512_mgfrand },
- { "tiger-mgf", tiger_mgfrand },
+ { "dsarand", dsarand_create },
+ { "rmd128-mgf", rmd128_mgfrand },
+ { "rmd160-mgf", rmd160_mgfrand },
+ { "rmd256-mgf", rmd256_mgfrand },
+ { "rmd320-mgf", rmd320_mgfrand },
+ { "sha-mgf", sha_mgfrand },
+ { "sha224-mgf", sha224_mgfrand },
+ { "sha256-mgf", sha256_mgfrand },
+ { "sha384-mgf", sha384_mgfrand },
+ { "sha512-mgf", sha512_mgfrand },
+ { "tiger-mgf", tiger_mgfrand },
{ 0, 0 }
};
qd_parse qd;
group *g;
const char *e;
-
+
if (strcmp(k->curve, "list") == 0) {
unsigned i, w;
LIST("Built-in prime fields", stdout, ptab[i].name, ptab[i].name);
if ((g = group_prime(&dp)) == 0)
die(EXIT_FAILURE, "invalid prime field");
if (!(k->f & f_quiet) && (e = G_CHECK(g, &rand_global)) != 0)
- moan("WARNING! group check failed: %s", e);
+ moan("WARNING! group check failed: %s", e);
G_DESTROYGROUP(g);
goto done;
}
-
+
if (!k->bits)
k->bits = 1024;
case 's': {
base64_ctx b;
dstr d = DSTR_INIT;
- if (seed) die(EXIT_FAILURE, "seed already set");
+ if (seed) die(EXIT_FAILURE, "seed already set");
base64_init(&b);
base64_decode(&b, optarg, strlen(optarg), &d);
base64_decode(&b, 0, 0, &d);
seed = optarg;
dstr_destroy(&d);
} break;
-
+
case 'n': {
base64_ctx b;
dstr d = DSTR_INIT;
unsigned n = strtoul(optarg, &p, 0);
if (n == 0 || *p != 0 || n % 8 != 0)
die(EXIT_FAILURE, "bad seed length `%s'", optarg);
- if (seed) die(EXIT_FAILURE, "seed already set");
+ if (seed) die(EXIT_FAILURE, "seed already set");
n /= 8;
p = xmalloc(n);
rand_get(RAND_GLOBAL, p, n);
die(EXIT_FAILURE, "bad key-id `%s'", optarg);
kid = id;
} break;
-
+
/* --- Other flags --- */
case 'R':
fputs(", 0x", stdout); mp_writefile(k->u.e.y, stdout, 16);
putchar('\n');
}
- break;
+ break;
/* --- Structured keys --- *
*
}
INDENT(ind);
fputs("}\n", stdout);
- } break;
+ } break;
}
#undef INDENT
if (!o->v) {
if (!(o->f & f_newline)) {
- printf("%8s %-20s %-20s %-10s %-10s\n",
+ printf("%8s %-20s %-20s %-10s %-10s\n",
"Id", "Tag", "Type", "Expire", "Delete");
}
- printf("%08lx %-20s %-20s %-10s %-10s\n",
+ printf("%08lx %-20s %-20s %-10s %-10s\n",
(unsigned long)k->id, k->tag ? k->tag : "<none>",
k->type, ebuf, dbuf);
o->f |= f_newline;
showkeydata(k->k, 0, o, &d);
dstr_destroy(&d);
}
-
+
o->f |= f_newline;
}
int e = key_readflags(optarg, &p, &o.kf.f, &o.kf.m);
if (e || *p)
die(EXIT_FAILURE, "bad filter string `%s'", optarg);
- } break;
+ } break;
default:
o.f |= f_bogus;
break;
doclose(&f);
return (0);
}
-
+
/* --- @cmd_comment@ --- */
static int cmd_comment(int argc, char *argv[])
key *k;
for (key_mkiter(&i, &f); (k = key_next(&i)) != 0; )
key_extract(&f, k, fp, &kf);
- } else {
+ } else {
for (i = 1; i < argc; i++) {
if ((k = key_bytag(&f, argv[i])) != 0)
key_extract(&f, k, fp, &kf);
{ "add", cmd_add,
"add [-OPTIONS] TYPE [ATTR...]\n\
Options: [-lqrLKS] [-a ALG] [-bB BITS] [-p PARAM] [-R TAG]\n\
- [-A SEEDALG] [-s SEED] [-n BITS] [-I KEYID]\n\
- [-e EXPIRE] [-t TAG] [-c COMMENT]", "\
+ [-A SEEDALG] [-s SEED] [-n BITS] [-I KEYID]\n\
+ [-e EXPIRE] [-t TAG] [-c COMMENT]", "\
Options:\n\
\n\
-a, --algorithm=ALG Generate keys suitable for ALG.\n\
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
do x = lcrand(x); while (x >= P256);
g->x = x;
return (x / (P256 / 256));
-}
+}
static uint32 grange(grand *r, uint32 l)
{
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
else {
dstr_putf(&l->d, "%s*", ev->name);
l->pops->pgen(&l->qq, qql, l);
- }
+ }
return (PGEN_TRY);
}
return (done(ev, l));
}
return (PGEN_ABORT);
-}
+}
/*----- Main code ---------------------------------------------------------*/
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
%%% it under the terms of the GNU Library General Public License as
%%% published by the Free Software Foundation; either version 2 of the
%%% License, or (at your option) any later version.
-%%%
+%%%
%%% Catacomb 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 Library General Public License for more details.
-%%%
+%%%
%%% You should have received a copy of the GNU Library General Public
%%% License along with Catacomb; if not, write to the Free
%%% Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
%%%----- That's all, folks --------------------------------------------------
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
-%%% End:
+%%% End:
An integer $d$ such that $0 \le d < m$ and $d R \equiv x y \bmod m$.
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: "catacomb"
-%%% End:
+%%% End:
\multicolumn{1}{c|}{\textbf{Value}} & \qquad &
\multicolumn{1}{c|}{\textbf{Constant}} &
\multicolumn{1}{c|}{\textbf{Value}} \\ \hlx{vc{1,2,4,5}v}
- MP_ZERO & 0 && MP_FOUR & 4 \\
- MP_ONE & 1 && MP_FIVE & 5 \\
- MP_TWO & 2 && MP_TEN & 10 \\
- MP_THREE & 3 && MP_MONE & -1 \\ \hlx{vc{1,2,4,5}}
+ MP_ZERO & 0 && MP_FOUR & 4 \\
+ MP_ONE & 1 && MP_FIVE & 5 \\
+ MP_TWO & 2 && MP_TEN & 10 \\
+ MP_THREE & 3 && MP_MONE & -1 \\ \hlx{vc{1,2,4,5}}
\end{tabular}
\goodbreak
The RSA public-key encryption algorithm leaks the Jacobi symbol of its
plaintext.
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: "catacomb"
-%%% End:
+%%% End:
\[
\mp(v .. \vl) =
\sum_{0 \le i < \vl - v}
- 2^{\code{MPW_BITS} \cdot i} v[i]
+ 2^{\code{MPW_BITS} \cdot i} v[i]
\]
If the array is empty (i.e., $v = \vl$) then the number is zero. If the
array is empty, or the final word is nonzero, then the representation is said
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|MPX_OCTETS(size_t |$o$|,|
- |const mpw *|$v$|, const mpw *|$\vl$|);|
+ |const mpw *|$v$|, const mpw *|$\vl$|);|
\end{listinglist}
\fsec{Description}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|MPX_COPY(mpw *|$\dv$|, mpw *|$\dvl$|,|
- |const mpw *|$\av$|, const mpw *|$\avl$|);|
+ |const mpw *|$\av$|, const mpw *|$\avl$|);|
\end{listinglist}
\fsec{Description}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|void mpx_storel(const mpw *|$v$|, const mpw *|$\vl$|,|
- |void *|$p$|, size_t |$\sz$|);|
+ |void *|$p$|, size_t |$\sz$|);|
\end{listinglist}
\fsec{Description}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|void mpx_loadl(mpw *|$v$|, mpw *|$\vl$|,|
- |const void *|$p$|, size_t |$\sz$|);|
+ |const void *|$p$|, size_t |$\sz$|);|
\end{listinglist}
\fsec{Description}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|void mpx_storeb(const mpw *|$v$|, const mpw *|$\vl$|,|
- |void *|$p$|, size_t |$\sz$|);|
+ |void *|$p$|, size_t |$\sz$|);|
\end{listinglist}
\fsec{Description}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|void mpx_loadb(mpw *|$v$|, mpw *|$\vl$|,|
- |const void *|$p$|, size_t |$\sz$|);|
+ |const void *|$p$|, size_t |$\sz$|);|
\end{listinglist}
\fsec{Description}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_lsl(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,| \\
- \>|const mpw *|$\av$|, const mpw *|$\avl$|, size_t |$n$|);|
+ \>|const mpw *|$\av$|, const mpw *|$\avl$|, size_t |$n$|);|
\end{tabbing}
\end{listinglist}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_lsr(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,| \\
- \>|const mpw *|$\av$|, const mpw *|$\avl$|, size_t |$n$|);|
+ \>|const mpw *|$\av$|, const mpw *|$\avl$|, size_t |$n$|);|
\end{tabbing}
\end{listinglist}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|void mpx_2c(mpw *|$\dv$|, mpw *|$\dvl$|,|
- |const mpw *|$v$|, const mpw *|$\vl$|);|
+ |const mpw *|$v$|, const mpw *|$\vl$|);|
\end{listinglist}
\fsec{Description}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|int mpx_ucmp(|\=|const mpw *|$\av$|, const mpw *|$\avl$|,| \\
- \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);| \\
+ \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);| \\
|int MPX_UCMP(|\=|const mpw *|$\av$|, const mpw *|$\avl$|, |\synt{rel-op}|,|
- \\ \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
+ \\ \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
\end{tabbing}
\end{listinglist}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_uadd(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,|
- |const mpw *|$\av$|, const mpw *|$\avl$|,| \\
- \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
+ |const mpw *|$\av$|, const mpw *|$\avl$|,| \\
+ \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
\end{tabbing}
\end{listinglist}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_usub(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,|
- |const mpw *|$\av$|, const mpw *|$\avl$|,| \\
- \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
+ |const mpw *|$\av$|, const mpw *|$\avl$|,| \\
+ \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
\end{tabbing}
\end{listinglist}
Subtracts one multiprecision integer from another. The difference of the two
arguments $\mp(\av .. \avl) - \mp(\bv .. \bvl)$ is stored in $\dv .. \dvl$.
The destination array may be equal to either or both source
-arrays.\footnote{%
+arrays.\footnote{%
Subtracting a number from itself is a particularly poor way of clearing an
integer to zero. A call to \code{MPX_ZERO} (page~\pageref{fn:MPX-ZERO}) is
much more efficient.} %
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_umul(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,|
- |const mpw *|$\av$|, const mpw *|$\avl$|,| \\
- \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
+ |const mpw *|$\av$|, const mpw *|$\avl$|,| \\
+ \>|const mpw *|$\bv$|, const mpw *|$\bvl$|);|
\end{tabbing}
\end{listinglist}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_umuln(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,| \\
- \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);| \\
+ \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);| \\
|void MPX_UMULN(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,| \\
- \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);|
+ \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);|
\end{tabbing}
\end{listinglist}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\*
|void mpx_umlan(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,| \\*
- \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);| \\
+ \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);| \\
|void MPX_UMLAN(|\=|mpw *|$\dv$|, mpw *|$\dvl$|,| \\
- \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);|
+ \> |const mpw *|$\av$|, const mpw *|$\avl$|, mpw |$n$|);|
\end{tabbing}
\end{listinglist}
\begin{listinglist}
|#include <catacomb/mpx.h>| \\
|void mpx_usqr(mpw *|$\dv$|, mpw *|$\dvl$|,|
- |const mpw *|$\av$|, const mpw *|$\avl$|);|
+ |const mpw *|$\av$|, const mpw *|$\avl$|);|
\end{listinglist}
\fsec{Description}
\begin{tabbing}
|#include <catacomb/mpx.h>| \\
|void mpx_udiv(|\=|mpw *|$\qv$|, mpw *|$\qvl$|, mpw *|$\rv$|, mpw *|$\rvl$|,|
-\\ \>|const mpw *|$\dv$|, const mpw *|$\dvl$|,|
- |mpw *|$\mathit{sv}$|, mpw *|$\mathit{svl}$|);|
+\\ \>|const mpw *|$\dv$|, const mpw *|$\dvl$|,|
+ |mpw *|$\mathit{sv}$|, mpw *|$\mathit{svl}$|);|
\end{tabbing}
\end{listinglist}
which is a useful property when performing modular reductions.
\shortverb\|
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: "catacomb"
-%%% End:
+%%% End:
\input{mp-mp}
\input{mp-mod}
-%%% Local Variables:
+%%% Local Variables:
%%% mode: latex
%%% TeX-master: "catacomb"
-%%% End:
+%%% End:
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
exit(EXIT_FAILURE);
}
- return (0);
+ return (0);
}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/*----- Useful tables -----------------------------------------------------*/
static const uint32 s[512] = MARS_S;
-#define s0 (s + 0)
+#define s0 (s + 0)
#define s1 (s + 256)
#define bb (s + 265)
#define IKSUB(k, a, b, c, d) d -= *--k, c -= *--k, b -= *--k, a -= *--k
#define MIX(a, b, c, d) do { \
- b ^= s0[(a >> 0) & 0xff]; \
- b += s1[(a >> 8) & 0xff]; \
+ b ^= s0[(a >> 0) & 0xff]; \
+ b += s1[(a >> 8) & 0xff]; \
c += s0[(a >> 16) & 0xff]; \
d ^= s1[(a >> 24) & 0xff]; \
a = ROL32(a, 8); \
a = ROR32(a, 8); \
d ^= s1[(a >> 24) & 0xff]; \
c -= s0[(a >> 16) & 0xff]; \
- b -= s1[(a >> 8) & 0xff]; \
- b ^= s0[(a >> 0) & 0xff]; \
+ b -= s1[(a >> 8) & 0xff]; \
+ b ^= s0[(a >> 0) & 0xff]; \
} while (0)
#define E(x, y, z, k, a) do { \
E(x, y, z, k, a); \
b += x; c += y; d ^= z; \
} while (0)
-
+
#define IROUND(k, a, b, c, d) do { \
uint32 x, y, z; \
IE(x, y, z, k, a); \
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- Handy macro for doing something lots of times --- */
#define DO(what, where) do { \
- what(where, 0); what(where, 1); what(where, 2); what(where, 3); \
- what(where, 4); what(where, 5); what(where, 6); what(where, 7); \
- what(where, 8); what(where, 9); what(where, 10); what(where, 11); \
+ what(where, 0); what(where, 1); what(where, 2); what(where, 3); \
+ what(where, 4); what(where, 5); what(where, 6); what(where, 7); \
+ what(where, 8); what(where, 9); what(where, 10); what(where, 11); \
what(where, 12); what(where, 13); what(where, 14); what(where, 15); \
} while (0)
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
void md4_set(md4_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->off = 0;
ctx->nl = U32(count);
{
octet *p = hash;
HASH_MD5STRENGTH(MD4, md4, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
}
unsigned long md4_state(md4_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
return (ctx->nl | ((ctx->nh >> 16) >> 16));
}
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
void md5_set(md5_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->off = 0;
ctx->nl = U32(count);
{
octet *p = hash;
HASH_MD5STRENGTH(MD5, md5, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
}
unsigned long md5_state(md5_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
return (ctx->nl | ((ctx->nh << 16) << 16));
}
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
k->bsz = 0; \
pre##_init(&k->k); \
} \
- \
+ \
void pre##_mgfkeyadd(pre##_mgfctx *k, const void *p, size_t sz) \
{ \
pre##_hash(&k->k, p, sz); \
k->bsz -= n; \
if (dd) { \
if (!ss) { \
- memcpy(dd, p, n); \
- dd += n; \
+ memcpy(dd, p, n); \
+ dd += n; \
} else { \
while (n) { \
*dd++ = *ss++ ^ *p++; \
if (dd) { \
const octet *p = k->buf; \
if (!ss) { \
- memcpy(dd, p, n); \
- dd += n; \
+ memcpy(dd, p, n); \
+ dd += n; \
} else { \
while (n) { \
*dd++ = *ss++ ^ *p++; \
if (memcmp(pt, text, sizeof(text)) == 0) { \
done++; \
if (sizeof(text) < 40 || done % 8 == 0) \
- fputc('.', stdout); \
+ fputc('.', stdout); \
if (done % 480 == 0) \
- fputs("\n\t", stdout); \
+ fputs("\n\t", stdout); \
fflush(stdout); \
} else { \
printf("\nError (sz = %lu)\n", (unsigned long)sz); \
status = 1; \
printf("\tplaintext = "); hexdump(text, sz); \
- printf(", "); hexdump(text + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(text + sz, rest); \
+ fputc('\n', stdout); \
printf("\tciphertext = "); hexdump(ct, sz); \
- printf(", "); hexdump(ct + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(ct + sz, rest); \
+ fputc('\n', stdout); \
printf("\trecovered text = "); hexdump(pt, sz); \
- printf(", "); hexdump(pt + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(pt + sz, rest); \
+ fputc('\n', stdout); \
fputc('\n', stdout); \
} \
if (sz < 63) \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
while True:
F = stdin.next().split()
if not F or F[0] != '#:factor':
- break
+ break
ff.append(C.MP(F[1]))
seed = C.rmd160().hash(name).done()
k = kf.newkey(C.ReadBuffer(seed).getu32(), 'dh-param')
.RB [ \-g
.IR generator ]
.br
-
+
.RB [ \-n
.IR count ]
.RB [ \-r
to standard output and exit.
.TP
.B "\-v, \-\-version"
-Write
+Write
.BR mkphrase 's
version information to standard output and exit.
.TP
.BR markov .
.TP
.BI "\-n, \-\-count=" count
-Produce
+Produce
.I count
phrases. The default is to produce only one.
.TP
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{
node (*model)[VECSZ][VECSZ][VECSZ] = xmalloc(sizeof(*model));
unsigned i, j, k, l;
-
+
for (i = 0; i < VECSZ; i++) {
for (j = 0; j < VECSZ; j++) {
for (k = 0; k < VECSZ; k++) {
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* @mp *a@ = source
*
* Returns: The bitwise complement of the source.
- */
+ */
mp *mp_not(mp *d, mp *a)
{
* negative at the end, we preinvert the output and then invert again with a
* sign-swap.
*
- * Start with: wxyz WXYZ
+ * Start with: wxyz WXYZ
* If @a@ negative: yzwx or YZWX
- * If @b@ negative: xwzy XWZY
- * If both negative: zyxw ZYXW
+ * If @b@ negative: xwzy XWZY
+ * If both negative: zyxw ZYXW
*/
#define MP_BIT2CBINOP(n, base, an, bn, abn, p_base, p_an, p_bn, p_abn) \
{
if (!MP_EQ(expect, result)) {
fprintf(stderr, "\n*** %s failed", op);
- fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 10);
- fputs("\n*** b = ", stderr); mp_writefile(b, stderr, 10);
+ fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 10);
+ fputs("\n*** b = ", stderr); mp_writefile(b, stderr, 10);
fputs("\n*** result = ", stderr); mp_writefile(result, stderr, 10);
fputs("\n*** expect = ", stderr); mp_writefile(expect, stderr, 10);
fputc('\n', stderr);
static int tbin(dstr *v)
{
static mp *(*fn[])(mp *, mp *, mp *) = {
-#define DO(string) mp_bit##string##2c,
+#define DO(string) mp_bit##string##2c,
MPX_DOBIN(DO)
#undef DO
};
mp *b = *(mp **)v[2].buf;
mp *r = *(mp **)v[3].buf;
mp *c;
-
+
if (strcmp(v[0].buf, "and") == 0) op = 1;
else if (strcmp(v[0].buf, "or") == 0) op = 7;
else if (strcmp(v[0].buf, "nand") == 0) op = 14;
mp_drop(a);
mp_drop(r);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
static int todd(dstr *v)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
mp *y = mp_modinv(MP_NEW, x, m);
if (!MP_EQ(y, r)) {
fputs("\n*** mp_modinv failed", stderr);
- fputs("\nx = ", stderr); mp_writefile(x, stderr, 10);
- fputs("\nm = ", stderr); mp_writefile(m, stderr, 10);
+ fputs("\nx = ", stderr); mp_writefile(x, stderr, 10);
+ fputs("\nm = ", stderr); mp_writefile(m, stderr, 10);
fputs("\nexpect = ", stderr); mp_writefile(r, stderr, 10);
fputs("\nresult = ", stderr); mp_writefile(y, stderr, 10);
ok = 0;
}
MP_DROP(x); MP_DROP(m); MP_DROP(r); MP_DROP(y);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
static int gcd(dstr *v)
mp_gcd(&gg, &xx, &yy, a, b);
if (!MP_EQ(x, xx)) {
fputs("\n*** mp_gcd(x) failed", stderr);
- fputs("\na = ", stderr); mp_writefile(a, stderr, 10);
- fputs("\nb = ", stderr); mp_writefile(b, stderr, 10);
+ fputs("\na = ", stderr); mp_writefile(a, stderr, 10);
+ fputs("\nb = ", stderr); mp_writefile(b, stderr, 10);
fputs("\nexpect = ", stderr); mp_writefile(x, stderr, 10);
fputs("\nresult = ", stderr); mp_writefile(xx, stderr, 10);
fputc('\n', stderr);
}
if (!MP_EQ(y, yy)) {
fputs("\n*** mp_gcd(y) failed", stderr);
- fputs("\na = ", stderr); mp_writefile(a, stderr, 10);
- fputs("\nb = ", stderr); mp_writefile(b, stderr, 10);
+ fputs("\na = ", stderr); mp_writefile(a, stderr, 10);
+ fputs("\nb = ", stderr); mp_writefile(b, stderr, 10);
fputs("\nexpect = ", stderr); mp_writefile(y, stderr, 10);
fputs("\nresult = ", stderr); mp_writefile(yy, stderr, 10);
fputc('\n', stderr);
if (!MP_EQ(g, gg)) {
fputs("\n*** mp_gcd(gcd) failed", stderr);
- fputs("\na = ", stderr); mp_writefile(a, stderr, 10);
- fputs("\nb = ", stderr); mp_writefile(b, stderr, 10);
+ fputs("\na = ", stderr); mp_writefile(a, stderr, 10);
+ fputs("\nb = ", stderr); mp_writefile(b, stderr, 10);
fputs("\nexpect = ", stderr); mp_writefile(g, stderr, 10);
fputs("\nresult = ", stderr); mp_writefile(gg, stderr, 10);
fputc('\n', stderr);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
mp *mp_createsecure(size_t sz)
{
- mp *m = CREATE(mp);
+ mp *m = CREATE(mp);
m->v = mpalloc(MPARENA_SECURE, sz);
m->vl = m->v + sz;
m->sz = sz;
* Returns: ---
*
* Use: Changes an integer's size. The length and value are not
- * changed. It is an error to
+ * changed. It is an error to
*/
void mp_resize(mp *m, size_t sz) { MP_RESIZE(m, sz); }
* buffer, or (b) the old buffer is secure and I'm not allowed to
* discard the old contents.
*/
-
+
mparena *a;
mpw *v;
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2006 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- Find the inverse of %$a$% --- */
ainv = mp_modinv(MP_NEW, a, p);
-
+
/* --- Split %$p - 1$% into a power of two and an odd number --- */
t = mp_sub(MP_NEW, p, MP_ONE);
fputs("a = ", stderr); mp_writefile(a, stderr, 10); fputc('\n', stderr);
fputs("p = ", stderr); mp_writefile(p, stderr, 10); fputc('\n', stderr);
if (r) {
- fputs("r = ", stderr);
+ fputs("r = ", stderr);
mp_writefile(r, stderr, 10);
fputc('\n', stderr);
} else
- fputs("r = <undef>\n", stderr);
+ fputs("r = <undef>\n", stderr);
fputs("rr = ", stderr); mp_writefile(rr, stderr, 10); fputc('\n', stderr);
ok = 0;
}
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (!MP_EQ(q, qq)) {
ok = 0;
fputs("\n*** sqrt failed", stderr);
- fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 10);
+ fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 10);
fputs("\n*** result = ", stderr); mp_writefile(q, stderr, 10);
fputs("\n*** expect = ", stderr); mp_writefile(qq, stderr, 10);
fputc('\n', stderr);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
extern mp mp_const[];
#define MP_ZERO (&mp_const[0])
-#define MP_ONE (&mp_const[1])
-#define MP_TWO (&mp_const[2])
+#define MP_ONE (&mp_const[1])
+#define MP_TWO (&mp_const[2])
#define MP_THREE (&mp_const[3])
-#define MP_FOUR (&mp_const[4])
-#define MP_FIVE (&mp_const[5])
-#define MP_TEN (&mp_const[6])
+#define MP_FOUR (&mp_const[4])
+#define MP_FIVE (&mp_const[5])
+#define MP_TEN (&mp_const[6])
#define MP_256 (&mp_const[7])
-#define MP_MONE (&mp_const[8])
+#define MP_MONE (&mp_const[8])
#define MP_NEW ((mp *)0)
#define MP_NEWSEC (&mp_const[9])
if (_mm->ref == 0 && !(_mm->f & MP_CONST)) \
mp_destroy(_mm); \
} while (0)
-
+
/* --- @mp_split@ --- *
*
* Arguments: @mp *m@ = pointer to a multiprecision integer
* @mp *a@ = source
*
* Returns: The bitwise complement of the source.
- */
+ */
extern mp *mp_not(mp */*d*/, mp */*a*/);
* Synonyms for the commonly-used functions.
*/
-#define mp_and mp_bit0001
-#define mp_or mp_bit0111
+#define mp_and mp_bit0001
+#define mp_or mp_bit0111
#define mp_nand mp_bit1110
-#define mp_nor mp_bit1000
-#define mp_xor mp_bit0110
+#define mp_nor mp_bit1000
+#define mp_xor mp_bit0110
/* --- @mp_testbit@ --- *
*
*/
#define mp_and2c mp_bit00012c
-#define mp_or2c mp_bit01112c
+#define mp_or2c mp_bit01112c
#define mp_nand2c mp_bit11102c
#define mp_nor2c mp_bit10002c
#define mp_xor2c mp_bit01102c
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
unsigned mparena_count(mparena *a)
{
return (a->n);
-}
+}
/* --- @mpalloc@ --- *
*
#ifdef MPARENA_DEBUG
MPARENA_OPENFILE;
- fprintf(debugfp, "alloc %u\n before: ", sz);
+ fprintf(debugfp, "alloc %u\n before: ", sz);
tdump(a->root); putc('\n', debugfp);
#endif
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @mpbarrett_exp@ --- *
*
* Arguments: @mpbarrett *mb@ = pointer to Barrett reduction context
- * @mp *d@ = fake destination
- * @mp *a@ = base
- * @mp *e@ = exponent
+ * @mp *d@ = fake destination
+ * @mp *a@ = base
+ * @mp *e@ = exponent
*
- * Returns: Result, %$a^e \bmod m$%.
+ * Returns: Result, %$a^e \bmod m$%.
*/
mp *mpbarrett_exp(mpbarrett *mb, mp *d, mp *a, mp *e)
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
sub_init();
test_run(argc, argv, tests, SRCDIR "/tests/mpbarrett");
return (0);
-}
+}
#endif
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @mpbarrett_exp@ --- *
*
* Arguments: @mpbarrett *mb@ = pointer to Barrett reduction context
- * @mp *d@ = fake destination
- * @mp *a@ = base
- * @mp *e@ = exponent
+ * @mp *d@ = fake destination
+ * @mp *a@ = base
+ * @mp *e@ = exponent
*
- * Returns: Result, %$a^e \bmod m$%.
+ * Returns: Result, %$a^e \bmod m$%.
*/
extern mp *mpbarrett_exp(mpbarrett */*mb*/, mp */*d*/, mp */*a*/, mp */*e*/);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
i = 0, j = 1;
else
i = 1, j = 0;
-
+
x = mp_mul(MP_NEW, v[j].n, v[j].ni);
x = mp_sub(x, x, MP_ONE);
mp_div(&x, 0, x, v[i].n);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
sub_init();
test_run(argc, argv, tests, SRCDIR "/tests/mpmont");
return (0);
-}
+}
#endif
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
fputs("\n*** bad r", stderr);
fputs("\nm = ", stderr); mp_writefile(m, stderr, 10);
fputs("\nexpected ", stderr); mp_writefile(r, stderr, 10);
- fputs("\n found ", stderr); mp_writefile(mm.r, stderr, 10);
+ fputs("\n found ", stderr); mp_writefile(mm.r, stderr, 10);
fputc('\n', stderr);
ok = 0;
}
fputs("\n*** bad r2", stderr);
fputs("\nm = ", stderr); mp_writefile(m, stderr, 10);
fputs("\nexpected ", stderr); mp_writefile(r2, stderr, 10);
- fputs("\n found ", stderr); mp_writefile(mm.r2, stderr, 10);
+ fputs("\n found ", stderr); mp_writefile(mm.r2, stderr, 10);
fputc('\n', stderr);
ok = 0;
}
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* @grand *r@ = random number source
* @mpw or@ = mask for low-order bits
*
- * Returns: A pseudorandom integer, unformly distributed over the
+ * Returns: A pseudorandom integer, unformly distributed over the
* interval %$[0, l)$%.
*
* Use: Generates a uniformly-distributed pseudorandom number in the
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* @grand *r@ = random number source
* @mpw or@ = mask for low-order bits
*
- * Returns: A pseudorandom integer, unformly distributed over the
+ * Returns: A pseudorandom integer, unformly distributed over the
* interval %$[0, l)$%.
*
* Use: Generates a uniformly-distributed pseudorandom number in the
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
for (i = 0, mp_scan(&sc, p); mp_step(&sc); i++) {
switch (st | mp_bit(&sc)) {
case Z | 1: st = Z1; break;
- case Z1 | 0: st = Z; printf("+ %lu\n", i - 1); break;
- case Z1 | 1: st = X; printf("- %lu\n", i - 1); break;
+ case Z1 | 0: st = Z; printf("+ %lu\n", i - 1); break;
+ case Z1 | 1: st = X; printf("- %lu\n", i - 1); break;
case X | 0: st = X0; break;
- case X0 | 1: st = X; printf("- %lu\n", i - 1); break;
- case X0 | 0: st = Z; printf("+ %lu\n", i - 1); break;
+ case X0 | 1: st = X; printf("- %lu\n", i - 1); break;
+ case X0 | 0: st = Z; printf("+ %lu\n", i - 1); break;
}
}
if (st >= X) printf("+ %lu\n", i - 1);
for (i = 0, mp_scan(&sc, p); i < d && mp_step(&sc); i++) {
switch (st | mp_bit(&sc)) {
case Z | 1: st = Z1; break;
- case Z1 | 0: st = Z; op = MPRI_SUB; goto instr;
- case Z1 | 1: st = X; op = MPRI_ADD; goto instr;
+ case Z1 | 0: st = Z; op = MPRI_SUB; goto instr;
+ case Z1 | 1: st = X; op = MPRI_ADD; goto instr;
case X | 0: st = X0; break;
- case X0 | 1: st = X; op = MPRI_ADD; goto instr;
- case X0 | 0: st = Z; op = MPRI_SUB; goto instr;
+ case X0 | 1: st = X; op = MPRI_ADD; goto instr;
+ case X0 | 0: st = Z; op = MPRI_SUB; goto instr;
instr:
w = (d - i)/MPW_BITS + 1;
b = (bb + i)%MPW_BITS;
/* --- @mpreduce_exp@ --- *
*
* Arguments: @mpreduce *mr@ = pointer to reduction context
- * @mp *d@ = fake destination
- * @mp *a@ = base
- * @mp *e@ = exponent
+ * @mp *d@ = fake destination
+ * @mp *a@ = base
+ * @mp *e@ = exponent
*
- * Returns: Result, %$a^e \bmod m$%.
+ * Returns: Result, %$a^e \bmod m$%.
*/
mp *mpreduce_exp(mpreduce *mr, mp *d, mp *a, mp *e)
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @mpreduce_exp@ --- *
*
* Arguments: @mpreduce *mr@ = pointer to reduction context
- * @mp *d@ = fake destination
- * @mp *a@ = base
- * @mp *e@ = exponent
+ * @mp *d@ = fake destination
+ * @mp *a@ = base
+ * @mp *e@ = exponent
*
- * Returns: Result, %$a^e \bmod m$%.
+ * Returns: Result, %$a^e \bmod m$%.
*/
extern mp *mpreduce_exp(mpreduce */*mr*/, mp */*d*/, mp */*a*/, mp */*e*/);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2002 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- Maximum recursion depth --- *
*
- * This is the number of bits in a @size_t@ object. Why?
+ * This is the number of bits in a @size_t@ object. Why?
*
* To see this, let %$b = \textit{MPW\_MAX} + 1$% and let %$Z$% be the
* largest @size_t@ value. Then the largest possible @mp@ is %$M - 1$% where
/* --- Initialize the stacks --- */
mp_build(&rr, &rd, &rd + 1);
- pow[0] = &rr;
+ pow[0] = &rr;
pows = 1;
sp = 0;
a |= MPW(x) << b;
} else {
a |= MPW(x) >> (bit - b);
- b += MPW_BITS - bit;
+ b += MPW_BITS - bit;
*--v = MPW(a);
n--;
if (!n) {
x = ch - '0';
else {
if (rd <= 36)
- ch = tolower(ch);
+ ch = tolower(ch);
if (ch >= 'a' && ch <= 'z') /* ASCII dependent! */
x = ch - 'a' + 10;
else if (ch >= 'A' && ch <= 'Z')
/* --- Bail out if the number was bad --- */
done:
- if (!(f & f_ok))
+ if (!(f & f_ok))
return (0);
/* --- Set the sign and return --- */
case 8: case -8: return (binary(m, 3, radix, ops, p));
case 16: case -16: return (binary(m, 4, radix, ops, p));
case 32: case -32: return (binary(m, 5, radix, ops, p));
- case -64: return (binary(m, 6, radix, ops, p));
- case -128: return (binary(m, 7, radix, ops, p));
+ case -64: return (binary(m, 6, radix, ops, p));
+ case -128: return (binary(m, 7, radix, ops, p));
}
/* --- If the number is small, do it the easy way --- */
if (m) {
if (!ob) {
fprintf(stderr, "*** unexpected successful parse\n"
- "*** input [%2i] = ", ib);
+ "*** input [%2i] = ", ib);
if (ib < 0)
type_hex.dump(&v[1], stderr);
else
mp_writedstr(m, &d, ob);
if (d.len != v[3].len || memcmp(d.buf, v[3].buf, d.len) != 0) {
fprintf(stderr, "*** failed read or write\n"
- "*** input [%2i] = ", ib);
+ "*** input [%2i] = ", ib);
if (ib < 0)
type_hex.dump(&v[1], stderr);
else
fputs(v[1].buf, stderr);
- fprintf(stderr, "\n*** output [%2i] = ", ob);
+ fprintf(stderr, "\n*** output [%2i] = ", ob);
if (ob < 0)
type_hex.dump(&d, stderr);
else
fputs(d.buf, stderr);
- fprintf(stderr, "\n*** expected [%2i] = ", ob);
+ fprintf(stderr, "\n*** expected [%2i] = ", ob);
if (ob < 0)
type_hex.dump(&v[3], stderr);
else
} else {
if (ob) {
fprintf(stderr, "*** unexpected parse failure\n"
- "*** input [%2i] = ", ib);
+ "*** input [%2i] = ", ib);
if (ib < 0)
type_hex.dump(&v[1], stderr);
else
if (v[1].len - off != v[4].len ||
memcmp(v[1].buf + off, v[4].buf, v[4].len) != 0) {
fprintf(stderr, "*** leftovers incorrect\n"
- "*** input [%2i] = ", ib);
+ "*** input [%2i] = ", ib);
if (ib < 0)
type_hex.dump(&v[1], stderr);
else
fputs(v[1].buf, stderr);
fprintf(stderr, "\n*** expected `%s'\n"
- "*** found `%s'\n",
+ "*** found `%s'\n",
v[4].buf, v[1].buf + off);
ok = 0;
}
-
+
dstr_destroy(&d);
assert(mparena_count(MPARENA_GLOBAL) == 0);
return (ok);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
fputc('\n', fp); \
} while (0)
-#define MP_DOFPRINTR(fp, name, m, r) \
+#define MP_DOFPRINTR(fp, name, m, r) \
MP_DOFPRINTFR(fp, (fp, "%s = ", name), m, r)
#define MP_PRINT(name, m) MP_DOFPRINTR(stdout, name, m, 10)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
w.bits /= 2; w.max = ~(~((umax)0) << w.bits);
d.bits = w.bits * 2; d.max = ~(~((umax)0) << d.bits);
mpw = &w; mpd = &d;
- }
+ }
#endif
for (p2 = 1; (p2 << 1) < mpw->bits; p2 <<= 1);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @MPW@ --- *
*
- * Arguments: @x@ = an unsigned value
+ * Arguments: @x@ = an unsigned value
*
- * Use: Expands to the value of @x@ masked and typecast to a
- * multiprecision integer word.
+ * Use: Expands to the value of @x@ masked and typecast to a
+ * multiprecision integer word.
*/
#define MPW(x) ((mpw)((x) & MPW_MAX))
/* --- @MPWS@ --- *
*
- * Arguments: @n@ = number of words
+ * Arguments: @n@ = number of words
*
- * Use: Expands to the number of bytes occupied by a given number of
- * words.
+ * Use: Expands to the number of bytes occupied by a given number of
+ * words.
*/
#define MPWS(n) ((n) * sizeof(mpw))
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#include <mLib/alloc.h>
#include <mLib/testrig.h>
-#define ALLOC(v, vl, sz) do { \
- size_t _sz = (sz); \
- mpw *_vv = xmalloc(MPWS(_sz)); \
- mpw *_vvl = _vv + _sz; \
- (v) = _vv; \
- (vl) = _vvl; \
+#define ALLOC(v, vl, sz) do { \
+ size_t _sz = (sz); \
+ mpw *_vv = xmalloc(MPWS(_sz)); \
+ mpw *_vvl = _vv + _sz; \
+ (v) = _vv; \
+ (vl) = _vvl; \
} while (0)
-#define LOAD(v, vl, d) do { \
- const dstr *_d = (d); \
- mpw *_v, *_vl; \
- ALLOC(_v, _vl, MPW_RQ(_d->len)); \
- mpx_loadb(_v, _vl, _d->buf, _d->len); \
- (v) = _v; \
- (vl) = _vl; \
+#define LOAD(v, vl, d) do { \
+ const dstr *_d = (d); \
+ mpw *_v, *_vl; \
+ ALLOC(_v, _vl, MPW_RQ(_d->len)); \
+ mpx_loadb(_v, _vl, _d->buf, _d->len); \
+ (v) = _v; \
+ (vl) = _vl; \
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
mpx_kmul(d, dl, a, al, b, bl, s, sl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** umul failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MPX_COPY(rdv + m + 1, dvl, svm + 1, svn);
UADD(rdv, sv, svm + 1);
USUB(tdv, sv, svn);
-
+
if (m > MPK_THRESH)
mpx_ksqr(sv, ssv, av, avm, ssv, svl);
else
#include <mLib/alloc.h>
#include <mLib/testrig.h>
-#define ALLOC(v, vl, sz) do { \
- size_t _sz = (sz); \
- mpw *_vv = xmalloc(MPWS(_sz)); \
- mpw *_vvl = _vv + _sz; \
- (v) = _vv; \
- (vl) = _vvl; \
+#define ALLOC(v, vl, sz) do { \
+ size_t _sz = (sz); \
+ mpw *_vv = xmalloc(MPWS(_sz)); \
+ mpw *_vvl = _vv + _sz; \
+ (v) = _vv; \
+ (vl) = _vvl; \
} while (0)
-#define LOAD(v, vl, d) do { \
- const dstr *_d = (d); \
- mpw *_v, *_vl; \
- ALLOC(_v, _vl, MPW_RQ(_d->len)); \
- mpx_loadb(_v, _vl, _d->buf, _d->len); \
- (v) = _v; \
- (vl) = _vl; \
+#define LOAD(v, vl, d) do { \
+ const dstr *_d = (d); \
+ mpw *_v, *_vl; \
+ ALLOC(_v, _vl, MPW_RQ(_d->len)); \
+ mpx_loadb(_v, _vl, _d->buf, _d->len); \
+ (v) = _v; \
+ (vl) = _vl; \
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
mpx_ksqr(d, dl, a, al, s, sl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** usqr failed\n");
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
/* --- Break out word and bit shifts for more sophisticated work --- */
-
+
nw = n / MPW_BITS;
nb = n % MPW_BITS;
}
/* --- Break out word and bit shifts for more sophisticated work --- */
-
+
nw = n / MPW_BITS;
nb = n % MPW_BITS;
MPX_SHRINK(bv, bvl);
/* --- Deal with a multiply by zero --- */
-
+
if (bv == bvl) {
MPX_ZERO(dv, dvl);
return;
} while (0)
#define MAX(x, y) ((x) > (y) ? (x) : (y))
-
+
static void dumpbits(const char *msg, const void *pp, size_t sz)
{
const octet *p = pp;
mpx_lsl(d, dl, a, al, n);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** lsl(%i) failed\n", n);
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_lslc(d, dl, a, al, n);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** lslc(%i) failed\n", n);
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_lsr(d, dl, a, al, n);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** lsr(%i) failed\n", n);
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_uadd(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** uadd failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_usub(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** usub failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_umul(d, dl, a, al, b, bl);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** umul failed\n");
- dumpmp(" a", a, al);
- dumpmp(" b", b, bl);
+ dumpmp(" a", a, al);
+ dumpmp(" b", b, bl);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
mpx_usqr(d, dl, a, al);
if (!mpx_ueq(d, dl, c, cl)) {
fprintf(stderr, "\n*** usqr failed\n");
- dumpmp(" a", a, al);
+ dumpmp(" a", a, al);
dumpmp("expected", c, cl);
dumpmp(" result", d, dl);
ok = 0;
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (_v == _vl) \
(b) = 0; \
else { \
- unsigned long _b = MPW_BITS * (_vl - _v - 1) + 1; \
+ unsigned long _b = MPW_BITS * (_vl - _v - 1) + 1; \
mpw _w = _vl[-1]; \
unsigned _k = MPW_P2; \
while (_k) { \
* Synonyms for the commonly-used functions above.
*/
-#define mpx_and mpx_bit0001
-#define mpx_or mpx_bit0111
+#define mpx_and mpx_bit0001
+#define mpx_or mpx_bit0111
#define mpx_nand mpx_bit1110
-#define mpx_nor mpx_bit1000
-#define mpx_xor mpx_bit0110
+#define mpx_nor mpx_bit1000
+#define mpx_xor mpx_bit0110
/* --- @mpx_not@ --- *
*
* Arguments: @mpw *qv, *qvl@ = quotient vector base and limit
* @mpw *rv, *rvl@ = dividend/remainder vector base and limit
* @const mpw *dv, *dvl@ = divisor vector base and limit
- * @mpw *sv, *svl@ = scratch workspace
+ * @mpw *sv, *svl@ = scratch workspace
*
* Returns: ---
*
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
static const noekeon_ctx nullkey = { { 0, 0, 0, 0 } };
KSZ_ASSERT(noekeon, sz);
- k->k[0] = LOAD32(p + 0);
- k->k[1] = LOAD32(p + 4);
- k->k[2] = LOAD32(p + 8);
+ k->k[0] = LOAD32(p + 0);
+ k->k[1] = LOAD32(p + 4);
+ k->k[2] = LOAD32(p + 8);
k->k[3] = LOAD32(p + 12);
noekeon_eblk(&nullkey, k->k, k->k);
}
a ^= ka; b ^= kb; c ^= kc; d ^= kd; \
_x = b ^ d; _x ^= ROR32(_x, 8) ^ ROL32(_x, 8); a ^= _x; c ^= _x; \
} while (0)
-
+
#define ITHETA(ka, kb, kc, kd, a, b, c, d) do { \
uint32 _x; \
_x = b ^ d; _x ^= ROR32(_x, 8) ^ ROL32(_x, 8); a ^= _x; c ^= _x; \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
unsigned long x, d, dd;
int de, dde;
int ret;
-
+
x = tv->tv_usec + MILLION * tv->tv_sec;
d = x ^ noise_last;
dd = d ^ noise_diff;
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (memcmp(pt, text, sizeof(text)) == 0) { \
done++; \
if (sizeof(text) < 40 || done % 8 == 0) \
- fputc('.', stdout); \
+ fputc('.', stdout); \
if (done % 480 == 0) \
- fputs("\n\t", stdout); \
+ fputs("\n\t", stdout); \
fflush(stdout); \
} else { \
printf("\nError (sz = %lu)\n", (unsigned long)sz); \
status = 1; \
printf("\tplaintext = "); hexdump(text, sz); \
- printf(", "); hexdump(text + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(text + sz, rest); \
+ fputc('\n', stdout); \
printf("\tciphertext = "); hexdump(ct, sz); \
- printf(", "); hexdump(ct + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(ct + sz, rest); \
+ fputc('\n', stdout); \
printf("\trecovered text = "); hexdump(pt, sz); \
- printf(", "); hexdump(pt + sz, rest); \
- fputc('\n', stdout); \
+ printf(", "); hexdump(pt + sz, rest); \
+ fputc('\n', stdout); \
fputc('\n', stdout); \
} \
if (sz < 63) \
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
%%% it under the terms of the GNU Library General Public License as
%%% published by the Free Software Foundation; either version 2 of the
%%% License, or (at your option) any later version.
-%%%
+%%%
%%% Catacomb 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 Library General Public License for more details.
-%%%
+%%%
%%% You should have received a copy of the GNU Library General Public
%%% License along with Catacomb; if not, write to the Free
%%% Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
superficially similar to (for example) the Linux and OpenBSD random number
generators, it introduces a number of its own innovations which improve
both security and performance.
-
+
The Catacomb generator uses an optional secret key, which can provide
additional security against forward state compromise extension. It uses a
catastrophic reseeding operation to prevent a compromise yielding
I'[8j + b] =
\begin{cases}
x\bigl[(r + b) \bmod 8\bigr] \xor
- \bigxor_{0 \le k < N_I}
- a_k I\bigl[8\bigl((j + k) \bmod N_I\bigr) + b\bigr] & if $i = j$ \\
+ \bigxor_{0 \le k < N_I}
+ a_k I\bigl[8\bigl((j + k) \bmod N_I\bigr) + b\bigr] & if $i = j$ \\
I[j + b] & otherwise
\end{cases} \\
\textrm{for all integers $j$ and $b$ where $0 \le j < N_I$ and
machine.
\begin{thebibliography}{99}
-
+
\bibitem{cp:rand}
J.~Kelsey, B.~Schneier, D.~Wagner, and C.~Hall, ``Cryptographic Attacks on
Pseudorandom Number Generators'', \emph{Fast Software Encryption, Fifth
%%%----- That's all, folks --------------------------------------------------
-\end{document}
\ No newline at end of file
+\end{document}
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
fail:
dstr_destroy(&d);
memset(buf, 0, sz);
- return (-1);
+ return (-1);
}
/* --- @passphrase_cancel@ --- *
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
for (;;) {
$_ = <>; @F = split; $F[0] eq "#:factor" or last; $f = $F[1];
print <<EOF;
- f = $f;
- if (!ptest(f)) print " factor not prime", f;
- ff *= f;
+ f = $f;
+ if (!ptest(f)) print " factor not prime", f;
+ ff *= f;
EOF
$ll = 1;
}
if ($ll) {
print <<EOF;
- if (ff != p - 1) print " missing factors";
+ if (ff != p - 1) print " missing factors";
EOF
}
}
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
} jobops;
static const jobops jobtab[] = {
- { "g-prime-exp", grp_init, gr_run },
+ { "g-prime-exp", grp_init, gr_run },
{ "g-ec-mul", grec_init, gr_run },
{ "g-prime-exp-sim", grp_init, grsim_run },
{ "g-ec-mul-sim", grec_init, grsim_run },
p = j->init(&o);
n = 0;
- ttot = itot = 0;
+ ttot = itot = 0;
gettimeofday(&tv_now, 0);
do {
tv_addl(&tv_next, &tv_now, o.t, fmod(o.t * MILLION, MILLION));
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
/* --- Gallivant through the residue table --- */
-
+
for (i = 0; i < NPRIME; i++) {
p->r[i] = (q->r[i] * m + a) % primetab[i];
if (!p->r[i] && rc == PGEN_TRY) {
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2006 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
rc = PGEN_ABORT;
break;
}
-
+
if (rc == PGEN_FAIL && !((f->step | f->f.m->v[0]) & 1))
rc = pfilt_step(&f->f, 1);
while (rc == PGEN_FAIL)
pfilt_destroy(&f->f);
return (PGEN_DONE);
}
-
+
while (rc == PGEN_FAIL)
rc = pfilt_jump(&f->f, f->j);
ev->m = MP_COPY(f->f.m);
if (p == P_TEST)
act |= A_ENDTEST;
}
- }
+ }
/* --- Close down tester and stepper functions --- */
mp_drop(m);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
static int verify(dstr *v)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
unsigned n; /* Size of the vector */
mp *step; /* Basic stepping value */
} pgen_simulctx;
-
+
/* --- @pgen_simulstep@ --- *
*
* Step a collection of numbers simultaneously.
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
/*----- That's all, folks -------------------------------------------------*/
-
+
.TP
.B "\-PP, \-\-verify-passphrase"
Connect to a running pixie and request verification of the passphrase
-with tag
+with tag
.IR tag .
If no pixie is running, request the passphrase from the terminal. Print
the result on standard output, followed by a newline.
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
return (p);
if (P_ROOT->next == P_ROOT)
return (0);
- if (verbose) {
+ if (verbose) {
log("flushing passphrase `%s' to free up needed space",
P_ROOT->next->tag);
}
case 'h': t *= 60;
case 'm': t *= 60;
case 's': if (q[1] != 0)
- default: t = 0;
+ default: t = 0;
case 0: break;
}
return (t);
shutdown(fd, 1);
c_flags |= cf_uclose | cf_cooked;
dstr_destroy(&d);
- }
+ }
/* --- And repeat --- */
/* --- Magic terminator --- */
- { 0, 0, 0, 0 }
+ { 0, 0, 0, 0 }
};
int i = mdwopt(argc, argv, "hVuqvCPs:c:ft:idl", opts, 0, 0, 0);
/* --- Fork into the background if requested --- */
- if (f & f_daemon) {
+ if (f & f_daemon) {
pid_t kid;
if (((f & f_stdin) &&
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
*
* INFO message
* Reports a human-readable informational message. Further responses
- * follow.
+ * follow.
*
* ITEM tag expires
* Reports a passphrase in response to a LIST request. One ITEM
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
assert(q == b + sz);
/* --- Collect the result --- */
-
+
return (mp_loadb(d, b, sz));
}
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
rc = PGEN_FAIL;
if (!c->exp)
- x = mp_copy(ev->m);
+ x = mp_copy(ev->m);
else {
x = mpmont_exp(&c->mm, MP_NEW, ev->m, c->exp);
if (MP_EQ(x, MP_ONE))
goto done;
}
if (c->n == 0)
- goto ok;
+ goto ok;
else {
size_t n = c->n;
mp **f = c->f;
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @rand_goodbits@ --- *
*
- * Arguments: @rand_pool *r@ = pointer to a randomness pool
+ * Arguments: @rand_pool *r@ = pointer to a randomness pool
*
- * Returns: Estimate of the number of good bits remaining in the pool.
+ * Returns: Estimate of the number of good bits remaining in the pool.
*/
unsigned rand_goodbits(rand_pool *r)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @rand_goodbits@ --- *
*
- * Arguments: @rand_pool *r@ = pointer to a randomness pool
+ * Arguments: @rand_pool *r@ = pointer to a randomness pool
*
- * Returns: Estimate of the number of good bits remaining in the pool.
+ * Returns: Estimate of the number of good bits remaining in the pool.
*/
extern unsigned rand_goodbits(rand_pool */*r*/);
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (memcmp(b.buf, v[3].buf, RC2_BLKSZ)) {
ok = 0;
printf("\nfail encryption:"
- "\n\tkey = ");
+ "\n\tkey = ");
type_hex.dump(&v[0], stdout);
printf("\n\tbraindamage= %u", bd);
printf("\n\tplaintext = "); type_hex.dump(&v[2], stdout);
if (memcmp(b.buf, v[2].buf, RC2_BLKSZ)) {
ok = 0;
printf("\nfail decryption:"
- "\n\tkey = ");
+ "\n\tkey = ");
type_hex.dump(&v[0], stdout);
printf("\n\tbraindamage= %u", bd);
printf("\n\tciphertext = "); type_hex.dump(&v[3], stdout);
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
ctx->s[j] = si;
if (p == q)
p = k;
- }
+ }
ctx->i = ctx->j = 0;
}
if (memcmp(v[2].buf, d.buf, d.len) != 0) {
ok = 0;
printf("\nfail encryption:"
- "\n\tkey = ");
+ "\n\tkey = ");
type_hex.dump(&v[0], stdout);
printf("\n\tplaintext = "); type_hex.dump(&v[1], stdout);
printf("\n\texpected = "); type_hex.dump(&v[2], stdout);
if (memcmp(v[2].buf, d.buf, d.len) != 0) {
ok = 0;
printf("\nfail generation:"
- "\n\tkey = ");
+ "\n\tkey = ");
type_hex.dump(&v[0], stdout);
printf("\n\tskip len = %i", *(int *)v[1].buf);
printf("\n\texpected = "); type_hex.dump(&v[2], stdout);
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#define SUB(s, a, b, c, d) \
(s[U8((a) >> 24)] << 24 | s[U8((b) >> 16)] << 16 | \
- s[U8((c) >> 8)] << 8 | s[U8((d) >> 0)] << 0)
+ s[U8((c) >> 8)] << 8 | s[U8((d) >> 0)] << 0)
#define MIX(t, a, b, c, d) \
(t[0][U8((a) >> 24)] ^ t[1][U8((b) >> 16)] ^ \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* tables. Let %$a$% be an element of the finite field. If the inverse of
* %$a$% is %$a^{-1}$%, then %$\log a a^{-1} = 0$%. Hence
* %$\log a = -\log a^{-1}$%. This saves fiddling about with Euclidean
- * algorithm.
+ * algorithm.
*/
#define S_MOD 0x11b
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
- }
+ }
fputs("\
#define RIJNDAEL_TI { \\\n\
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
- }
+ }
/* --- Round constants --- */
fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
- }
+ }
/* --- Done --- */
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
DO(MIX, T, aa, bb, cc, dd, ee, ff, a, b, c, d, e, f, w);
DO(MIX, T, a, b, c, d, e, f, aa, bb, cc, dd, ee, ff, w);
DO(MIX, T, aa, bb, cc, dd, ee, ff, a, b, c, d, e, f, w);
- }
+ }
DO(SUB, S, a, b, c, d, e, f, aa, bb, cc, dd, ee, ff, w);
dst[0] = a; dst[1] = b; dst[2] = c; dst[3] = d; dst[4] = e; dst[5] = f;
UNDO(MIX, TI, aa, bb, cc, dd, ee, ff, a, b, c, d, e, f, w);
UNDO(MIX, TI, a, b, c, d, e, f, aa, bb, cc, dd, ee, ff, w);
UNDO(MIX, TI, aa, bb, cc, dd, ee, ff, a, b, c, d, e, f, w);
- }
+ }
UNDO(SUB, SI, a, b, c, d, e, f, aa, bb, cc, dd, ee, ff, w);
dst[0] = a; dst[1] = b; dst[2] = c; dst[3] = d; dst[4] = e; dst[5] = f;
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#define G1(w, x, y, z, i, r) T(w, x, y, z, i, r, G, 0x5a827999)
#define H1(w, x, y, z, i, r) T(w, x, y, z, i, r, H, 0x6ed9eba1)
#define I1(w, x, y, z, i, r) T(w, x, y, z, i, r, I, 0x8f1bbcdc)
-
+
#define F2(w, x, y, z, i, r) T(w, x, y, z, i, r, I, 0x50a28be6)
#define G2(w, x, y, z, i, r) T(w, x, y, z, i, r, H, 0x5c4dd124)
#define H2(w, x, y, z, i, r) T(w, x, y, z, i, r, G, 0x6d703ef3)
I1(d, a, b, c, 5, 6);
I1(c, d, a, b, 6, 5);
I1(b, c, d, a, 2, 12);
-
+
/* --- And then the right hand side --- */
F2(A, B, C, D, 5, 8);
I2(D, A, B, C, 7, 5);
I2(C, D, A, B, 10, 15);
I2(B, C, D, A, 14, 8);
-
+
/* --- Recombine the two halves --- */
{
void rmd128_set(rmd128_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->off = 0;
ctx->nl = U32(count);
{
octet *p = hash;
HASH_MD5STRENGTH(RMD128, rmd128, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
}
unsigned long rmd128_state(rmd128_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
return (ctx->nl | ((ctx->nh << 16) << 16));
}
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
F1(e, a, b, c, d, 1, 14);
F1(d, e, a, b, c, 2, 15);
F1(c, d, e, a, b, 3, 12);
- F1(b, c, d, e, a, 4, 5);
- F1(a, b, c, d, e, 5, 8);
- F1(e, a, b, c, d, 6, 7);
- F1(d, e, a, b, c, 7, 9);
+ F1(b, c, d, e, a, 4, 5);
+ F1(a, b, c, d, e, 5, 8);
+ F1(e, a, b, c, d, 6, 7);
+ F1(d, e, a, b, c, 7, 9);
F1(c, d, e, a, b, 8, 11);
F1(b, c, d, e, a, 9, 13);
F1(a, b, c, d, e, 10, 14);
F1(e, a, b, c, d, 11, 15);
- F1(d, e, a, b, c, 12, 6);
- F1(c, d, e, a, b, 13, 7);
- F1(b, c, d, e, a, 14, 9);
- F1(a, b, c, d, e, 15, 8);
-
+ F1(d, e, a, b, c, 12, 6);
+ F1(c, d, e, a, b, 13, 7);
+ F1(b, c, d, e, a, 14, 9);
+ F1(a, b, c, d, e, 15, 8);
+
G1(e, a, b, c, d, 7, 7);
G1(d, e, a, b, c, 4, 6);
G1(c, d, e, a, b, 13, 8);
G1(b, c, d, e, a, 14, 7);
G1(a, b, c, d, e, 11, 13);
G1(e, a, b, c, d, 8, 12);
-
+
H1(d, e, a, b, c, 3, 11);
H1(c, d, e, a, b, 10, 13);
H1(b, c, d, e, a, 14, 6);
H1(a, b, c, d, e, 11, 12);
H1(e, a, b, c, d, 5, 7);
H1(d, e, a, b, c, 12, 5);
-
+
I1(c, d, e, a, b, 1, 11);
I1(b, c, d, e, a, 9, 12);
I1(a, b, c, d, e, 11, 14);
I1(e, a, b, c, d, 5, 6);
I1(d, e, a, b, c, 6, 5);
I1(c, d, e, a, b, 2, 12);
-
+
J1(b, c, d, e, a, 4, 9);
J1(a, b, c, d, e, 0, 15);
J1(e, a, b, c, d, 5, 5);
F2(C, D, E, A, B, 10, 14);
F2(B, C, D, E, A, 3, 12);
F2(A, B, C, D, E, 12, 6);
-
+
G2(E, A, B, C, D, 6, 9);
G2(D, E, A, B, C, 11, 13);
G2(C, D, E, A, B, 3, 15);
G2(B, C, D, E, A, 9, 15);
G2(A, B, C, D, E, 1, 13);
G2(E, A, B, C, D, 2, 11);
-
+
H2(D, E, A, B, C, 15, 9);
H2(C, D, E, A, B, 5, 7);
H2(B, C, D, E, A, 1, 15);
H2(A, B, C, D, E, 0, 13);
H2(E, A, B, C, D, 4, 7);
H2(D, E, A, B, C, 13, 5);
-
+
I2(C, D, E, A, B, 8, 15);
I2(B, C, D, E, A, 6, 5);
I2(A, B, C, D, E, 4, 8);
I2(E, A, B, C, D, 7, 5);
I2(D, E, A, B, C, 10, 15);
I2(C, D, E, A, B, 14, 8);
-
+
J2(B, C, D, E, A, 12, 8);
J2(A, B, C, D, E, 15, 5);
J2(E, A, B, C, D, 10, 12);
void rmd160_set(rmd160_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->e = LOAD32_L(p + 16);
ctx->off = 0;
{
octet *p = hash;
HASH_MD5STRENGTH(RMD160, rmd160, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
}
unsigned long rmd160_state(rmd160_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
return (ctx->nl | ((ctx->nh << 16) << 16));
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#define G1(w, x, y, z, i, r) T(w, x, y, z, i, r, G, 0x5a827999)
#define H1(w, x, y, z, i, r) T(w, x, y, z, i, r, H, 0x6ed9eba1)
#define I1(w, x, y, z, i, r) T(w, x, y, z, i, r, I, 0x8f1bbcdc)
-
+
#define F2(w, x, y, z, i, r) T(w, x, y, z, i, r, I, 0x50a28be6)
#define G2(w, x, y, z, i, r) T(w, x, y, z, i, r, H, 0x5c4dd124)
#define H2(w, x, y, z, i, r) T(w, x, y, z, i, r, G, 0x6d703ef3)
I1(d, A, B, C, 5, 6);
I1(C, d, A, B, 6, 5);
I1(B, C, d, A, 2, 12);
-
+
I2(a, b, c, D, 8, 15);
I2(D, a, b, c, 6, 5);
I2(c, D, a, b, 4, 8);
I2(D, a, b, c, 7, 5);
I2(c, D, a, b, 10, 15);
I2(b, c, D, a, 14, 8);
-
+
/* --- Recombine the two halves --- */
ctx->a += A;
void rmd256_set(rmd256_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->A = LOAD32_L(p + 16);
ctx->B = LOAD32_L(p + 20);
{
octet *p = hash;
HASH_MD5STRENGTH(RMD256, rmd256, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->A);
STORE32_L(p + 20, ctx->B);
unsigned long rmd256_state(rmd256_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->A);
STORE32_L(p + 20, ctx->B);
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
F1(e, a, b, c, d, 1, 14);
F1(d, e, a, b, c, 2, 15);
F1(c, d, e, a, b, 3, 12);
- F1(b, c, d, e, a, 4, 5);
- F1(a, b, c, d, e, 5, 8);
- F1(e, a, b, c, d, 6, 7);
- F1(d, e, a, b, c, 7, 9);
+ F1(b, c, d, e, a, 4, 5);
+ F1(a, b, c, d, e, 5, 8);
+ F1(e, a, b, c, d, 6, 7);
+ F1(d, e, a, b, c, 7, 9);
F1(c, d, e, a, b, 8, 11);
F1(b, c, d, e, a, 9, 13);
F1(a, b, c, d, e, 10, 14);
F1(e, a, b, c, d, 11, 15);
- F1(d, e, a, b, c, 12, 6);
- F1(c, d, e, a, b, 13, 7);
- F1(b, c, d, e, a, 14, 9);
- F1(a, b, c, d, e, 15, 8);
-
+ F1(d, e, a, b, c, 12, 6);
+ F1(c, d, e, a, b, 13, 7);
+ F1(b, c, d, e, a, 14, 9);
+ F1(a, b, c, d, e, 15, 8);
+
F2(A, B, C, D, E, 5, 8);
F2(E, A, B, C, D, 14, 9);
F2(D, E, A, B, C, 7, 9);
G1(b, c, d, e, A, 14, 7);
G1(A, b, c, d, e, 11, 13);
G1(e, A, b, c, d, 8, 12);
-
+
G2(E, a, B, C, D, 6, 9);
G2(D, E, a, B, C, 11, 13);
G2(C, D, E, a, B, 3, 15);
G2(B, C, D, E, a, 9, 15);
G2(a, B, C, D, E, 1, 13);
G2(E, a, B, C, D, 2, 11);
-
+
H1(d, e, A, B, c, 3, 11);
H1(c, d, e, A, B, 10, 13);
H1(B, c, d, e, A, 14, 6);
H1(A, B, c, d, e, 11, 12);
H1(e, A, B, c, d, 5, 7);
H1(d, e, A, B, c, 12, 5);
-
+
H2(D, E, a, b, C, 15, 9);
H2(C, D, E, a, b, 5, 7);
H2(b, C, D, E, a, 1, 15);
H2(a, b, C, D, E, 0, 13);
H2(E, a, b, C, D, 4, 7);
H2(D, E, a, b, C, 13, 5);
-
+
I1(C, d, e, A, B, 1, 11);
I1(B, C, d, e, A, 9, 12);
I1(A, B, C, d, e, 11, 14);
I1(e, A, B, C, d, 5, 6);
I1(d, e, A, B, C, 6, 5);
I1(C, d, e, A, B, 2, 12);
-
+
I2(c, D, E, a, b, 8, 15);
I2(b, c, D, E, a, 6, 5);
I2(a, b, c, D, E, 4, 8);
void rmd320_set(rmd320_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- ctx->a = LOAD32_L(p + 0);
- ctx->b = LOAD32_L(p + 4);
- ctx->c = LOAD32_L(p + 8);
+ ctx->a = LOAD32_L(p + 0);
+ ctx->b = LOAD32_L(p + 4);
+ ctx->c = LOAD32_L(p + 8);
ctx->d = LOAD32_L(p + 12);
ctx->e = LOAD32_L(p + 16);
ctx->A = LOAD32_L(p + 20);
{
octet *p = hash;
HASH_MD5STRENGTH(RMD320, rmd320, ctx);
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
STORE32_L(p + 20, ctx->A);
unsigned long rmd320_state(rmd320_ctx *ctx, void *state)
{
octet *p = state;
- STORE32_L(p + 0, ctx->a);
- STORE32_L(p + 4, ctx->b);
- STORE32_L(p + 8, ctx->c);
+ STORE32_L(p + 0, ctx->a);
+ STORE32_L(p + 4, ctx->b);
+ STORE32_L(p + 8, ctx->c);
STORE32_L(p + 12, ctx->d);
STORE32_L(p + 16, ctx->e);
STORE32_L(p + 20, ctx->A);
* (c) 1998 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{ "n", offsetof(rsa_priv, n), KENC_MP, 0 },
{ "e", offsetof(rsa_priv, e), KENC_MP, 0 },
{ "private", 0, KENC_STRUCT, priv },
- { 0, 0, 0, 0 }
+ { 0, 0, 0, 0 }
};
/* --- @rsa_pubfree@, @rsa_privfree@ --- *
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2004 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
mp_drop(c);
xfree(q);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
#define tsigpad tencpad
mp_drop(c);
dstr_destroy(&d);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
static int tvrfpad(int nbits,
mp_drop(c);
dstr_destroy(&d);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
static int tencpub(rsa_pub *rp,
dstr_destroy(&d);
GR_DESTROY(r);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
static int tvrfpub(rsa_pub *rp,
mp_drop(c);
dstr_destroy(&d);
assert(mparena_count(MPARENA_GLOBAL) == 0);
- return (ok);
+ return (ok);
}
/*----- Deep magic --------------------------------------------------------*
rp.d = *(mp **)v++->buf; \
rsa_recover(&rp);
#define ARG_priv \
- &rp,
+ &rp,
#define TAB_priv \
&type_mp, &type_mp, &type_mp,
rp.n = *(mp **)v++->buf; \
rp.e = *(mp **)v++->buf;
#define ARG_pub \
- &rp,
+ &rp,
#define TAB_pub \
- &type_mp, &type_mp,
+ &type_mp, &type_mp,
#define DECL_pad \
int nbits;
static grand *fib;
-TESTS(FUNCS)
+TESTS(FUNCS)
static const test_chunk tests[] = {
TESTS(TAB)
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* The factors of this number are
*
* @p = 1229936431484295969649886203367009966370895964206162032259292413@
- * @7754313537966036459299022912838407755462506416274551744201653277@
+ * @7754313537966036459299022912838407755462506416274551744201653277@
* @313130311731673973886822067@
*
* @q = 9798171783943489959487301695884963889684294764514008432498259742@
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
exit(EXIT_FAILURE);
}
- return (0);
+ return (0);
}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
const char *safersk_magic = "Compile this useless file";
BLKC_TEST(SAFERSK, safersk)
-
+
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
if (sz) { *p++ = e; sz--; }
skip = 0;
}
- }
+ }
}
/* --- @seal_initkey@ --- *
}
A = n ^ c->r[0];
- B = ROR32(n, 8) ^ c->r[1];
+ B = ROR32(n, 8) ^ c->r[1];
C = ROR32(n, 16) ^ c->r[2];
D = ROR32(n, 24) ^ c->r[3];
c->l += 4;
if (j == 256) {
seal_reset(c);
- A = c->a, B = c->b, C = c->c, D = c->d;
+ A = c->a, B = c->b, C = c->c, D = c->d;
n1 = c->n1, n2 = c->n2, n3 = c->n3, n4 = c->n4;
j = 0;
}
Q = (Q + B) & 0x7fc; C += k->t[Q >> 2]; B = ROR32(B, 9);
P = (P + C) & 0x7fc; D ^= k->t[P >> 2]; C = ROR32(C, 9);
Q = (Q + D) & 0x7fc; A += k->t[Q >> 2]; D = ROR32(D, 9);
-
+
/* --- Remember the output and set up the next round --- */
aa = B + k->s[j + 0];
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/*----- S-box tables ------------------------------------------------------*/
static const octet s[8][16] = {
- { 3, 8, 15, 1, 10, 6, 5, 11, 14, 13, 4, 2, 7, 0, 9, 12 },
- { 15, 12, 2, 7, 9, 0, 5, 10, 1, 11, 14, 8, 6, 13, 3, 4 },
- { 8, 6, 7, 9, 3, 12, 10, 15, 13, 1, 14, 4, 0, 11, 5, 2 },
- { 0, 15, 11, 8, 12, 9, 6, 3, 13, 1, 2, 4, 10, 7, 5, 14 },
- { 1, 15, 8, 3, 12, 0, 11, 6, 2, 5, 4, 10, 9, 14, 7, 13 },
- { 15, 5, 2, 11, 4, 10, 9, 12, 0, 3, 14, 8, 13, 6, 7, 1 },
- { 7, 2, 12, 5, 8, 4, 6, 11, 14, 9, 1, 15, 13, 3, 10, 0 },
- { 1, 13, 15, 0, 14, 8, 2, 11, 7, 4, 12, 10, 9, 3, 5, 6 }
+ { 3, 8, 15, 1, 10, 6, 5, 11, 14, 13, 4, 2, 7, 0, 9, 12 },
+ { 15, 12, 2, 7, 9, 0, 5, 10, 1, 11, 14, 8, 6, 13, 3, 4 },
+ { 8, 6, 7, 9, 3, 12, 10, 15, 13, 1, 14, 4, 0, 11, 5, 2 },
+ { 0, 15, 11, 8, 12, 9, 6, 3, 13, 1, 2, 4, 10, 7, 5, 14 },
+ { 1, 15, 8, 3, 12, 0, 11, 6, 2, 5, 4, 10, 9, 14, 7, 13 },
+ { 15, 5, 2, 11, 4, 10, 9, 12, 0, 3, 14, 8, 13, 6, 7, 1 },
+ { 7, 2, 12, 5, 8, 4, 6, 11, 14, 9, 1, 15, 13, 3, 10, 0 },
+ { 1, 13, 15, 0, 14, 8, 2, 11, 7, 4, 12, 10, 9, 3, 5, 6 }
};
/*----- Main code ---------------------------------------------------------*/
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#define S0(r0, r1, r2, r3) do { \
uint32 r4; \
- r3 ^= r0; r4 = r1; r1 &= r3; r4 ^= r2; \
+ r3 ^= r0; r4 = r1; r1 &= r3; r4 ^= r2; \
r1 ^= r0; r0 |= r3; r0 ^= r4; r4 ^= r3; \
r3 ^= r2; r2 |= r1; r2 ^= r4; r4 = ~r4; \
r4 |= r1; r1 ^= r3; r1 ^= r4; r3 |= r0; \
#define IS0(r0, r1, r2, r3) do { \
uint32 r4; \
- r2 = ~r2; r4 = r1; r1 |= r0; r4 = ~r4; \
+ r2 = ~r2; r4 = r1; r1 |= r0; r4 = ~r4; \
r1 ^= r2; r2 |= r4; r1 ^= r3; r0 ^= r4; \
r2 ^= r0; r0 &= r3; r4 ^= r0; r0 |= r1; \
r0 ^= r2; r3 ^= r4; r2 ^= r1; r3 ^= r0; \
#define IS5(r0, r1, r2, r3) do { \
uint32 r4; \
- r1 = ~r1; r4 = r3; r2 ^= r1; r3 |= r0; \
+ r1 = ~r1; r4 = r3; r2 ^= r1; r3 |= r0; \
r3 ^= r2; r2 |= r1; r2 &= r0; r4 ^= r3; \
r2 ^= r4; r4 |= r0; r4 ^= r1; r1 &= r2; \
r1 ^= r3; r4 ^= r2; r3 &= r4; r4 ^= r1; \
#define S6(r0, r1, r2, r3) do { \
uint32 r4; \
- r2 = ~r2; r4 = r3; r3 &= r0; r0 ^= r4; \
+ r2 = ~r2; r4 = r3; r3 &= r0; r0 ^= r4; \
r3 ^= r2; r2 |= r4; r1 ^= r3; r2 ^= r0; \
r0 |= r1; r2 ^= r1; r4 ^= r0; r0 |= r3; \
r0 ^= r2; r4 ^= r3; r4 ^= r0; r3 = ~r3; \
#define IS6(r0, r1, r2, r3) do { \
uint32 r4; \
- r0 ^= r2; r4 = r2; r2 &= r0; r4 ^= r3; \
+ r0 ^= r2; r4 = r2; r2 &= r0; r4 ^= r3; \
r2 = ~r2; r3 ^= r1; r2 ^= r3; r4 |= r0; \
r0 ^= r2; r3 ^= r4; r4 ^= r1; r1 &= r3; \
r1 ^= r0; r0 ^= r3; r0 |= r2; r3 ^= r1; \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
a ^= *k++; b ^= *k++; c ^= *k++; d ^= *k++; \
S##r(a, b, c, d); \
a = ROL32(a, 13); c = ROL32(c, 3); b ^= a ^ c; d ^= c ^ (a << 3); \
- b = ROL32(b, 1); d = ROL32(d, 7); a ^= b ^ d; c ^= d ^ (b << 7); \
- a = ROL32(a, 5); c = ROL32(c, 22); \
+ b = ROL32(b, 1); d = ROL32(d, 7); a ^= b ^ d; c ^= d ^ (b << 7); \
+ a = ROL32(a, 5); c = ROL32(c, 22); \
} while (0)
#define DROUND(a, b, c, d, r, k) do { \
IS##r(a, b, c, d); \
d ^= *--k; c ^= *--k; b ^= *--k; a ^= *--k; \
- a = ROR32(a, 5); c = ROR32(c, 22); a ^= b ^ d; c ^= d ^ (b << 7); \
- b = ROR32(b, 1); d = ROR32(d, 7); b ^= a ^ c; d ^= c ^ (a << 3); \
+ a = ROR32(a, 5); c = ROR32(c, 22); a ^= b ^ d; c ^= d ^ (b << 7); \
+ b = ROR32(b, 1); d = ROR32(d, 7); b ^= a ^ c; d ^= c ^ (a << 3); \
a = ROR32(a, 13); c = ROR32(c, 3); \
} while (0)
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
}
/* --- The main compression function --- */
-
+
T(a, b, c, d, e, f, g, h, 0, 0x428a2f98);
T(h, a, b, c, d, e, f, g, 1, 0x71374491);
T(g, h, a, b, c, d, e, f, 2, 0xb5c0fbcf);
HASH_PAD(SHA256, sha256, ctx, 0x80, 0, 8);
STORE32(ctx->buf + SHA256_BUFSZ - 8, (ctx->nl >> 29) | (ctx->nh << 3));
STORE32(ctx->buf + SHA256_BUFSZ - 4, ctx->nl << 3);
- sha256_compress(ctx, ctx->buf);
+ sha256_compress(ctx, ctx->buf);
}
void sha256_done(sha256_ctx *ctx, void *hash)
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
{
octet *p = hash;
final(ctx);
- STORE64_(p + 0, ctx->a);
- STORE64_(p + 8, ctx->b);
+ STORE64_(p + 0, ctx->a);
+ STORE64_(p + 8, ctx->b);
STORE64_(p + 16, ctx->c);
STORE64_(p + 24, ctx->d);
STORE64_(p + 32, ctx->e);
{
octet *p = hash;
final(ctx);
- STORE64_(p + 0, ctx->a);
- STORE64_(p + 8, ctx->b);
+ STORE64_(p + 0, ctx->a);
+ STORE64_(p + 8, ctx->b);
STORE64_(p + 16, ctx->c);
STORE64_(p + 24, ctx->d);
STORE64_(p + 32, ctx->e);
unsigned long sha512_state(sha512_ctx *ctx, void *state)
{
octet *p = state;
- STORE64_(p + 0, ctx->a);
- STORE64_(p + 8, ctx->b);
+ STORE64_(p + 0, ctx->a);
+ STORE64_(p + 8, ctx->b);
STORE64_(p + 16, ctx->c);
STORE64_(p + 24, ctx->d);
STORE64_(p + 32, ctx->e);
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @skipjack_init@ --- *
*
- * Arguments: @skipjack_ctx *k@ = pointer to key block
- * @const void *buf@ = pointer to key buffer
- * @size_t sz@ = size of key material
+ * Arguments: @skipjack_ctx *k@ = pointer to key block
+ * @const void *buf@ = pointer to key buffer
+ * @size_t sz@ = size of key material
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Initializes a Skipjack key buffer. The key buffer must be
+ * Use: Initializes a Skipjack key buffer. The key buffer must be
* exactly 10 bytes long.
*/
/* --- @skipjack_eblk@, @skipjack_dblk@ --- *
*
- * Arguments: @const skipjack_ctx *k@ = pointer to key block
- * @const uint32 s[2]@ = pointer to source block
- * @uint32 d[2]@ = pointer to skipjacktination block
+ * Arguments: @const skipjack_ctx *k@ = pointer to key block
+ * @const uint32 s[2]@ = pointer to source block
+ * @uint32 d[2]@ = pointer to skipjacktination block
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Low-level block encryption and decryption.
+ * Use: Low-level block encryption and decryption.
*/
#define G(x, k) do { \
octet _x = U8(x >> 8), _y = U8(x); \
_x ^= f[_y ^ U8(k >> 24)]; \
_y ^= f[_x ^ U8(k >> 16)]; \
- _x ^= f[_y ^ U8(k >> 8)]; \
- _y ^= f[_x ^ U8(k >> 0)]; \
+ _x ^= f[_y ^ U8(k >> 8)]; \
+ _y ^= f[_x ^ U8(k >> 0)]; \
x = (_x << 8) | _y; \
} while (0)
#define G_INV(x, k) do { \
octet _x = U8(x >> 8), _y = U8(x); \
- _y ^= f[_x ^ U8(k >> 0)]; \
- _x ^= f[_y ^ U8(k >> 8)]; \
+ _y ^= f[_x ^ U8(k >> 0)]; \
+ _x ^= f[_y ^ U8(k >> 8)]; \
_y ^= f[_x ^ U8(k >> 16)]; \
_x ^= f[_y ^ U8(k >> 24)]; \
x = (_x << 8) | _y; \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @skipjack_init@ --- *
*
- * Arguments: @skipjack_ctx *k@ = pointer to key block
- * @const void *buf@ = pointer to key buffer
- * @size_t sz@ = size of key material
+ * Arguments: @skipjack_ctx *k@ = pointer to key block
+ * @const void *buf@ = pointer to key buffer
+ * @size_t sz@ = size of key material
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Initializes a Skipjack key buffer. The key buffer must be
+ * Use: Initializes a Skipjack key buffer. The key buffer must be
* exactly 10 bytes long.
*/
/* --- @skipjack_eblk@, @skipjack_dblk@ --- *
*
- * Arguments: @const skipjack_ctx *k@ = pointer to key block
- * @const uint32 s[2]@ = pointer to source block
- * @uint32 d[2]@ = pointer to skipjacktination block
+ * Arguments: @const skipjack_ctx *k@ = pointer to key block
+ * @const uint32 s[2]@ = pointer to source block
+ * @uint32 d[2]@ = pointer to skipjacktination block
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Low-level block encryption and decryption.
+ * Use: Low-level block encryption and decryption.
*/
extern void skipjack_eblk(const skipjack_ctx */*k*/,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* tables. Let %$a$% be an element of the finite field. If the inverse of
* %$a$% is %$a^{-1}$%, then %$\log a a^{-1} = 0$%. Hence
* %$\log a = -\log a^{-1}$%. This saves fiddling about with Euclidean
- * algorithm.
+ * algorithm.
*/
#define S_MOD 0x1f5
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
- }
+ }
fputs("\
#define SQUARE_TI { \\\n\
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
- }
+ }
/* --- Round constants --- */
fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
- }
+ }
/* --- Done --- */
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
for (i = 0; i < nr * 4; i++) {
uint32 w = kk[i];
- k->w[i] = (U[0][U8(w >> 0)] ^ U[1][U8(w >> 8)] ^
+ k->w[i] = (U[0][U8(w >> 0)] ^ U[1][U8(w >> 8)] ^
U[2][U8(w >> 16)] ^ U[3][U8(w >> 24)]);
}
for (; i < nw; i++)
*/
#define SUB(s, sh, a, b, c, d) \
- (s[U8((a) >> sh)] << 0 | s[U8((b) >> sh)] << 8 | \
+ (s[U8((a) >> sh)] << 0 | s[U8((b) >> sh)] << 8 | \
s[U8((c) >> sh)] << 16 | s[U8((d) >> sh)] << 24)
#define MIX(t, sh, a, b, c, d) \
t[2][U8((c) >> sh)] ^ t[3][U8((d) >> sh)])
#define DO(what, t, aa, bb, cc, dd, a, b, c, d, w) do { \
- aa = what(t, 0, a, b, c, d) ^ *w++; \
- bb = what(t, 8, a, b, c, d) ^ *w++; \
+ aa = what(t, 0, a, b, c, d) ^ *w++; \
+ bb = what(t, 8, a, b, c, d) ^ *w++; \
cc = what(t, 16, a, b, c, d) ^ *w++; \
dd = what(t, 24, a, b, c, d) ^ *w++; \
} while (0)
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
} break;
default:
GRAND_BADOP;
- break;
+ break;
}
va_end(ap);
if (memcmp(v[2].buf, d.buf, d.len) != 0) {
ok = 0;
printf("\nfail sslprf:"
- "\n\tkey = ");
+ "\n\tkey = ");
type_hex.dump(&v[0], stdout);
- printf("\n\tseed = "); type_hex.dump(&v[1], stdout);
+ printf("\n\tseed = "); type_hex.dump(&v[1], stdout);
printf("\n\texpected = "); type_hex.dump(&v[2], stdout);
printf("\n\tcalculated = "); type_hex.dump(&d, stdout);
putchar('\n');
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
pfilt f;
pgen_jumpctx j;
rabin rb;
-
+
d = strongprime_setup(name, d, &f, nbits, r, n, event, ectx);
j.j = &f;
d = pgen(name, d, d, event, ectx, n, pgen_jump, &j,
* (c) 1999 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @tea_init@ --- *
*
- * Arguments: @tea_ctx *k@ = pointer to key block
- * @const void *buf@ = pointer to key buffer
- * @size_t sz@ = size of key material
+ * Arguments: @tea_ctx *k@ = pointer to key block
+ * @const void *buf@ = pointer to key buffer
+ * @size_t sz@ = size of key material
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Initializes a TEA key buffer. The key buffer must be 16
+ * Use: Initializes a TEA key buffer. The key buffer must be 16
* bytes long.
*/
/* --- @tea_eblk@, @tea_dblk@ --- *
*
- * Arguments: @const tea_ctx *k@ = pointer to key block
- * @const uint32 s[2]@ = pointer to source block
- * @uint32 d[2]@ = pointer to teatination block
+ * Arguments: @const tea_ctx *k@ = pointer to key block
+ * @const uint32 s[2]@ = pointer to source block
+ * @uint32 d[2]@ = pointer to teatination block
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Low-level block encryption and decryption.
+ * Use: Low-level block encryption and decryption.
*/
#define DELTA 0x9e3779b9
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @tea_init@ --- *
*
- * Arguments: @tea_ctx *k@ = pointer to key block
- * @const void *buf@ = pointer to key buffer
- * @size_t sz@ = size of key material
+ * Arguments: @tea_ctx *k@ = pointer to key block
+ * @const void *buf@ = pointer to key buffer
+ * @size_t sz@ = size of key material
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Initializes a TEA key buffer. The key buffer may be up to 16
+ * Use: Initializes a TEA key buffer. The key buffer may be up to 16
* bytes long.
*/
/* --- @tea_eblk@, @tea_dblk@ --- *
*
- * Arguments: @const tea_ctx *k@ = pointer to key block
- * @const uint32 s[2]@ = pointer to source block
- * @uint32 d[2]@ = pointer to teatination block
+ * Arguments: @const tea_ctx *k@ = pointer to key block
+ * @const uint32 s[2]@ = pointer to source block
+ * @uint32 d[2]@ = pointer to teatination block
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Low-level block encryption and decryption.
+ * Use: Low-level block encryption and decryption.
*/
extern void tea_eblk(const tea_ctx */*k*/,
- const uint32 */*s*/, uint32 */*d*/);
+ const uint32 */*s*/, uint32 */*d*/);
extern void tea_dblk(const tea_ctx */*k*/,
- const uint32 */*s*/, uint32 */*d*/);
+ const uint32 */*s*/, uint32 */*d*/);
/*----- That's all, folks -------------------------------------------------*/
## it under the terms of the GNU Library General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
-##
+##
## Catacomb 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 Library General Public License for more details.
-##
+##
## You should have received a copy of the GNU Library General Public
## License along with Catacomb; if not, write to the Free
## Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#
# From wherever the previous tests came from.
- f0
+ f0
fedcba9876543210 f9ad597c49db005e;
- f0e1
+ f0e1
fedcba9876543210 e91d21c1d961a6d6;
- f0e1d2
+ f0e1d2
fedcba9876543210 e9c2b70a1bc65cf3;
- f0e1d2c3
+ f0e1d2c3
fedcba9876543210 be1e639408640f05;
- f0e1d2c3b4
+ f0e1d2c3b4
fedcba9876543210 b39e44481bdb1e6e;
- f0e1d2c3b4a5
+ f0e1d2c3b4a5
fedcba9876543210 9457aa83b1928c0d;
- f0e1d2c3b4a596
+ f0e1d2c3b4a596
fedcba9876543210 8bb77032f960629d;
- f0e1d2c3b4a59687
+ f0e1d2c3b4a59687
fedcba9876543210 e87a244e2cc85e82;
- f0e1d2c3b4a5968778
+ f0e1d2c3b4a5968778
fedcba9876543210 15750e7a4f4ec577;
- f0e1d2c3b4a596877869
+ f0e1d2c3b4a596877869
fedcba9876543210 122ba70b3ab64ae0;
- f0e1d2c3b4a5968778695a
+ f0e1d2c3b4a5968778695a
fedcba9876543210 3a833c9affc537f6;
- f0e1d2c3b4a5968778695a4b
+ f0e1d2c3b4a5968778695a4b
fedcba9876543210 9409da87a90f6bf2;
- f0e1d2c3b4a5968778695a4b3c
+ f0e1d2c3b4a5968778695a4b3c
fedcba9876543210 884f80625060b8b4;
- f0e1d2c3b4a5968778695a4b3c2d
+ f0e1d2c3b4a5968778695a4b3c2d
fedcba9876543210 1f85031c19e11968;
- f0e1d2c3b4a5968778695a4b3c2d1e
+ f0e1d2c3b4a5968778695a4b3c2d1e
fedcba9876543210 79d9373a714ca34f;
- f0e1d2c3b4a5968778695a4b3c2d1e0f
+ f0e1d2c3b4a5968778695a4b3c2d1e0f
fedcba9876543210 93142887ee3be15c;
- f0e1d2c3b4a5968778695a4b3c2d1e0f00
+ f0e1d2c3b4a5968778695a4b3c2d1e0f00
fedcba9876543210 03429e838ce2d14b;
- f0e1d2c3b4a5968778695a4b3c2d1e0f0011
+ f0e1d2c3b4a5968778695a4b3c2d1e0f0011
fedcba9876543210 a4299e27469ff67b;
- f0e1d2c3b4a5968778695a4b3c2d1e0f001122
+ f0e1d2c3b4a5968778695a4b3c2d1e0f001122
fedcba9876543210 afd5aed1c1bc96a8;
- f0e1d2c3b4a5968778695a4b3c2d1e0f00112233
+ f0e1d2c3b4a5968778695a4b3c2d1e0f00112233
fedcba9876543210 10851c0e3858da9f;
- f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344
+ f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344
fedcba9876543210 e6f51ed79b9db21f;
- f0e1d2c3b4a5968778695a4b3c2d1e0f001122334455
+ f0e1d2c3b4a5968778695a4b3c2d1e0f001122334455
fedcba9876543210 64a6e14afd36b46f;
- f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566
+ f0e1d2c3b4a5968778695a4b3c2d1e0f00112233445566
fedcba9876543210 80c7d7d45a5479ad;
f0e1d2c3b4a5968778695a4b3c2d1e0f0011223344556677
01010101010101010123456789abcdef1011121314151617
94dbe082549a14ef 9011121314151617;
- # --- 7-bit key tests ---
+ # --- 7-bit key tests ---
004513389573771011121314151617
- 4445535864657378 d8fa5084fad4b35c;
+ 4445535864657378 d8fa5084fad4b35c;
000000000000000123456789abcdef1011121314151617
94dbe082549a14ef 9011121314151617;
0;
"prime: 6277101735386680763835789423207666416083908700390324961279
prime: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
- "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
+ "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
0xdccf19d3e76abfa05d529c07575f54c94fa5fc9f3decc246"
0;
"prime: 6277101735386680763835789423207666416083908700390324961279
0;
"niceprime: 6277101735386680763835789423207666416083908700390324961279
prime: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
- "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
+ "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
0xdccf19d3e76abfa05d529c07575f54c94fa5fc9f3decc246"
0;
"niceprime: 6277101735386680763835789423207666416083908700390324961279
0;
"binpoly: 0x800000000000000000000000000000000000000c9
binproj: 1, 0x20a601907b8c953ca1481eb10512f78744a3205fd"
- "0x3f0eba16286a2d57ea0591168d4994637e8343e36,
+ "0x3f0eba16286a2d57ea0591168d4994637e8343e36,
0x7fa8423c5ae194b56cdf21998ad8a721ef1201b8c"
0;
}
"prime: 6277101735386680763835789423207666416083908700390324961279
prime: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411
- "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
+ "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
0x2330e62c1895405fa2ad63f8a8a0ab35b05a0360c2133db9";
"niceprime: 6277101735386680763835789423207666416083908700390324961279
"niceprime: 6277101735386680763835789423207666416083908700390324961279
prime: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411
- "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
+ "0x188da80eb03090f67cbf20eb43a18801f4ff0afd82ff1411,
0x2330e62c1895405fa2ad63f8a8a0ab35b05a0360c2133db9";
"binpoly: 0x800000000000000000000000000000000000000c9
"binpoly: 0x800000000000000000000000000000000000000c9
bin: 1, 0x20a601907b8c953ca1481eb10512f78744a3205fd"
0x3f0eba16286a2d57ea0591168d4994637e8343e36
- "0x3f0eba16286a2d57ea0591168d4994637e8343e36,
+ "0x3f0eba16286a2d57ea0591168d4994637e8343e36,
0x7fa8423c5ae194b56cdf21998ad8a721ef1201b8c";
}
"binpoly: 0x020000000000000000000000000000200000000000000001
bin: 0, 0x1ee9"
- "0x18, 0xd"
+ "0x18, 0xd"
"0x1bd555555555555555555555555554e8000000000000158,
0x14e999999999999999999999999998d7000000000001fe6";
}
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
6277101735386680763835789423176059013767194773182842284080
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
- 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
+ 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
"prime: 6277101735386680763835789423207666416083908700390324961279
prime: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
6277101735386680763835789423176059013767194773182842284080
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
- 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
+ 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
"prime: 6277101735386680763835789423207666416083908700390324961279
primeproj: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
6277101735386680763835789423176059013767194773182842284080
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
- 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
+ 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
"niceprime: 6277101735386680763835789423207666416083908700390324961279
prime: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
6277101735386680763835789423176059013767194773182842284080
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
- 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
+ 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
"niceprime: 6277101735386680763835789423207666416083908700390324961279
primeproj: -3, 0x64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1"
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x19131871d75b1612a819f29d78d1b0d7346f7aa77bb62a859bfd6c5675da9d212d3a36ef1672ef660b8c7c255cc0ec74858fba33f44c06699630a76b030ee333
"abc"
0x8bac1ab66410435cb7181f95b16ab97c92b341c0
- 0x41e2345f1f56df2458f426d155b4ba2db6dcd8c8
+ 0x41e2345f1f56df2458f426d155b4ba2db6dcd8c8
0;
# --- A test I made up ---
# --- Elliptic curve test vectors ---
"ec { nist-b163 }" sha
- "0x1e7d847d0331a794852ded2b96c71d82e61f9bb4c,
+ "0x1e7d847d0331a794852ded2b96c71d82e61f9bb4c,
0x1a2370ab2e63f5aa8f348fbe83c0415a7d8ee207b"
"An example message"
0x12e2f4e865bf6e034712b4f2ba6f3c825452d6419
0x90f99cd799abc0ea571d0e02bad80f8323050b1adbdbff50060b6e1e6ebd8611"
"An example message"
0xb30f954bfb624041e56f09ece884c17c74f866c24149bba0712303a9530142a6
- 0x1076bd32f298aaffa8c6242d881d928b1c4e0f5ad7e8ce3c4d815fe348a9666a
+ 0x1076bd32f298aaffa8c6242d881d928b1c4e0f5ad7e8ce3c4d815fe348a9666a
0;
}
0xc1a7bd3b4e853fc92d4e1588719986aa
0xbe1f8593ee2c6f8f9497cc7335d97111;
0x1e2933215e1c3bba8d2b404d98f43086bfc6198a219b168f214042a5e7df6b21
- 0x1e2933215e1c3bba8d2b404d98f43086bfc6198a219b168f214042a5e7df6b22 3;
+ 0x1e2933215e1c3bba8d2b404d98f43086bfc6198a219b168f214042a5e7df6b22 3;
}
mul {
0x20000000000000000000000000000000000000004000000000000000001
0x1499e398ac5d79e368559b35ca49bb7305da6c0390bcf9e2300253203c9
0x1006a08a41903350678e58528bebf8a0beff867a7ca36716f7e01f81052
- 0x04925df77bd8b8ff1a5ff519417822bfedf2bbd752644292c98c7af6e02;
+ 0x04925df77bd8b8ff1a5ff519417822bfedf2bbd752644292c98c7af6e02;
}
# Test efficient polynomial reduction
reduce {
- 0x10000000
+ 0x10000000
0x4509823098098435
- 0x8098435;
+ 0x8098435;
0x100000000000000050002
0x4509823098098435
0x4509823098098435;
01 01 00;
02 02 00;
03 01 02;
-
+
# --- Random data tests ---
7fb838a8a0a95046b9d9d9fb4440f7bb
-1;
"ec { nist-p256 }" sha256
- "0x5068f177ccebee933a27457707f6879eb5c4c59d58483766caf9aabcc367c0d1,
+ "0x5068f177ccebee933a27457707f6879eb5c4c59d58483766caf9aabcc367c0d1,
0x4869c59dceadad93f1ed306b3ed544356c119996cc78708b9557c7ca5901da4a"
"Testing elliptic curves with KCDSA"
e3f05cea444ec44d508b3af5b8d2d8eb2bcbff680e83684e3e630ec5b07393c0
"prime { 29, 7, 16 }" "ok";
"prime { 29, 6, 5 }" "not a subgroup";
"prime { 21, 2, 2 }" "p is not prime";
- "prime { 29, 14, 9 }" "group order not prime";
+ "prime { 29, 14, 9 }" "group order not prime";
"ec { secp224r1 }" "ok";
"prime { catacomb-ll-160-1024 }" "ok";
- "ec {
+ "ec {
prime:
0xdb7c2abf62e35e668076bead208b
- primeproj:
+ primeproj:
0xdb7c2abf62e35e668076bead2088, 0x659ef8ba043916eede8911702b22
0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500
0xdb7c2abf62e35e7628dfac6561c5 * 1
}" "ok";
-
- "ec {
+
+ "ec {
prime:
0xdb7c2abf62e35e668076bead208b
- primeproj:
+ primeproj:
0xdb7c2abf62e35e668076bead2088, 0x659ef8ba043916eede8911702b22
0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500
0xdb7c2abf62e35e7628dfac6561c5 * 2
# --- This one's oakley-155 ---
- "ec {
+ "ec {
binpoly: 0x0800000000000000000000004000000000000001
binproj: 0, 0x7338F
0xaa089ae4666a422e714651ad9372213fa65a93,
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500"
0;
- "ec {
+ "ec {
binpoly: 0x0800000000000000000000004000000000000001
binproj: 0, 0x7338F
0xaa089ae4666a422e714651ad9372213fa65a93,
"0xdafebf5828783f2ad35534631588a3f629a70fb16982a888,
0xdd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab"
"0x76e32a2557599e6edcd283201fb2b9aadfd0d359cbb263da,
- 0x782c37e372ba4520aa62e0fed121d49ef3b543660cfd05fd";
+ 0x782c37e372ba4520aa62e0fed121d49ef3b543660cfd05fd";
}
sqr {
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
"0xdafebf5828783f2ad35534631588a3f629a70fb16982a888,
- 0xdd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab";
+ 0xdd6bda0d993da0fa46b27bbc141b868f59331afa5c7e93ab";
}
inv {
"prime { 29, 7, 16 }" 9 13;
-
+
"prime { catacomb-ll-128-512 }"
3344609493517948819439808013094817124423784439045485500527919676470975342917009634212031124646834193243018749323077268170586751415510015906107400678608590
5876676858790113051879264634636727534122591023949326683791506203503263391580079717512212895466773363712551406785344528808275608153699681298608650332072384;
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
- 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
+ 0xf8e6d46a003725879cefee1294db32298c06885ee186b7ee";
}
div {
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
-3131675836296406071791252329528905062261497366991742517193
- "0xea711858c23d92f9964655910bc90a197a915e90111cf11b,
+ "0xea711858c23d92f9964655910bc90a197a915e90111cf11b,
0x664189a1d8b2bb24f2b2ac64b19e2178118842e6ba9f4ad5"
1110875761630725856340142297645383444629395595869672555585
"0xaa25bb0bf38b06821e8641c1afb8bc078dbe11c3cf9bc97,
"ec { nist-p192 }" inf -1 0;
- "ec { nist-p192 }"
+ "ec { nist-p192 }"
"0x188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012,
0x07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
0 602046282375688656758213480587526111916698976636884684818;
"prime { 29, 7, 16 }" 39527306161272833161358334459 0 19;
"ec { nist-p192 }" 1 -1 inf;
- "ec { nist-p192 }" 0
+ "ec { nist-p192 }" 0
0 "0, 0x7b685605ee600cb363db5ea912f2bb5e3a0a2e0e60360f12";
}
toec {
"prime { 29, 7, 16 }" 0 -1 inf;
"ec { nist-p192 }" inf 0 inf;
- "ec { secp112r1 }"
+ "ec { secp112r1 }"
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500"
0
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500";
"ec { secp112r1 }" inf 0 inf;
"ec { nist-p192 }" "1, 5" -1 inf;
- "ec { secp112r1 }"
+ "ec { secp112r1 }"
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500"
0
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500";
"ec { secp112r1 }" inf 0 "0000";
"ec { secp112r1 }"
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500"
- 0 "000e09487239995a5ee76b55f9c2f098000ea89ce5af8724c0a23e0e0ff77500";
+ 0 "000e09487239995a5ee76b55f9c2f098000ea89ce5af8724c0a23e0e0ff77500";
"ec { nist-p192 }"
"0, 0x8497a9fa119ff34c9c24a156ed0d44a0c5f5d1f19fc9f0ed"
0 "00010000188497a9fa119ff34c9c24a156ed0d44a0c5f5d1f19fc9f0ed";
"ec { secp112r1 }" inf 0 "00";
"ec { secp112r1 }"
"0x09487239995a5ee76b55f9c2f098, 0xa89ce5af8724c0a23e0e0ff77500"
- 0 "0409487239995a5ee76b55f9c2f098a89ce5af8724c0a23e0e0ff77500";
+ 0 "0409487239995a5ee76b55f9c2f098a89ce5af8724c0a23e0e0ff77500";
"ec { nist-p192 }"
"0, 0x8497a9fa119ff34c9c24a156ed0d44a0c5f5d1f19fc9f0ed"
0 "040000000000000000000000000000000000000000000000008497a9fa119ff34c9c24a156ed0d44a0c5f5d1f19fc9f0ed";
2624567577 0;
2966901975 1;
- # --- Fixed point ---
+ # --- Fixed point ---
3223959250 3223959250;
}
# HMAC code is autogenerated anyway, and ought to be reliable and correct.
#
# These test vectors are here to spot changes in behaviour rather than ensure
-# interoperability.
+# interoperability.
md4-hmac {
"Hi There"
# --- Montgomery exponentiation ---
- 435365332435654643667 8745435676786567758678547
+ 435365332435654643667 8745435676786567758678547
4325987397987458979875737589783
2439674515119108242643169132064;
0xfffffffdfffffffffffffffffffffffe 0 0xfffffffdffffffffffffffffffffffff 1;
# --- Negative exponents ---
- 0xfffffffdffffffffffffffffffffffff 0xfffffffdfffffffffffffffffffffffe 0 1;
+ 0xfffffffdffffffffffffffffffffffff 0xfffffffdfffffffffffffffffffffffe 0 1;
8939489893434234331 1804289383 -8939035539979879765 6139425926295484741;
# --- DSA public key derivation ---
0xdde5808744e1cd37c88667e7033694b2513a7429f035f11c0bafc4dff2b96a672bd0a3ca16aba2ea526df00c8571106ba4a1d83eb62605fc9274ab70bef0a111cd070cca2d8b10edf042d6c44f863c36fabea8bb0d7340eb8c169da27a4b0ba2713c166152a0244235093391c5f71aee8c03dcaf2335a2e4689ccb27ba365ec7
0x65985e4c2d6027a8afdeb9b44cc619e1c4d46bde873e0d4b45325412a2f8365e51245324f888704295fe8233a6666624d9a4701172dbfcab5c9643e1caab79eb2a0c85284d1b858688b8f16804326321f53a723502a6d6ae08dcbffccf2187a799f6281c2478ef0faed5c5c80adeabc5ee435cff8b9ae0b603e47fb08d73b014
0x23a252f60bae4907a8ed5b6203e2b1da32848cd9
- 0x9720498d8ec1208585635faaf952c1204c37119acccc64ed7942867be24770e33db39ffcfa1194549ead8495a7918a20e15144e68125860ef4f8c1a3d771bad690938bdb2c8817e2b89a8fc615d067084a7a2f2f9280e15fb9ccebfe713584260d5ed30545b69745d7b22977bfd44d60d7c5e657aab1c79dc5cb33ff29ee9074;
+ 0x9720498d8ec1208585635faaf952c1204c37119acccc64ed7942867be24770e33db39ffcfa1194549ead8495a7918a20e15144e68125860ef4f8c1a3d771bad690938bdb2c8817e2b89a8fc615d067084a7a2f2f9280e15fb9ccebfe713584260d5ed30545b69745d7b22977bfd44d60d7c5e657aab1c79dc5cb33ff29ee9074;
# --- Quick RSA test ---
- 905609324890967090294090970600361 # This is p
+ 905609324890967090294090970600361 # This is p
3
- 905609324890967090294090970600360 # This is (p - 1)
- 1; # Fermat test: p is prime
+ 905609324890967090294090970600360 # This is (p - 1)
+ 1; # Fermat test: p is prime
- 734589569806680985408670989082927 # This is q
+ 734589569806680985408670989082927 # This is q
5
- 734589569806680985408670989082926 # And this is (q - 1)
- 1; # Fermat again: q is prime
+ 734589569806680985408670989082926 # And this is (q - 1)
+ 1; # Fermat again: q is prime
# --- Encrypt a message ---
#
5945908509680983480596809586040589085680968709809890671
25906467774034212974484417859588980567136610347807401817990462701;
- # --- And decrypt it again ---
+ # --- And decrypt it again ---
665251164384574309450646977867045404520085938543622535546005136647
25906467774034212974484417859588980567136610347807401817990462701
# --- Negative and zero exponents ---
- 0xfffffffdffffffffffffffffffffffff 0xfffffffdfffffffffffffffffffffffe 0 1;
+ 0xfffffffdffffffffffffffffffffffff 0xfffffffdfffffffffffffffffffffffe 0 1;
8939489893434234331 1804289383 -8939035539979879765 6139425926295484741;
# --- DSA public key derivation ---
0xdde5808744e1cd37c88667e7033694b2513a7429f035f11c0bafc4dff2b96a672bd0a3ca16aba2ea526df00c8571106ba4a1d83eb62605fc9274ab70bef0a111cd070cca2d8b10edf042d6c44f863c36fabea8bb0d7340eb8c169da27a4b0ba2713c166152a0244235093391c5f71aee8c03dcaf2335a2e4689ccb27ba365ec7
0x65985e4c2d6027a8afdeb9b44cc619e1c4d46bde873e0d4b45325412a2f8365e51245324f888704295fe8233a6666624d9a4701172dbfcab5c9643e1caab79eb2a0c85284d1b858688b8f16804326321f53a723502a6d6ae08dcbffccf2187a799f6281c2478ef0faed5c5c80adeabc5ee435cff8b9ae0b603e47fb08d73b014
0x23a252f60bae4907a8ed5b6203e2b1da32848cd9
- 0x9720498d8ec1208585635faaf952c1204c37119acccc64ed7942867be24770e33db39ffcfa1194549ead8495a7918a20e15144e68125860ef4f8c1a3d771bad690938bdb2c8817e2b89a8fc615d067084a7a2f2f9280e15fb9ccebfe713584260d5ed30545b69745d7b22977bfd44d60d7c5e657aab1c79dc5cb33ff29ee9074;
+ 0x9720498d8ec1208585635faaf952c1204c37119acccc64ed7942867be24770e33db39ffcfa1194549ead8495a7918a20e15144e68125860ef4f8c1a3d771bad690938bdb2c8817e2b89a8fc615d067084a7a2f2f9280e15fb9ccebfe713584260d5ed30545b69745d7b22977bfd44d60d7c5e657aab1c79dc5cb33ff29ee9074;
# --- Quick RSA test ---
5945908509680983480596809586040589085680968709809890671
25906467774034212974484417859588980567136610347807401817990462701;
- # --- And decrypt it again ---
+ # --- And decrypt it again ---
665251164384574309450646977867045404520085938543622535546005136647
25906467774034212974484417859588980567136610347807401817990462701
modexp {
0xfffffffdffffffffffffffffffffffff 0xfffffffdfffffffffffffffffffffffe 0 1;
- 0xfffffffdffffffffffffffffffffffff 2
+ 0xfffffffdffffffffffffffffffffffff 2
0xfffffffdfffffffffffffffffffffffe 1;
- 0xfffffffdffffffffffffffffffffffff 2
- 0xfffffffdfffffffffffffffffffffffd
+ 0xfffffffdffffffffffffffffffffffff 2
+ 0xfffffffdfffffffffffffffffffffffd
0x7fffffff000000000000000000000000;
8939489893434234331 1804289383
-8939035539979879765 6139425926295484741;
00 00 00;
00 01 01;
- 01 00 01;
+ 01 00 01;
# --- Carry propagation tests ---
ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
- 01
+ 01
0100000000000000000000000000000000000000000000000000000000;
- 01
+ 01
ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
0100000000000000000000000000000000000000000000000000000000;
45 01 45;
# --- Random tests ---
-
+
4162c300b3e157e9cd1301d499c20121
10549901fc6dcb85882440087bd398ff
042bc7ac8fe08ceefb098f286cdd84fd037906ead144324e361c488a221db7df;
# --- Karatsuba regression ---
#
- # This bug was caused by kmul (a) choosing the split point too low on
+ # This bug was caused by kmul (a) choosing the split point too low on
# odd-sized inputs and (b) not allocating enough workspace.
21a9269d7b8b63cf18faa933b3c868ba1e8cb3f00b57e197709abf96eeb9bf12e8fe22b3
The provided implementations each use a different set of tables
- Java implementation: uses no tables
- reference C implementation: uses Logtable, Alogtable, S, Si, rcon
- - fast C implementation: uses Logtable, Alogtable, rcon
- and additionally, T1, T2, T3, T4, T5, T6, T7, T8
+ - fast C implementation: uses Logtable, Alogtable, rcon
+ and additionally, T1, T2, T3, T4, T5, T6, T7, T8
All these tables are tested.
=========================
# --- HMAC mode ---
#
-# I couldn't find any official test vectors. These are therefore generated
+# I couldn't find any official test vectors. These are therefore generated
# using the Catacomb implementation.
rmd256-hmac {
# --- HMAC mode ---
#
-# I couldn't find any official test vectors. These are therefore generated
+# I couldn't find any official test vectors. These are therefore generated
# using the Catacomb implementation.
rmd320-hmac {
p1sig-pad {
# nbits msg rc result eparam
- 256 "616263" 0
+ 256 "616263" 0
0x0001ffffffffffffffffffffffffffffffffffffffffffffff00cc22cc616263
"cc22cc";
129 "616263" 0 0x0001ffffffffffffffff00cc22cc616263 "cc22cc";
p1sig-priv {
# n e d msg rc result eparam
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
- 0x10001
+ 0x10001
0x1fd9da85ec2d8ea09abe8f2c7804916853ac1f05189b657af9b294f73c515bf9
"616263" 0
0xc484642d0e4dc4a4424d22410456dbdd9275b5c157d6974a66bee9aa02501c26
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
0x10001
0xc484642d0e4dc4a4424d22410456dbdd9275b5c157d6974a66bee9aa02501c26
- "" 3 "616263" "cc22cc";
+ "" 3 "616263" "cc22cc";
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
0x10001
0xc484642d0e4dc4a4424d22410456dbdd9275b5c157d6974a66bee9aa02501c26
- "616263" 0 "" "cc22cc";
+ "616263" 0 "" "cc22cc";
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
0x10001
0x27654c24f4ffefffc3bef7be8ae469db3069407702391eeb551ce9544621b63a
- "" 18 "ffffffffffffffffffffff00cc22cc616263" "cc22cc";
+ "" 18 "ffffffffffffffffffffff00cc22cc616263" "cc22cc";
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
0x10001
0xd980f3047ab74bc4e7bb99eeb17fcc657f50ee26146b7f2a9f982ef2f44cba
- "" -1 "" "cc22cc";
+ "" -1 "" "cc22cc";
0xb6dd0145ada7547bba5db3a35d34e612a8d73e93c33c720f4e4506428cacc6861b2143ed3a0683394fd94cfab8ab66a024161e9c9c1848d50627b3ac46de6d1b1d73ae7b5540b3df65c53aed9d4bdf1f86c8ddacfaf608823bb3d307d89d4c8bb11b5198f9851a519538787cd054ced98734daa2f7f2dc5b51c8c02ea8c362ff
0x10001
p1enc-pub {
# n e msg rc ct eparam
- 0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
+ 0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
0x10001 "616263" 0
0x8f20a0fc778b7c55567f41c344d39bfcdaca04fd475f2290dc05c236585a68ca "";
# nbits msg rc pt eparam
256 0x0002efbdfc524ad6419b65537a59b42a4662918436d6e0e4804b6b1000616263
3 "616263" "";
- 105 0x0002efbd98524ad6419b00616263
+ 105 0x0002efbd98524ad6419b00616263
3 "616263" "";
- 104 0x0002efbd98524ad64100616263
+ 104 0x0002efbd98524ad64100616263
-1 "" "";
256 0x0002efbdfc524ad6419b00537a59b42a4662918436d6e0e4804b6b1000616263
21 "537a59b42a4662918436d6e0e4804b6b1000616263" "";
p1dec-priv {
# p e d msg rc pt eparam
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
- 0x10001
+ 0x10001
0x1fd9da85ec2d8ea09abe8f2c7804916853ac1f05189b657af9b294f73c515bf9
0x8f20a0fc778b7c55567f41c344d39bfcdaca04fd475f2290dc05c236585a68ca
3 "616263" "";
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
- 0x10001
+ 0x10001
0x1fd9da85ec2d8ea09abe8f2c7804916853ac1f05189b657af9b294f73c515bf9
0x19d6408010f0c2722b44cd4d5e006b6ffaa634aa225d727fa37c7c6ec29c5155
21 "537a59b42a4662918436d6e0e4804b6b1000616263" "";
0xccbd3b508e1ac2ed16f0f85adfec8d17ad525018307e613e0ee3aa4652b7ceb3
- 0x10001
+ 0x10001
0x1fd9da85ec2d8ea09abe8f2c7804916853ac1f05189b657af9b294f73c515bf9~
0x952aa4893cd2620e4942f449529ea2f7105b9d67e041a676259fb986bc507b7d
-1 "" "";
pssvrf-pad {
# nbits sig msg rc result mgf hash saltsz
- 256
+ 256
0x3426a2a3e34a2ea4b6831d1366f0477cf42d9b98fddf692f3d14f9b8a168e4bc
"a9993e364706816aba3e25717850c26c9cd0d89d" 0 "" sha-mgf sha 10;
- 256
+ 256
0x3426a2a3e34a2ea4b6831d1366f0477cf42d9b98fddf692f3d14f9b8a168e4bc
"a9993e364706816aba3e25717850c26c9cd0d89e" -1 "" sha-mgf sha 10;
- 256
+ 256
0x3426a2a3e34a2ea4b6831d1366f0477cf42d9b98fddf692f3d14f9b8a168e4bd
"a9993e364706816aba3e25717850c26c9cd0d89d" -1 "" sha-mgf sha 10;
- 256
+ 256
0x3526a2a3e34a2ea4b6831d1366f0477cf42d9b98fddf692f3d14f9b8a168e4bc
- "a9993e364706816aba3e25717850c26c9cd0d89d" -1 "" sha-mgf sha 10;
+ "a9993e364706816aba3e25717850c26c9cd0d89d" -1 "" sha-mgf sha 10;
- 1024
+ 1024
0x2d22499324a1428e11201e9103ba63a5be9812e104b789a128214c05e767ceae82a51ce2f13cf907183dfa3b5bfe998be503d6c99cecb32e2b488028ece05e0caf479c254a5cd823bb5ad529a0152dab4dcdd4746718e8720f6b7a46b1056d9a0bc6ce95c99ce914886ff80c3a3c5abcc4b4a4346e77722de7b318c1750e3abc
"fda74fa48306a43dda32e18d95e2b3b1e3edc172" 0 ""
sha-mgf sha 20;
- 1025
+ 1025
0xad22499324a1428e11201e9103ba63a5be9812e104b789a128214c05e767ceae82a51ce2f13cf907183dfa3b5bfe998be503d6c99cecb32e2b488028ece05e0caf479c254a5cd823bb5ad529a0152dab4dcdd4746718e8720f6b7a46b1056d9a0bc6ce95c99ce914886ff80c3a3c5abcc4b4a4346e77722de7b318c1750e3abc
"fda74fa48306a43dda32e18d95e2b3b1e3edc172" 0 ""
sha-mgf sha 20;
- 1024
+ 1024
0x6d59bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fdd4987e9f2d57a3ae237d126d87c53f50db3641f9cab66739970843fe9182ff6ebcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1025
+ 1025
0x6d59bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fdd4987e9f2d57a3ae237d126d87c53f50db3641f9cab66739970843fe9182ff6ebcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1026
+ 1026
0x159bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1027
+ 1027
0x159bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1028
+ 1028
0x559bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1029
+ 1029
0xd59bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1030
+ 1030
0xd59bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1031
+ 1031
0x2d59bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
- 1032
+ 1032
0x6d59bc4a479db6990a56909b9077e87f29473f88203c830c1ef6f160cd48e537a178992e98663de4fe2c5c31bbe49764484a46bdc1f5bd243f010c698614fc3acac3cd35cb3474dd4b3b4e6a5b53742823f319fcb203f2b7739ce25d3073af94bcb4b0a690ede55ffe88ceb8c946766fa4fb3343f0c15bfb1d1ee07212c49dd5bc
"9a741f76c050657815eadefc360e8cd191edd49f66ecbdedd048a364d8ef5e86" 0 ""
sha256-mgf sha256 32;
0x10001
0x27f0e74fa6a8ad5a83d59a09fd85f10dd0d131baaad40bec1dba3cc0d24129cf72efc60443e671de8ac9b162d11eddee26c0a7a6bb052d4b155407baf9eeaffe351674bc6781d2b4b576ddbbf5f1f4429c974047f4149488148e4c365c1bd063ddfcdac3a2f5eec91e4dc091689c95189c8d0edbfd23da722e25643ffa58ad94ec06f6ab21fc8805b09066ffe3849e2d5536cf8a7385e62526989605c9fefbd9092ddb51bd887ee71cababab3a150b34d7de54d01c19987438bef4672208418e51bf49cdbe1825f16e2764c58aab339afbb4f673914646d2a191fec4f7a503e512841a2cccdc8852c0f348b8aedea3123747d20c3c580c38b438ef5fde3608bf
"12f1c8bb1c560ae3f3b0fcb1ae918af64947a95c4c53e81551280ffc2e842884"
- 0
+ 0
0x35fcbf7c5a69bd892dbf2ee88e53e40fe58ecddb4cf7c8885b228bfa9c24730ac554e20c65d82fc98d67a7805343450b1712a5f8c5ed6970c4310e06f65a9758d33e1c9dedec7178507da977a5ab76635d9f824b136abb855210caf851700bb57eb3aef7de61b217ae79ee4d6ad7c1a94279d9f8a425e06a0e4024d4c5b709ce1af6d09a26ce346f0a7eb36675fdbe1367f3d040ab7e18235b8090f91c355ee07425e3f4adf302e741be55959ac0f31075ccf1beef20e2f90693a82a30a48969c5ef32bc779ce84961b6a8d3ae0228cc520e2c644067bae96f14d90ceda2c8d00c97de3895d434a001d3cca244777fba4e0f5b5ed01c103842652c6402d2525b
sha256-mgf sha256 32;
}
"1234567890" 8
b50aecbe4e9bb0b57bc5f3ae760a8e01db24f203fb3cdcd13148046e;
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
-" 23
+" 23
5a86156c37c95ab356e003d569370580737794815f46de7f4834d634;
"a" 1000000
20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67;
# match my (or anyone else's!) implementation. These are the values
# which seem to be generally agreed.
- e7496e99e4628b7f9ffb 99ccfe2b90fd550b 60a73d387b517fca;
+ e7496e99e4628b7f9ffb 99ccfe2b90fd550b 60a73d387b517fca;
e7496e99e4628b7f9ffb 60a73d387b517fca 24c90cb05d668b27;
e5caf4dcc70e55f1dd90 b71cb0d009af2765 64f4877ae68a8a62;
e5caf4dcc70e55f1dd90 64f4877ae68a8a62 fee778a838a601cd;
* Almost. I changed the types from long to unsigned long.
*/
-void code(unsigned long* v, unsigned long* k) {
+void code(unsigned long* v, unsigned long* k) {
unsigned long y=v[0],z=v[1], sum=0, /* set up */
- delta=0x9e3779b9, n=32 ; /* a key schedule constant */
-while (n-->0) { /* basic cycle start */
+ delta=0x9e3779b9, n=32 ; /* a key schedule constant */
+while (n-->0) { /* basic cycle start */
sum += delta ;
y += (z<<4)+k[0] ^ z+sum ^ (z>>5)+k[1] ;
z += (y<<4)+k[2] ^ y+sum ^ (y>>5)+k[3] ; /* end cycle */
- }
+ }
v[0]=y ; v[1]=z ; }
int main(void)
code(p, k);
printf("%08lx%08lx;\n", p[0], p[1]);
}
-
+
return (0);
}
# ought to be reliable and correct.
#
# These test vectors are here to spot changes in behaviour rather than ensure
-# interoperability.
+# interoperability.
tiger-hmac {
"Hi There"
Tables Known Answer Test
Tests permutation tables and MDS matrix multiply tables.
-Algorithm Name: TWOFISH
+Algorithm Name: TWOFISH
Principal Submitter: Bruce Schneier, Counterpane Systems
==========
# --- Basic hash function ---
#
-# Some of these are taken from the ISO test vectors from the Whirlpool
+# Some of these are taken from the ISO test vectors from the Whirlpool
# distribution.
whirlpool {
# --- Basic hash function ---
#
-# Some of these are taken from the ISO test vectors from the Whirlpool
+# Some of these are taken from the ISO test vectors from the Whirlpool
# distribution.
whirlpool256 {
y+= (z<<4 ^ z>>5) + z ^ sum + k[sum&3],
sum+=DELTA,
z+= (y<<4 ^ y>>5) + y ^ sum + k[sum>>11 &3] ;
- }
+ }
else {
- /* decoding */
+ /* decoding */
unsigned long sum=DELTA*(-N) ;
while (sum)
z-= (y<<4 ^ y>>5) + y ^ sum + k[sum>>11 &3],
tean(p, k, 32);
printf("%08lx%08lx;\n", p[0], p[1]);
}
-
+
return (0);
}
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
#define TIGER_ROUND(a, b, c, x, n, op) do { \
kludge64 _t; \
XOR64(c, c, x); \
- _t = s[0][U8(LO64(c) >> 0)]; \
+ _t = s[0][U8(LO64(c) >> 0)]; \
XOR64(_t, _t, s[1][U8(LO64(c) >> 16)]); \
XOR64(_t, _t, s[2][U8(HI64(c) >> 0)]); \
XOR64(_t, _t, s[3][U8(HI64(c) >> 16)]); \
SUB64(a, a, _t); \
- _t = s[3][U8(LO64(c) >> 8)]; \
+ _t = s[3][U8(LO64(c) >> 8)]; \
XOR64(_t, _t, s[2][U8(LO64(c) >> 24)]); \
XOR64(_t, _t, s[1][U8(HI64(c) >> 8)]); \
XOR64(_t, _t, s[0][U8(HI64(c) >> 24)]); \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
\\\n\
{ ", stdout);
} else if (j % 2 == 1)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
void tiger_set(tiger_ctx *ctx, const void *buf, unsigned long count)
{
const octet *p = buf;
- LOAD64_L_(ctx->a, p + 0);
- LOAD64_L_(ctx->b, p + 8);
+ LOAD64_L_(ctx->a, p + 0);
+ LOAD64_L_(ctx->b, p + 8);
LOAD64_L_(ctx->c, p + 16);
ctx->off = 0;
ctx->nl = U32(count);
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
} break;
default:
GRAND_BADOP;
- break;
+ break;
}
va_end(ap);
} break;
default:
GRAND_BADOP;
- break;
+ break;
}
va_end(ap);
if (memcmp(v[2].buf, d.buf, d.len) != 0) {
ok = 0;
printf("\nfail tlsprf:"
- "\n\tkey = ");
+ "\n\tkey = ");
type_hex.dump(&v[0], stdout);
- printf("\n\tseed = "); type_hex.dump(&v[1], stdout);
+ printf("\n\tseed = "); type_hex.dump(&v[1], stdout);
printf("\n\texpected = "); type_hex.dump(&v[2], stdout);
printf("\n\tcalculated = "); type_hex.dump(&d, stdout);
putchar('\n');
* (c) 2001 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
puts(" }, \\\n\
\\");
} else if (j % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- Apply a series of @q@ tables to an integer --- */
# define Q(x, qa, qb, qc, qd) \
- ((qa[((x) >> 0) & 0xff] << 0) | \
- (qb[((x) >> 8) & 0xff] << 8) | \
+ ((qa[((x) >> 0) & 0xff] << 0) | \
+ (qb[((x) >> 8) & 0xff] << 8) | \
(qc[((x) >> 16) & 0xff] << 16) | \
(qd[((x) >> 24) & 0xff] << 24))
qq++;
r++;
}
-
+
s[j][sz - 1 - i] = ss[j] = a;
}
q += 8;
/* --- Feistel function --- */
#define GG(k, t0, t1, x, y, kk) do { \
- t0 = (k->g[0][U8(x >> 0)] ^ \
- k->g[1][U8(x >> 8)] ^ \
+ t0 = (k->g[0][U8(x >> 0)] ^ \
+ k->g[1][U8(x >> 8)] ^ \
k->g[2][U8(x >> 16)] ^ \
k->g[3][U8(x >> 24)]); \
- t1 = (k->g[1][U8(y >> 0)] ^ \
- k->g[2][U8(y >> 8)] ^ \
+ t1 = (k->g[1][U8(y >> 0)] ^ \
+ k->g[2][U8(y >> 8)] ^ \
k->g[3][U8(y >> 16)] ^ \
k->g[0][U8(y >> 24)]); \
t0 += t1; \
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
chunk to be inserted into ectab.in.
ecentry-prettify.pl
- Run
+ Run
ecentry-prettify.pl NAME FIELD-TYPE
and enter P, A, B, R, H and G by pasting from some appropriate
standard, terminating each one by a `.' on its own line.
for (i = 0; i < DA_LEN(v); i++)
mp_drop(DA(v)[i].n);
- DA_DESTROY(v);
+ DA_DESTROY(v);
}
static mp *ecm(mp *x)
{
mp *f;
- x = smallfactors(x, v);
+ x = smallfactors(x, v);
if (MP_EQ(x, MP_ONE)) return;
#ifdef POLLARDRHO
poly_mul(f, &c, &c, &c);
poly_add(f, &c, &c, &ut);
poly_div(f, 0, &c, &c, &g);
-/* putchar('.'); fflush(stdout); */
+/* putchar('.'); fflush(stdout); */
}
-/* poly_dump(f, "c-out", &c); */
+/* poly_dump(f, "c-out", &c); */
poly_gcd(f, &h, &c, &g);
-/* poly_dump(f, "h", &h); */
+/* poly_dump(f, "h", &h); */
if (POLY_CONSTANTP(&h) || POLY_DEGREE(&h) == POLY_DEGREE(&g))
continue;
if (2 * POLY_DEGREE(&h) > POLY_DEGREE(&g))
#else
abort();
#endif
- } break;
+ } break;
}
return (p);
}
n = 0;
while (!dofip(m, &p, n, m))
n += 2;
- return (p);
+ return (p);
}
static mp *fnb(mp *p)
id = C.ReadBuffer(seed).getu32()
k = kf.newkey(id, 'dh-param')
k.data = C.KeyDataStructured({'p': C.KeyDataMP(dhi.p, 'shared'),
- 'q': C.KeyDataMP(dhi.r, 'shared'),
- 'g': C.KeyDataMP(dhi.g, 'shared')})
+ 'q': C.KeyDataMP(dhi.r, 'shared'),
+ 'g': C.KeyDataMP(dhi.g, 'shared')})
k.attr['factor'] = ', '.join([str(f) for f in ff])
k.attr['genseed'] = M.base64_encode(seed)
k.attr['seedalg'] = 'rmd160-mgf'
print '# fingerprint = %s' % fprhex
print ''
print 'group %s' % name
-print ' p %s' % dhi.p
-print ' q %s' % dhi.r
-print ' g %s' % dhi.g
+print ' p %s' % dhi.p
+print ' q %s' % dhi.r
+print ' g %s' % dhi.g
for f in ff: print '#:factor %s' % f
print
3072:256 \
7680:384 \
15360:512
-do
+do
set -- `echo $i | tr : " "`
utils/genpgroup catacomb-ll-$2-$1 $1 $2 !
done
for k in xrange(i + 1, i + 16):
x = R.randrange(1L << k)
print " 0x%x" % m
- print " 0x%x" % x
- print " 0x%x;" % (x%m)
+ print " 0x%x" % x
+ print " 0x%x;" % (x%m)
if not first:
- print
+ print
first = False
print "}"
for (i = 0; i < DA_LEN(f); i++) {
x = gfreduce_exp(&r, x, MP_TWO, DA(f)[i].r);
#ifdef DEBUG
- MP_PRINT(" r", DA(f)[i].r);
- MP_PRINTX(" x", x);
+ MP_PRINT(" r", DA(f)[i].r);
+ MP_PRINTX(" x", x);
#endif
if (MP_EQ(x, MP_ONE)) {
rc = 0;
n = 0;
while (!dofip(f, m, &p, n, m))
n += 2;
- return (p);
+ return (p);
}
static void findprim(unsigned m)
0x~A
\"~A\" 0 \"\"
~A-mgf ~:*~A ~A~)~%"
- nbits
+ nbits
out
hash
(get mech 'hash)
(get mech 'hashsz))
t)))))
-
+
(with-open-file (str "/tmp/mdw/psstests")
(parse-stanza str))
* (c) 2005 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
\\\n\
{ ", stdout);
} else if (i % 2 == 1)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
\\\n\
{ ", stdout);
} else if (i % 4 == 3)
- fputs(", \\\n ", stdout);
+ fputs(", \\\n ", stdout);
else
fputs(", ", stdout);
}
exit(EXIT_FAILURE);
}
- return (0);
+ return (0);
}
/*----- That's all, folks -------------------------------------------------*/
* (c) 2005 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
int i; \
printf("\n"); \
for (i = 0; i < 8; i++) \
- printf(" %08x %08x : %08x %08x\n", \
+ printf(" %08x %08x : %08x %08x\n", \
HI64(k[i]), LO64(k[i]), \
HI64(v[i]), LO64(v[i])); \
} while (0)
vv[i].lo ^= UUL(v, i, 0); vv[i].hi ^= VVL(v, i, 0); \
XROW(vv, v, i); \
} while (0)
-
+
#endif
#define RHO(vv, v, kk, k) do { \
- ROWK(kk, k, 0, *c++); ROWK(vv, v, 0, kk[0]); \
- ROWZ(kk, k, 1); ROWK(vv, v, 1, kk[1]); \
- ROWZ(kk, k, 2); ROWK(vv, v, 2, kk[2]); \
- ROWZ(kk, k, 3); ROWK(vv, v, 3, kk[3]); \
- ROWZ(kk, k, 4); ROWK(vv, v, 4, kk[4]); \
- ROWZ(kk, k, 5); ROWK(vv, v, 5, kk[5]); \
- ROWZ(kk, k, 6); ROWK(vv, v, 6, kk[6]); \
- ROWZ(kk, k, 7); ROWK(vv, v, 7, kk[7]); \
+ ROWK(kk, k, 0, *c++); ROWK(vv, v, 0, kk[0]); \
+ ROWZ(kk, k, 1); ROWK(vv, v, 1, kk[1]); \
+ ROWZ(kk, k, 2); ROWK(vv, v, 2, kk[2]); \
+ ROWZ(kk, k, 3); ROWK(vv, v, 3, kk[3]); \
+ ROWZ(kk, k, 4); ROWK(vv, v, 4, kk[4]); \
+ ROWZ(kk, k, 5); ROWK(vv, v, 5, kk[5]); \
+ ROWZ(kk, k, 6); ROWK(vv, v, 6, kk[6]); \
+ ROWZ(kk, k, 7); ROWK(vv, v, 7, kk[7]); \
} while (0)
void whirlpool_compress(whirlpool_ctx *ctx, const void *sbuf)
const kludge64 *c = C;
const octet *s = sbuf;
int i;
-
+
for (i = 0; i < 8; i++) {
LOAD64_L_(m[i], &s[i * 8]);
XOR64(v[i], m[i], ctx->s[i]);
{
HASH_PAD(WHIRLPOOL, whirlpool, ctx, 0x80, 0, 32);
memset(ctx->buf + WHIRLPOOL_BUFSZ - 32, 0, 24);
- STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 8, (ctx->nl >> 29) | (ctx->nh << 3));
- STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 4, ctx->nl << 3);
+ STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 8, (ctx->nl >> 29) | (ctx->nh << 3));
+ STORE32(ctx->buf + WHIRLPOOL_BUFSZ - 4, ctx->nl << 3);
whirlpool_compress(ctx, ctx->buf);
}
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @xtea_init@ --- *
*
- * Arguments: @xtea_ctx *k@ = pointer to key block
- * @const void *buf@ = pointer to key buffer
- * @size_t sz@ = size of key material
+ * Arguments: @xtea_ctx *k@ = pointer to key block
+ * @const void *buf@ = pointer to key buffer
+ * @size_t sz@ = size of key material
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Initializes an XTEA key buffer. The key buffer must be 16
+ * Use: Initializes an XTEA key buffer. The key buffer must be 16
* bytes long.
*/
p = kb;
}
- k->k[0] = LOAD32(p + 0); k->k[1] = LOAD32(p + 4);
- k->k[2] = LOAD32(p + 8); k->k[3] = LOAD32(p + 12);
+ k->k[0] = LOAD32(p + 0); k->k[1] = LOAD32(p + 4);
+ k->k[2] = LOAD32(p + 8); k->k[3] = LOAD32(p + 12);
k->r = 32;
if (p == kb)
/* --- @xtea_eblk@, @xtea_dblk@ --- *
*
- * Arguments: @const xtea_ctx *k@ = pointer to key block
- * @const uint32 s[2]@ = pointer to source block
- * @uint32 d[2]@ = pointer to xteatination block
+ * Arguments: @const xtea_ctx *k@ = pointer to key block
+ * @const uint32 s[2]@ = pointer to source block
+ * @uint32 d[2]@ = pointer to xteatination block
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Low-level block encryption and decryption.
+ * Use: Low-level block encryption and decryption.
*/
#define DELTA 0x9e3779b9
* (c) 2000 Straylight/Edgeware
*/
-/*----- Licensing notice --------------------------------------------------*
+/*----- Licensing notice --------------------------------------------------*
*
* This file is part of Catacomb.
*
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
- *
+ *
* Catacomb 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 Library General Public License for more details.
- *
+ *
* You should have received a copy of the GNU Library General Public
* License along with Catacomb; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
/* --- @xtea_init@ --- *
*
- * Arguments: @xtea_ctx *k@ = pointer to key block
- * @const void *buf@ = pointer to key buffer
- * @size_t sz@ = size of key material
+ * Arguments: @xtea_ctx *k@ = pointer to key block
+ * @const void *buf@ = pointer to key buffer
+ * @size_t sz@ = size of key material
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Initializes an XTEA key buffer. The key buffer may be up to
+ * Use: Initializes an XTEA key buffer. The key buffer may be up to
* 16 bytes long.
*/
/* --- @xtea_eblk@, @xtea_dblk@ --- *
*
- * Arguments: @const xtea_ctx *k@ = pointer to key block
- * @const uint32 s[2]@ = pointer to source block
- * @uint32 d[2]@ = pointer to xteatination block
+ * Arguments: @const xtea_ctx *k@ = pointer to key block
+ * @const uint32 s[2]@ = pointer to source block
+ * @uint32 d[2]@ = pointer to xteatination block
*
- * Returns: ---
+ * Returns: ---
*
- * Use: Low-level block encryption and decryption.
+ * Use: Low-level block encryption and decryption.
*/
extern void xtea_eblk(const xtea_ctx */*k*/,