OpenSSH 3.9.1 fix for IRIX 5.3 cc

Georg Schwarz geos at epost.de
Sun Oct 17 21:43:39 EST 2004


Hi,

the following patch to cipher.c enables OpenSSH 3.9.1 to compile on IRIX 5.3 with the native IDO cc:

--- cipher.c.orig       2004-10-17 12:04:10.000000000 +0200
+++ cipher.c    2004-10-17 13:43:22.000000000 +0200
@@ -76,15 +76,15 @@
        u_int   key_len;
        const EVP_CIPHER        *(*evptype)(void);
 } ciphers[] = {
-       { "none",               SSH_CIPHER_NONE, 8, 0, EVP_enc_null },
-       { "des",                SSH_CIPHER_DES, 8, 8, EVP_des_cbc },
+       { "none",               SSH_CIPHER_NONE, 8, 0, (const EVP_CIPHER        *(*)(void)) EVP_enc_null },
+       { "des",                SSH_CIPHER_DES, 8, 8, (const EVP_CIPHER *(*)(void)) EVP_des_cbc },
        { "3des",               SSH_CIPHER_3DES, 8, 16, evp_ssh1_3des },
        { "blowfish",           SSH_CIPHER_BLOWFISH, 8, 32, evp_ssh1_bf },
 
-       { "3des-cbc",           SSH_CIPHER_SSH2, 8, 24, EVP_des_ede3_cbc },
-       { "blowfish-cbc",       SSH_CIPHER_SSH2, 8, 16, EVP_bf_cbc },
-       { "cast128-cbc",        SSH_CIPHER_SSH2, 8, 16, EVP_cast5_cbc },
-       { "arcfour",            SSH_CIPHER_SSH2, 8, 16, EVP_rc4 },
+       { "3des-cbc",           SSH_CIPHER_SSH2, 8, 24, (const EVP_CIPHER *(*)(void)) EVP_des_ede3_cbc },
+       { "blowfish-cbc",       SSH_CIPHER_SSH2, 8, 16, (const EVP_CIPHER *(*)(void)) EVP_bf_cbc },
+       { "cast128-cbc",        SSH_CIPHER_SSH2, 8, 16, (const EVP_CIPHER *(*)(void)) EVP_cast5_cbc },
+       { "arcfour",            SSH_CIPHER_SSH2, 8, 16, (const EVP_CIPHER *(*)(void)) EVP_rc4 },
 #if OPENSSL_VERSION_NUMBER < 0x00907000L
        { "aes128-cbc",         SSH_CIPHER_SSH2, 16, 16, evp_rijndael },
        { "aes192-cbc",         SSH_CIPHER_SSH2, 16, 24, evp_rijndael },
@@ -92,11 +92,11 @@
        { "rijndael-cbc at lysator.liu.se",
                                SSH_CIPHER_SSH2, 16, 32, evp_rijndael },
 #else
-       { "aes128-cbc",         SSH_CIPHER_SSH2, 16, 16, EVP_aes_128_cbc },
-       { "aes192-cbc",         SSH_CIPHER_SSH2, 16, 24, EVP_aes_192_cbc },
-       { "aes256-cbc",         SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
+       { "aes128-cbc",         SSH_CIPHER_SSH2, 16, 16, (const EVP_CIPHER *(*)(void)) EVP_aes_128_cbc },
+       { "aes192-cbc",         SSH_CIPHER_SSH2, 16, 24, (const EVP_CIPHER *(*)(void)) EVP_aes_192_cbc },
+       { "aes256-cbc",         SSH_CIPHER_SSH2, 16, 32, (const EVP_CIPHER *(*)(void)) EVP_aes_256_cbc },
        { "rijndael-cbc at lysator.liu.se",
-                               SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc },
+                               SSH_CIPHER_SSH2, 16, 32, (const EVP_CIPHER *(*)(void)) EVP_aes_256_cbc },
 #endif
 #if OPENSSL_VERSION_NUMBER >= 0x00905000L
        { "aes128-ctr",         SSH_CIPHER_SSH2, 16, 16, evp_aes_128_ctr },
@@ -104,7 +104,7 @@
        { "aes256-ctr",         SSH_CIPHER_SSH2, 16, 32, evp_aes_128_ctr },
 #endif
 #if defined(EVP_CTRL_SET_ACSS_MODE)
-       { "acss at openssh.org",   SSH_CIPHER_SSH2, 16, 5, EVP_acss },
+       { "acss at openssh.org",   SSH_CIPHER_SSH2, 16, 5, (const EVP_CIPHER *(*)(void)) EVP_acss },
 #endif
        { NULL,                 SSH_CIPHER_INVALID, 0, 0, NULL }
 };
@@ -415,7 +415,7 @@
        Cipher *c = cc->cipher;
        int plen = 0;
 
-       if (c->evptype == EVP_rc4 || c->evptype == EVP_acss) {
+       if (c->evptype == (const EVP_CIPHER *(*)(void)) EVP_rc4 || c->evptype == (const EVP_CIPHER *(*)(void)) EVP_acss) {
                plen = EVP_X_STATE_LEN(cc->evp);
                if (dat == NULL)
                        return (plen);
@@ -430,7 +430,7 @@
        Cipher *c = cc->cipher;
        int plen;
 
-       if (c->evptype == EVP_rc4 || c->evptype == EVP_acss) {
+       if (c->evptype == (const EVP_CIPHER *(*)(void)) EVP_rc4 || c->evptype == (const EVP_CIPHER *(*)(void)) EVP_acss) {
                plen = EVP_X_STATE_LEN(cc->evp);
                memcpy(EVP_X_STATE(cc->evp), dat, plen);
        }


This is because OpenSSL does not define these function pointers as const, and the IRIX 5.3 IDO cc is quite picky on such details and refuses to compile otherwise.

The second patch is for the same reason. While not strictly necessary here, it does away with some annoying warnings for the same reasons.

--- mac.c.orig  2004-10-17 12:39:46.000000000 +0200
+++ mac.c       2004-10-17 12:41:04.000000000 +0200
@@ -39,12 +39,12 @@
        const EVP_MD *  (*mdfunc)(void);
        int             truncatebits;   /* truncate digest if != 0 */
 } macs[] = {
-       { "hmac-sha1",                  EVP_sha1, 0, },
-       { "hmac-sha1-96",               EVP_sha1, 96 },
-       { "hmac-md5",                   EVP_md5, 0 },
-       { "hmac-md5-96",                EVP_md5, 96 },
-       { "hmac-ripemd160",             EVP_ripemd160, 0 },
-       { "hmac-ripemd160 at openssh.com", EVP_ripemd160, 0 },
+       { "hmac-sha1",                  (const EVP_MD *(*)(void)) EVP_sha1, 0, },
+       { "hmac-sha1-96",               (const EVP_MD *(*)(void)) EVP_sha1, 96 },
+       { "hmac-md5",                   (const EVP_MD *(*)(void)) EVP_md5, 0 },
+       { "hmac-md5-96",                (const EVP_MD *(*)(void)) EVP_md5, 96 },
+       { "hmac-ripemd160",             (const EVP_MD *(*)(void)) EVP_ripemd160, 0 },
+       { "hmac-ripemd160 at openssh.com", (const EVP_MD *(*)(void)) EVP_ripemd160, 0 },
        { NULL,                         NULL, 0 }
 };
 



This issue might apply to other non-gcc compilers as well.

I'd appreciate your feedback.

Georg

-- 
Georg Schwarz    http://home.pages.de/~schwarz/
 geos at epost.de     +49 177 8811442




More information about the openssh-unix-dev mailing list