summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1999-09-29 06:15:01 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1999-09-29 06:15:01 +0000
commit6dc7bd1624a8cff4b2322ebdd254d8e95977f9bf (patch)
tree398f48ac0bfbe52f03769dd10c540a0d6237d0fe
parent1c8ddcef3bd43f4841daaa2619ab0cb31c23bebc (diff)
test for RSA in the ssl library, real early on
-rw-r--r--usr.bin/ssh/rsa.c15
-rw-r--r--usr.bin/ssh/rsa.h10
-rw-r--r--usr.bin/ssh/ssh-add.c12
-rw-r--r--usr.bin/ssh/ssh-agent.c12
-rw-r--r--usr.bin/ssh/ssh-keygen.c12
-rw-r--r--usr.bin/ssh/ssh.c12
-rw-r--r--usr.bin/ssh/sshd.c8
7 files changed, 71 insertions, 10 deletions
diff --git a/usr.bin/ssh/rsa.c b/usr.bin/ssh/rsa.c
index f578e631184..2b3d565ac33 100644
--- a/usr.bin/ssh/rsa.c
+++ b/usr.bin/ssh/rsa.c
@@ -35,7 +35,7 @@ Description of the RSA algorithm can be found e.g. from the following sources:
*/
#include "includes.h"
-RCSID("$Id: rsa.c,v 1.1 1999/09/28 04:45:37 provos Exp $");
+RCSID("$Id: rsa.c,v 1.2 1999/09/29 06:15:00 deraadt Exp $");
#include "rsa.h"
#include "ssh.h"
@@ -43,6 +43,19 @@ RCSID("$Id: rsa.c,v 1.1 1999/09/28 04:45:37 provos Exp $");
int rsa_verbose = 1;
+int
+rsa_alive()
+{
+ RSA *key;
+ extern char *__progname;
+
+ key = RSA_generate_key(32, 3, NULL, NULL);
+ if (key == NULL)
+ return (0);
+ RSA_free(key);
+ return (1);
+}
+
/* Generates RSA public and private keys. This initializes the data
structures; they should be freed with rsa_clear_private_key and
rsa_clear_public_key. */
diff --git a/usr.bin/ssh/rsa.h b/usr.bin/ssh/rsa.h
index a775c824fce..a1023a2a0c4 100644
--- a/usr.bin/ssh/rsa.h
+++ b/usr.bin/ssh/rsa.h
@@ -13,7 +13,7 @@ RSA key generation, encryption and decryption.
*/
-/* RCSID("$Id: rsa.h,v 1.1 1999/09/28 04:45:37 provos Exp $"); */
+/* RCSID("$Id: rsa.h,v 1.2 1999/09/29 06:15:00 deraadt Exp $"); */
#ifndef RSA_H
#define RSA_H
@@ -26,9 +26,11 @@ void rsa_generate_key(RSA *prv, RSA *pub, unsigned int bits);
/* Indicates whether the rsa module is permitted to show messages on
the terminal. */
-void rsa_set_verbose(int verbose);
+void rsa_set_verbose __P((int verbose));
-void rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *prv);
-void rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *prv);
+int rsa_alive __P((void));
+
+void rsa_public_encrypt __P((BIGNUM *out, BIGNUM *in, RSA *prv));
+void rsa_private_decrypt __P((BIGNUM *out, BIGNUM *in, RSA *prv));
#endif /* RSA_H */
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c
index d2c6547badc..f5cd92ba159 100644
--- a/usr.bin/ssh/ssh-add.c
+++ b/usr.bin/ssh/ssh-add.c
@@ -14,7 +14,7 @@ Adds an identity to the authentication server, or removes an identity.
*/
#include "includes.h"
-RCSID("$Id: ssh-add.c,v 1.2 1999/09/28 04:45:37 provos Exp $");
+RCSID("$Id: ssh-add.c,v 1.3 1999/09/29 06:15:00 deraadt Exp $");
#include "rsa.h"
#include "ssh.h"
@@ -216,6 +216,16 @@ main(int ac, char **av)
int i;
int deleting = 0;
+ /* check if RSA support exists */
+ if (rsa_alive() == 0) {
+ extern char *__progname;
+
+ fprintf(stderr,
+ "%s: no RSA support in libssl and libcrypto. See ssl(8).\n",
+ __progname);
+ exit(1);
+ }
+
for (i = 1; i < ac; i++)
{
if (strcmp(av[i], "-l") == 0)
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index 80f855f895c..28713f2ba70 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -14,7 +14,7 @@ The authentication agent program.
*/
#include "includes.h"
-RCSID("$Id: ssh-agent.c,v 1.2 1999/09/28 04:45:37 provos Exp $");
+RCSID("$Id: ssh-agent.c,v 1.3 1999/09/29 06:15:00 deraadt Exp $");
#include "ssh.h"
#include "rsa.h"
@@ -539,6 +539,16 @@ main(int ac, char **av)
int sockets[2], i;
int *dups;
+ /* check if RSA support exists */
+ if (rsa_alive() == 0) {
+ extern char *__progname;
+
+ fprintf(stderr,
+ "%s: no RSA support in libssl and libcrypto. See ssl(8).\n",
+ __progname);
+ exit(1);
+ }
+
if (ac < 2)
{
fprintf(stderr, "ssh-agent version %s\n", SSH_VERSION);
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index cd38b8e2a22..7bae7da4e68 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -14,7 +14,7 @@ Identity and host key generation and maintenance.
*/
#include "includes.h"
-RCSID("$Id: ssh-keygen.c,v 1.3 1999/09/28 19:42:05 deraadt Exp $");
+RCSID("$Id: ssh-keygen.c,v 1.4 1999/09/29 06:15:00 deraadt Exp $");
#ifndef HAVE_GETHOSTNAME
#include <sys/utsname.h>
@@ -322,6 +322,16 @@ main(int ac, char **av)
extern int optind;
extern char *optarg;
+ /* check if RSA support exists */
+ if (rsa_alive() == 0) {
+ extern char *__progname;
+
+ fprintf(stderr,
+ "%s: no RSA support in libssl and libcrypto. See ssl(8).\n",
+ __progname);
+ exit(1);
+ }
+
/* Get user\'s passwd structure. We need this for the home directory. */
pw = getpwuid(getuid());
if (!pw)
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 018dda25347..842d97abf31 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -18,7 +18,7 @@ Modified to work with SSL by Niels Provos <provos@citi.umich.edu> in Canada.
*/
#include "includes.h"
-RCSID("$Id: ssh.c,v 1.4 1999/09/29 00:10:16 deraadt Exp $");
+RCSID("$Id: ssh.c,v 1.5 1999/09/29 06:15:00 deraadt Exp $");
#include "xmalloc.h"
#include "ssh.h"
@@ -422,6 +422,16 @@ main(int ac, char **av)
if (!host)
usage();
+ /* check if RSA support exists */
+ if (rsa_alive() == 0) {
+ extern char *__progname;
+
+ fprintf(stderr,
+ "%s: no RSA support in libssl and libcrypto. See ssl(8).\n",
+ __progname);
+ exit(1);
+ }
+
/* Initialize the command to execute on remote host. */
buffer_init(&command);
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index 326aab63d49..ca3bc508e13 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -18,7 +18,7 @@ agent connections.
*/
#include "includes.h"
-RCSID("$Id: sshd.c,v 1.2 1999/09/28 04:45:37 provos Exp $");
+RCSID("$Id: sshd.c,v 1.3 1999/09/29 06:15:00 deraadt Exp $");
#include "xmalloc.h"
#include "rsa.h"
@@ -268,6 +268,12 @@ main(int ac, char **av)
else
av0 = av[0];
+ /* check if RSA support exists */
+ if (rsa_alive() == 0) {
+ log("no RSA support in libssl and libcrypto -- exiting. See ssl(8)");
+ exit(1);
+ }
+
/* Initialize configuration options to their default values. */
initialize_server_options(&options);