]> andersk Git - openssh.git/blobdiff - ssh-agent.c
- markus@cvs.openbsd.org 2001/04/04 15:50:55
[openssh.git] / ssh-agent.c
index c23d73b7e0b38274e68922c0b27447872696d053..e8362ded0ed0c364637bb004e826cfc8b474231b 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ssh-agent.c,v 1.49 2001/01/29 19:47:31 markus Exp $   */
+/*     $OpenBSD: ssh-agent.c,v 1.54 2001/04/03 13:56:11 stevesk Exp $  */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -13,7 +13,7 @@
  * called by a name other than "ssh" or "Secure Shell".
  *
  * SSH2 implementation,
- * Copyright (c) 2000 Markus Friedl. All rights reserved.
+ * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -37,7 +37,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-agent.c,v 1.49 2001/01/29 19:47:31 markus Exp $");
+RCSID("$OpenBSD: ssh-agent.c,v 1.54 2001/04/03 13:56:11 stevesk Exp $");
 
 #include <openssl/evp.h>
 #include <openssl/md5.h>
@@ -360,25 +360,6 @@ process_remove_all_identities(SocketEntry *e, int version)
        return;
 }
 
-void
-generate_additional_parameters(RSA *rsa)
-{
-       BIGNUM *aux;
-       BN_CTX *ctx;
-       /* Generate additional parameters */
-       aux = BN_new();
-       ctx = BN_CTX_new();
-
-       BN_sub(aux, rsa->q, BN_value_one());
-       BN_mod(rsa->dmq1, rsa->d, aux, ctx);
-
-       BN_sub(aux, rsa->p, BN_value_one());
-       BN_mod(rsa->dmp1, rsa->d, aux, ctx);
-
-       BN_clear_free(aux);
-       BN_CTX_free(ctx);
-}
-
 void
 process_add_identity(SocketEntry *e, int version)
 {
@@ -582,9 +563,9 @@ prepare_select(fd_set **fdrp, fd_set **fdwp, int *fdl)
        sz = howmany(n+1, NFDBITS) * sizeof(fd_mask);
        if (*fdrp == NULL || n > *fdl) {
                if (*fdrp)
-                       free(*fdrp);
+                       xfree(*fdrp);
                if (*fdwp)
-                       free(*fdwp);
+                       xfree(*fdwp);
                *fdrp = xmalloc(sz);
                *fdwp = xmalloc(sz);
                *fdl = n;
@@ -635,9 +616,15 @@ after_select(fd_set *readset, fd_set *writeset)
                case AUTH_CONNECTION:
                        if (buffer_len(&sockets[i].output) > 0 &&
                            FD_ISSET(sockets[i].fd, writeset)) {
-                               len = write(sockets[i].fd,
-                                   buffer_ptr(&sockets[i].output),
-                                   buffer_len(&sockets[i].output));
+                               do {
+                                       len = write(sockets[i].fd,
+                                           buffer_ptr(&sockets[i].output),
+                                           buffer_len(&sockets[i].output));
+                                       if (len == -1 && (errno == EAGAIN ||
+                                           errno == EINTR))
+                                               continue;
+                                       break;
+                               } while (1);
                                if (len <= 0) {
                                        shutdown(sockets[i].fd, SHUT_RDWR);
                                        close(sockets[i].fd);
@@ -649,7 +636,13 @@ after_select(fd_set *readset, fd_set *writeset)
                                buffer_consume(&sockets[i].output, len);
                        }
                        if (FD_ISSET(sockets[i].fd, readset)) {
-                               len = read(sockets[i].fd, buf, sizeof(buf));
+                               do {
+                                       len = read(sockets[i].fd, buf, sizeof(buf));
+                                       if (len == -1 && (errno == EAGAIN ||
+                                           errno == EINTR))
+                                               continue;
+                                       break;
+                               } while (1);
                                if (len <= 0) {
                                        shutdown(sockets[i].fd, SHUT_RDWR);
                                        close(sockets[i].fd);
@@ -705,7 +698,7 @@ cleanup_handler(int sig)
 }
 
 void
-usage()
+usage(void)
 {
        fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION);
        fprintf(stderr, "Usage: %s [-c | -s] [-k] [command {args...]]\n",
@@ -726,8 +719,11 @@ main(int ac, char **av)
        extern int optind;
        fd_set *readsetp = NULL, *writesetp = NULL;
 
+       SSLeay_add_all_algorithms();
+
        __progname = get_progname(av[0]);
        init_rng();
+       seed_rng();
 
 #ifdef __GNU_LIBRARY__
        while ((ch = getopt(ac, av, "+cks")) != -1) {
This page took 0.084243 seconds and 4 git commands to generate.