I'm glad to know that Ultrix CC has a bug optimizing switch() statements
authormiod <miod@openbsd.org>
Wed, 23 Apr 2014 19:14:59 +0000 (19:14 +0000)
committermiod <miod@openbsd.org>
Wed, 23 Apr 2014 19:14:59 +0000 (19:14 +0000)
lacking an explicit `case 0:' construct. But Ultrix has been dead for more than
15 years, really. Don't give it any reason to move out of its coffin.

lib/libcrypto/bn/bn_lib.c
lib/libcrypto/rc4/rc4_enc.c
lib/libssl/src/crypto/bn/bn_lib.c
lib/libssl/src/crypto/rc4/rc4_enc.c

index b491c78..c8de547 100644 (file)
@@ -345,10 +345,6 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
                case 3: A[2]=B[2];
                case 2: A[1]=B[1];
                case 1: A[0]=B[0];
-               case 0: /* workaround for ultrix cc: without 'case 0', the optimizer does
-                        * the switch table by doing a=top&3; a--; goto jump_table[a];
-                        * which fails for top== 0 */
-                       ;
                        }
                }
 
@@ -500,7 +496,6 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
                case 3: A[2]=B[2];
                case 2: A[1]=B[1];
                case 1: A[0]=B[0];
-               case 0: ; /* ultrix cc workaround, see comments in bn_expand_internal */
                }
 #else
        memcpy(a->d,b->d,sizeof(b->d[0])*b->top);
index d8fc939..ec9d9e7 100644 (file)
@@ -189,11 +189,6 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
                                        case 3: otp |= RC4_STEP<<i, i-=8;
                                        case 2: otp |= RC4_STEP<<i, i-=8;
                                        case 1: otp |= RC4_STEP<<i, i-=8;
-                                       case 0: ; /*
-                                                  * it's never the case,
-                                                  * but it has to be here
-                                                  * for ultrix?
-                                                  */
                                        }
                                ochunk &= ~mask;
                                ochunk |= (otp^ichunk) & mask;
@@ -242,11 +237,6 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
                                        case 3: otp |= RC4_STEP<<i, i+=8;
                                        case 2: otp |= RC4_STEP<<i, i+=8;
                                        case 1: otp |= RC4_STEP<<i, i+=8;
-                                       case 0: ; /*
-                                                  * it's never the case,
-                                                  * but it has to be here
-                                                  * for ultrix?
-                                                  */
                                        }
                                ochunk &= ~mask;
                                ochunk |= (otp^ichunk) & mask;
index b491c78..c8de547 100644 (file)
@@ -345,10 +345,6 @@ static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
                case 3: A[2]=B[2];
                case 2: A[1]=B[1];
                case 1: A[0]=B[0];
-               case 0: /* workaround for ultrix cc: without 'case 0', the optimizer does
-                        * the switch table by doing a=top&3; a--; goto jump_table[a];
-                        * which fails for top== 0 */
-                       ;
                        }
                }
 
@@ -500,7 +496,6 @@ BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
                case 3: A[2]=B[2];
                case 2: A[1]=B[1];
                case 1: A[0]=B[0];
-               case 0: ; /* ultrix cc workaround, see comments in bn_expand_internal */
                }
 #else
        memcpy(a->d,b->d,sizeof(b->d[0])*b->top);
index d8fc939..ec9d9e7 100644 (file)
@@ -189,11 +189,6 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
                                        case 3: otp |= RC4_STEP<<i, i-=8;
                                        case 2: otp |= RC4_STEP<<i, i-=8;
                                        case 1: otp |= RC4_STEP<<i, i-=8;
-                                       case 0: ; /*
-                                                  * it's never the case,
-                                                  * but it has to be here
-                                                  * for ultrix?
-                                                  */
                                        }
                                ochunk &= ~mask;
                                ochunk |= (otp^ichunk) & mask;
@@ -242,11 +237,6 @@ void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
                                        case 3: otp |= RC4_STEP<<i, i+=8;
                                        case 2: otp |= RC4_STEP<<i, i+=8;
                                        case 1: otp |= RC4_STEP<<i, i+=8;
-                                       case 0: ; /*
-                                                  * it's never the case,
-                                                  * but it has to be here
-                                                  * for ultrix?
-                                                  */
                                        }
                                ochunk &= ~mask;
                                ochunk |= (otp^ichunk) & mask;