|
FFmpeg
|
#include "libavutil/attributes.h"#include "libavutil/avassert.h"#include "libavutil/avstring.h"#include "libavutil/crc.h"#include "libavutil/error.h"#include "libavutil/file.h"#include "libavutil/hash.h"#include "libavutil/file_open.h"#include "libavutil/mem.h"#include "libavutil/opt.h"#include "libavutil/time.h"#include "internal.h"#include "os_support.h"#include "url.h"#include <assert.h>#include <errno.h>#include <fcntl.h>#include <inttypes.h>#include <stdatomic.h>#include <string.h>#include <sys/stat.h>#include <sys/file.h>Go to the source code of this file.
Data Structures | |
| struct | Block |
| struct | Spacemap |
| struct | SharedContext |
Macros | |
| #define | HASH_METHOD "SHA512/256" |
| This hash should be resistant against collision attacks, so that an attacker could not generate e.g. | |
| #define | HASH_SIZE 32 |
| #define | HEADER_MAGIC MKTAG(u'\xFF', 'S', 'h', '$') |
| #define | HEADER_VERSION 3 |
| #define | MAX_CORRUPT_BLOCKS 10 |
| Hard watershed of consecutive failed blocks before we give up on the cache file altogether and assume it's entirely lost to us. | |
| #define | DEF_SET_ONCE(ctype, atype) |
| #define | RELEASE_PENDING(block, state) |
| #define | OFFSET(x) |
| #define | D AV_OPT_FLAG_DECODING_PARAM |
Enumerations | |
| enum | BlockState { BLOCK_NONE = 0 , BLOCK_PENDING , BLOCK_FAILED } |
Variables | |
| static const AVOption | options [] |
| static const AVClass | shared_context_class |
| const URLProtocol | ff_shared_protocol |
| #define HASH_METHOD "SHA512/256" |
This hash should be resistant against collision attacks, so that an attacker could not generate e.g.
two different URIs that map to the same cache file. This requires at least 64 bits of collision resistance in practice (i.e. 128 bits = 16 bytes of hash size). However, we can be conservative by computing e.g. a 256 bit hash and storing it inside the file header for verification.
Note that due to the way we use atomics, we should avoid zero bytes in the resulting hash; hence we tweak the input slightly to avoid this. The resulting loss in hash strength is negligible, since 32 bytes is already much more than needed.
Definition at line 67 of file shared.c.
Referenced by hash_uri().
| #define HASH_SIZE 32 |
Definition at line 68 of file shared.c.
Referenced by close_out(), hash_uri(), main(), shared_open(), and spacemap_init().
Definition at line 69 of file shared.c.
Referenced by spacemap_init().
| #define HEADER_VERSION 3 |
Definition at line 70 of file shared.c.
Referenced by hash_uri(), and spacemap_init().
| #define MAX_CORRUPT_BLOCKS 10 |
Hard watershed of consecutive failed blocks before we give up on the cache file altogether and assume it's entirely lost to us.
Definition at line 76 of file shared.c.
Referenced by shared_read().
| #define DEF_SET_ONCE | ( | ctype, | |
| atype ) |
Referenced by shared_read().
| #define OFFSET | ( | x | ) |
| #define D AV_OPT_FLAG_DECODING_PARAM |
| enum BlockState |
|
static |
Definition at line 78 of file shared.c.
Referenced by shared_open().
|
static |
Definition at line 110 of file shared.c.
Referenced by shared_read().
|
static |
Definition at line 204 of file shared.c.
Referenced by shared_open().
|
static |
Definition at line 391 of file shared.c.
Referenced by set_filesize(), and shared_open().
|
static |
Definition at line 519 of file shared.c.
Referenced by shared_open().
|
static |
Definition at line 483 of file shared.c.
Referenced by shared_open(), and shared_read().
|
static |
Definition at line 228 of file shared.c.
Referenced by shared_open(), shared_read(), shared_seek(), and spacemap_grow().
|
static |
Definition at line 242 of file shared.c.
Referenced by shared_read(), and shared_seek().
|
static |
Definition at line 265 of file shared.c.
Referenced by shared_open(), and shared_seek().
|
static |
|
static |
Definition at line 416 of file shared.c.
Referenced by spacemap_grow(), and spacemap_init().
|
static |
Definition at line 574 of file shared.c.
Referenced by shared_read().
|
static |
Definition at line 594 of file shared.c.
Referenced by shared_read().
|
static |
Definition at line 614 of file shared.c.
Referenced by shared_read().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| const URLProtocol ff_shared_protocol |