[BACK]Return to jpake.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Annotation of src/usr.bin/ssh/jpake.c, Revision 1.3

1.3     ! djm         1: /* $OpenBSD: jpake.c,v 1.2 2009/03/05 07:18:19 djm Exp $ */
1.1       djm         2: /*
                      3:  * Copyright (c) 2008 Damien Miller.  All rights reserved.
                      4:  *
                      5:  * Permission to use, copy, modify, and distribute this software for any
                      6:  * purpose with or without fee is hereby granted, provided that the above
                      7:  * copyright notice and this permission notice appear in all copies.
                      8:  *
                      9:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     10:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     11:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     12:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     13:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     14:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     15:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     16:  */
                     17:
                     18: /*
                     19:  * Shared components of zero-knowledge password auth using J-PAKE protocol
                     20:  * as described in:
                     21:  *
                     22:  * F. Hao, P. Ryan, "Password Authenticated Key Exchange by Juggling",
                     23:  * 16th Workshop on Security Protocols, Cambridge, April 2008
                     24:  *
                     25:  * http://grouper.ieee.org/groups/1363/Research/contributions/hao-ryan-2008.pdf
                     26:  */
                     27:
                     28: #include <sys/types.h>
                     29:
                     30: #include <stdio.h>
                     31: #include <string.h>
                     32: #include <stdarg.h>
                     33:
                     34: #include <openssl/bn.h>
                     35: #include <openssl/evp.h>
                     36:
                     37: #include "xmalloc.h"
                     38: #include "ssh2.h"
                     39: #include "key.h"
                     40: #include "hostfile.h"
                     41: #include "auth.h"
                     42: #include "buffer.h"
                     43: #include "packet.h"
                     44: #include "dispatch.h"
                     45: #include "log.h"
                     46:
                     47: #include "jpake.h"
1.2       djm        48: #include "schnorr.h"
1.1       djm        49:
                     50: #ifdef JPAKE
                     51:
                     52: /* RFC3526 group 5, 1536 bits */
                     53: #define JPAKE_GROUP_G "2"
                     54: #define JPAKE_GROUP_P \
                     55:        "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74" \
                     56:        "020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F1437" \
                     57:        "4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" \
                     58:        "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF05" \
                     59:        "98DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB" \
                     60:        "9ED529077096966D670C354E4ABC9804F1746C08CA237327FFFFFFFFFFFFFFFF"
                     61:
