/* -*-c-*-
*
- * $Id: keyutil.c,v 1.9 2000/08/15 21:40:49 mdw Exp $
+ * $Id: keyutil.c,v 1.10 2000/10/08 12:02:21 mdw Exp $
*
* Simple key manager program
*
/*----- Revision history --------------------------------------------------*
*
* $Log: keyutil.c,v $
+ * Revision 1.10 2000/10/08 12:02:21 mdw
+ * Use @MP_EQ@ instead of @MP_CMP@.
+ *
* Revision 1.9 2000/08/15 21:40:49 mdw
* Minor formatting change in listing attributes.
*
c = rsa_qpubop(&rpp, MP_NEW, m);
c = rsa_qprivop(&rp, c, c, g);
- if (MP_CMP(c, !=, m))
+ if (!MP_EQ(c, m))
die(EXIT_FAILURE, "test encryption failed");
mp_drop(c);
mp_drop(m);
/* -*-c-*-
*
- * $Id: mp-arith.c,v 1.7 2000/06/22 19:02:53 mdw Exp $
+ * $Id: mp-arith.c,v 1.8 2000/10/08 12:02:21 mdw Exp $
*
* Basic arithmetic on multiprecision integers
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-arith.c,v $
+ * Revision 1.8 2000/10/08 12:02:21 mdw
+ * Use @MP_EQ@ instead of @MP_CMP@.
+ *
* Revision 1.7 2000/06/22 19:02:53 mdw
* New function @mp_odd@ to extract powers of two from an integer. This is
* common code from the Rabin-Miller test, RSA key recovery and modular
return (d);
}
+/* --- @mp_eq@ --- *
+ *
+ * Arguments: @const mp *a, *b@ = two numbers
+ *
+ * Returns: Nonzero if the numbers are equal.
+ */
+
+int mp_eq(const mp *a, const mp *b) { return (MP_EQ(a, b)); }
+
/* --- @mp_cmp@ --- *
*
* Arguments: @const mp *a, *b@ = two numbers
static int verify(const char *op, mp *expect, mp *result, mp *a, mp *b)
{
- if (MP_CMP(expect, !=, result)) {
+ 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);
mp *t;
size_t s;
t = mp_odd(MP_NEW, a, &s);
- if (s != rs || MP_CMP(t, !=, rt)) {
+ if (s != rs || !MP_EQ(t, rt)) {
ok = 0;
fprintf(stderr, "\n*** odd failed");
fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 10);
/* -*-c-*-
*
- * $Id: mp-modsqrt.c,v 1.1 2000/06/22 19:01:31 mdw Exp $
+ * $Id: mp-modsqrt.c,v 1.2 2000/10/08 12:02:21 mdw Exp $
*
* Compute square roots modulo a prime
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-modsqrt.c,v $
+ * Revision 1.2 2000/10/08 12:02:21 mdw
+ * Use @MP_EQ@ instead of @MP_CMP@.
+ *
* Revision 1.1 2000/06/22 19:01:31 mdw
* Compute square roots in a prime field.
*
/* --- Fiddle at the end --- */
- if (MP_CMP(dd, ==, mone))
+ if (MP_EQ(dd, mone))
r = mpmont_mul(&mm, r, r, c);
c = mp_sqr(c, c);
c = mpmont_reduce(&mm, c, c);
if (!r)
ok = 0;
- else if (MP_CMP(r, ==, rr))
+ else if (MP_EQ(r, rr))
ok = 1;
else {
r = mp_sub(r, p, r);
- if (MP_CMP(r, ==, rr))
+ if (MP_EQ(r, rr))
ok = 1;
}
/* -*-c-*-
*
- * $Id: mp-sqrt.c,v 1.1 2000/06/22 19:01:44 mdw Exp $
+ * $Id: mp-sqrt.c,v 1.2 2000/10/08 12:02:21 mdw Exp $
*
* Compute integer square roots
*
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-sqrt.c,v $
+ * Revision 1.2 2000/10/08 12:02:21 mdw
+ * Use @MP_EQ@ instead of @MP_CMP@.
+ *
* Revision 1.1 2000/06/22 19:01:44 mdw
* Compute (approximations to) integer square roots.
*
mp *q = mp_sqrt(MP_NEW, a);
int ok = 1;
- if (MP_CMP(q, !=, qq)) {
+ if (!MP_EQ(q, qq)) {
ok = 0;
fputs("\n*** sqrt failed", stderr);
fputs("\n*** a = ", stderr); mp_writefile(a, stderr, 10);