|
iPXE
|
Peer Content Caching and Retrieval: Content Identification [MS-PCCRC]. More...
#include <errno.h>#include <assert.h>#include <ipxe/sha256.h>#include <ipxe/sha512.h>#include <ipxe/hmac.h>#include <ipxe/base16.h>#include <ipxe/pccrc.h>Go to the source code of this file.
Data Structures | |
| struct | peerdist_info_v2_cursor |
| A segment cursor. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| static const char * | peerdist_info_hash_ntoa (const struct peerdist_info *info, const void *hash) |
| Transcribe hash value (for debugging). | |
| static int | peerdist_info_get (const struct peerdist_info *info, void *data, size_t offset, size_t len) |
| Get raw data. | |
| static void | peerdist_info_segment_hash (struct peerdist_info_segment *segment, const void *hash, const void *secret) |
| Populate segment hashes. | |
| static int | peerdist_info_v1_blocks (const struct peerdist_info *info, size_t offset) |
| Get number of blocks within a block description. | |
| static ssize_t | peerdist_info_v1_block_offset (const struct peerdist_info *info, unsigned int index) |
| Locate block description. | |
| static int | peerdist_info_v1 (struct peerdist_info *info) |
| Populate content information. | |
| static int | peerdist_info_v1_segment (struct peerdist_info_segment *segment) |
| Populate content information segment. | |
| static int | peerdist_info_v1_block (struct peerdist_info_block *block) |
| Populate content information block. | |
| static void | peerdist_info_v2_cursor_init (struct peerdist_info_v2_cursor *cursor) |
| Initialise segment cursor. | |
| 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. | |
| static int | peerdist_info_v2_segments (const struct peerdist_info *info, size_t *len) |
| Get number of segments and total length. | |
| static int | peerdist_info_v2 (struct peerdist_info *info) |
| Populate content information. | |
| static int | peerdist_info_v2_segment (struct peerdist_info_segment *segment) |
| Populate content information segment. | |
| static int | peerdist_info_v2_block (struct peerdist_info_block *block) |
| Populate content information block. | |
| int | peerdist_info (const void *data, size_t len, struct peerdist_info *info) |
| Populate content information. | |
| int | peerdist_info_segment (const struct peerdist_info *info, struct peerdist_info_segment *segment, unsigned int index) |
| Populate content information segment. | |
| int | peerdist_info_block (const struct peerdist_info_segment *segment, struct peerdist_info_block *block, unsigned int index) |
| Populate content information block. | |
Variables | |
| static struct peerdist_info_operations | peerdist_info_v1_operations |
| Content information version 1 operations. | |
| static struct peerdist_info_operations | peerdist_info_v2_operations |
| Content information version 2 operations. | |
Peer Content Caching and Retrieval: Content Identification [MS-PCCRC].
Definition in file pccrc.c.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
inlinestatic |
Transcribe hash value (for debugging).
| string | Hash value string |
Definition at line 56 of file pccrc.c.
References assert, base16_encoded_len(), digestsize, hash, info, NULL, and PEERDIST_DIGEST_MAX_SIZE.
Referenced by peerdist_info_block(), and peerdist_info_segment().
|
static |
Get raw data.
| rc | Return status code |
Definition at line 79 of file pccrc.c.
References data, DBGC, ERANGE, info, len, memcpy(), 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 |
Populate segment hashes.
| segment | Content information segment to fill in |
| hash | Segment hash of data |
| secret | Segment secret |
Definition at line 103 of file pccrc.c.
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 |
Get number of blocks within a block description.
| blocks | Number of blocks, or negative error |
Definition at line 143 of file pccrc.c.
References peerdist_info_v1_block::blocks, info, le32_to_cpu, offset, peerdist_info_get(), raw, and rc.
Referenced by peerdist_info_v1_block_offset(), and peerdist_info_v1_segment().
|
static |
Locate block description.
| offset | Block description offset, or negative error |
Definition at line 167 of file pccrc.c.
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().
|
static |
Populate content information.
| info | Content information to fill in |
| rc | Return status code |
Definition at line 209 of file pccrc.c.
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().
|
static |
Populate content information segment.
| segment | Content information segment to fill in |
| rc | Return status code |
Definition at line 289 of file pccrc.c.
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().
|
static |
Populate content information block.
| block | Content information block to fill in |
| rc | Return status code |
Definition at line 350 of file pccrc.c.
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().
|
inlinestatic |
Initialise segment cursor.
| cursor | Segment cursor |
Definition at line 420 of file pccrc.c.
References peerdist_info_v2_cursor::len, peerdist_info_v2_cursor::offset, and peerdist_info_v2_cursor::remaining.
Referenced by peerdist_info_v2_segment(), and peerdist_info_v2_segments().
|
static |
Update segment cursor to next segment description.
| info | Content information |
| offset | Current offset |
| remaining | Number of segments remaining within this chunk |
| rc | Return status code |
Definition at line 438 of file pccrc.c.
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().
|
static |
Get number of segments and total length.
| rc | Number of segments, or negative error |
Definition at line 482 of file pccrc.c.
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().
|
static |
Populate content information.
| info | Content information to fill in |
| rc | Return status code |
Definition at line 514 of file pccrc.c.
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().
|
static |
Populate content information segment.
| segment | Content information segment to fill in |
| rc | Return status code |
Definition at line 575 of file pccrc.c.
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().
|
static |
Populate content information block.
| block | Content information block to fill in |
| rc | Return status code |
Definition at line 633 of file pccrc.c.
References assert, block, digestsize, info, memcpy(), and segment.
| int peerdist_info | ( | const void * | data, |
| size_t | len, | ||
| struct peerdist_info * | info ) |
Populate content information.
| rc | Return status code |
Definition at line 670 of file pccrc.c.
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.
| int peerdist_info_segment | ( | const struct peerdist_info * | info, |
| struct peerdist_info_segment * | segment, | ||
| unsigned int | index ) |
Populate content information segment.
| rc | Return status code |
Definition at line 724 of file pccrc.c.
References assert, DBGC, DBGC2, ERANGE, index, info, memset(), NULL, peerdist_info_hash_ntoa(), rc, and segment.
| int peerdist_info_block | ( | const struct peerdist_info_segment * | segment, |
| struct peerdist_info_block * | block, | ||
| unsigned int | index ) |
Populate content information block.
| segment | Content information segment |
| block | Content information block to fill in |
| index | Block index |
| rc | Return status code |
Definition at line 768 of file pccrc.c.
References assert, block, DBGC, DBGC2, end, ERANGE, index, info, memset(), NULL, peerdist_info_hash_ntoa(), rc, segment, peerdist_range::start, start, and peerdist_info::trim.
|
static |
Content information version 1 operations.
Definition at line 391 of file pccrc.c.
Referenced by peerdist_info().
|
static |
Content information version 2 operations.
Definition at line 649 of file pccrc.c.
Referenced by peerdist_info().