2011-01-16 10 views
1

Kollegen,ATA Trusted Befehle in Linux

ich Unterstützung vertraut für ATA Implementierung Befehle

0x5C, TRUSTED RECEIVE, 
0x5D, TRUSTED RECEIVE DMA, 
0x5E, TRUSTED SEND 
0x5F, TRUSTED SEND DMA, 

für Linux (zwei Hosts, Fedora 12 und 14) selbst verschlüsselnde Laufwerke zu unterstützen. Ich habe einen Code von dieser Seite http://www.jukie.net/bart/blog/ata-via-scsi als Basiscode genommen. Für erhalten vertraute (auf dieser Ebene ist es identisch zu identifizieren, 0xEC):

sg_io.interface_id = 'S'; 
sg_io.cmdp   = cdb; 
sg_io.cmd_len   = sizeof(cdb); 
sg_io.dxferp   = data_in_buffer; 
sg_io.dxfer_len  = data_in_length;   // multiple of 512 
sg_io.dxfer_direction = SG_DXFER_FROM_DEV; 
sg_io.sbp    = sense; 
sg_io.mx_sb_len  = sizeof(sense); 
sg_io.timeout   = 5000;     // 5 seconds 


cdb[0] = 0x85;   // pass-through ATA16 command (no translation) 
cdb[1] = (4 << 1);  // data-in 
cdb[2] = 0x2e;   // data-in 
cdb[4] = feature_id;  // ATA feature ID 
cdb[6] = 1;    // number of sectors 
cdb[7] = lba_low >> 8; 
cdb[8] = lba_low; 
cdb[9] = lba_mid >> 8; 
cdb[10] = lba_mid; 
cdb[11] = lba_high >> 8; 
cdb[12] = lba_high; 
cdb[14] = 0x5C;   // TRUSTED RECEIVE 

rc = ioctl (fd, SG_IO, &sg_io); 

Es funktioniert perfekt für für vertrauenswürdige Befehle zu identifizieren und alle anderen Befehle, aber nicht. Wenn ich den Protokollanalysator anschließe, sehe ich, dass diese Befehle nicht an den SATA-Bus gesendet werden. Der Adapter kann sie senden, weil sie unter Windows OK sind (nicht mein Code, aber ich denke mit ATA_PASS_THROUGH). Und ja, ich führe diesen Code als root.

Bitte helfen, dieses Rätsel zu lösen :)

+0

was lba_low sind, lba_mid und lba_high .. Wie kann ich Informationen über die Einstellung dieser Variablen finden? – Nick

Antwort

4

/usr/src/linux/drivers/ata/libata-scsi.c Siehe:

/* 
* Filter TPM commands by default. These provide an 
* essentially uncontrolled encrypted "back door" between 
* applications and the disk. Set libata.allow_tpm=1 if you 
* have a real reason for wanting to use them. This ensures 
* that installed software cannot easily mess stuff up without 
* user intent. DVR type users will probably ship with this enabled 
* for movie content management. 
* 
* Note that for ATA8 we can issue a DCS change and DCS freeze lock 
* for this and should do in future but that it is not sufficient as 
* DCS is an optional feature set. Thus we also do the software filter 
* so that we comply with the TC consortium stated goal that the user 
* can turn off TC features of their system. 
*/ 
if (tf->command >= 0x5C && tf->command <= 0x5F && !libata_allow_tpm) 
     goto invalid_fld; 
+0

Danke, danke, danke, Ephemient! –

+0

Es scheint, als ob "modprobe libata allow_tpm = 1" auf meinem Fedora 14 nicht funktioniert. –

+0

@Dmitry: Es funktioniert nicht, wenn 'libata' bereits geladen ist. Sie müssen mit 'libata.allow_tpm = 1' in der Kernel-Befehlszeile oder mit' options libata allow_tpm = 1' in '/ etc/modprobe.conf' oder' /etc/modprobe.d/ *. Conf' booten , je nachdem, wie das System eingerichtet ist. – ephemient