/src/libtpms/src/tpm12/tpm_libtpms_io.c
Line | Count | Source |
1 | | /********************************************************************************/ |
2 | | /* */ |
3 | | /* Libtpms IO Init */ |
4 | | /* Written by Ken Goldman, Stefan Berger */ |
5 | | /* IBM Thomas J. Watson Research Center */ |
6 | | /* $Id: tpm_io.c 4564 2011-04-13 19:33:38Z stefanb $ */ |
7 | | /* */ |
8 | | /* (c) Copyright IBM Corporation 2006, 2010. */ |
9 | | /* */ |
10 | | /* All rights reserved. */ |
11 | | /* */ |
12 | | /* Redistribution and use in source and binary forms, with or without */ |
13 | | /* modification, are permitted provided that the following conditions are */ |
14 | | /* met: */ |
15 | | /* */ |
16 | | /* Redistributions of source code must retain the above copyright notice, */ |
17 | | /* this list of conditions and the following disclaimer. */ |
18 | | /* */ |
19 | | /* Redistributions in binary form must reproduce the above copyright */ |
20 | | /* notice, this list of conditions and the following disclaimer in the */ |
21 | | /* documentation and/or other materials provided with the distribution. */ |
22 | | /* */ |
23 | | /* Neither the names of the IBM Corporation nor the names of its */ |
24 | | /* contributors may be used to endorse or promote products derived from */ |
25 | | /* this software without specific prior written permission. */ |
26 | | /* */ |
27 | | /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ |
28 | | /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ |
29 | | /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ |
30 | | /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ |
31 | | /* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ |
32 | | /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
33 | | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ |
34 | | /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ |
35 | | /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ |
36 | | /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ |
37 | | /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
38 | | /********************************************************************************/ |
39 | | |
40 | | #include "tpm_debug.h" |
41 | | #include "tpm_error.h" |
42 | | #include "tpm_platform.h" |
43 | | #include "tpm_types.h" |
44 | | |
45 | | #include "tpm_library_intern.h" |
46 | | |
47 | | /* header for this file */ |
48 | | #include "tpm_io.h" |
49 | | |
50 | | /* TPM_IO_Init initializes the TPM to host interface. |
51 | | |
52 | | This is the Unix platform dependent socket version. |
53 | | */ |
54 | | |
55 | | TPM_RESULT TPM_IO_Init(void) |
56 | 0 | { |
57 | 0 | TPM_RESULT rc = 0; |
58 | 0 | struct libtpms_callbacks *cbs = TPMLIB_GetCallbacks(); |
59 | | |
60 | | /* call user-provided function if available */ |
61 | 0 | if (cbs->tpm_io_init) { |
62 | 0 | rc = cbs->tpm_io_init(); |
63 | 0 | return rc; |
64 | 0 | } else { |
65 | | /* Below code would start a TCP server socket; we don't want this |
66 | | but rather expect all commands via TPMLIB_Process() to be sent |
67 | | to the TPM. */ |
68 | 0 | return TPM_SUCCESS; |
69 | 0 | } |
70 | 0 | } |