> Point ke 2 : Ada python script file kalau ingin mengecek ke device:
> fileDiffer.py di directory cryptsetup-luks-1.0.3/luks/testing.

Saya masih belum .... paham .., cara pakai nya gimana yah ? :d

> Berikut saya excerpt dari file setup.c :
>
> ------------------------snipped-------------------------------
> if(isatty(fd))
> {
>                 char *pass2;
>
>                 pass2 = getpass(prompt);
>                 if (!pass2)
>                  {
>                         set_error("Error reading passphrase");
>                         goto out_err;
>                 }
>                 pass = safe_strdup(pass2);
>                 memset(pass2, 0, strlen(pass2));
>
>                 if (verify || verify_if_possible)
>                  {
>                    char *pass_verify = getpass("Verify passphrase:   ");
>                      if (!pass_verify || strcmp(pass, pass_verify) != 0)
>                         {
>                                 set_error("Passphrases do not match");
>                                 goto out_err;
>                         }
>                         memset(pass_verify, 0, strlen(pass_verify));
>                 }
>                 *passLen = strlen(pass);
>                 *key = pass;
> }
> ------------------------snipped------------------------------------------
>
> Jika diasumsikan tetap menggunakan interactive passphrase, seharusnya
> memang file descriptor (fd) yang diasosiasikan tidak terbaca.

Tapi kenyataannya dibaca lho .... (lihat penjelasan dibawah)

Oh ic ic ....

Yang anda
> maksud langsung bypass ke serial terminal untuk memasukkan passphrase
> atau apa?

Maksud saya mode interactive, memasukkan passphrase via stdin.

Kelihatannya masalah ada pada fungsi get_key() [1]

Komentar pada code tersebut ditulis :

* Returns true when more keys are available (that is when password
* reading can be retried as for interactive terminals).

Ketika memasukkan passphrase, get_key tidak dapat mengambil key (yg
berada pada slot 0)



>
> Di snippet Anda juga di bagian :
>
> ioctl(0, TCGETS, {B115200 opost isig icanon echo …}) = 0
> ioctl(1, TCGETS, {B115200 opost isig icanon echo …}) = 0
>
> masih belum berhasil proses read dan write hingga akhirnya
> ke proses
>
> open("/proc/devices", O_RDONLY|O_LARGEFILE) = 3
> ioctl(3, TCGETS, 0×7fe715f0) = -1 ENOTTY (Inappropriate ioctl for device)
>
> Hanya berhasil read device tapi disaat masuk ke stack ioctl untuk
> mengambil terminal command (TCGETS) yang ditunjuk oleh 0×7fe715f0 gagal.


Belum saya trace yang diatas .., tapi flow code nya seperti ini
(interactive passphrase yah ..) :

Saya menuliskan perintah :

$cryptsetup --cipher aes luksOpen /dev/mmcblk0p2 rahasia

maka aplikasi akan masuk ke code __crypt_luks_open() di setup.c  [2]

Ketika aplikasi meminta passphrase input :

----cut------------------------------
if(get_key(options,"Masukkan LUKS passphrase: ",&password,&passwordLen))
                tries--;
        else {
                tries = 0;
                printf("\nAfter entering passphrase tries = %d \n",tries) ;
        }
--------------------cut----------------------------------

Sebagai catatan, variabel tries nilai awal nya adalah 3, jadi ketika get_key()
gagal mendapatkan key pada slot 0, maka dia akan mencoba sebanyak 3 kali ..,
jika masih gagal juga ....

maka aplikasi akan mencoba membuka key di slot berapa saja ...,

Ini bisa dilihat pada code selanjutnya di setup.c

-------cut ---------------
        if(!password) {
                r = -EINVAL; goto out;
        }
        
        if((r = LUKS_open_any_key(options->device, password, passwordLen,
&hdr, &mk, backend)) < 0) {
                set_error("No key available with this passphrase.\n");
                goto out1;
        }
--------cut-------------


Berarti inti masalahnya sekarang sudah bisa disolasi, yaitu pada
fungsi get_key() ...

Setelah saya buat "breakpoint" manual .. (hehe .., GDB nya gagal
dicompilasi untuk arsitektur ini sih ... )-: ), execution flow nya
ternyata masuk ke :

if(isatty(fd)) ....