1.2       djm        62: struct modp_group *
1.1       djm        63: jpake_default_group(void)
                     64: {
1.2       djm        65:        return modp_group_from_g_and_safe_p(JPAKE_GROUP_G, JPAKE_GROUP_P);
1.1       djm        66: }
                     67:
                     68: struct jpake_ctx *
                     69: jpake_new(void)
                     70: {
                     71:        struct jpake_ctx *ret;
                     72:
                     73:        ret = xcalloc(1, sizeof(*ret));
                     74:
                     75:        ret->grp = jpake_default_group();
                     76:
                     77:        ret->s = ret->k = NULL;
                     78:        ret->x1 = ret->x2 = ret->x3 = ret->x4 = NULL;
                     79:        ret->g_x1 = ret->g_x2 = ret->g_x3 = ret->g_x4 = NULL;
                     80:        ret->a = ret->b = NULL;
                     81:
                     82:        ret->client_id = ret->server_id = NULL;
                     83:        ret->h_k_cid_sessid = ret->h_k_sid_sessid = NULL;
                     84:
                     85:        debug3("%s: alloc %p", __func__, ret);
                     86:
                     87:        return ret;
                     88: }
                     89:
                     90: void
                     91: jpake_free(struct jpake_ctx *pctx)
                     92: {
                     93:        debug3("%s: free %p", __func__, pctx);
                     94:
                     95: #define JPAKE_BN_CLEAR_FREE(v)                 \
                     96:        do {                                    \
                     97:                if ((v) != NULL) {              \
                     98:                        BN_clear_free(v);       \
                     99:                        (v) = NULL;             \
                    100:                }                               \
                    101:        } while (0)
                    102: #define JPAKE_BUF_CLEAR_FREE(v, l)             \
                    103:        do {                                    \
                    104:                if ((v) != NULL) {              \
                    105:                        bzero((v), (l));        \
                    106:                        xfree(v);               \
                    107:                        (v) = NULL;             \
                    108:                        (l) = 0;                \
                    109:                }                               \
                    110:        } while (0)
                    111:
                    112:        JPAKE_BN_CLEAR_FREE(pctx->s);
                    113:        JPAKE_BN_CLEAR_FREE(pctx->k);
                    114:        JPAKE_BN_CLEAR_FREE(pctx->x1);
                    115:        JPAKE_BN_CLEAR_FREE(pctx->x2);
                    116:        JPAKE_BN_CLEAR_FREE(pctx->x3);
                    117:        JPAKE_BN_CLEAR_FREE(pctx->x4);
                    118:        JPAKE_BN_CLEAR_FREE(pctx->g_x1);
                    119:        JPAKE_BN_CLEAR_FREE(pctx->g_x2);
                    120:        JPAKE_BN_CLEAR_FREE(pctx->g_x3);
                    121:        JPAKE_BN_CLEAR_FREE(pctx->g_x4);
                    122:        JPAKE_BN_CLEAR_FREE(pctx->a);
                    123:        JPAKE_BN_CLEAR_FREE(pctx->b);
                    124:
                    125:        JPAKE_BUF_CLEAR_FREE(pctx->client_id, pctx->client_id_len);
                    126:        JPAKE_BUF_CLEAR_FREE(pctx->server_id, pctx->server_id_len);
                    127:        JPAKE_BUF_CLEAR_FREE(pctx->h_k_cid_sessid, pctx->h_k_cid_sessid_len);
                    128:        JPAKE_BUF_CLEAR_FREE(pctx->h_k_sid_sessid, pctx->h_k_sid_sessid_len);
                    129:
                    130: #undef JPAKE_BN_CLEAR_FREE
                    131: #undef JPAKE_BUF_CLEAR_FREE
                    132:
                    133:        bzero(pctx, sizeof(pctx));
                    134:        xfree(pctx);
                    135: }
                    136:
                    137: /* dump entire jpake_ctx. NB. includes private values! */
                    138: void
                    139: jpake_dump(struct jpake_ctx *pctx, const char *fmt, ...)
                    140: {
                    141:        char *out;
                    142:        va_list args;
                    143:
                    144:        out = NULL;
                    145:        va_start(args, fmt);
                    146:        vasprintf(&out, fmt, args);
                    147:        va_end(args);
                    148:        if (out == NULL)
                    149:                fatal("%s: vasprintf failed", __func__);
                    150:
                    151:        debug3("%s: %s (ctx at %p)", __func__, out, pctx);
                    152:        if (pctx == NULL) {
                    153:                free(out);
                    154:                return;
                    155:        }
                    156:
                    157: #define JPAKE_DUMP_BN(a)       do { \
                    158:                if ((a) != NULL) \
                    159:                        JPAKE_DEBUG_BN(((a), "%s = ", #a)); \
                    160:        } while (0)
                    161: #define JPAKE_DUMP_BUF(a, b)   do { \
                    162:                if ((a) != NULL) \
                    163:                        JPAKE_DEBUG_BUF((a, b, "%s", #a)); \
                    164:        } while (0)
                    165:
                    166:        JPAKE_DUMP_BN(pctx->s);
                    167:        JPAKE_DUMP_BN(pctx->k);
                    168:        JPAKE_DUMP_BN(pctx->x1);
                    169:        JPAKE_DUMP_BN(pctx->x2);
                    170:        JPAKE_DUMP_BN(pctx->x3);
                    171:        JPAKE_DUMP_BN(pctx->x4);
                    172:        JPAKE_DUMP_BN(pctx->g_x1);
                    173:        JPAKE_DUMP_BN(pctx->g_x2);
                    174:        JPAKE_DUMP_BN(pctx->g_x3);
                    175:        JPAKE_DUMP_BN(pctx->g_x4);
                    176:        JPAKE_DUMP_BN(pctx->a);
                    177:        JPAKE_DUMP_BN(pctx->b);
                    178:
                    179:        JPAKE_DUMP_BUF(pctx->client_id, pctx->client_id_len);
                    180:        JPAKE_DUMP_BUF(pctx->server_id, pctx->server_id_len);
                    181:        JPAKE_DUMP_BUF(pctx->h_k_cid_sessid, pctx->h_k_cid_sessid_len);
                    182:        JPAKE_DUMP_BUF(pctx->h_k_sid_sessid, pctx->h_k_sid_sessid_len);
                    183:
                    184:        debug3("%s: %s done", __func__, out);
                    185:        free(out);
                    186: }
                    187:
                    188: /* Shared parts of step 1 exchange calculation */
                    189: void
1.2       djm       190: jpake_step1(struct modp_group *grp,
1.1       djm       191:     u_char **id, u_int *id_len,
                    192:     BIGNUM **priv1, BIGNUM **priv2, BIGNUM **g_priv1, BIGNUM **g_priv2,
                    193:     u_char **priv1_proof, u_int *priv1_proof_len,
                    194:     u_char **priv2_proof, u_int *priv2_proof_len)
                    195: {
                    196:        BN_CTX *bn_ctx;
                    197:
                    198:        if ((bn_ctx = BN_CTX_new()) == NULL)
                    199:                fatal("%s: BN_CTX_new", __func__);
                    200:
                    201:        /* Random nonce to prevent replay */
                    202:        *id = xmalloc(KZP_ID_LEN);
                    203:        *id_len = KZP_ID_LEN;
                    204:        arc4random_buf(*id, *id_len);
                    205:
                    206:        /*
                    207:         * x1/x3 is a random element of Zq
                    208:         * x2/x4 is a random element of Z*q
                    209:         * We also exclude [1] from x1/x3 candidates and [0, 1] from
                    210:         * x2/x4 candiates to avoid possible degeneracy (i.e. g^0, g^1).
                    211:         */
                    212:        if ((*priv1 = bn_rand_range_gt_one(grp->q)) == NULL ||
                    213:            (*priv2 = bn_rand_range_gt_one(grp->q)) == NULL)
                    214:                fatal("%s: bn_rand_range_gt_one", __func__);
                    215:
                    216:        /*
                    217:         * client: g_x1 = g^x1 mod p / server: g_x3 = g^x3 mod p
                    218:         * client: g_x2 = g^x2 mod p / server: g_x4 = g^x4 mod p
                    219:         */
                    220:        if ((*g_priv1 = BN_new()) == NULL ||
                    221:            (*g_priv2 = BN_new()) == NULL)
                    222:                fatal("%s: BN_new", __func__);
                    223:        if (BN_mod_exp(*g_priv1, grp->g, *priv1, grp->p, bn_ctx) == -1)
                    224:                fatal("%s: BN_mod_exp", __func__);
                    225:        if (BN_mod_exp(*g_priv2, grp->g, *priv2, grp->p, bn_ctx) == -1)
                    226:                fatal("%s: BN_mod_exp", __func__);
                    227:
                    228:        /* Generate proofs for holding x1/x3 and x2/x4 */
1.2       djm       229:        if (schnorr_sign_buf(grp->p, grp->q, grp->g,
1.1       djm       230:            *priv1, *g_priv1, *id, *id_len,
                    231:            priv1_proof, priv1_proof_len) != 0)
                    232:                fatal("%s: schnorr_sign", __func__);
1.2       djm       233:        if (schnorr_sign_buf(grp->p, grp->q, grp->g,
1.1       djm       234:            *priv2, *g_priv2, *id, *id_len,
                    235:            priv2_proof, priv2_proof_len) != 0)
                    236:                fatal("%s: schnorr_sign", __func__);
                    237:
                    238:        BN_CTX_free(bn_ctx);
                    239: }
                    240:
                    241: /* Shared parts of step 2 exchange calculation */
                    242: void
1.2       djm       243: jpake_step2(struct modp_group *grp, BIGNUM *s,
1.1       djm       244:     BIGNUM *mypub1, BIGNUM *theirpub1, BIGNUM *theirpub2, BIGNUM *mypriv2,
                    245:     const u_char *theirid, u_int theirid_len,
                    246:     const u_char *myid, u_int myid_len,
                    247:     const u_char *theirpub1_proof, u_int theirpub1_proof_len,
                    248:     const u_char *theirpub2_proof, u_int theirpub2_proof_len,
                    249:     BIGNUM **newpub,
                    250:     u_char **newpub_exponent_proof, u_int *newpub_exponent_proof_len)
                    251: {
                    252:        BN_CTX *bn_ctx;
                    253:        BIGNUM *tmp, *exponent;
                    254:
                    255:        /* Validate peer's step 1 values */
                    256:        if (BN_cmp(theirpub1, BN_value_one()) <= 0)
                    257:                fatal("%s: theirpub1 <= 1", __func__);
                    258:        if (BN_cmp(theirpub2, BN_value_one()) <= 0)
                    259:                fatal("%s: theirpub2 <= 1", __func__);
                    260:
1.2       djm       261:        if (schnorr_verify_buf(grp->p, grp->q, grp->g, theirpub1,
1.1       djm       262:            theirid, theirid_len, theirpub1_proof, theirpub1_proof_len) != 1)
                    263:                fatal("%s: schnorr_verify theirpub1 failed", __func__);
1.2       djm       264:        if (schnorr_verify_buf(grp->p, grp->q, grp->g, theirpub2,
1.1       djm       265:            theirid, theirid_len, theirpub2_proof, theirpub2_proof_len) != 1)
                    266:                fatal("%s: schnorr_verify theirpub2 failed", __func__);
                    267:
                    268:        if ((bn_ctx = BN_CTX_new()) == NULL)
                    269:                fatal("%s: BN_CTX_new", __func__);
                    270:
                    271:        if ((*newpub = BN_new()) == NULL ||
                    272:            (tmp = BN_new()) == NULL ||
                    273:            (exponent = BN_new()) == NULL)
                    274:                fatal("%s: BN_new", __func__);
                    275:
                    276:        /*
                    277:         * client: exponent = x2 * s mod p
                    278:         * server: exponent = x4 * s mod p
                    279:         */
                    280:        if (BN_mod_mul(exponent, mypriv2, s, grp->q, bn_ctx) != 1)
                    281:                fatal("%s: BN_mod_mul (exponent = mypriv2 * s mod p)",
                    282:                    __func__);
                    283:
                    284:        /*
                    285:         * client: tmp = g^(x1 + x3 + x4) mod p
                    286:         * server: tmp = g^(x1 + x2 + x3) mod p
                    287:         */
                    288:        if (BN_mod_mul(tmp, mypub1, theirpub1, grp->p, bn_ctx) != 1)
                    289:                fatal("%s: BN_mod_mul (tmp = mypub1 * theirpub1 mod p)",
                    290:                    __func__);
                    291:        if (BN_mod_mul(tmp, tmp, theirpub2, grp->p, bn_ctx) != 1)
                    292:                fatal("%s: BN_mod_mul (tmp = tmp * theirpub2 mod p)", __func__);
                    293:
                    294:        /*
                    295:         * client: a = tmp^exponent = g^((x1+x3+x4) * x2 * s) mod p
                    296:         * server: b = tmp^exponent = g^((x1+x2+x3) * x4 * s) mod p
                    297:         */
                    298:        if (BN_mod_exp(*newpub, tmp, exponent, grp->p, bn_ctx) != 1)
                    299:                fatal("%s: BN_mod_mul (newpub = tmp^exponent mod p)", __func__);
                    300:
                    301:        JPAKE_DEBUG_BN((tmp, "%s: tmp = ", __func__));
                    302:        JPAKE_DEBUG_BN((exponent, "%s: exponent = ", __func__));
                    303:
                    304:        /* Note the generator here is 'tmp', not g */
1.2       djm       305:        if (schnorr_sign_buf(grp->p, grp->q, tmp, exponent, *newpub,
1.1       djm       306:            myid, myid_len,
                    307:            newpub_exponent_proof, newpub_exponent_proof_len) != 0)
                    308:                fatal("%s: schnorr_sign newpub", __func__);
                    309:
                    310:        BN_clear_free(tmp); /* XXX stash for later use? */
                    311:        BN_clear_free(exponent); /* XXX stash for later use? (yes, in conf) */
                    312:
                    313:        BN_CTX_free(bn_ctx);
                    314: }
                    315:
                    316: /* Confirmation hash calculation */
                    317: void
                    318: jpake_confirm_hash(const BIGNUM *k,
                    319:     const u_char *endpoint_id, u_int endpoint_id_len,
                    320:     const u_char *sess_id, u_int sess_id_len,
                    321:     u_char **confirm_hash, u_int *confirm_hash_len)
                    322: {
                    323:        Buffer b;
                    324:
                    325:        /*
                    326:         * Calculate confirmation proof:
                    327:         *     client: H(k || client_id || session_id)
                    328:         *     server: H(k || server_id || session_id)
                    329:         */
                    330:        buffer_init(&b);
                    331:        buffer_put_bignum2(&b, k);
                    332:        buffer_put_string(&b, endpoint_id, endpoint_id_len);
                    333:        buffer_put_string(&b, sess_id, sess_id_len);
                    334:        if (hash_buffer(buffer_ptr(&b), buffer_len(&b), EVP_sha256(),
                    335:            confirm_hash, confirm_hash_len) != 0)
                    336:                fatal("%s: hash_buffer", __func__);
                    337:        buffer_free(&b);
                    338: }
                    339:
                    340: /* Shared parts of key derivation and confirmation calculation */
                    341: void
1.2       djm       342: jpake_key_confirm(struct modp_group *grp, BIGNUM *s, BIGNUM *step2_val,
1.1       djm       343:     BIGNUM *mypriv2, BIGNUM *mypub1, BIGNUM *mypub2,
                    344:     BIGNUM *theirpub1, BIGNUM *theirpub2,
                    345:     const u_char *my_id, u_int my_id_len,
                    346:     const u_char *their_id, u_int their_id_len,
                    347:     const u_char *sess_id, u_int sess_id_len,
                    348:     const u_char *theirpriv2_s_proof, u_int theirpriv2_s_proof_len,
                    349:     BIGNUM **k,
                    350:     u_char **confirm_hash, u_int *confirm_hash_len)
                    351: {
                    352:        BN_CTX *bn_ctx;
                    353:        BIGNUM *tmp;
                    354:
                    355:        if ((bn_ctx = BN_CTX_new()) == NULL)
                    356:                fatal("%s: BN_CTX_new", __func__);
                    357:        if ((tmp = BN_new()) == NULL ||
                    358:            (*k = BN_new()) == NULL)
                    359:                fatal("%s: BN_new", __func__);
                    360:
                    361:        /* Validate step 2 values */
                    362:        if (BN_cmp(step2_val, BN_value_one()) <= 0)
                    363:                fatal("%s: step2_val <= 1", __func__);
                    364:
                    365:        /*
                    366:         * theirpriv2_s_proof is calculated with a different generator:
                    367:         * tmp = g^(mypriv1+mypriv2+theirpub1) = g^mypub1*g^mypub2*g^theirpub1
                    368:         * Calculate it here so we can check the signature.
                    369:         */
                    370:        if (BN_mod_mul(tmp, mypub1, mypub2, grp->p, bn_ctx) != 1)
                    371:                fatal("%s: BN_mod_mul (tmp = mypub1 * mypub2 mod p)", __func__);
                    372:        if (BN_mod_mul(tmp, tmp, theirpub1, grp->p, bn_ctx) != 1)
                    373:                fatal("%s: BN_mod_mul (tmp = tmp * theirpub1 mod p)", __func__);
                    374:
                    375:        JPAKE_DEBUG_BN((tmp, "%s: tmp = ", __func__));
                    376:
1.2       djm       377:        if (schnorr_verify_buf(grp->p, grp->q, tmp, step2_val,
1.1       djm       378:            their_id, their_id_len,
                    379:            theirpriv2_s_proof, theirpriv2_s_proof_len) != 1)
                    380:                fatal("%s: schnorr_verify theirpriv2_s_proof failed", __func__);
                    381:
                    382:        /*
                    383:         * Derive shared key:
                    384:         *     client: k = (b / g^(x2*x4*s))^x2 = g^((x1+x3)*x2*x4*s)
                    385:         *     server: k = (a / g^(x2*x4*s))^x4 = g^((x1+x3)*x2*x4*s)
                    386:         *
                    387:         * Computed as:
                    388:         *     client: k = (g_x4^(q - (x2 * s)) * b)^x2 mod p
                    389:         *     server: k = (g_x2^(q - (x4 * s)) * b)^x4 mod p
                    390:         */
                    391:        if (BN_mul(tmp, mypriv2, s, bn_ctx) != 1)
                    392:                fatal("%s: BN_mul (tmp = mypriv2 * s)", __func__);
                    393:        if (BN_mod_sub(tmp, grp->q, tmp, grp->q, bn_ctx) != 1)
                    394:                fatal("%s: BN_mod_sub (tmp = q - tmp mod q)", __func__);
                    395:        if (BN_mod_exp(tmp, theirpub2, tmp, grp->p, bn_ctx) != 1)
                    396:                fatal("%s: BN_mod_exp (tmp = theirpub2^tmp) mod p", __func__);
                    397:        if (BN_mod_mul(tmp, tmp, step2_val, grp->p, bn_ctx) != 1)
                    398:                fatal("%s: BN_mod_mul (tmp = tmp * step2_val) mod p", __func__);
                    399:        if (BN_mod_exp(*k, tmp, mypriv2, grp->p, bn_ctx) != 1)
                    400:                fatal("%s: BN_mod_exp (k = tmp^mypriv2) mod p", __func__);
                    401:
                    402:        BN_CTX_free(bn_ctx);
                    403:        BN_clear_free(tmp);
                    404:
                    405:        jpake_confirm_hash(*k, my_id, my_id_len, sess_id, sess_id_len,
                    406:            confirm_hash, confirm_hash_len);
                    407: }
                    408:
                    409: /*
                    410:  * Calculate and check confirmation hash from peer. Returns 1 on success
                    411:  * 0 on failure/mismatch.
                    412:  */
                    413: int
                    414: jpake_check_confirm(const BIGNUM *k,
                    415:     const u_char *peer_id, u_int peer_id_len,
                    416:     const u_char *sess_id, u_int sess_id_len,
                    417:     const u_char *peer_confirm_hash, u_int peer_confirm_hash_len)
                    418: {
                    419:        u_char *expected_confirm_hash;
                    420:        u_int expected_confirm_hash_len;
                    421:        int success = 0;
                    422:
                    423:        /* Calculate and verify expected confirmation hash */
                    424:        jpake_confirm_hash(k, peer_id, peer_id_len, sess_id, sess_id_len,
                    425:            &expected_confirm_hash, &expected_confirm_hash_len);
                    426:
                    427:        JPAKE_DEBUG_BUF((expected_confirm_hash, expected_confirm_hash_len,
                    428:            "%s: expected confirm hash", __func__));
                    429:        JPAKE_DEBUG_BUF((peer_confirm_hash, peer_confirm_hash_len,
                    430:            "%s: received confirm hash", __func__));
                    431:
                    432:        if (peer_confirm_hash_len != expected_confirm_hash_len)
                    433:                error("%s: confirmation length mismatch (my %u them %u)",
                    434:                    __func__, expected_confirm_hash_len, peer_confirm_hash_len);
1.3     ! djm       435:        else if (timing_safe_cmp(peer_confirm_hash, expected_confirm_hash,
1.1       djm       436:            expected_confirm_hash_len) == 0)
                    437:                success = 1;
                    438:        bzero(expected_confirm_hash, expected_confirm_hash_len);
                    439:        xfree(expected_confirm_hash);
                    440:        debug3("%s: success = %d", __func__, success);
                    441:        return success;
                    442: }
                    443:
                    444: /* XXX main() function with tests */
                    445:
                    446: #endif /* JPAKE */
                    447: