From 58514ca8266f2c4d6361a64a775f1e3a56f60405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Fri, 6 Oct 2006 09:17:25 +0000 Subject: [PATCH] Print how wrong the lenght are. Try more context token exchanges. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18255 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/gssmask/gssmaestro.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/appl/gssmask/gssmaestro.c b/appl/gssmask/gssmaestro.c index 0280eef0f..280eeb75f 100644 --- a/appl/gssmask/gssmaestro.c +++ b/appl/gssmask/gssmaestro.c @@ -417,7 +417,8 @@ test_wrap(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2, } if (msg.length != out.length) { - warnx("decrypted'ed token have wrong length"); + warnx("decrypted'ed token have wrong length (%lu != %lu)", + (unsigned long)msg.length, (unsigned long)out.length); val = GSMERR_ERROR; } else if (memcmp(msg.data, out.data, msg.length) != 0) { warnx("decryptd'ed token have wrong data"); @@ -433,18 +434,20 @@ static int32_t test_token(struct client *c1, int32_t hc1, struct client *c2, int32_t hc2) { int32_t val; + int i; - test_mic(c1, hc1, c2, hc2); - test_mic(c2, hc2, c1, hc1); - val = test_wrap(c1, hc1, c2, hc2, 0); - if (val) return val; - val = test_wrap(c2, hc2, c1, hc1, 0); - if (val) return val; - val = test_wrap(c1, hc1, c2, hc2, 1); - if (val) return val; - val = test_wrap(c2, hc2, c1, hc1, 1); - if (val) return val; - + for (i = 0; i < 10; i++) { + test_mic(c1, hc1, c2, hc2); + test_mic(c2, hc2, c1, hc1); + val = test_wrap(c1, hc1, c2, hc2, 0); + if (val) return val; + val = test_wrap(c2, hc2, c1, hc1, 0); + if (val) return val; + val = test_wrap(c1, hc1, c2, hc2, 1); + if (val) return val; + val = test_wrap(c2, hc2, c1, hc1, 1); + if (val) return val; + } return GSMERR_OK; }