Ketika aplikasi memasuki fungsi get_key, dia akan langsung ke baris
berikut  (setup.c [2]):

----cut---------
        } else {
                printf("\n Entering spot 5 \n") ;
                fd = options->passphrase_fd;
                newline_stop = 1;
                read_horizon = 0;   /* Infinite, if read from terminal or fd */
        }       
------------------cut-------------------------

Kemudian dia masuk ke if else ini .. (Tadi, menurut pak doni seharus
nya eksekusi tidak akan memasuki if else ini  ? ) :

----cut---------------
        /* Interactive case */
        if(isatty(fd)) {
                int i;
                
                printf("\n Entering spot 6 \n");
                
                pass = safe_alloc(512);
                if (!pass || (i = interactive_pass(prompt, pass, 512, 
options->timeout))) {
                        set_error("Error reading passphrase");
                        goto out_err;
                }
                if (verify || verify_if_possible) {
                        char pass_verify[512];
                        i = interactive_pass("Verify passphrase: ", pass_verify,
sizeof(pass_verify), options->timeout);
                        if (i || strcmp(pass, pass_verify) != 0) {
                                set_error("Passphrases do not match");
                                goto out_err;
                        }
                        memset(pass_verify, 0, sizeof(pass_verify));
                }
                *passLen = strlen(pass);
                *key = pass;
        } else {
                /*
                 * This is either a fd-input or a file, in neither case we can
verify the input,
                 * however we don't stop on new lines if it's a binary file.
                 */
                int buflen, i;

                if(verify) {
                        set_error("Can't do passphrase verification on non-tty 
inputs");
                        goto out_err;
                }
                /* The following for control loop does an exhausting
                 * read on the key material file, if requested with
                 * key_size == 0, as it's done by LUKS. However, we
                 * should warn the user, if it's a non-regular file,
                 * such as /dev/random, because in this case, the loop
                 * will read forever.
                 */
                if(options->key_file && strcmp(options->key_file, "-") && 
read_horizon == 0) {
                        struct stat st;
                        if(stat(options->key_file, &st) < 0) {
                                set_error("Can't stat key file");
                                goto out_err;
                        }
                        if(!S_ISREG(st.st_mode)) {
                                //                              
set_error("Can't do exhausting read on non regular files");
                                // goto out_err;
                                fprintf(stderr,"Warning: exhausting read 
requested, but key file
is not a regular file, function might never return.\n");
                        }
                }
                buflen = 0;
                for(i = 0; read_horizon == 0 || i < read_horizon; i++) {
                        if(i >= buflen - 1) {
                                buflen += 128;
                                pass = safe_realloc(pass, buflen);
                                if (!pass) {
                                        set_error("Not enough memory while "
                                                  "reading passphrase");
                                        goto out_err;
                                }
                        }
                        if(read(fd, pass + i, 1) != 1 || (newline_stop && 
pass[i] == '\n'))
                                break;
                }
                if(options->key_file)
                        close(fd);
                pass[i] = 0;
                *key = pass;
                *passLen = i;
        }
----cut--------------

Seperti sudah dikatakan tadi, fungsi get_key() ini akan me-return
nilai false, sehigga
encrypted partition tidak dapat dibuka ...

> Keep going and please give your modified codes...

Thanks .., jangan bosen kasih saya petunjuk yah .. :)
Maklum .., learning by doing nih ...

Tolong kasih link2 saja .., kalau misal2 ada yg perlu saya baca2 lagi ..,
agar saya bisa memecahkan masalah ini ...

Thanks


Ref:
[1] http://bakmi.wordpress.com/2007/09/11/get_key-cryptsetup-105libsetupc/
[2] 
http://bakmi.wordpress.com/2007/09/11/interactive_pass-cryptsetup-105libsetupc/


Salam
Wildan

-- 
---
Person who say it cannot be done should not interrupt person doing it.
Coz.....
Miracles are closer than you think ...
------------
http://wildanm.fisika.ui.edu
HP: 08888378594
Y! : hawking_123

--
FAQ milis di http://wiki.linux.or.id/FAQ_milis_tanya-jawab
Unsubscribe: kirim email ke [EMAIL PROTECTED]
Arsip dan info milis selengkapnya di http://linux.or.id/milis

Kirim email ke