diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2011-08-22 14:30:08 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-22 14:30:08 +0200 |
commit | 1e019fee43681ef5d47fb700099d6d4d9fdc0cc1 (patch) | |
tree | 994b1d8eae37681fbabb6e7c7324619d463acf47 /src/keys.c | |
parent | 4de452055952b89aa093f7b43d3a5e40c5f7bc68 (diff) | |
download | libssh-1e019fee43681ef5d47fb700099d6d4d9fdc0cc1.tar.gz libssh-1e019fee43681ef5d47fb700099d6d4d9fdc0cc1.tar.xz libssh-1e019fee43681ef5d47fb700099d6d4d9fdc0cc1.zip |
keys: Remove unused obsolete ssh_sign_session_id().
Diffstat (limited to 'src/keys.c')
-rw-r--r-- | src/keys.c | 95 |
1 files changed, 0 insertions, 95 deletions
@@ -484,101 +484,6 @@ ssh_string ssh_do_sign(ssh_session session, ssh_buffer sigbuf, return signature; } - -/* this function signs the session id */ -ssh_string ssh_sign_session_id(ssh_session session, ssh_private_key privatekey) { - struct ssh_crypto_struct *crypto=session->current_crypto ? session->current_crypto : - session->next_crypto; - unsigned char hash[SHA_DIGEST_LEN + 1] = {0}; - ssh_string signature = NULL; - SIGNATURE *sign = NULL; - SHACTX ctx = NULL; -#ifdef HAVE_LIBGCRYPT - gcry_sexp_t data_sexp; -#endif - - ctx = sha1_init(); - if (ctx == NULL) { - return NULL; - } - sha1_update(ctx,crypto->session_id,SHA_DIGEST_LEN); - sha1_final(hash + 1,ctx); - hash[0] = 0; - -#ifdef DEBUG_CRYPTO - ssh_print_hexa("Hash being signed with dsa",hash+1,SHA_DIGEST_LEN); -#endif - - sign = malloc(sizeof(SIGNATURE)); - if (sign == NULL) { - return NULL; - } - - switch(privatekey->type) { - case SSH_KEYTYPE_DSS: -#ifdef HAVE_LIBGCRYPT - if (gcry_sexp_build(&data_sexp, NULL, "%b", SHA_DIGEST_LEN + 1, hash) || - gcry_pk_sign(&sign->dsa_sign, data_sexp, privatekey->dsa_priv)) { - ssh_set_error(session, SSH_FATAL, "Signing: libgcrypt error"); - gcry_sexp_release(data_sexp); - signature_free(sign); - return NULL; - } -#elif defined HAVE_LIBCRYPTO - sign->dsa_sign = DSA_do_sign(hash + 1, SHA_DIGEST_LEN, - privatekey->dsa_priv); - if (sign->dsa_sign == NULL) { - ssh_set_error(session, SSH_FATAL, "Signing: openssl error"); - signature_free(sign); - return NULL; - } - -#ifdef DEBUG_CRYPTO - ssh_print_bignum("r",sign->dsa_sign->r); - ssh_print_bignum("s",sign->dsa_sign->s); -#endif - -#endif /* HAVE_LIBCRYPTO */ - sign->rsa_sign = NULL; - break; - case SSH_KEYTYPE_RSA: -#ifdef HAVE_LIBGCRYPT - if (gcry_sexp_build(&data_sexp, NULL, "(data(flags pkcs1)(hash sha1 %b))", - SHA_DIGEST_LEN, hash + 1) || - gcry_pk_sign(&sign->rsa_sign, data_sexp, privatekey->rsa_priv)) { - ssh_set_error(session, SSH_FATAL, "Signing: libgcrypt error"); - gcry_sexp_release(data_sexp); - signature_free(sign); - return NULL; - } -#elif defined HAVE_LIBCRYPTO - sign->rsa_sign = RSA_do_sign(hash + 1, SHA_DIGEST_LEN, - privatekey->rsa_priv); - if (sign->rsa_sign == NULL) { - ssh_set_error(session, SSH_FATAL, "Signing: openssl error"); - signature_free(sign); - return NULL; - } -#endif - sign->dsa_sign = NULL; - break; - default: - signature_free(sign); - return NULL; - } - -#ifdef HAVE_LIBGCRYPT - gcry_sexp_release(data_sexp); -#endif - - sign->type = privatekey->type; - - signature = signature_to_string(sign); - signature_free(sign); - - return signature; -} - /** @} */ /* vim: set ts=4 sw=4 et cindent: */ |