diff options
author | Ben Lindstrom <mouring@eviladmin.org> | 2002-03-08 03:50:57 +0000 |
---|---|---|
committer | Ben Lindstrom <mouring@eviladmin.org> | 2002-03-08 03:50:57 +0000 |
commit | 784e234c19fc474af3ac3b7f96fa2dcc9f6443be (patch) | |
tree | 73ee0f45ac2714865bd2cc4d6b59d1d2a8d643d5 | |
parent | 7577fd83c16ef3415b61ca1bea1b14e1ab8e4228 (diff) |
- (bal) Test for IRIX JOBS support at runtime. Patch provided
by David Kaelbling <drk@sgi.com>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | cipher.c | 33 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | openbsd-compat/port-irix.c | 27 |
4 files changed, 59 insertions, 11 deletions
@@ -17,7 +17,9 @@ | |||
17 | - (bal) Add in check for rpc/types.h since it is needed on | 17 | - (bal) Add in check for rpc/types.h since it is needed on |
18 | some platforms for INADDR_LOOPBACK. We should retest | 18 | some platforms for INADDR_LOOPBACK. We should retest |
19 | SCO 3 to see if this fixes their problem also. | 19 | SCO 3 to see if this fixes their problem also. |
20 | 20 | - (bal) Test for IRIX JOBS support at runtime. Patch provided | |
21 | by David Kaelbling <drk@sgi.com> | ||
22 | |||
21 | 20020305 | 23 | 20020305 |
22 | - stevesk@cvs.openbsd.org 2002/03/02 09:34:42 | 24 | - stevesk@cvs.openbsd.org 2002/03/02 09:34:42 |
23 | [LICENCE] | 25 | [LICENCE] |
@@ -7818,4 +7820,4 @@ | |||
7818 | - Wrote replacements for strlcpy and mkdtemp | 7820 | - Wrote replacements for strlcpy and mkdtemp |
7819 | - Released 1.0pre1 | 7821 | - Released 1.0pre1 |
7820 | 7822 | ||
7821 | $Id: ChangeLog,v 1.1915 2002/03/08 03:11:07 mouring Exp $ | 7823 | $Id: ChangeLog,v 1.1916 2002/03/08 03:50:57 mouring Exp $ |
@@ -41,6 +41,10 @@ RCSID("$OpenBSD: cipher.c,v 1.52 2002/02/18 13:05:32 markus Exp $"); | |||
41 | #include "log.h" | 41 | #include "log.h" |
42 | #include "cipher.h" | 42 | #include "cipher.h" |
43 | 43 | ||
44 | #if OPENSSL_VERSION_NUMBER <= 0x0090600fL | ||
45 | #define EVP_CIPHER_CTX_get_app_data(e) ((e)->app_data) | ||
46 | #endif | ||
47 | |||
44 | #include <openssl/md5.h> | 48 | #include <openssl/md5.h> |
45 | #include "rijndael.h" | 49 | #include "rijndael.h" |
46 | 50 | ||
@@ -196,6 +200,7 @@ cipher_init(CipherContext *cc, Cipher *cipher, | |||
196 | type = (*cipher->evptype)(); | 200 | type = (*cipher->evptype)(); |
197 | 201 | ||
198 | EVP_CIPHER_CTX_init(&cc->evp); | 202 | EVP_CIPHER_CTX_init(&cc->evp); |
203 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
199 | if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv, | 204 | if (EVP_CipherInit(&cc->evp, type, NULL, (u_char *)iv, |
200 | (encrypt == CIPHER_ENCRYPT)) == 0) | 205 | (encrypt == CIPHER_ENCRYPT)) == 0) |
201 | fatal("cipher_init: EVP_CipherInit failed for %s", | 206 | fatal("cipher_init: EVP_CipherInit failed for %s", |
@@ -210,6 +215,10 @@ cipher_init(CipherContext *cc, Cipher *cipher, | |||
210 | if (EVP_CipherInit(&cc->evp, NULL, (u_char *)key, NULL, -1) == 0) | 215 | if (EVP_CipherInit(&cc->evp, NULL, (u_char *)key, NULL, -1) == 0) |
211 | fatal("cipher_init: EVP_CipherInit: set key failed for %s", | 216 | fatal("cipher_init: EVP_CipherInit: set key failed for %s", |
212 | cipher->name); | 217 | cipher->name); |
218 | #else | ||
219 | EVP_CipherInit(&cc->evp, type, (u_char *)key, (u_char *)iv, | ||
220 | (encrypt == CIPHER_ENCRYPT)); | ||
221 | #endif | ||
213 | } | 222 | } |
214 | 223 | ||
215 | void | 224 | void |
@@ -217,15 +226,23 @@ cipher_crypt(CipherContext *cc, u_char *dest, const u_char *src, u_int len) | |||
217 | { | 226 | { |
218 | if (len % cc->cipher->block_size) | 227 | if (len % cc->cipher->block_size) |
219 | fatal("cipher_encrypt: bad plaintext length %d", len); | 228 | fatal("cipher_encrypt: bad plaintext length %d", len); |
229 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
220 | if (EVP_Cipher(&cc->evp, dest, (u_char *)src, len) == 0) | 230 | if (EVP_Cipher(&cc->evp, dest, (u_char *)src, len) == 0) |
221 | fatal("evp_crypt: EVP_Cipher failed"); | 231 | fatal("evp_crypt: EVP_Cipher failed"); |
232 | #else | ||
233 | EVP_Cipher(&cc->evp, dest, (u_char *)src, len); | ||
234 | #endif | ||
222 | } | 235 | } |
223 | 236 | ||
224 | void | 237 | void |
225 | cipher_cleanup(CipherContext *cc) | 238 | cipher_cleanup(CipherContext *cc) |
226 | { | 239 | { |
240 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
227 | if (EVP_CIPHER_CTX_cleanup(&cc->evp) == 0) | 241 | if (EVP_CIPHER_CTX_cleanup(&cc->evp) == 0) |
228 | error("cipher_cleanup: EVP_CIPHER_CTX_cleanup failed"); | 242 | error("cipher_cleanup: EVP_CIPHER_CTX_cleanup failed"); |
243 | #else | ||
244 | EVP_CIPHER_CTX_cleanup(&cc->evp); | ||
245 | #endif | ||
229 | } | 246 | } |
230 | 247 | ||
231 | /* | 248 | /* |
@@ -296,6 +313,7 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, | |||
296 | EVP_CIPHER_CTX_init(&c->k1); | 313 | EVP_CIPHER_CTX_init(&c->k1); |
297 | EVP_CIPHER_CTX_init(&c->k2); | 314 | EVP_CIPHER_CTX_init(&c->k2); |
298 | EVP_CIPHER_CTX_init(&c->k3); | 315 | EVP_CIPHER_CTX_init(&c->k3); |
316 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
299 | if (EVP_CipherInit(&c->k1, EVP_des_cbc(), k1, NULL, enc) == 0 || | 317 | if (EVP_CipherInit(&c->k1, EVP_des_cbc(), k1, NULL, enc) == 0 || |
300 | EVP_CipherInit(&c->k2, EVP_des_cbc(), k2, NULL, !enc) == 0 || | 318 | EVP_CipherInit(&c->k2, EVP_des_cbc(), k2, NULL, !enc) == 0 || |
301 | EVP_CipherInit(&c->k3, EVP_des_cbc(), k3, NULL, enc) == 0) { | 319 | EVP_CipherInit(&c->k3, EVP_des_cbc(), k3, NULL, enc) == 0) { |
@@ -304,6 +322,11 @@ ssh1_3des_init(EVP_CIPHER_CTX *ctx, const u_char *key, const u_char *iv, | |||
304 | EVP_CIPHER_CTX_set_app_data(ctx, NULL); | 322 | EVP_CIPHER_CTX_set_app_data(ctx, NULL); |
305 | return (0); | 323 | return (0); |
306 | } | 324 | } |
325 | #else | ||
326 | EVP_CipherInit(&c->k1, EVP_des_cbc(), k1, NULL, enc); | ||
327 | EVP_CipherInit(&c->k2, EVP_des_cbc(), k2, NULL, !enc); | ||
328 | EVP_CipherInit(&c->k3, EVP_des_cbc(), k3, NULL, enc); | ||
329 | #endif | ||
307 | return (1); | 330 | return (1); |
308 | } | 331 | } |
309 | static int | 332 | static int |
@@ -315,10 +338,16 @@ ssh1_3des_cbc(EVP_CIPHER_CTX *ctx, u_char *dest, const u_char *src, u_int len) | |||
315 | error("ssh1_3des_cbc: no context"); | 338 | error("ssh1_3des_cbc: no context"); |
316 | return (0); | 339 | return (0); |
317 | } | 340 | } |
341 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
318 | if (EVP_Cipher(&c->k1, dest, (u_char *)src, len) == 0 || | 342 | if (EVP_Cipher(&c->k1, dest, (u_char *)src, len) == 0 || |
319 | EVP_Cipher(&c->k2, dest, dest, len) == 0 || | 343 | EVP_Cipher(&c->k2, dest, dest, len) == 0 || |
320 | EVP_Cipher(&c->k3, dest, dest, len) == 0) | 344 | EVP_Cipher(&c->k3, dest, dest, len) == 0) |
321 | return (0); | 345 | return (0); |
346 | #else | ||
347 | EVP_Cipher(&c->k1, dest, (u_char *)src, len); | ||
348 | EVP_Cipher(&c->k2, dest, dest, len); | ||
349 | EVP_Cipher(&c->k3, dest, dest, len); | ||
350 | #endif | ||
322 | return (1); | 351 | return (1); |
323 | } | 352 | } |
324 | static int | 353 | static int |
@@ -346,7 +375,9 @@ evp_ssh1_3des(void) | |||
346 | ssh1_3des.init = ssh1_3des_init; | 375 | ssh1_3des.init = ssh1_3des_init; |
347 | ssh1_3des.cleanup = ssh1_3des_cleanup; | 376 | ssh1_3des.cleanup = ssh1_3des_cleanup; |
348 | ssh1_3des.do_cipher = ssh1_3des_cbc; | 377 | ssh1_3des.do_cipher = ssh1_3des_cbc; |
378 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
349 | ssh1_3des.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH; | 379 | ssh1_3des.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH; |
380 | #endif | ||
350 | return (&ssh1_3des); | 381 | return (&ssh1_3des); |
351 | } | 382 | } |
352 | 383 | ||
@@ -494,7 +525,9 @@ evp_rijndael(void) | |||
494 | rijndal_cbc.init = ssh_rijndael_init; | 525 | rijndal_cbc.init = ssh_rijndael_init; |
495 | rijndal_cbc.cleanup = ssh_rijndael_cleanup; | 526 | rijndal_cbc.cleanup = ssh_rijndael_cleanup; |
496 | rijndal_cbc.do_cipher = ssh_rijndael_cbc; | 527 | rijndal_cbc.do_cipher = ssh_rijndael_cbc; |
528 | #if OPENSSL_VERSION_NUMBER > 0x0090600fL | ||
497 | rijndal_cbc.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | | 529 | rijndal_cbc.flags = EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | |
498 | EVP_CIPH_ALWAYS_CALL_INIT; | 530 | EVP_CIPH_ALWAYS_CALL_INIT; |
531 | #endif | ||
499 | return (&rijndal_cbc); | 532 | return (&rijndal_cbc); |
500 | } | 533 | } |
diff --git a/configure.ac b/configure.ac index 5e4e659a9..413deb4d9 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | # $Id: configure.ac,v 1.24 2002/03/08 03:11:08 mouring Exp $ | 1 | # $Id: configure.ac,v 1.25 2002/03/08 03:50:58 mouring Exp $ |
2 | 2 | ||
3 | AC_INIT | 3 | AC_INIT |
4 | AC_CONFIG_SRCDIR([ssh.c]) | 4 | AC_CONFIG_SRCDIR([ssh.c]) |
@@ -115,7 +115,7 @@ case "$host" in | |||
115 | AC_DEFINE(WITH_IRIX_ARRAY) | 115 | AC_DEFINE(WITH_IRIX_ARRAY) |
116 | AC_DEFINE(WITH_IRIX_PROJECT) | 116 | AC_DEFINE(WITH_IRIX_PROJECT) |
117 | AC_DEFINE(WITH_IRIX_AUDIT) | 117 | AC_DEFINE(WITH_IRIX_AUDIT) |
118 | AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)]) | 118 | AC_DEFINE(WITH_IRIX_JOBS) |
119 | AC_DEFINE(BROKEN_INET_NTOA) | 119 | AC_DEFINE(BROKEN_INET_NTOA) |
120 | ;; | 120 | ;; |
121 | *-*-linux*) | 121 | *-*-linux*) |
diff --git a/openbsd-compat/port-irix.c b/openbsd-compat/port-irix.c index a63ec429a..bd03366f5 100644 --- a/openbsd-compat/port-irix.c +++ b/openbsd-compat/port-irix.c | |||
@@ -3,13 +3,20 @@ | |||
3 | #if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) | 3 | #if defined(WITH_IRIX_PROJECT) || defined(WITH_IRIX_JOBS) || defined(WITH_IRIX_ARRAY) |
4 | 4 | ||
5 | #ifdef WITH_IRIX_PROJECT | 5 | #ifdef WITH_IRIX_PROJECT |
6 | #include <proj.h> | 6 | # include <proj.h> |
7 | #endif /* WITH_IRIX_PROJECT */ | 7 | #endif /* WITH_IRIX_PROJECT */ |
8 | #ifdef WITH_IRIX_JOBS | 8 | #ifdef WITH_IRIX_JOBS |
9 | #include <sys/resource.h> | 9 | # include <sys/resource.h> |
10 | #endif | 10 | # include <optional_sym.h> |
11 | # if !defined(JLIMIT_CPU) | ||
12 | /* Simulate job limit support so we can still test for it at runtime. */ | ||
13 | typedef __int64_t jid_t; | ||
14 | extern jid_t jlimit_startjob(char *, uid_t, char *); | ||
15 | # pragma optional jlimit_startjob | ||
16 | # endif | ||
17 | #endif /* WITH_IRIX_JOBS */ | ||
11 | #ifdef WITH_IRIX_AUDIT | 18 | #ifdef WITH_IRIX_AUDIT |
12 | #include <sat.h> | 19 | # include <sat.h> |
13 | #endif /* WITH_IRIX_AUDIT */ | 20 | #endif /* WITH_IRIX_AUDIT */ |
14 | 21 | ||
15 | void | 22 | void |
@@ -27,10 +34,16 @@ irix_setusercontext(struct passwd *pw) | |||
27 | #endif /* WITH_IRIX_JOBS */ | 34 | #endif /* WITH_IRIX_JOBS */ |
28 | 35 | ||
29 | #ifdef WITH_IRIX_JOBS | 36 | #ifdef WITH_IRIX_JOBS |
30 | jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive"); | 37 | if (_MIPS_SYMBOL_PRESENT(jlimit_startjob)) { |
31 | if (jid == -1) | 38 | jid = jlimit_startjob(pw->pw_name, pw->pw_uid, "interactive"); |
32 | fatal("Failed to create job container: %.100s", | 39 | if (jid == -1) { |
40 | if (errno == ENOPKG) | ||
41 | jid = 0; | ||
42 | else | ||
43 | fatal("Failed to create job container: %.100s", | ||
33 | strerror(errno)); | 44 | strerror(errno)); |
45 | } | ||
46 | } | ||
34 | #endif /* WITH_IRIX_JOBS */ | 47 | #endif /* WITH_IRIX_JOBS */ |
35 | #ifdef WITH_IRIX_ARRAY | 48 | #ifdef WITH_IRIX_ARRAY |
36 | /* initialize array session */ | 49 | /* initialize array session */ |