| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Licensed Materials - Property of IBM | 3 * Licensed Materials - Property of IBM |
| 4 * | 4 * |
| 5 * trousers - An open source TCG Software Stack | 5 * trousers - An open source TCG Software Stack |
| 6 * | 6 * |
| 7 * (C) Copyright International Business Machines Corp. 2005, 2007 | 7 * (C) Copyright International Business Machines Corp. 2005, 2007 |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 if ((obj = obj_list_get_obj(&context_list, tspContext)) == NULL) | 181 if ((obj = obj_list_get_obj(&context_list, tspContext)) == NULL) |
| 182 return TSPERR(TSS_E_INVALID_HANDLE); | 182 return TSPERR(TSS_E_INVALID_HANDLE); |
| 183 | 183 |
| 184 context = (struct tr_context_obj *)obj->data; | 184 context = (struct tr_context_obj *)obj->data; |
| 185 | 185 |
| 186 if (context->machineNameLength == 0) { | 186 if (context->machineNameLength == 0) { |
| 187 *data = NULL; | 187 *data = NULL; |
| 188 *size = 0; | 188 *size = 0; |
| 189 } else { | 189 } else { |
| 190 » » *data = calloc_tspi(obj->tspContext, context->machineNameLength)
; | 190 » » /* |
| 191 » » * Don't use calloc_tspi because this memory is |
| 192 » » * not freed using "free_tspi" |
| 193 » » */ |
| 194 » » *data = calloc(1, context->machineNameLength); |
| 191 if (*data == NULL) { | 195 if (*data == NULL) { |
| 192 LogError("malloc of %u bytes failed.", | 196 LogError("malloc of %u bytes failed.", |
| 193 context->machineNameLength); | 197 context->machineNameLength); |
| 194 result = TSPERR(TSS_E_OUTOFMEMORY); | 198 result = TSPERR(TSS_E_OUTOFMEMORY); |
| 195 goto done; | 199 goto done; |
| 196 } | 200 } |
| 197 *size = context->machineNameLength; | 201 *size = context->machineNameLength; |
| 198 memcpy(*data, context->machineName, *size); | 202 memcpy(*data, context->machineName, *size); |
| 199 } | 203 } |
| 200 | 204 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 inLen, dec, &decLen))) { | 960 inLen, dec, &decLen))) { |
| 957 free(dec); | 961 free(dec); |
| 958 return result; | 962 return result; |
| 959 } | 963 } |
| 960 | 964 |
| 961 break; | 965 break; |
| 962 } | 966 } |
| 963 default: | 967 default: |
| 964 LogDebug("Unknown algorithm for encrypted transport session: 0x%
x", | 968 LogDebug("Unknown algorithm for encrypted transport session: 0x%
x", |
| 965 transPub->algId); | 969 transPub->algId); |
| 970 free(dec); |
| 966 return TSPERR(TSS_E_INTERNAL_ERROR); | 971 return TSPERR(TSS_E_INTERNAL_ERROR); |
| 967 } | 972 } |
| 968 | 973 |
| 969 *out = dec; | 974 *out = dec; |
| 970 *outLen = decLen; | 975 *outLen = decLen; |
| 971 | 976 |
| 972 return result; | 977 return result; |
| 973 } | 978 } |
| 974 | 979 |
| 975 TSS_RESULT | 980 TSS_RESULT |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 inLen, enc, &encLen))) { | 1040 inLen, enc, &encLen))) { |
| 1036 free(enc); | 1041 free(enc); |
| 1037 return result; | 1042 return result; |
| 1038 } | 1043 } |
| 1039 | 1044 |
| 1040 break; | 1045 break; |
| 1041 } | 1046 } |
| 1042 default: | 1047 default: |
| 1043 LogDebug("Unknown algorithm for encrypted transport session: 0x%
x", | 1048 LogDebug("Unknown algorithm for encrypted transport session: 0x%
x", |
| 1044 transPub->algId); | 1049 transPub->algId); |
| 1050 free(enc); |
| 1045 return TSPERR(TSS_E_INTERNAL_ERROR); | 1051 return TSPERR(TSS_E_INTERNAL_ERROR); |
| 1046 } | 1052 } |
| 1047 | 1053 |
| 1048 *out = enc; | 1054 *out = enc; |
| 1049 *outLen = encLen; | 1055 *outLen = encLen; |
| 1050 | 1056 |
| 1051 return result; | 1057 return result; |
| 1052 } | 1058 } |
| 1053 | 1059 |
| 1054 TSS_RESULT | 1060 TSS_RESULT |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 case TSS_CONTEXT_FLAGS_TPM_VERSION_1: | 1515 case TSS_CONTEXT_FLAGS_TPM_VERSION_1: |
| 1510 *ordinal = TPM_ORD_LoadKey; | 1516 *ordinal = TPM_ORD_LoadKey; |
| 1511 break; | 1517 break; |
| 1512 } | 1518 } |
| 1513 | 1519 |
| 1514 obj_list_put(&context_list); | 1520 obj_list_put(&context_list); |
| 1515 | 1521 |
| 1516 return TSS_SUCCESS; | 1522 return TSS_SUCCESS; |
| 1517 } | 1523 } |
| 1518 | 1524 |
| OLD | NEW |