I did not write the blog for a long time. These days, i use the google doc and note to record. I love them very much:) But there is a disadvantage in google doc, it does not support syntax highlight, so i think i have to write here. Fortunately, CSDN has support search in blog.
I have finished the virtual disk driver on the mobile recently. It can encrypt the data in devices automatically without user intervention, providing a user-transparent yet fully-enforceable security policy. I use the fat FS to implement the virtual disk, Before write every sector, encrypt data with aes, and decrypt before read. I
user password's MD5 to make aes key.
That code like this:
In anthentication, i use user password's SHA1 in register. like this:
The most important is XXX_IOControl, we have to
implement our IOCTL_DISK_GETINFO, DISK_IOCTL_GETINFO, IOCTL_DISK_DEVICE_INFO,IOCTL_DISK_READ, DISK_IOCTL_READ, IOCTL_DISK_WRITE, DISK_IOCTL_WRITE, the sample like this:
break;
case IOCTL_CHANGE_PASSWORD_FINI:
{
CHANGE_PASSWD* pwd = (CHANGE_PASSWD*)pBufIn;
RETAILMSG(1, (L"pwd->NewPassword: "));
for (int i = 0; i < strlen(pwd->NewPassword); ++i)
{
RETAILMSG(1, (L"%c", pwd->NewPassword[i]));
}
RETAILMSG(1, (L"/n"));
MakeAesKey(devContext, &(devContext->nowKeyInst), pwd->NewPassword);
}
break;
default:
break;
}
Becareful
IOCTL_DISK_GETINFO and DISK_IOCTL_GETINFO are defferent!!
Next, i want implement my owner file system, So it can be more safely and efficiently! FAT or EXT2? i do'nt know.