]> andersk Git - openssh.git/blobdiff - cipher.c
- (tim) [configure.ac] Bug #1149. Changes in QNX section only. Patch by
[openssh.git] / cipher.c
index df46c01753d836385aa7e7f0a5c8da8d8bc23ede..1434d5524029a7743f93319c384c3f6c6c426961 100644 (file)
--- a/cipher.c
+++ b/cipher.c
@@ -35,7 +35,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: cipher.c,v 1.74 2005/05/23 23:32:46 djm Exp $");
+RCSID("$OpenBSD: cipher.c,v 1.77 2005/07/16 01:35:24 djm Exp $");
 
 #include "xmalloc.h"
 #include "log.h"
@@ -43,6 +43,9 @@ RCSID("$OpenBSD: cipher.c,v 1.74 2005/05/23 23:32:46 djm Exp $");
 
 #include <openssl/md5.h>
 
+/* compatibility with old or broken OpenSSL versions */
+#include "openbsd-compat/openssl-compat.h"
+
 extern const EVP_CIPHER *evp_ssh1_bf(void);
 extern const EVP_CIPHER *evp_ssh1_3des(void);
 extern void ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int);
@@ -235,7 +238,7 @@ cipher_init(CipherContext *cc, Cipher *cipher,
                fatal("cipher_init: EVP_CipherInit failed for %s",
                    cipher->name);
        klen = EVP_CIPHER_CTX_key_length(&cc->evp);
-       if (klen > 0 && keylen != klen) {
+       if (klen > 0 && keylen != (u_int)klen) {
                debug2("cipher_init: set keylen (%d -> %d)", klen, keylen);
                if (EVP_CIPHER_CTX_set_key_length(&cc->evp, keylen) == 0)
                        fatal("cipher_init: set keylen failed (%d -> %d)",
@@ -246,7 +249,7 @@ cipher_init(CipherContext *cc, Cipher *cipher,
                    cipher->name);
 #endif
 
-       if (cipher->discard_len > 0) {          
+       if (cipher->discard_len > 0) {
                junk = xmalloc(cipher->discard_len);
                discard = xmalloc(cipher->discard_len);
                if (EVP_Cipher(&cc->evp, discard, junk,
@@ -326,12 +329,12 @@ cipher_get_keyiv(CipherContext *cc, u_char *iv, u_int len)
        case SSH_CIPHER_DES:
        case SSH_CIPHER_BLOWFISH:
                evplen = EVP_CIPHER_CTX_iv_length(&cc->evp);
-               if (evplen == 0)
+               if (evplen <= 0)
                        return;
-               if (evplen != len)
+               if ((u_int)evplen != len)
                        fatal("%s: wrong iv length %d != %d", __func__,
                            evplen, len);
-#if OPENSSL_VERSION_NUMBER < 0x00907000L
+#ifdef USE_BUILTIN_RIJNDAEL
                if (c->evptype == evp_rijndael)
                        ssh_rijndael_iv(&cc->evp, 0, iv, len);
                else
@@ -362,7 +365,7 @@ cipher_set_keyiv(CipherContext *cc, u_char *iv)
                evplen = EVP_CIPHER_CTX_iv_length(&cc->evp);
                if (evplen == 0)
                        return;
-#if OPENSSL_VERSION_NUMBER < 0x00907000L
+#ifdef USE_BUILTIN_RIJNDAEL
                if (c->evptype == evp_rijndael)
                        ssh_rijndael_iv(&cc->evp, 1, iv, evplen);
                else
This page took 0.043964 seconds and 4 git commands to generate.