- /* Allocate buffers for the challenge */
-
- if(!c->mychallenge)
- c->mychallenge = xmalloc(len);
-
- /* Convert the challenge from hexadecimal back to binary */
-
- hex2bin(buffer, c->mychallenge, len);
-
- c->allow_request = CHAL_REPLY;
-
- /* Rest is done by send_chal_reply() */
-
- return send_chal_reply(c);
-}
-
-int send_chal_reply(connection_t *c)
-{
- char hash[EVP_MAX_MD_SIZE * 2 + 1];
- EVP_MD_CTX ctx;
-
- cp();
-
- /* Calculate the hash from the challenge we received */
-
- EVP_DigestInit(&ctx, c->indigest);
- EVP_DigestUpdate(&ctx, c->mychallenge,
- RSA_size(myself->connection->rsa_key));
- EVP_DigestFinal(&ctx, hash, NULL);
-
- /* Convert the hash to a hexadecimal formatted string */
-
- bin2hex(hash, hash, c->indigest->md_size);
- hash[c->indigest->md_size * 2] = '\0';
-
- /* Send the reply */
-
- return send_request(c, "%d %s", CHAL_REPLY, hash);
-}
-
-int chal_reply_h(connection_t *c)
-{
- char hishash[MAX_STRING_SIZE];
- char myhash[EVP_MAX_MD_SIZE];
- EVP_MD_CTX ctx;