diff -3Nur ssh-1.2.27-fresh/ssh_auth_sc.c ssh-1.2.27/ssh_auth_sc.c
--- ssh-1.2.27-fresh/ssh_auth_sc.c	Wed Dec 31 19:00:00 1969
+++ ssh-1.2.27/ssh_auth_sc.c	Fri Jul 21 13:16:58 2000
@@ -0,0 +1,180 @@
+#ifdef SC_SSH
+
+#include "ssh_sc.h"
+#include "ssh.h"
+#include "scrw.h"
+#include "ssh.h"
+
+extern int fdsc;
+char *appletID = "CITI-ssh";
+
+/*
+void printMPInt (FILE * fd, MP_INT * mpint, char * msg)
+{
+  int i0;
+  printf ("\n-------Printing %s-------\n", msg);
+  printf ("_mp_alloc=%d, _mp_size=%d\n",
+	  mpint->_mp_alloc, mpint->_mp_size);
+  //for (i0=0; i0<mpint->_mp_alloc; i0++)
+  for (i0=0; i0<mpint->_mp_size; i0++)
+    printf (" %x", mpint->_mp_d[i0]);
+  printf ("\n");
+}
+*/
+
+
+/* void openPort (int argc, char * argv[]) */
+void openPort (int port)
+{
+  char buf[BUFLEN];
+  int err;
+  /* NI */
+  int r1 = 0, r2 = 0, cla = 0; 
+
+  debug ("opening port %d....\n", port);
+  
+  if (port<0 || 1<port){
+    debug ("port# should be 0 or 1.\n");
+    return;
+  }
+    
+  /* fdsc = scopen(port-1, SCODSR, NULL); */
+  fdsc = scopen(port, SCODSR, NULL);
+  if (fdsc < 0) {
+    debug ("can't open port %d\n", port);
+    return;
+  }
+  
+  scxreset(fdsc, 0, buf, &err);
+  if (err != SCEOK) {
+    debug ("%s\n", scerrtab[err]);
+    scclose (fdsc);
+    fdsc = -1;
+    return;
+  }
+
+  debug ("port opened\n");
+
+  /* figure out what the class byte for this card is */
+  scwrite(fdsc,  0x00, 0x2a, 0x00, 0x00, 0x00, NULL, &r1, &r2);
+  if (r1 == 0x63) cla = 0x00; /* 00 card */
+  else if (r1 == 0x6d) cla = 0xf0; /* f0 card */
+  else {
+    printf("trying to figure out if this is 00 or f0 card: ");
+    print_r1r2 (r1, r2); 
+    return;
+  }
+
+#ifdef NIXX
+  /* select applet */
+  scwrite (fdsc, cla, 0xa4, 0x04, 0x00, strlen (appletID),
+		appletID, &r1, &r2);
+  if (r1 != 0x90 && r1 != 0x61) {
+    /* error */
+    printf("selecting applet %s failed: ", appletID);
+    print_r1r2(r1, r2);
+  }
+#endif /* NIXX */
+
+  debug ("applet selected\n");
+}
+
+
+int load_public_key_sc (MP_INT * pub_n)
+{
+  short numBytes;
+  int r1, r2;
+  unsigned char buf[256];
+
+  /* is reader opened? */
+  if (fdsc < 0){
+    debug ("Reader not opened\n");
+    return 0;
+  }
+  
+  /* get key size */
+  if (scread(fdsc, CLA, GET_KEYLENGTH, 0, 0, 2, buf, &r1, &r2)==-1){
+      debug ("couldn't obtain key length\n");
+      return 0;
+  }
+  numBytes = (buf[0] << 8 | buf[1]) / 8;
+
+  debug ("keysize = %d", numBytes*8);
+
+  if (scread(fdsc, CLA, GET_PUBKEY, 0, 0, numBytes, buf, &r1, &r2)==-1)
+    return 0;
+
+  /* dump_reply (buf, numBytes, r1, r2); */
+  /*
+  pub_n->_mp_alloc = (numBytes/4)+1;
+  pub_n->_mp_d = (mp_limb_t *) malloc (sizeof(mp_limb_t) * pub_n->_mp_alloc);
+  putBufToMPInt (buf, pub_n, numBytes);
+  */
+
+  mpz_init(pub_n);
+  mp_unlinearize_msb_first (pub_n, buf, numBytes);
+  return 1;
+}
+
+int try_rsa_authentication_sc()
+{
+  MP_INT challenge;
+  MP_INT pub_n;  /* modulus of key */
+  int type, rv;
+  /* NI */
+  struct termios tio;
+
+  /* Try to load identification for the authentication key. */
+
+  rv = load_public_key_sc (&pub_n);
+
+  if (! rv) {
+    debug ("Can't obtain public key from card\n");
+    return 0;  /* Could not load it.  Fail. */
+  }
+  /* Tell the server that we are willing to authenticate using this key. */
+  packet_start(SSH_CMSG_AUTH_RSA);
+  /* printf ("\n------------printing n......\n"); */
+  packet_put_mp_int(&pub_n);
+  /* printf ("\n------------printing n done\n"); */
+  /* printMPInt (stdout, &pub_n, "pub_n"); */
+  mpz_clear(&pub_n);  /* We no longer need the public key. */
+  packet_send();
+  packet_write_wait();
+
+  switch (type = packet_read()) {  /* Wait for server'sr esponse. */
+  case SSH_SMSG_AUTH_RSA_CHALLENGE: /* Get the challenge from the packet. */
+    mpz_init(&challenge);
+    packet_get_mp_int(&challenge);
+    debug("Received RSA challenge from server.");
+    break;
+  case SSH_SMSG_FAILURE:
+    /* Server doesn't like our key or doesn't support RSA authentication. */
+    debug("Server refused our key.");
+    return 0; /* Server refuses to authenticate with this key. */
+  default:
+    packet_disconnect("Protocol error during RSA authentication: %d", type);
+  }
+
+  /* Compute and send a response to the challenge. */
+  respond_to_rsa_challenge(&challenge, NULL);
+
+  scclose (fdsc);
+  debug ("try_rsa_authentication_sc() : tcgetattr returns %d\n", tcgetattr(0, &tio));
+  
+  mpz_clear(&challenge);  /* We no longer need the challenge. */
+
+
+  switch (type = packet_read()) {  /* Wait for response from the server. */
+  case SSH_SMSG_SUCCESS:
+    debug("RSA authentication accepted by server.");
+    return 1;
+  case SSH_SMSG_FAILURE:
+    debug("RSA authentication refused.");
+    return 0;
+  default:
+    packet_disconnect("Protocol error waiting RSA auth response: %d", type);
+  }
+}
+     
+#endif SC_SSH
