Lines Matching refs:ptr

51 inline BYTE* pack_BYTE(BYTE* ptr, BYTE t) {  in pack_BYTE()  argument
52 ptr[0] = t; in pack_BYTE()
53 return ++ptr; in pack_BYTE()
57 inline BYTE* unpack_BYTE(BYTE* ptr, BYTE* t) { in unpack_BYTE() argument
58 t[0] = ptr[0]; in unpack_BYTE()
59 return ++ptr; in unpack_BYTE()
63 inline int unpack3_BYTE(BYTE* ptr, UINT32* pos, UINT32 max, BYTE *t) in unpack3_BYTE() argument
67 unpack_BYTE(ptr + *pos, t); in unpack3_BYTE()
79 inline BYTE* pack_UINT16(void* ptr, UINT16 t) { in pack_UINT16() argument
80 UINT16* p = ptr; in pack_UINT16()
82 return ptr + sizeof(UINT16); in pack_UINT16()
86 inline BYTE* unpack_UINT16(void* ptr, UINT16* t) { in unpack_UINT16() argument
87 UINT16* p = ptr; in unpack_UINT16()
89 return ptr + sizeof(UINT16); in unpack_UINT16()
93 inline int unpack3_UINT16(BYTE* ptr, UINT32* pos, UINT32 max, UINT16 *t) in unpack3_UINT16() argument
97 unpack_UINT16(ptr + *pos, t); in unpack3_UINT16()
103 inline BYTE* pack_UINT32(void* ptr, UINT32 t) { in pack_UINT32() argument
104 UINT32* p = ptr; in pack_UINT32()
106 return ptr + sizeof(UINT32); in pack_UINT32()
110 inline BYTE* unpack_UINT32(void* ptr, UINT32* t) { in unpack_UINT32() argument
111 UINT32* p = ptr; in unpack_UINT32()
113 return ptr + sizeof(UINT32); in unpack_UINT32()
117 inline int unpack3_UINT32(BYTE* ptr, UINT32* pos, UINT32 max, UINT32 *t) in unpack3_UINT32() argument
121 unpack_UINT32(ptr + *pos, t); in unpack3_UINT32()
249 inline BYTE* pack_BUFFER(BYTE* ptr, const BYTE* buf, UINT32 size) { in pack_BUFFER() argument
250 memcpy(ptr, buf, size); in pack_BUFFER()
251 return ptr + size; in pack_BUFFER()
255 inline BYTE* unpack_BUFFER(BYTE* ptr, BYTE* buf, UINT32 size) { in unpack_BUFFER() argument
256 memcpy(buf, ptr, size); in unpack_BUFFER()
257 return ptr + size; in unpack_BUFFER()
261 inline int unpack3_BUFFER(BYTE* ptr, UINT32* pos, UINT32 max, BYTE* buf, UINT32 size) { in unpack3_BUFFER() argument
264 memcpy(buf, ptr + *pos, size); in unpack3_BUFFER()
272 inline BYTE* unpack_ALIAS(BYTE* ptr, BYTE** buf, UINT32 size) { in unpack_ALIAS() argument
273 *buf = ptr; in unpack_ALIAS()
274 return ptr + size; in unpack_ALIAS()
278 inline BYTE* unpack_ALLOC(BYTE* ptr, BYTE** buf, UINT32 size) { in unpack_ALLOC() argument
281 memcpy(*buf, ptr, size); in unpack_ALLOC()
285 return ptr + size; in unpack_ALLOC()
289 inline BYTE* unpack_PTR(BYTE* ptr, BYTE** buf, UINT32 size, UnpackPtr alloc) { in unpack_PTR() argument
291 return unpack_ALLOC(ptr, buf, size); in unpack_PTR()
293 return unpack_ALIAS(ptr, buf, size); in unpack_PTR()
298 inline int unpack3_PTR(BYTE* ptr, UINT32* pos, UINT32 max, BYTE** buf, UINT32 size, UnpackPtr alloc… in unpack3_PTR() argument
302 unpack_ALLOC(ptr + *pos, buf, size); in unpack3_PTR()
304 unpack_ALIAS(ptr + *pos, buf, size); in unpack3_PTR()
309 #define unpack3_VPTR(ptr, pos, max, buf, size, alloc) unpack3_PTR(ptr, pos, max, (void*)(buf), size… argument
312 inline BYTE* pack_TPM_AUTHDATA(BYTE* ptr, const TPM_AUTHDATA* d) { in pack_TPM_AUTHDATA() argument
313 return pack_BUFFER(ptr, *d, TPM_DIGEST_SIZE); in pack_TPM_AUTHDATA()
317 inline BYTE* unpack_TPM_AUTHDATA(BYTE* ptr, TPM_AUTHDATA* d) { in unpack_TPM_AUTHDATA() argument
318 return unpack_BUFFER(ptr, *d, TPM_DIGEST_SIZE); in unpack_TPM_AUTHDATA()
322 inline int unpack3_TPM_AUTHDATA(BYTE* ptr, UINT32* pos, UINT32 len, TPM_AUTHDATA* d) { in unpack3_TPM_AUTHDATA() argument
323 return unpack3_BUFFER(ptr, pos, len, *d, TPM_DIGEST_SIZE); in unpack3_TPM_AUTHDATA()
348 inline BYTE* pack_TPM_VERSION(BYTE* ptr, const TPM_VERSION* t) { in pack_TPM_VERSION() argument
349 ptr[0] = t->major; in pack_TPM_VERSION()
350 ptr[1] = t->minor; in pack_TPM_VERSION()
351 ptr[2] = t->revMajor; in pack_TPM_VERSION()
352 ptr[3] = t->revMinor; in pack_TPM_VERSION()
353 return ptr + 4; in pack_TPM_VERSION()
357 inline BYTE* unpack_TPM_VERSION(BYTE* ptr, TPM_VERSION* t) { in unpack_TPM_VERSION() argument
358 t->major = ptr[0]; in unpack_TPM_VERSION()
359 t->minor = ptr[1]; in unpack_TPM_VERSION()
360 t->revMajor = ptr[2]; in unpack_TPM_VERSION()
361 t->revMinor = ptr[3]; in unpack_TPM_VERSION()
362 return ptr + 4; in unpack_TPM_VERSION()
366 inline int unpack3_TPM_VERSION(BYTE* ptr, UINT32 *pos, UINT32 max, TPM_VERSION* t) { in unpack3_TPM_VERSION() argument
369 ptr += *pos; in unpack3_TPM_VERSION()
370 t->major = ptr[0]; in unpack3_TPM_VERSION()
371 t->minor = ptr[1]; in unpack3_TPM_VERSION()
372 t->revMajor = ptr[2]; in unpack3_TPM_VERSION()
373 t->revMinor = ptr[3]; in unpack3_TPM_VERSION()
381 inline BYTE* pack_TPM_CAP_VERSION_INFO(BYTE* ptr, const TPM_CAP_VERSION_INFO* v) { in pack_TPM_CAP_VERSION_INFO() argument
382 ptr = pack_TPM_STRUCTURE_TAG(ptr, v->tag); in pack_TPM_CAP_VERSION_INFO()
383 ptr = pack_TPM_VERSION(ptr, &v->version); in pack_TPM_CAP_VERSION_INFO()
384 ptr = pack_UINT16(ptr, v->specLevel); in pack_TPM_CAP_VERSION_INFO()
385 ptr = pack_BYTE(ptr, v->errataRev); in pack_TPM_CAP_VERSION_INFO()
386 ptr = pack_BUFFER(ptr, v->tpmVendorID, sizeof(v->tpmVendorID)); in pack_TPM_CAP_VERSION_INFO()
387 ptr = pack_UINT16(ptr, v->vendorSpecificSize); in pack_TPM_CAP_VERSION_INFO()
388 ptr = pack_BUFFER(ptr, v->vendorSpecific, v->vendorSpecificSize); in pack_TPM_CAP_VERSION_INFO()
389 return ptr; in pack_TPM_CAP_VERSION_INFO()
393 inline BYTE* unpack_TPM_CAP_VERSION_INFO(BYTE* ptr, TPM_CAP_VERSION_INFO* v, UnpackPtr alloc) { in unpack_TPM_CAP_VERSION_INFO() argument
394 ptr = unpack_TPM_STRUCTURE_TAG(ptr, &v->tag); in unpack_TPM_CAP_VERSION_INFO()
395 ptr = unpack_TPM_VERSION(ptr, &v->version); in unpack_TPM_CAP_VERSION_INFO()
396 ptr = unpack_UINT16(ptr, &v->specLevel); in unpack_TPM_CAP_VERSION_INFO()
397 ptr = unpack_BYTE(ptr, &v->errataRev); in unpack_TPM_CAP_VERSION_INFO()
398 ptr = unpack_BUFFER(ptr, v->tpmVendorID, sizeof(v->tpmVendorID)); in unpack_TPM_CAP_VERSION_INFO()
399 ptr = unpack_UINT16(ptr, &v->vendorSpecificSize); in unpack_TPM_CAP_VERSION_INFO()
400 ptr = unpack_PTR(ptr, &v->vendorSpecific, v->vendorSpecificSize, alloc); in unpack_TPM_CAP_VERSION_INFO()
401 return ptr; in unpack_TPM_CAP_VERSION_INFO()
405 inline BYTE* pack_TPM_DIGEST(BYTE* ptr, const TPM_DIGEST* d) { in pack_TPM_DIGEST() argument
406 return pack_BUFFER(ptr, d->digest, TPM_DIGEST_SIZE); in pack_TPM_DIGEST()
410 inline BYTE* unpack_TPM_DIGEST(BYTE* ptr, TPM_DIGEST* d) { in unpack_TPM_DIGEST() argument
411 return unpack_BUFFER(ptr, d->digest, TPM_DIGEST_SIZE); in unpack_TPM_DIGEST()
415 inline int unpack3_TPM_DIGEST(BYTE* ptr, UINT32* pos, UINT32 max, TPM_DIGEST* d) { in unpack3_TPM_DIGEST() argument
416 return unpack3_BUFFER(ptr, pos, max, d->digest, TPM_DIGEST_SIZE); in unpack3_TPM_DIGEST()
421 #define pack_TPM_PCRVALUE(ptr, d) pack_TPM_DIGEST(ptr, d) argument
422 #define unpack_TPM_PCRVALUE(ptr, d) unpack_TPM_DIGEST(ptr, d) argument
425 #define pack_TPM_COMPOSITE_HASH(ptr, d) pack_TPM_DIGEST(ptr, d) argument
426 #define unpack_TPM_COMPOSITE_HASH(ptr, d) unpack_TPM_DIGEST(ptr, d) argument
427 #define unpack3_TPM_COMPOSITE_HASH(ptr, p, m, d) unpack3_TPM_DIGEST(ptr, p, m, d) argument
430 #define pack_TPM_DIRVALUE(ptr, d) pack_TPM_DIGEST(ptr, d) argument
431 #define unpack_TPM_DIRVALUE(ptr, d) unpack_TPM_DIGEST(ptr, d) argument
433 #define pack_TPM_HMAC(ptr, d) pack_TPM_DIGEST(ptr, d) argument
434 #define unpack_TPM_HMAC(ptr, d) unpack_TPM_DIGEST(ptr, d) argument
436 #define pack_TPM_CHOSENID_HASH(ptr, d) pack_TPM_DIGEST(ptr, d) argument
437 #define unpack_TPM_CHOSENID_HASH(ptr, d) unpack_TPM_DIGEST(ptr, d) argument
440 inline BYTE* pack_TPM_NONCE(BYTE* ptr, const TPM_NONCE* n) { in pack_TPM_NONCE() argument
441 return pack_BUFFER(ptr, n->nonce, TPM_DIGEST_SIZE); in pack_TPM_NONCE()
445 inline BYTE* unpack_TPM_NONCE(BYTE* ptr, TPM_NONCE* n) { in unpack_TPM_NONCE() argument
446 return unpack_BUFFER(ptr, n->nonce, TPM_DIGEST_SIZE); in unpack_TPM_NONCE()
452 inline int unpack3_TPM_NONCE(BYTE* ptr, UINT32* pos, UINT32 max, TPM_NONCE* n) { in unpack3_TPM_NONCE() argument
453 return unpack3_BUFFER(ptr, pos, max, n->nonce, TPM_DIGEST_SIZE); in unpack3_TPM_NONCE()
457 inline BYTE* pack_TPM_SYMMETRIC_KEY_PARMS(BYTE* ptr, const TPM_SYMMETRIC_KEY_PARMS* k) { in pack_TPM_SYMMETRIC_KEY_PARMS() argument
458 ptr = pack_UINT32(ptr, k->keyLength); in pack_TPM_SYMMETRIC_KEY_PARMS()
459 ptr = pack_UINT32(ptr, k->blockSize); in pack_TPM_SYMMETRIC_KEY_PARMS()
460 ptr = pack_UINT32(ptr, k->ivSize); in pack_TPM_SYMMETRIC_KEY_PARMS()
461 return pack_BUFFER(ptr, k->IV, k->ivSize); in pack_TPM_SYMMETRIC_KEY_PARMS()
465 inline BYTE* pack_TPM_SYMMETRIC_KEY(BYTE* ptr, const TPM_SYMMETRIC_KEY* k) { in pack_TPM_SYMMETRIC_KEY() argument
466 ptr = pack_UINT32(ptr, k->algId); in pack_TPM_SYMMETRIC_KEY()
467 ptr = pack_UINT16(ptr, k->encScheme); in pack_TPM_SYMMETRIC_KEY()
468 ptr = pack_UINT16(ptr, k->size); in pack_TPM_SYMMETRIC_KEY()
469 return pack_BUFFER(ptr, k->data, k->size); in pack_TPM_SYMMETRIC_KEY()
473 inline int unpack3_TPM_SYMMETRIC_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 max, TPM_SYMMETRIC_KEY_PA… in unpack3_TPM_SYMMETRIC_KEY_PARMS() argument
474 return unpack3_UINT32(ptr, pos, max, &k->keyLength) || in unpack3_TPM_SYMMETRIC_KEY_PARMS()
475 unpack3_UINT32(ptr, pos, max, &k->blockSize) || in unpack3_TPM_SYMMETRIC_KEY_PARMS()
476 unpack3_UINT32(ptr, pos, max, &k->ivSize) || in unpack3_TPM_SYMMETRIC_KEY_PARMS()
477 unpack3_PTR(ptr, pos, max, &k->IV, k->ivSize, alloc); in unpack3_TPM_SYMMETRIC_KEY_PARMS()
486 inline int unpack3_TPM_SYMMETRIC_KEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_SYMMETRIC_KEY* k, Unpa… in unpack3_TPM_SYMMETRIC_KEY() argument
487 return unpack3_UINT32(ptr, pos, max, &k->algId) || in unpack3_TPM_SYMMETRIC_KEY()
488 unpack3_UINT16(ptr, pos, max, &k->encScheme) || in unpack3_TPM_SYMMETRIC_KEY()
489 unpack3_UINT16(ptr, pos, max, &k->size) || in unpack3_TPM_SYMMETRIC_KEY()
490 unpack3_PTR(ptr, pos, max, &k->data, k->size, alloc); in unpack3_TPM_SYMMETRIC_KEY()
494 inline BYTE* pack_TPM_RSA_KEY_PARMS(BYTE* ptr, const TPM_RSA_KEY_PARMS* k) { in pack_TPM_RSA_KEY_PARMS() argument
495 ptr = pack_UINT32(ptr, k->keyLength); in pack_TPM_RSA_KEY_PARMS()
496 ptr = pack_UINT32(ptr, k->numPrimes); in pack_TPM_RSA_KEY_PARMS()
497 ptr = pack_UINT32(ptr, k->exponentSize); in pack_TPM_RSA_KEY_PARMS()
498 return pack_BUFFER(ptr, k->exponent, k->exponentSize); in pack_TPM_RSA_KEY_PARMS()
502 inline int unpack3_TPM_RSA_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 max, TPM_RSA_KEY_PARMS* k, Unpa… in unpack3_TPM_RSA_KEY_PARMS() argument
503 return unpack3_UINT32(ptr, pos, max, &k->keyLength) || in unpack3_TPM_RSA_KEY_PARMS()
504 unpack3_UINT32(ptr, pos, max, &k->numPrimes) || in unpack3_TPM_RSA_KEY_PARMS()
505 unpack3_UINT32(ptr, pos, max, &k->exponentSize) || in unpack3_TPM_RSA_KEY_PARMS()
506 unpack3_PTR(ptr, pos, max, &k->exponent, k->exponentSize, alloc); in unpack3_TPM_RSA_KEY_PARMS()
516 inline BYTE* pack_TPM_KEY_PARMS(BYTE* ptr, const TPM_KEY_PARMS* k) { in pack_TPM_KEY_PARMS() argument
517 ptr = pack_TPM_ALGORITHM_ID(ptr, k->algorithmID); in pack_TPM_KEY_PARMS()
518 ptr = pack_TPM_ENC_SCHEME(ptr, k->encScheme); in pack_TPM_KEY_PARMS()
519 ptr = pack_TPM_SIG_SCHEME(ptr, k->sigScheme); in pack_TPM_KEY_PARMS()
520 ptr = pack_UINT32(ptr, k->parmSize); in pack_TPM_KEY_PARMS()
525 return pack_TPM_RSA_KEY_PARMS(ptr, &k->parms.rsa); in pack_TPM_KEY_PARMS()
529 return pack_TPM_SYMMETRIC_KEY_PARMS(ptr, &k->parms.sym); in pack_TPM_KEY_PARMS()
532 return ptr; in pack_TPM_KEY_PARMS()
536 inline int unpack3_TPM_KEY_PARMS(BYTE* ptr, UINT32* pos, UINT32 len, TPM_KEY_PARMS* k, UnpackPtr al… in unpack3_TPM_KEY_PARMS() argument
537 int rc = unpack3_TPM_ALGORITHM_ID(ptr, pos, len, &k->algorithmID) || in unpack3_TPM_KEY_PARMS()
538 unpack3_TPM_ENC_SCHEME(ptr, pos, len, &k->encScheme) || in unpack3_TPM_KEY_PARMS()
539 unpack3_TPM_SIG_SCHEME(ptr, pos, len, &k->sigScheme) || in unpack3_TPM_KEY_PARMS()
540 unpack3_UINT32(ptr, pos, len, &k->parmSize); in unpack3_TPM_KEY_PARMS()
545 return unpack3_TPM_RSA_KEY_PARMS(ptr, pos, len, &k->parms.rsa, alloc); in unpack3_TPM_KEY_PARMS()
549 return unpack3_TPM_SYMMETRIC_KEY_PARMS(ptr, pos, len, &k->parms.sym, alloc); in unpack3_TPM_KEY_PARMS()
577 inline BYTE* pack_TPM_STORE_PUBKEY(BYTE* ptr, const TPM_STORE_PUBKEY* k) { in pack_TPM_STORE_PUBKEY() argument
578 ptr = pack_UINT32(ptr, k->keyLength); in pack_TPM_STORE_PUBKEY()
579 ptr = pack_BUFFER(ptr, k->key, k->keyLength); in pack_TPM_STORE_PUBKEY()
580 return ptr; in pack_TPM_STORE_PUBKEY()
584 inline int unpack3_TPM_STORE_PUBKEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_STORE_PUBKEY* k, Unpack… in unpack3_TPM_STORE_PUBKEY() argument
585 return unpack3_UINT32(ptr, pos, max, &k->keyLength) || in unpack3_TPM_STORE_PUBKEY()
586 unpack3_PTR(ptr, pos, max, &k->key, k->keyLength, alloc); in unpack3_TPM_STORE_PUBKEY()
595 inline BYTE* pack_TPM_PUBKEY(BYTE* ptr, const TPM_PUBKEY* k) { in pack_TPM_PUBKEY() argument
596 ptr = pack_TPM_KEY_PARMS(ptr, &k->algorithmParms); in pack_TPM_PUBKEY()
597 return pack_TPM_STORE_PUBKEY(ptr, &k->pubKey); in pack_TPM_PUBKEY()
601 inline int unpack3_TPM_PUBKEY(BYTE* ptr, UINT32* pos, UINT32 len, TPM_PUBKEY* k, UnpackPtr alloc) { in unpack3_TPM_PUBKEY() argument
602 return unpack3_TPM_KEY_PARMS(ptr, pos, len, &k->algorithmParms, alloc) || in unpack3_TPM_PUBKEY()
603 unpack3_TPM_STORE_PUBKEY(ptr, pos, len, &k->pubKey, alloc); in unpack3_TPM_PUBKEY()
607 inline BYTE* pack_TPM_PCR_SELECTION(BYTE* ptr, const TPM_PCR_SELECTION* p) { in pack_TPM_PCR_SELECTION() argument
608 ptr = pack_UINT16(ptr, p->sizeOfSelect); in pack_TPM_PCR_SELECTION()
609 ptr = pack_BUFFER(ptr, p->pcrSelect, p->sizeOfSelect); in pack_TPM_PCR_SELECTION()
610 return ptr; in pack_TPM_PCR_SELECTION()
614 inline BYTE* unpack_TPM_PCR_SELECTION(BYTE* ptr, TPM_PCR_SELECTION* p, UnpackPtr alloc) { in unpack_TPM_PCR_SELECTION() argument
615 ptr = unpack_UINT16(ptr, &p->sizeOfSelect); in unpack_TPM_PCR_SELECTION()
616 ptr = unpack_PTR(ptr, &p->pcrSelect, p->sizeOfSelect, alloc); in unpack_TPM_PCR_SELECTION()
617 return ptr; in unpack_TPM_PCR_SELECTION()
621 inline int unpack3_TPM_PCR_SELECTION(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_SELECTION* p, Unpa… in unpack3_TPM_PCR_SELECTION() argument
622 return unpack3_UINT16(ptr, pos, max, &p->sizeOfSelect) || in unpack3_TPM_PCR_SELECTION()
623 unpack3_PTR(ptr, pos, max, &p->pcrSelect, p->sizeOfSelect, alloc); in unpack3_TPM_PCR_SELECTION()
632 inline BYTE* pack_TPM_PCR_INFO(BYTE* ptr, const TPM_PCR_INFO* p) { in pack_TPM_PCR_INFO() argument
633 ptr = pack_TPM_PCR_SELECTION(ptr, &p->pcrSelection); in pack_TPM_PCR_INFO()
634 ptr = pack_TPM_COMPOSITE_HASH(ptr, &p->digestAtRelease); in pack_TPM_PCR_INFO()
635 ptr = pack_TPM_COMPOSITE_HASH(ptr, &p->digestAtCreation); in pack_TPM_PCR_INFO()
636 return ptr; in pack_TPM_PCR_INFO()
640 inline int unpack3_TPM_PCR_INFO(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_INFO* p, UnpackPtr allo… in unpack3_TPM_PCR_INFO() argument
641 return unpack3_TPM_PCR_SELECTION(ptr, pos, max, &p->pcrSelection, alloc) || in unpack3_TPM_PCR_INFO()
642 unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, &p->digestAtRelease) || in unpack3_TPM_PCR_INFO()
643 unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, &p->digestAtCreation); in unpack3_TPM_PCR_INFO()
656 inline BYTE* pack_TPM_PCR_INFO_LONG(BYTE* ptr, const TPM_PCR_INFO_LONG* p) { in pack_TPM_PCR_INFO_LONG() argument
657 ptr = pack_TPM_STRUCTURE_TAG(ptr, p->tag); in pack_TPM_PCR_INFO_LONG()
658 ptr = pack_TPM_LOCALITY_SELECTION(ptr, p->localityAtCreation); in pack_TPM_PCR_INFO_LONG()
659 ptr = pack_TPM_LOCALITY_SELECTION(ptr, p->localityAtRelease); in pack_TPM_PCR_INFO_LONG()
660 ptr = pack_TPM_PCR_SELECTION(ptr, &p->creationPCRSelection); in pack_TPM_PCR_INFO_LONG()
661 ptr = pack_TPM_PCR_SELECTION(ptr, &p->releasePCRSelection); in pack_TPM_PCR_INFO_LONG()
662 ptr = pack_TPM_COMPOSITE_HASH(ptr, &p->digestAtCreation); in pack_TPM_PCR_INFO_LONG()
663 ptr = pack_TPM_COMPOSITE_HASH(ptr, &p->digestAtRelease); in pack_TPM_PCR_INFO_LONG()
664 return ptr; in pack_TPM_PCR_INFO_LONG()
681 inline int unpack3_TPM_PCR_INFO_LONG(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_INFO_LONG* p, Unpa… in unpack3_TPM_PCR_INFO_LONG() argument
682 return unpack3_TPM_STRUCTURE_TAG(ptr, pos, max, &p->tag) || in unpack3_TPM_PCR_INFO_LONG()
683 unpack3_TPM_LOCALITY_SELECTION(ptr, pos, max, in unpack3_TPM_PCR_INFO_LONG()
685 unpack3_TPM_LOCALITY_SELECTION(ptr, pos, max, in unpack3_TPM_PCR_INFO_LONG()
687 unpack3_TPM_PCR_SELECTION(ptr, pos, max, in unpack3_TPM_PCR_INFO_LONG()
689 unpack3_TPM_PCR_SELECTION(ptr, pos, max, in unpack3_TPM_PCR_INFO_LONG()
691 unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, in unpack3_TPM_PCR_INFO_LONG()
693 unpack3_TPM_COMPOSITE_HASH(ptr, pos, max, &p->digestAtRelease); in unpack3_TPM_PCR_INFO_LONG()
697 inline BYTE* pack_TPM_PCR_COMPOSITE(BYTE* ptr, const TPM_PCR_COMPOSITE* p) { in pack_TPM_PCR_COMPOSITE() argument
698 ptr = pack_TPM_PCR_SELECTION(ptr, &p->select); in pack_TPM_PCR_COMPOSITE()
699 ptr = pack_UINT32(ptr, p->valueSize); in pack_TPM_PCR_COMPOSITE()
700 ptr = pack_BUFFER(ptr, (const BYTE*)p->pcrValue, p->valueSize); in pack_TPM_PCR_COMPOSITE()
701 return ptr; in pack_TPM_PCR_COMPOSITE()
705 inline int unpack3_TPM_PCR_COMPOSITE(BYTE* ptr, UINT32* pos, UINT32 max, TPM_PCR_COMPOSITE* p, Unpa… in unpack3_TPM_PCR_COMPOSITE() argument
706 return unpack3_TPM_PCR_SELECTION(ptr, pos, max, &p->select, alloc) || in unpack3_TPM_PCR_COMPOSITE()
707 unpack3_UINT32(ptr, pos, max, &p->valueSize) || in unpack3_TPM_PCR_COMPOSITE()
708 unpack3_PTR(ptr, pos, max, (BYTE**)&p->pcrValue, p->valueSize, alloc); in unpack3_TPM_PCR_COMPOSITE()
712 inline BYTE* pack_TPM_KEY(BYTE* ptr, const TPM_KEY* k) { in pack_TPM_KEY() argument
713 ptr = pack_TPM_VERSION(ptr, &k->ver); in pack_TPM_KEY()
714 ptr = pack_TPM_KEY_USAGE(ptr, k->keyUsage); in pack_TPM_KEY()
715 ptr = pack_TPM_KEY_FLAGS(ptr, k->keyFlags); in pack_TPM_KEY()
716 ptr = pack_TPM_AUTH_DATA_USAGE(ptr, k->authDataUsage); in pack_TPM_KEY()
717 ptr = pack_TPM_KEY_PARMS(ptr, &k->algorithmParms); in pack_TPM_KEY()
718 ptr = pack_UINT32(ptr, k->PCRInfoSize); in pack_TPM_KEY()
720 ptr = pack_TPM_PCR_INFO(ptr, &k->PCRInfo); in pack_TPM_KEY()
722 ptr = pack_TPM_STORE_PUBKEY(ptr, &k->pubKey); in pack_TPM_KEY()
723 ptr = pack_UINT32(ptr, k->encDataSize); in pack_TPM_KEY()
724 return pack_BUFFER(ptr, k->encData, k->encDataSize); in pack_TPM_KEY()
728 inline int unpack3_TPM_KEY(BYTE* ptr, UINT32* pos, UINT32 max, TPM_KEY* k, UnpackPtr alloc) { in unpack3_TPM_KEY() argument
729 int rc = unpack3_TPM_VERSION(ptr, pos, max, &k->ver) || in unpack3_TPM_KEY()
730 unpack3_TPM_KEY_USAGE(ptr, pos, max, &k->keyUsage) || in unpack3_TPM_KEY()
731 unpack3_TPM_KEY_FLAGS(ptr, pos, max, &k->keyFlags) || in unpack3_TPM_KEY()
732 unpack3_TPM_AUTH_DATA_USAGE(ptr, pos, max, &k->authDataUsage) || in unpack3_TPM_KEY()
733 unpack3_TPM_KEY_PARMS(ptr, pos, max, &k->algorithmParms, alloc) || in unpack3_TPM_KEY()
734 unpack3_UINT32(ptr, pos, max, &k->PCRInfoSize); in unpack3_TPM_KEY()
737 rc = unpack3_TPM_PCR_INFO(ptr, pos, max, &k->PCRInfo, alloc); in unpack3_TPM_KEY()
740 return unpack3_TPM_STORE_PUBKEY(ptr, pos, max, &k->pubKey, alloc) || in unpack3_TPM_KEY()
741 unpack3_UINT32(ptr, pos, max, &k->encDataSize) || in unpack3_TPM_KEY()
742 unpack3_PTR(ptr, pos, max, &k->encData, k->encDataSize, alloc); in unpack3_TPM_KEY()
764 inline BYTE* pack_TPM_BOUND_DATA(BYTE* ptr, const TPM_BOUND_DATA* b, UINT32 payloadSize) { in pack_TPM_BOUND_DATA() argument
765 ptr = pack_TPM_VERSION(ptr, &b->ver); in pack_TPM_BOUND_DATA()
766 ptr = pack_TPM_PAYLOAD_TYPE(ptr, b->payload); in pack_TPM_BOUND_DATA()
767 return pack_BUFFER(ptr, b->payloadData, payloadSize); in pack_TPM_BOUND_DATA()
771 inline BYTE* unpack_TPM_BOUND_DATA(BYTE* ptr, TPM_BOUND_DATA* b, UINT32 payloadSize, UnpackPtr allo… in unpack_TPM_BOUND_DATA() argument
772 ptr = unpack_TPM_VERSION(ptr, &b->ver); in unpack_TPM_BOUND_DATA()
773 ptr = unpack_TPM_PAYLOAD_TYPE(ptr, &b->payload); in unpack_TPM_BOUND_DATA()
774 return unpack_PTR(ptr, &b->payloadData, payloadSize, alloc); in unpack_TPM_BOUND_DATA()
778 inline BYTE* pack_TPM_STORED_DATA(BYTE* ptr, const TPM_STORED_DATA* d) { in pack_TPM_STORED_DATA() argument
779 ptr = pack_TPM_VERSION(ptr, &d->ver); in pack_TPM_STORED_DATA()
780 ptr = pack_UINT32(ptr, d->sealInfoSize); in pack_TPM_STORED_DATA()
782 ptr = pack_TPM_PCR_INFO(ptr, &d->sealInfo); in pack_TPM_STORED_DATA()
784 ptr = pack_UINT32(ptr, d->encDataSize); in pack_TPM_STORED_DATA()
785 ptr = pack_BUFFER(ptr, d->encData, d->encDataSize); in pack_TPM_STORED_DATA()
786 return ptr; in pack_TPM_STORED_DATA()
801 inline int unpack3_TPM_STORED_DATA(BYTE* ptr, UINT32* pos, UINT32 len, TPM_STORED_DATA* d, UnpackPt… in unpack3_TPM_STORED_DATA() argument
802 int rc = unpack3_TPM_VERSION(ptr, pos, len, &d->ver) || in unpack3_TPM_STORED_DATA()
803 unpack3_UINT32(ptr, pos, len, &d->sealInfoSize); in unpack3_TPM_STORED_DATA()
807 rc = unpack3_TPM_PCR_INFO(ptr, pos, len, &d->sealInfo, alloc); in unpack3_TPM_STORED_DATA()
810 rc = unpack3_UINT32(ptr, pos, len, &d->encDataSize) || in unpack3_TPM_STORED_DATA()
811 unpack3_PTR(ptr, pos, len, &d->encData, d->encDataSize, alloc); in unpack3_TPM_STORED_DATA()
816 inline BYTE* pack_TPM_STORED_DATA12(BYTE* ptr, const TPM_STORED_DATA12* d) { in pack_TPM_STORED_DATA12() argument
817 ptr = pack_TPM_STRUCTURE_TAG(ptr, d->tag); in pack_TPM_STORED_DATA12()
818 ptr = pack_TPM_ENTITY_TYPE(ptr, d->et); in pack_TPM_STORED_DATA12()
819 ptr = pack_UINT32(ptr, d->sealInfoLongSize); in pack_TPM_STORED_DATA12()
821 ptr = pack_TPM_PCR_INFO_LONG(ptr, &d->sealInfoLong); in pack_TPM_STORED_DATA12()
823 ptr = pack_UINT32(ptr, d->encDataSize); in pack_TPM_STORED_DATA12()
824 ptr = pack_BUFFER(ptr, d->encData, d->encDataSize); in pack_TPM_STORED_DATA12()
825 return ptr; in pack_TPM_STORED_DATA12()
842 inline int unpack3_TPM_STORED_DATA12(BYTE* ptr, UINT32* pos, UINT32 len, TPM_STORED_DATA12* d, Unpa… in unpack3_TPM_STORED_DATA12() argument
843 int rc = unpack3_TPM_STRUCTURE_TAG(ptr, pos, len, &d->tag) || in unpack3_TPM_STORED_DATA12()
844 unpack3_TPM_ENTITY_TYPE(ptr, pos, len, &d->et) || in unpack3_TPM_STORED_DATA12()
845 unpack3_UINT32(ptr, pos, len, &d->sealInfoLongSize); in unpack3_TPM_STORED_DATA12()
849 rc = unpack3_TPM_PCR_INFO_LONG(ptr, pos, len, &d->sealInfoLong, in unpack3_TPM_STORED_DATA12()
853 rc = unpack3_UINT32(ptr, pos, len, &d->encDataSize) || in unpack3_TPM_STORED_DATA12()
854 unpack3_PTR(ptr, pos, len, &d->encData, d->encDataSize, alloc); in unpack3_TPM_STORED_DATA12()
859 inline BYTE* pack_TPM_AUTH_SESSION(BYTE* ptr, const TPM_AUTH_SESSION* auth) { in pack_TPM_AUTH_SESSION() argument
860 ptr = pack_TPM_AUTH_HANDLE(ptr, auth->AuthHandle); in pack_TPM_AUTH_SESSION()
861 ptr = pack_TPM_NONCE(ptr, &auth->NonceOdd); in pack_TPM_AUTH_SESSION()
862 ptr = pack_BOOL(ptr, auth->fContinueAuthSession); in pack_TPM_AUTH_SESSION()
863 ptr = pack_TPM_AUTHDATA(ptr, &auth->HMAC); in pack_TPM_AUTH_SESSION()
864 return ptr; in pack_TPM_AUTH_SESSION()
868 inline BYTE* unpack_TPM_AUTH_SESSION(BYTE* ptr, TPM_AUTH_SESSION* auth) { in unpack_TPM_AUTH_SESSION() argument
869 ptr = unpack_TPM_NONCE(ptr, &auth->NonceEven); in unpack_TPM_AUTH_SESSION()
870 ptr = unpack_BOOL(ptr, &auth->fContinueAuthSession); in unpack_TPM_AUTH_SESSION()
871 ptr = unpack_TPM_AUTHDATA(ptr, &auth->HMAC); in unpack_TPM_AUTH_SESSION()
872 return ptr; in unpack_TPM_AUTH_SESSION()
876 inline int unpack3_TPM_AUTH_SESSION(BYTE* ptr, UINT32* pos, UINT32 len, TPM_AUTH_SESSION* auth) { in unpack3_TPM_AUTH_SESSION() argument
877 return unpack3_TPM_NONCE(ptr, pos, len, &auth->NonceEven) || in unpack3_TPM_AUTH_SESSION()
878 unpack3_BOOL(ptr, pos, len, &auth->fContinueAuthSession) || in unpack3_TPM_AUTH_SESSION()
879 unpack3_TPM_AUTHDATA(ptr, pos, len, &auth->HMAC); in unpack3_TPM_AUTH_SESSION()
894 inline BYTE* pack_TPM_RQU_HEADER(BYTE* ptr, in pack_TPM_RQU_HEADER() argument
898 ptr = pack_UINT16(ptr, tag); in pack_TPM_RQU_HEADER()
899 ptr = pack_UINT32(ptr, size); in pack_TPM_RQU_HEADER()
900 return pack_UINT32(ptr, ord); in pack_TPM_RQU_HEADER()
904 inline BYTE* unpack_TPM_RQU_HEADER(BYTE* ptr, in unpack_TPM_RQU_HEADER() argument
908 ptr = unpack_UINT16(ptr, tag); in unpack_TPM_RQU_HEADER()
909 ptr = unpack_UINT32(ptr, size); in unpack_TPM_RQU_HEADER()
910 ptr = unpack_UINT32(ptr, ord); in unpack_TPM_RQU_HEADER()
911 return ptr; in unpack_TPM_RQU_HEADER()
915 inline int unpack3_TPM_RQU_HEADER(BYTE* ptr, UINT32* pos, UINT32 max, in unpack3_TPM_RQU_HEADER() argument
918 unpack3_UINT16(ptr, pos, max, tag) || in unpack3_TPM_RQU_HEADER()
919 unpack3_UINT32(ptr, pos, max, size) || in unpack3_TPM_RQU_HEADER()
920 unpack3_UINT32(ptr, pos, max, ord); in unpack3_TPM_RQU_HEADER()