]> err.no Git - util-linux/commitdiff
Merge commit 'origin/master'
authorLaMont Jones <lamont@debian.org>
Fri, 12 Oct 2007 02:51:36 +0000 (20:51 -0600)
committerLaMont Jones <lamont@debian.org>
Fri, 12 Oct 2007 02:51:36 +0000 (20:51 -0600)
1  2 
mount/lomount.c
mount/mount.c

diff --cc mount/lomount.c
index 37b64137e92e8f8efd808f68e1e85d8b474a58e4,737194e912a1d5c54a7ea41079e57a9aef8e09be..69107910b1326ac88c77497abd08d99f93be3704
@@@ -335,78 -331,14 +335,78 @@@ set_loop(const char *device, const cha
                break;
        case LO_CRYPT_XOR:
                pass = getpass(_("Password: "));
 -              goto gotpass;
 -      default:
 -              pass = xgetpass(pfd, _("Password: "));
 -      gotpass:
                memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE);
-               xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
+               xstrncpy((char *)loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
                memset(pass, 0, strlen(pass));
                loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
 +              break;
 +#define HASHLENGTH 20
 +#if 0
 +      case LO_CRYPT_FISH2:
 +      case LO_CRYPT_BLOW:
 +      case LO_CRYPT_IDEA:
 +      case LO_CRYPT_CAST128:
 +      case LO_CRYPT_SERPENT:
 +      case LO_CRYPT_MARS:
 +      case LO_CRYPT_RC6:
 +      case LO_CRYPT_3DES:
 +      case LO_CRYPT_DFC:
 +      case LO_CRYPT_RIJNDAEL:
 +          {
 +              char keybits[2*HASHLENGTH]; 
 +              char *pass2;
 +              int passwdlen;
 +              int keylength;
 +              int i;
 +
 +              pass = xgetpass(pfd, _("Password: "));
 +              passwdlen=strlen(pass);
 +              pass2=malloc(passwdlen+2);
 +              pass2[0]='A';
 +              strcpy(pass2+1,pass);
 +              rmd160_hash_buffer(keybits,pass,passwdlen);
 +              rmd160_hash_buffer(keybits+HASHLENGTH,pass2,passwdlen+1);
 +              memcpy((char*)loopinfo64.lo_encrypt_key,keybits,2*HASHLENGTH);
 +              memset(pass, 0, passwdlen);
 +              memset(pass2, 0, passwdlen+1);
 +              free(pass2);
 +              keylength=0;
 +              for(i=0; crypt_type_tbl[i].id != -1; i++){
 +                       if(loopinfo64.lo_encrypt_type == crypt_type_tbl[i].id){
 +                               keylength = crypt_type_tbl[i].keylength;
 +                               break;
 +                       }
 +              }
 +              loopinfo64.lo_encrypt_key_size=keylength;
 +              break;
 +          }
 +#endif
 +      default:
 +              if (hash_pass) {
 +                  char keybits[2*HASHLENGTH]; 
 +                  char *pass2;
 +                  int passwdlen;
 +
 +                  pass = xgetpass(pfd, _("Password: "));
 +                  passwdlen=strlen(pass);
 +                  pass2=malloc(passwdlen+2);
 +                  pass2[0]='A';
 +                  strcpy(pass2+1,pass);
 +                  rmd160_hash_buffer(keybits,pass,passwdlen);
 +                  rmd160_hash_buffer(keybits+HASHLENGTH,pass2,passwdlen+1);
 +                  memset(pass, 0, passwdlen);
 +                  memset(pass2, 0, passwdlen+1);
 +                  free(pass2);
 +
 +                  memcpy((char*)loopinfo64.lo_encrypt_key,keybits,keysz/8);
 +                  loopinfo64.lo_encrypt_key_size = keysz/8;
 +              } else {
 +                  pass = xgetpass(pfd, _("Password: "));
 +                  memset(loopinfo64.lo_encrypt_key, 0, LO_KEY_SIZE);
 +                  xstrncpy(loopinfo64.lo_encrypt_key, pass, LO_KEY_SIZE);
 +                  memset(pass, 0, strlen(pass));
 +                  loopinfo64.lo_encrypt_key_size = LO_KEY_SIZE;
 +              }
        }
  
        if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
diff --cc mount/mount.c
Simple merge