Peer Content Caching and Retrieval: Content Identification [MS-PCCRC].
Definition in file pccrc.c.
Get raw data.
- Parameters
-
info | Content information |
data | Data buffer |
offset | Starting offset |
len | Length |
- Return values
-
Definition at line 79 of file pccrc.c.
85 DBGC (
info,
"PCCRC %p data underrun at [%zx,%zx) of %zx\n",
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
#define ERANGE
Result too large.
uint8_t data[48]
Additional event data.
uint16_t offset
Offset to command line.
References copy_from_user(), data, DBGC, ERANGE, info, len, and offset.
Referenced by peerdist_info(), peerdist_info_v1(), peerdist_info_v1_block(), peerdist_info_v1_blocks(), peerdist_info_v1_segment(), peerdist_info_v2(), peerdist_info_v2_cursor_next(), and peerdist_info_v2_segment().
static void peerdist_info_segment_hash |
( |
struct peerdist_info_segment * |
segment, |
|
|
const void * |
hash, |
|
|
const void * |
secret |
|
) |
| |
|
static |
Populate segment hashes.
- Parameters
-
segment | Content information segment to fill in |
hash | Segment hash of data |
secret | Segment secret |
Definition at line 103 of file pccrc.c.
void hmac_init(struct digest_algorithm *digest, void *ctx, const void *key, size_t key_len)
Initialise HMAC.
uint16_t segment
Code segment.
pseudo_bit_t hash[0x00010]
struct golan_eq_context ctx
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define PEERDIST_SEGMENT_ID_MAGIC
Magic string constant used to calculate segment identifier.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void hmac_update(struct digest_algorithm *digest, void *ctx, const void *data, size_t len)
Update HMAC.
static size_t hmac_ctxsize(struct digest_algorithm *digest)
Calculate HMAC context size.
uint16_t magic
Magic signature.
A message digest algorithm.
void hmac_final(struct digest_algorithm *digest, void *ctx, void *hmac)
Finalise HMAC.
uint32_t digestsize
Digest size (i.e.
References assert(), ctx, digestsize, hash, hmac_ctxsize(), hmac_final(), hmac_init(), hmac_update(), info, magic, memcpy(), PEERDIST_SEGMENT_ID_MAGIC, and segment.
Referenced by peerdist_info_v1_segment(), and peerdist_info_v2_segment().
static ssize_t peerdist_info_v1_block_offset |
( |
const struct peerdist_info * |
info, |
|
|
unsigned int |
index |
|
) |
| |
|
static |
Locate block description.
- Parameters
-
info | Content information |
index | Segment index |
- Return values
-
offset | Block description offset, or negative error |
Definition at line 167 of file pccrc.c.
176 assert ( index < info->segments );
184 for ( i = 0 ; i <
index ; i++ ) {
190 DBGC (
info,
"PCCRC %p segment %d could not get number " struct arbelprm_rc_send_wqe rc
Content Information version 1 data structure header.
uint32_t segments
Number of segments within the content information.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
char * strerror(int errno)
Retrieve string representation of error number.
static int peerdist_info_v1_blocks(const struct peerdist_info *info, size_t offset)
Get number of blocks within a block description.
#define peerdist_info_v1_segment_t(digestsize)
Content Information version 1 segment description.
uint32_t blocks
Number of blocks within the block description.
uint16_t offset
Offset to command line.
uint32_t digestsize
Digest size (i.e.
#define peerdist_info_v1_block_t(digestsize, blocks)
Content Information version 1 block description.
References assert(), peerdist_info_v1_block::blocks, DBGC, digestsize, index, info, offset, peerdist_info_v1_block_t, peerdist_info_v1_blocks(), peerdist_info_v1_segment_t, rc, peerdist_info_v1::segments, and strerror().
Referenced by peerdist_info_v1_block(), and peerdist_info_v1_segment().
Populate content information.
- Parameters
-
info | Content information to fill in |
- Return values
-
Definition at line 209 of file pccrc.c.
220 DBGC (
info,
"PCCRC %p could not get V1 content information: " 227 switch (
raw.hash ) {
238 DBGC (
info,
"PCCRC %p unsupported hash algorithm %#08x\n",
242 info->digestsize =
info->digest->digestsize;
244 DBGC2 (
info,
"PCCRC %p using %s[%zd]\n",
259 info->trim.start = (
first.range.start + first_skip );
263 (
info->segments - 1 ) ) ) != 0 )
267 info->range.end = last.range.end;
273 last_skip = ( last.index ? 0 : first_skip );
274 info->trim.end = ( last.range.start + last_skip + last_read );
277 info->trim.end = last.range.end;
struct arbelprm_rc_send_wqe rc
#define PEERDIST_INFO_V1_HASH_SHA512
SHA-512 hash algorithm.
A content information segment.
#define le32_to_cpu(value)
Content Information version 1 data structure header.
uint32_t first
First block in range.
struct digest_algorithm sha512_algorithm
SHA-512 algorithm.
struct digest_algorithm sha384_algorithm
SHA-384 algorithm.
#define ENOTSUP
Operation not supported.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define cpu_to_le32(value)
char * strerror(int errno)
Retrieve string representation of error number.
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
#define PEERDIST_INFO_V1_HASH_SHA384
SHA-384 hash algorithm.
#define PEERDIST_INFO_V1_HASH_SHA256
SHA-256 hash algorithm.
struct digest_algorithm sha256_algorithm
SHA-256 algorithm.
#define cpu_to_le16(value)
#define NULL
NULL pointer (VOID *)
#define PEERDIST_INFO_V1
Content Information version 1.
References assert(), cpu_to_le16, cpu_to_le32, DBGC, DBGC2, peerdist_range::end, ENOTSUP, first, peerdist_info_segment::index, info, le32_to_cpu, NULL, peerdist_info_get(), PEERDIST_INFO_V1, PEERDIST_INFO_V1_HASH_SHA256, PEERDIST_INFO_V1_HASH_SHA384, PEERDIST_INFO_V1_HASH_SHA512, peerdist_info_segment::range, raw, rc, sha256_algorithm, sha384_algorithm, sha512_algorithm, peerdist_range::start, and strerror().
Populate content information segment.
- Parameters
-
segment | Content information segment to fill in |
- Return values
-
Definition at line 289 of file pccrc.c.
304 sizeof (
raw ) ) ) != 0 ) {
305 DBGC (
info,
"PCCRC %p segment %d could not get segment " 323 if ( raw_offset < 0 ) {
332 DBGC (
info,
"PCCRC %p segment %d could not get number of " uint16_t segment
Code segment.
struct arbelprm_rc_send_wqe rc
#define le32_to_cpu(value)
Content Information version 1 data structure header.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static ssize_t peerdist_info_v1_block_offset(const struct peerdist_info *info, unsigned int index)
Locate block description.
char * strerror(int errno)
Retrieve string representation of error number.
static void peerdist_info_segment_hash(struct peerdist_info_segment *segment, const void *hash, const void *secret)
Populate segment hashes.
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
static int peerdist_info_v1_blocks(const struct peerdist_info *info, size_t offset)
Get number of blocks within a block description.
#define peerdist_info_v1_segment_t(digestsize)
Content Information version 1 segment description.
uint32_t digestsize
Digest size (i.e.
#define le64_to_cpu(value)
References assert(), DBGC, digestsize, index, info, le32_to_cpu, le64_to_cpu, peerdist_info_get(), peerdist_info_segment_hash(), peerdist_info_v1_block_offset(), peerdist_info_v1_blocks(), peerdist_info_v1_segment_t, raw, rc, segment, and strerror().
Populate content information block.
- Parameters
-
block | Content information block to fill in |
- Return values
-
Definition at line 350 of file pccrc.c.
372 if ( raw_offset < 0 ) {
381 DBGC (
info,
"PCCRC %p segment %d block %d could not get " uint16_t segment
Code segment.
struct arbelprm_rc_send_wqe rc
pseudo_bit_t hash[0x00010]
A content information segment.
#define offsetof(type, field)
Get offset of a field within a structure.
uint32_t start
Starting offset.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static ssize_t peerdist_info_v1_block_offset(const struct peerdist_info *info, unsigned int index)
Locate block description.
static __always_inline void struct pci_range * range
char * strerror(int errno)
Retrieve string representation of error number.
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
uint8_t block[3][8]
DES-encrypted blocks.
uint32_t end
Ending offset.
uint32_t blksize
Cipher block size.
typeof(acpi_finder=acpi_find)
ACPI table finder.
uint32_t digestsize
Digest size (i.e.
#define peerdist_info_v1_block_t(digestsize, blocks)
Content Information version 1 block description.
if(natsemi->flags &NATSEMI_64BIT) return 1
References assert(), block, DBGC, digestsize, hash, info, offsetof, peerdist_info_get(), peerdist_info_v1_block_offset(), peerdist_info_v1_block_t, raw, rc, segment, strerror(), and typeof().
Update segment cursor to next segment description.
- Parameters
-
info | Content information |
offset | Current offset |
remaining | Number of segments remaining within this chunk |
- Return values
-
Definition at line 438 of file pccrc.c.
452 sizeof ( chunk ) ) ) != 0 )
462 sizeof (
raw.segment ) ) ) != 0 )
469 cursor->
offset +=
sizeof ( chunk );
struct arbelprm_rc_send_wqe rc
unsigned int remaining
Number of segments remaining within this chunk.
#define be32_to_cpu(value)
size_t offset
Raw data offset.
#define peerdist_info_v2_segment_t(digestsize)
Content Information version 2 segment description.
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
size_t len
Accumulated segment length.
uint32_t digestsize
Digest size (i.e.
Content Information version 2 chunk description header.
References be32_to_cpu, digestsize, info, peerdist_info_v2_chunk::len, peerdist_info_v2_cursor::len, peerdist_info_v2_cursor::offset, peerdist_info_get(), peerdist_info_v2_segment_t, raw, rc, and peerdist_info_v2_cursor::remaining.
Referenced by peerdist_info_v2_segment(), and peerdist_info_v2_segments().
Get number of segments and total length.
- Parameters
-
info | Content information |
len | Length to fill in |
- Return values
-
rc | Number of segments, or negative error |
Definition at line 482 of file pccrc.c.
485 unsigned int segments;
490 cursor.offset <
info->raw.len ; segments++ ) {
495 DBGC (
info,
"PCCRC %p segment %d could not update " 496 "segment cursor: %s\n",
struct arbelprm_rc_send_wqe rc
static void peerdist_info_v2_cursor_init(struct peerdist_info_v2_cursor *cursor)
Initialise segment cursor.
char * strerror(int errno)
Retrieve string representation of error number.
static int peerdist_info_v2_cursor_next(const struct peerdist_info *info, struct peerdist_info_v2_cursor *cursor)
Update segment cursor to next segment description.
References DBGC, info, len, peerdist_info_v2_cursor::len, peerdist_info_v2_cursor::offset, peerdist_info_v2_cursor_init(), peerdist_info_v2_cursor_next(), rc, and strerror().
Referenced by peerdist_info_v2().
Populate content information.
- Parameters
-
info | Content information to fill in |
- Return values
-
Definition at line 514 of file pccrc.c.
522 DBGC (
info,
"PCCRC %p could not get V2 content information: " 529 switch (
raw.hash ) {
532 info->digestsize = ( 256 / 8 );
535 DBGC (
info,
"PCCRC %p unsupported hash algorithm %#02x\n",
540 DBGC2 (
info,
"PCCRC %p using %s[%zd]\n",
545 if ( segments < 0 ) {
547 DBGC (
info,
"PCCRC %p could not get segment count and length: " 551 info->segments = segments;
struct arbelprm_rc_send_wqe rc
struct digest_algorithm sha512_algorithm
SHA-512 algorithm.
#define ENOTSUP
Operation not supported.
#define PEERDIST_INFO_V2
Content Information version 2.
#define be32_to_cpu(value)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static int peerdist_info_v2_segments(const struct peerdist_info *info, size_t *len)
Get number of segments and total length.
static __always_inline void struct pci_range * range
char * strerror(int errno)
Retrieve string representation of error number.
#define be64_to_cpu(value)
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
#define PEERDIST_INFO_V2_HASH_SHA512_TRUNC
SHA-512 hash algorithm with output truncated to first 256 bits.
#define cpu_to_le16(value)
uint32_t end
Ending offset.
Content Information version 2 data structure header.
#define NULL
NULL pointer (VOID *)
References assert(), be32_to_cpu, be64_to_cpu, cpu_to_le16, DBGC, DBGC2, ENOTSUP, info, len, NULL, peerdist_info_get(), PEERDIST_INFO_V2, PEERDIST_INFO_V2_HASH_SHA512_TRUNC, peerdist_info_v2_segments(), raw, rc, sha512_algorithm, and strerror().
Populate content information segment.
- Parameters
-
segment | Content information segment to fill in |
- Return values
-
Definition at line 575 of file pccrc.c.
594 DBGC (
info,
"PCCRC %p segment %d could not update " 595 "segment cursor: %s\n",
603 sizeof (
raw ) ) ) != 0 ) {
604 DBGC (
info,
"PCCRC %p segment %d could not get segment " 611 segment->range.start = (
info->range.start + cursor.len );
uint16_t segment
Code segment.
struct arbelprm_rc_send_wqe rc
static void peerdist_info_v2_cursor_init(struct peerdist_info_v2_cursor *cursor)
Initialise segment cursor.
#define be32_to_cpu(value)
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
char * strerror(int errno)
Retrieve string representation of error number.
#define peerdist_info_v2_segment_t(digestsize)
Content Information version 2 segment description.
static void peerdist_info_segment_hash(struct peerdist_info_segment *segment, const void *hash, const void *secret)
Populate segment hashes.
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
static int peerdist_info_v2_cursor_next(const struct peerdist_info *info, struct peerdist_info_v2_cursor *cursor)
Update segment cursor to next segment description.
uint32_t digestsize
Digest size (i.e.
References assert(), be32_to_cpu, DBGC, digestsize, index, info, len, peerdist_info_v2_cursor::len, peerdist_info_v2_cursor::offset, peerdist_info_get(), peerdist_info_segment_hash(), peerdist_info_v2_cursor_init(), peerdist_info_v2_cursor_next(), peerdist_info_v2_segment_t, raw, rc, segment, and strerror().
Populate content information.
- Parameters
-
data | Raw data |
len | Length of raw data |
info | Content information to fill in |
- Return values
-
Definition at line 670 of file pccrc.c.
681 sizeof (
version ) ) ) != 0 ) {
682 DBGC (
info,
"PCCRC %p could not get version: %s\n",
686 DBGC2 (
info,
"PCCRC %p version %d.%d\n",
698 DBGC (
info,
"PCCRC %p unsupported version %d.%d\n",
709 DBGC2 (
info,
"PCCRC %p range [%08zx,%08zx) covers [%08zx,%08zx) with " 710 "%d segments\n",
info,
info->range.start,
info->range.end,
struct arbelprm_rc_send_wqe rc
#define ENOTSUP
Operation not supported.
static struct peerdist_info_operations peerdist_info_v1_operations
Content information version 1 operations.
u32 version
Driver version.
#define PEERDIST_INFO_V2
Content Information version 2.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
char * strerror(int errno)
Retrieve string representation of error number.
static int peerdist_info_get(const struct peerdist_info *info, void *data, size_t offset, size_t len)
Get raw data.
static uint16_t struct vmbus_xfer_pages_operations * op
static struct peerdist_info_operations peerdist_info_v2_operations
Content information version 2 operations.
#define cpu_to_le16(value)
uint8_t data[48]
Additional event data.
#define NULL
NULL pointer (VOID *)
#define PEERDIST_INFO_V1
Content Information version 1.
Content Information version number.
void * memset(void *dest, int character, size_t len) __nonnull
References assert(), cpu_to_le16, data, DBGC, DBGC2, ENOTSUP, info, len, memset(), NULL, peerdist_info_get(), PEERDIST_INFO_V1, peerdist_info_v1_operations, PEERDIST_INFO_V2, peerdist_info_v2_operations, rc, strerror(), and version.
Populate content information block.
- Parameters
-
segment | Content information segment |
block | Content information block to fill in |
index | Block index |
- Return values
-
Definition at line 767 of file pccrc.c.
781 DBGC (
info,
"PCCRC %p segment %d block %d of [0,%d) out of " 807 DBGC2 (
info,
"PCCRC %p segment %d block %d hash %s\n",
810 DBGC2 (
info,
"PCCRC %p segment %d block %d range [%08zx,%08zx) covers " uint16_t segment
Code segment.
struct arbelprm_rc_send_wqe rc
static const char * peerdist_info_hash_ntoa(const struct peerdist_info *info, const void *hash)
Transcribe hash value (for debugging)
size_t start
Start offset.
uint32_t start
Starting offset.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct peerdist_range trim
Trimmed content range.
#define ERANGE
Result too large.
uint8_t block[3][8]
DES-encrypted blocks.
uint32_t end
Ending offset.
#define NULL
NULL pointer (VOID *)
void * memset(void *dest, int character, size_t len) __nonnull
References assert(), block, DBGC, DBGC2, end, ERANGE, index, info, memset(), NULL, peerdist_info_hash_ntoa(), rc, segment, start, peerdist_range::start, and peerdist_info::trim.