Software Engineering/Linux

TPM 개발환경

HelloJaewon 2012. 7. 24. 17:59

TPM(Trusted Platform Module)의 약자로 trusted computing group에서 spec을 제안한 모듈이다.


TPM을 이용해 개발하기 위해 다음과 같은 packages를 설치함


apt-get install trousers

apt-get install tpm-tools

apt-get install libtspi-dev

apt-get install libtspi1

apt-get install trousers-dbg


// 아래 두 패키지는 프로젝트할 때 같이 필요했던 패키지

apt-get install libcurl4-openssl-dev // curl package 설치 for communication with privacy CA

apt-get install swig // for python


설치를 했다면 이제 TPM을 사용하기 위한 환경을 만들어야 한다.


ek credential을 만들고 /etc/endorsement.cert에 생성

(ek credential은 tpm_test 프로그램으로 생성했었다.)


/etc/tcsd.conf 파일안의 내용중에 다음과 같이 추가

endorsement_cred = /etc/endorsement.cert


완료후 tcsd를 통해 daemon 실행

$ tcsd


tpm_takeownership 을 통해 tpm ownership 설정(password 설정을 요구함)

$ tpm_takeownership


ownership까지 설정을 마쳤다면 이제 tpm을 사용할 수 있다.


tpm_getpubek를 통해 public endorsement key를 확인할 수 있다면 모든 세팅이 완료된 것이다.

(안된다면 bios에서 TPM설정을 clear, disable, enable등을 통해 TPM을 초기화 해야했던 것 같다.)


$ tpm_getpubek


tpm사용하려는데 Key not found in persistent storage 에러가 나온다면

이는 SRK가 아직 생성이 안된것이다. 이것은 tpm_takeownership 설정이 제대로 되지 않아서 발생하는 현상이다.

tpm_clear 를 통해서 tpm을 초기화하고 다시 설정해보도록 하자.


또한 tpm을 사용하다가 다음과 같은 에러를 만날 수 도 있다.

TPM is defending against dictionary attacks and is in some time-out period

이럴땐 tpm을 먼저 reset 시키고 takeownership을 다시 설정한다.

$ tpm_resetdalock (이때 owner secret을 입력해야함)

$ tpm_takeownership