$OpenBSD: patch-src_runtime_kwalletd_backend_blowfish_cc,v 1.3 2017/06/07 17:03:39 rsadowski Exp $
Unbreak build.
Index: src/runtime/kwalletd/backend/blowfish.cc
--- src/runtime/kwalletd/backend/blowfish.cc.orig
+++ src/runtime/kwalletd/backend/blowfish.cc
@@ -38,18 +38,18 @@
 BlowFish::BlowFish()
 {
     _blksz = 8;
-    _key = nullptr;
-    _init = false;
+    key = nullptr;
+    initialized = false;
 }
 
 bool BlowFish::init()
 {
     // Initialize the sboxes
     for (int i = 0; i < 256; i++) {
-        _S[0][i] = ks0[i];
-        _S[1][i] = ks1[i];
-        _S[2][i] = ks2[i];
-        _S[3][i] = ks3[i];
+        S[0][i] = ks0[i];
+        S[1][i] = ks1[i];
+        S[2][i] = ks2[i];
+        S[3][i] = ks3[i];
     }
 
     uint32_t datal = 0;
@@ -61,25 +61,25 @@ bool BlowFish::init()
     for (int i = 0; i < 18; i++) {
         data = 0;
         for (int k = 0; k < 4; ++k) {
-            data = (data << 8) | ((unsigned char *)_key)[j++];
-            if (j >= _keylen / 8) {
+            data = (data << 8) | ((unsigned char *)key)[j++];
+            if (j >= keylen / 8) {
                 j = 0;
             }
         }
-        _P[i] = P[i] ^ data;
+        Pm[i] = P[i] ^ data;
     }
 
     for (int i = 0; i < 18; i += 2) {
         encipher(&datal, &datar);
-        _P[i] = datal;
-        _P[i + 1] = datar;
+        Pm[i] = datal;
+        Pm[i + 1] = datar;
     }
 
     for (int j = 0; j < 4; j++) {
         for (int i = 0; i < 256; i += 2) {
             encipher(&datal, &datar);
-            _S[j][i] = datal;
-            _S[j][i + 1] = datar;
+            S[j][i] = datal;
+            S[j][i + 1] = datar;
         }
     }
 
@@ -87,22 +87,22 @@ bool BlowFish::init()
     //     check to see if the key is weak and return error if so
     for (int i = 0; i < 255; i++) {
         for (int j = i + 1; j < 256; j++) {
-            if ((_S[0][i] == _S[0][j]) || (_S[1][i] == _S[1][j]) ||
-                    (_S[2][i] == _S[2][j]) || (_S[3][i] == _S[3][j])) {
+            if ((S[0][i] == S[0][j]) || (S[1][i] == S[1][j]) ||
+                    (S[2][i] == S[2][j]) || (S[3][i] == S[3][j])) {
                 return false;
             }
         }
     }
 
-    _init = true;
+    initialized = true;
 
     return true;
 }
 
 BlowFish::~BlowFish()
 {
-    delete[](unsigned char *)_key;
-    _key = nullptr;
+    delete[](unsigned char *)key;
+    key = nullptr;
 }
 
 int BlowFish::keyLen() const
@@ -117,20 +117,20 @@ bool BlowFish::variableKeyLen() const
 
 bool BlowFish::readyToGo() const
 {
-    return _init;
+    return initialized;
 }
 
-bool BlowFish::setKey(void *key, int bitlength)
+bool BlowFish::setKey(void *newkey, int bitlength)
 {
     if (bitlength <= 0 || bitlength > 448 || bitlength % 8 != 0) {
         return false;
     }
 
-    delete[](unsigned char *)_key;
+    delete[](unsigned char *)key;
 
-    _key = new unsigned char[bitlength / 8];
-    memcpy(_key, key, bitlength / 8);
-    _keylen = bitlength;
+    key = new unsigned char[bitlength / 8];
+    memcpy(key, newkey, bitlength / 8);
+    keylen = bitlength;
 
     return init();
 }
@@ -149,7 +149,7 @@ int BlowFish::encrypt(void *block, int len)
 {
     uint32_t *d = (uint32_t *)block;
 
-    if (!_init || len % _blksz != 0) {
+    if (!initialized || len % _blksz != 0) {
         return -1;
     }
 
@@ -173,7 +173,7 @@ int BlowFish::decrypt(void *block, int len)
 {
     uint32_t *d = (uint32_t *)block;
 
-    if (!_init || len % _blksz != 0) {
+    if (!initialized || len % _blksz != 0) {
         return -1;
     }
 
@@ -206,9 +206,9 @@ uint32_t BlowFish::F(uint32_t x)
     x >>= 8;
     a = x & 0x000000ff;
 
-    y = _S[0][a] + _S[1][b];
-    y ^= _S[2][c];
-    y += _S[3][d];
+    y = S[0][a] + S[1][b];
+    y ^= S[2][c];
+    y += S[3][d];
 
     return y;
 }
@@ -218,7 +218,7 @@ void BlowFish::encipher(uint32_t *xl, uint32_t *xr)
     uint32_t Xl = *xl, Xr = *xr, temp;
 
     for (int i = 0; i < 16; ++i) {
-        Xl ^= _P[i];
+        Xl ^= Pm[i];
         Xr ^= F(Xl);
         // Exchange
         temp = Xl; Xl = Xr; Xr = temp;
@@ -227,8 +227,8 @@ void BlowFish::encipher(uint32_t *xl, uint32_t *xr)
     // Exchange
     temp = Xl; Xl = Xr; Xr = temp;
 
-    Xr ^= _P[16];
-    Xl ^= _P[17];
+    Xr ^= Pm[16];
+    Xl ^= Pm[17];
 
     *xl = Xl;
     *xr = Xr;
@@ -239,7 +239,7 @@ void BlowFish::decipher(uint32_t *xl, uint32_t *xr)
     uint32_t Xl = *xl, Xr = *xr, temp;
 
     for (int i = 17; i > 1; --i) {
-        Xl ^= _P[i];
+        Xl ^= Pm[i];
         Xr ^= F(Xl);
         // Exchange
         temp = Xl; Xl = Xr; Xr = temp;
@@ -248,8 +248,8 @@ void BlowFish::decipher(uint32_t *xl, uint32_t *xr)
     // Exchange
     temp = Xl; Xl = Xr; Xr = temp;
 
-    Xr ^= _P[1];
-    Xl ^= _P[0];
+    Xr ^= Pm[1];
+    Xl ^= Pm[0];
 
     *xl = Xl;
     *xr = Xr;
