1
2/*
3 * Licensed Materials - Property of IBM
4 *
5 * trousers - An open source TCG Software Stack
6 *
7 * (C) Copyright International Business Machines Corp. 2006
8 *
9 */
10
11
12#include <stdlib.h>
13#include <stdio.h>
14#include <string.h>
15#include <inttypes.h>
16
17#include "trousers/tss.h"
18#include "trousers_types.h"
19#include "tcs_tsp.h"
20#include "tcsps.h"
21#include "tcs_utils.h"
22#include "tcs_int_literals.h"
23#include "capabilities.h"
24#include "tcslog.h"
25#include "req_mgr.h"
26#include "tcsd_wrap.h"
27#include "tcsd.h"
28
29TSS_RESULT
30UnloadBlob_MIGRATIONKEYAUTH(UINT64 *offset, BYTE *blob, TCPA_MIGRATIONKEYAUTH *mkAuth)
31{
32	TSS_RESULT result;
33
34	if (!mkAuth) {
35		if ((result = UnloadBlob_PUBKEY(offset, blob, NULL)))
36			return result;
37
38		UnloadBlob_UINT16(offset, NULL, blob);
39		UnloadBlob(offset, 20, blob, NULL);
40
41		return TSS_SUCCESS;
42	}
43
44	if ((result = UnloadBlob_PUBKEY(offset, blob, &mkAuth->migrationKey)))
45		return result;
46
47	UnloadBlob_UINT16(offset, &mkAuth->migrationScheme, blob);
48	UnloadBlob(offset, 20, blob, mkAuth->digest.digest);
49
50	return result;
51}
52