2011-01-23 01:31:41 +02:00
|
|
|
/*
|
|
|
|
* Decryption protocol handler
|
|
|
|
* Copyright (c) 2011 Martin Storsjo
|
|
|
|
*
|
2013-08-16 00:12:51 +03:00
|
|
|
* This file is part of FFmpeg.
|
2011-01-23 01:31:41 +02:00
|
|
|
*
|
2013-08-16 00:12:51 +03:00
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
2011-01-23 01:31:41 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2013-08-16 00:12:51 +03:00
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
2011-01-23 01:31:41 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2013-08-16 00:12:51 +03:00
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
2011-01-23 01:31:41 +02:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "libavutil/aes.h"
|
|
|
|
#include "libavutil/avstring.h"
|
|
|
|
#include "libavutil/opt.h"
|
|
|
|
#include "url.h"
|
|
|
|
|
2016-08-30 09:47:02 +02:00
|
|
|
// encourage reads of 4096 bytes - 1 block is always retained.
|
|
|
|
#define MAX_BUFFER_BLOCKS 257
|
2011-01-23 01:31:41 +02:00
|
|
|
#define BLOCKSIZE 16
|
|
|
|
|
2014-09-22 10:19:33 +03:00
|
|
|
typedef struct CryptoContext {
|
2011-01-23 01:31:41 +02:00
|
|
|
const AVClass *class;
|
|
|
|
URLContext *hd;
|
|
|
|
uint8_t inbuffer [BLOCKSIZE*MAX_BUFFER_BLOCKS],
|
|
|
|
outbuffer[BLOCKSIZE*MAX_BUFFER_BLOCKS];
|
|
|
|
uint8_t *outptr;
|
|
|
|
int indata, indata_used, outdata;
|
2016-08-30 10:40:14 +02:00
|
|
|
int64_t position; // position in file - used in seek
|
|
|
|
int flags;
|
2011-01-23 01:31:41 +02:00
|
|
|
int eof;
|
|
|
|
uint8_t *key;
|
|
|
|
int keylen;
|
|
|
|
uint8_t *iv;
|
|
|
|
int ivlen;
|
2014-12-01 20:55:28 +02:00
|
|
|
uint8_t *decrypt_key;
|
|
|
|
int decrypt_keylen;
|
|
|
|
uint8_t *decrypt_iv;
|
|
|
|
int decrypt_ivlen;
|
|
|
|
uint8_t *encrypt_key;
|
|
|
|
int encrypt_keylen;
|
|
|
|
uint8_t *encrypt_iv;
|
|
|
|
int encrypt_ivlen;
|
|
|
|
struct AVAES *aes_decrypt;
|
|
|
|
struct AVAES *aes_encrypt;
|
2014-12-01 20:55:28 +02:00
|
|
|
uint8_t *write_buf;
|
|
|
|
unsigned int write_buf_size;
|
2014-12-01 20:55:28 +02:00
|
|
|
uint8_t pad[BLOCKSIZE];
|
|
|
|
int pad_len;
|
2011-01-23 01:31:41 +02:00
|
|
|
} CryptoContext;
|
|
|
|
|
|
|
|
#define OFFSET(x) offsetof(CryptoContext, x)
|
2011-11-05 16:07:13 +03:00
|
|
|
#define D AV_OPT_FLAG_DECODING_PARAM
|
2014-12-01 20:55:28 +02:00
|
|
|
#define E AV_OPT_FLAG_ENCODING_PARAM
|
2011-01-23 01:31:41 +02:00
|
|
|
static const AVOption options[] = {
|
2014-12-01 20:55:28 +02:00
|
|
|
{"key", "AES encryption/decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, .flags = D|E },
|
|
|
|
{"iv", "AES encryption/decryption initialization vector", OFFSET(iv), AV_OPT_TYPE_BINARY, .flags = D|E },
|
|
|
|
{"decryption_key", "AES decryption key", OFFSET(decrypt_key), AV_OPT_TYPE_BINARY, .flags = D },
|
|
|
|
{"decryption_iv", "AES decryption initialization vector", OFFSET(decrypt_iv), AV_OPT_TYPE_BINARY, .flags = D },
|
|
|
|
{"encryption_key", "AES encryption key", OFFSET(encrypt_key), AV_OPT_TYPE_BINARY, .flags = E },
|
|
|
|
{"encryption_iv", "AES encryption initialization vector", OFFSET(encrypt_iv), AV_OPT_TYPE_BINARY, .flags = E },
|
2011-01-23 01:31:41 +02:00
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const AVClass crypto_class = {
|
2011-04-29 12:30:02 +03:00
|
|
|
.class_name = "crypto",
|
|
|
|
.item_name = av_default_item_name,
|
|
|
|
.option = options,
|
|
|
|
.version = LIBAVUTIL_VERSION_INT,
|
2011-01-23 01:31:41 +02:00
|
|
|
};
|
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
static int set_aes_arg(URLContext *h, uint8_t **buf, int *buf_len,
|
2014-12-01 20:55:28 +02:00
|
|
|
uint8_t *default_buf, int default_buf_len,
|
|
|
|
const char *desc)
|
|
|
|
{
|
|
|
|
if (!*buf_len) {
|
|
|
|
if (!default_buf_len) {
|
2014-12-01 20:55:28 +02:00
|
|
|
av_log(h, AV_LOG_ERROR, "%s not set\n", desc);
|
2014-12-01 20:55:28 +02:00
|
|
|
return AVERROR(EINVAL);
|
|
|
|
} else if (default_buf_len != BLOCKSIZE) {
|
2014-12-01 20:55:28 +02:00
|
|
|
av_log(h, AV_LOG_ERROR,
|
2014-12-01 20:55:28 +02:00
|
|
|
"invalid %s size (%d bytes, block size is %d)\n",
|
|
|
|
desc, default_buf_len, BLOCKSIZE);
|
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
2014-12-02 02:47:49 +02:00
|
|
|
*buf = av_memdup(default_buf, default_buf_len);
|
2014-12-01 20:55:28 +02:00
|
|
|
if (!*buf)
|
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
*buf_len = default_buf_len;
|
|
|
|
} else if (*buf_len != BLOCKSIZE) {
|
2014-12-01 20:55:28 +02:00
|
|
|
av_log(h, AV_LOG_ERROR,
|
2014-12-01 20:55:28 +02:00
|
|
|
"invalid %s size (%d bytes, block size is %d)\n",
|
|
|
|
desc, *buf_len, BLOCKSIZE);
|
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-09 21:13:14 +03:00
|
|
|
static int crypto_open2(URLContext *h, const char *uri, int flags, AVDictionary **options)
|
2011-01-23 01:31:41 +02:00
|
|
|
{
|
|
|
|
const char *nested_url;
|
2011-11-09 01:50:37 +03:00
|
|
|
int ret = 0;
|
2011-01-23 01:31:41 +02:00
|
|
|
CryptoContext *c = h->priv_data;
|
2016-08-30 10:40:14 +02:00
|
|
|
c->flags = flags;
|
2011-01-23 01:31:41 +02:00
|
|
|
|
|
|
|
if (!av_strstart(uri, "crypto+", &nested_url) &&
|
|
|
|
!av_strstart(uri, "crypto:", &nested_url)) {
|
|
|
|
av_log(h, AV_LOG_ERROR, "Unsupported url %s\n", uri);
|
|
|
|
ret = AVERROR(EINVAL);
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
if (flags & AVIO_FLAG_READ) {
|
2014-12-01 20:55:28 +02:00
|
|
|
if ((ret = set_aes_arg(h, &c->decrypt_key, &c->decrypt_keylen,
|
2014-12-01 20:55:28 +02:00
|
|
|
c->key, c->keylen, "decryption key")) < 0)
|
|
|
|
goto err;
|
2014-12-01 20:55:28 +02:00
|
|
|
if ((ret = set_aes_arg(h, &c->decrypt_iv, &c->decrypt_ivlen,
|
2014-12-09 20:58:56 +02:00
|
|
|
c->iv, c->ivlen, "decryption IV")) < 0)
|
2014-12-01 20:55:28 +02:00
|
|
|
goto err;
|
2011-01-23 01:31:41 +02:00
|
|
|
}
|
2014-12-01 20:55:28 +02:00
|
|
|
|
2011-01-23 01:31:41 +02:00
|
|
|
if (flags & AVIO_FLAG_WRITE) {
|
2014-12-01 20:55:28 +02:00
|
|
|
if ((ret = set_aes_arg(h, &c->encrypt_key, &c->encrypt_keylen,
|
2014-12-01 20:55:28 +02:00
|
|
|
c->key, c->keylen, "encryption key")) < 0)
|
|
|
|
if (ret < 0)
|
|
|
|
goto err;
|
2014-12-01 20:55:28 +02:00
|
|
|
if ((ret = set_aes_arg(h, &c->encrypt_iv, &c->encrypt_ivlen,
|
2014-12-09 20:58:56 +02:00
|
|
|
c->iv, c->ivlen, "encryption IV")) < 0)
|
2014-12-01 20:55:28 +02:00
|
|
|
goto err;
|
2011-01-23 01:31:41 +02:00
|
|
|
}
|
2014-12-01 20:55:28 +02:00
|
|
|
|
2016-01-30 03:17:51 +02:00
|
|
|
if ((ret = ffurl_open_whitelist(&c->hd, nested_url, flags,
|
|
|
|
&h->interrupt_callback, options,
|
2016-04-21 16:55:09 +02:00
|
|
|
h->protocol_whitelist, h->protocol_blacklist, h)) < 0) {
|
2014-12-01 20:55:28 +02:00
|
|
|
av_log(h, AV_LOG_ERROR, "Unable to open resource: %s\n", nested_url);
|
2011-01-23 01:31:41 +02:00
|
|
|
goto err;
|
|
|
|
}
|
2014-12-01 20:55:28 +02:00
|
|
|
|
|
|
|
if (flags & AVIO_FLAG_READ) {
|
|
|
|
c->aes_decrypt = av_aes_alloc();
|
|
|
|
if (!c->aes_decrypt) {
|
|
|
|
ret = AVERROR(ENOMEM);
|
|
|
|
goto err;
|
|
|
|
}
|
2014-12-01 20:55:28 +02:00
|
|
|
ret = av_aes_init(c->aes_decrypt, c->decrypt_key, BLOCKSIZE * 8, 1);
|
2014-12-01 20:55:28 +02:00
|
|
|
if (ret < 0)
|
|
|
|
goto err;
|
2016-08-30 10:40:14 +02:00
|
|
|
|
|
|
|
// pass back information about the context we openned
|
|
|
|
if (c->hd->is_streamed)
|
|
|
|
h->is_streamed = c->hd->is_streamed;
|
2011-01-23 01:31:41 +02:00
|
|
|
}
|
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
if (flags & AVIO_FLAG_WRITE) {
|
|
|
|
c->aes_encrypt = av_aes_alloc();
|
|
|
|
if (!c->aes_encrypt) {
|
|
|
|
ret = AVERROR(ENOMEM);
|
|
|
|
goto err;
|
|
|
|
}
|
2014-12-01 20:55:28 +02:00
|
|
|
ret = av_aes_init(c->aes_encrypt, c->encrypt_key, BLOCKSIZE * 8, 0);
|
2014-12-01 20:55:28 +02:00
|
|
|
if (ret < 0)
|
|
|
|
goto err;
|
2016-08-30 10:40:14 +02:00
|
|
|
// for write, we must be streamed
|
|
|
|
// - linear write only for crytpo aes-128-cbc
|
|
|
|
h->is_streamed = 1;
|
2014-12-01 20:55:28 +02:00
|
|
|
}
|
|
|
|
|
2011-01-23 01:31:41 +02:00
|
|
|
err:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int crypto_read(URLContext *h, uint8_t *buf, int size)
|
|
|
|
{
|
|
|
|
CryptoContext *c = h->priv_data;
|
|
|
|
int blocks;
|
|
|
|
retry:
|
|
|
|
if (c->outdata > 0) {
|
|
|
|
size = FFMIN(size, c->outdata);
|
|
|
|
memcpy(buf, c->outptr, size);
|
|
|
|
c->outptr += size;
|
|
|
|
c->outdata -= size;
|
2016-08-30 10:40:14 +02:00
|
|
|
c->position = c->position + size;
|
2011-01-23 01:31:41 +02:00
|
|
|
return size;
|
|
|
|
}
|
|
|
|
// We avoid using the last block until we've found EOF,
|
|
|
|
// since we'll remove PKCS7 padding at the end. So make
|
|
|
|
// sure we've got at least 2 blocks, so we can decrypt
|
|
|
|
// at least one.
|
|
|
|
while (c->indata - c->indata_used < 2*BLOCKSIZE) {
|
|
|
|
int n = ffurl_read(c->hd, c->inbuffer + c->indata,
|
|
|
|
sizeof(c->inbuffer) - c->indata);
|
|
|
|
if (n <= 0) {
|
|
|
|
c->eof = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
c->indata += n;
|
|
|
|
}
|
|
|
|
blocks = (c->indata - c->indata_used) / BLOCKSIZE;
|
|
|
|
if (!blocks)
|
|
|
|
return AVERROR_EOF;
|
|
|
|
if (!c->eof)
|
|
|
|
blocks--;
|
2014-12-01 20:55:28 +02:00
|
|
|
av_aes_crypt(c->aes_decrypt, c->outbuffer, c->inbuffer + c->indata_used,
|
|
|
|
blocks, c->decrypt_iv, 1);
|
2011-01-23 01:31:41 +02:00
|
|
|
c->outdata = BLOCKSIZE * blocks;
|
|
|
|
c->outptr = c->outbuffer;
|
|
|
|
c->indata_used += BLOCKSIZE * blocks;
|
|
|
|
if (c->indata_used >= sizeof(c->inbuffer)/2) {
|
|
|
|
memmove(c->inbuffer, c->inbuffer + c->indata_used,
|
|
|
|
c->indata - c->indata_used);
|
|
|
|
c->indata -= c->indata_used;
|
|
|
|
c->indata_used = 0;
|
|
|
|
}
|
|
|
|
if (c->eof) {
|
|
|
|
// Remove PKCS7 padding at the end
|
|
|
|
int padding = c->outbuffer[c->outdata - 1];
|
|
|
|
c->outdata -= padding;
|
|
|
|
}
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
|
2016-08-30 10:40:14 +02:00
|
|
|
static int64_t crypto_seek(URLContext *h, int64_t pos, int whence)
|
|
|
|
{
|
|
|
|
CryptoContext *c = h->priv_data;
|
|
|
|
int64_t block;
|
|
|
|
int64_t newpos;
|
|
|
|
|
|
|
|
if (c->flags & AVIO_FLAG_WRITE) {
|
|
|
|
av_log(h, AV_LOG_ERROR,
|
|
|
|
"Crypto: seek not supported for write\r\n");
|
|
|
|
/* seems the most appropriate error to return */
|
|
|
|
return AVERROR(ESPIPE);
|
|
|
|
}
|
|
|
|
|
|
|
|
// reset eof, else we won't read it correctly if we already hit eof.
|
|
|
|
c->eof = 0;
|
|
|
|
|
|
|
|
switch (whence) {
|
|
|
|
case SEEK_SET:
|
|
|
|
break;
|
|
|
|
case SEEK_CUR:
|
|
|
|
pos = pos + c->position;
|
|
|
|
break;
|
2020-07-14 08:18:25 +02:00
|
|
|
case SEEK_END:
|
|
|
|
newpos = ffurl_seek( c->hd, pos, AVSEEK_SIZE );
|
2016-08-30 10:40:14 +02:00
|
|
|
if (newpos < 0) {
|
|
|
|
av_log(h, AV_LOG_ERROR,
|
|
|
|
"Crypto: seek_end - can't get file size (pos=%lld)\r\n", (long long int)pos);
|
|
|
|
return newpos;
|
|
|
|
}
|
|
|
|
pos = newpos - pos;
|
|
|
|
break;
|
2020-07-14 08:18:25 +02:00
|
|
|
case AVSEEK_SIZE:
|
|
|
|
return ffurl_seek( c->hd, pos, AVSEEK_SIZE );
|
2016-08-30 10:40:14 +02:00
|
|
|
default:
|
|
|
|
av_log(h, AV_LOG_ERROR,
|
|
|
|
"Crypto: no support for seek where 'whence' is %d\r\n", whence);
|
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
c->outdata = 0;
|
|
|
|
c->indata = 0;
|
|
|
|
c->indata_used = 0;
|
|
|
|
c->outptr = c->outbuffer;
|
|
|
|
|
|
|
|
// identify the block containing the IV for the
|
|
|
|
// next block we will decrypt
|
|
|
|
block = pos/BLOCKSIZE;
|
|
|
|
if (block == 0) {
|
|
|
|
// restore the iv to the seed one - this is the iv for the FIRST block
|
|
|
|
memcpy( c->decrypt_iv, c->iv, c->ivlen );
|
|
|
|
c->position = 0;
|
|
|
|
} else {
|
|
|
|
// else, go back one block - we will get av_cyrpt to read this block
|
|
|
|
// which it will then store use as the iv.
|
|
|
|
// note that the DECRYPTED result will not be correct,
|
|
|
|
// but will be discarded
|
|
|
|
block--;
|
|
|
|
c->position = (block * BLOCKSIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
newpos = ffurl_seek( c->hd, c->position, SEEK_SET );
|
|
|
|
if (newpos < 0) {
|
|
|
|
av_log(h, AV_LOG_ERROR,
|
|
|
|
"Crypto: nested protocol no support for seek or seek failed\n");
|
|
|
|
return newpos;
|
|
|
|
}
|
|
|
|
|
|
|
|
// read and discard from here up to required position
|
|
|
|
// (which will set the iv correctly to it).
|
|
|
|
if (pos - c->position) {
|
|
|
|
uint8_t buff[BLOCKSIZE*2]; // maximum size of pos-c->position
|
|
|
|
int len = pos - c->position;
|
|
|
|
int res;
|
|
|
|
|
|
|
|
while (len > 0) {
|
|
|
|
// note: this may not return all the bytes first time
|
|
|
|
res = crypto_read(h, buff, len);
|
|
|
|
if (res < 0)
|
|
|
|
break;
|
|
|
|
len -= res;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we did not get all the bytes
|
|
|
|
if (len != 0) {
|
|
|
|
char errbuf[100] = "unknown error";
|
|
|
|
av_strerror(res, errbuf, sizeof(errbuf));
|
|
|
|
av_log(h, AV_LOG_ERROR,
|
|
|
|
"Crypto: discard read did not get all the bytes (%d remain) - read returned (%d)-%s\n",
|
|
|
|
len, res, errbuf);
|
|
|
|
return AVERROR(EINVAL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return c->position;
|
|
|
|
}
|
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
static int crypto_write(URLContext *h, const unsigned char *buf, int size)
|
|
|
|
{
|
|
|
|
CryptoContext *c = h->priv_data;
|
|
|
|
int total_size, blocks, pad_len, out_size;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
total_size = size + c->pad_len;
|
|
|
|
pad_len = total_size % BLOCKSIZE;
|
|
|
|
out_size = total_size - pad_len;
|
|
|
|
blocks = out_size / BLOCKSIZE;
|
|
|
|
|
|
|
|
if (out_size) {
|
2014-12-01 20:55:28 +02:00
|
|
|
av_fast_malloc(&c->write_buf, &c->write_buf_size, out_size);
|
|
|
|
|
|
|
|
if (!c->write_buf)
|
2014-12-01 20:55:28 +02:00
|
|
|
return AVERROR(ENOMEM);
|
|
|
|
|
|
|
|
if (c->pad_len) {
|
|
|
|
memcpy(&c->pad[c->pad_len], buf, BLOCKSIZE - c->pad_len);
|
2014-12-01 20:55:28 +02:00
|
|
|
av_aes_crypt(c->aes_encrypt, c->write_buf, c->pad, 1, c->encrypt_iv, 0);
|
2014-12-01 20:55:28 +02:00
|
|
|
blocks--;
|
|
|
|
}
|
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
av_aes_crypt(c->aes_encrypt,
|
|
|
|
&c->write_buf[c->pad_len ? BLOCKSIZE : 0],
|
|
|
|
&buf[c->pad_len ? BLOCKSIZE - c->pad_len : 0],
|
|
|
|
blocks, c->encrypt_iv, 0);
|
2014-12-01 20:55:28 +02:00
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
ret = ffurl_write(c->hd, c->write_buf, out_size);
|
2014-12-01 20:55:28 +02:00
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
memcpy(c->pad, &buf[size - pad_len], pad_len);
|
|
|
|
} else
|
|
|
|
memcpy(&c->pad[c->pad_len], buf, size);
|
|
|
|
|
|
|
|
c->pad_len = pad_len;
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
2011-01-23 01:31:41 +02:00
|
|
|
static int crypto_close(URLContext *h)
|
|
|
|
{
|
|
|
|
CryptoContext *c = h->priv_data;
|
2014-12-01 20:55:28 +02:00
|
|
|
int ret = 0;
|
2014-12-01 20:55:28 +02:00
|
|
|
|
|
|
|
if (c->aes_encrypt) {
|
2014-12-01 20:55:28 +02:00
|
|
|
uint8_t out_buf[BLOCKSIZE];
|
|
|
|
int pad = BLOCKSIZE - c->pad_len;
|
|
|
|
|
2014-12-01 20:55:28 +02:00
|
|
|
memset(&c->pad[c->pad_len], pad, pad);
|
|
|
|
av_aes_crypt(c->aes_encrypt, out_buf, c->pad, 1, c->encrypt_iv, 0);
|
2014-12-01 20:55:28 +02:00
|
|
|
ret = ffurl_write(c->hd, out_buf, BLOCKSIZE);
|
2014-12-01 20:55:28 +02:00
|
|
|
}
|
|
|
|
|
2020-04-03 17:03:38 +02:00
|
|
|
ffurl_closep(&c->hd);
|
2014-12-01 20:55:28 +02:00
|
|
|
av_freep(&c->aes_decrypt);
|
|
|
|
av_freep(&c->aes_encrypt);
|
2014-12-01 20:55:28 +02:00
|
|
|
av_freep(&c->write_buf);
|
|
|
|
return ret;
|
2011-01-23 01:31:41 +02:00
|
|
|
}
|
|
|
|
|
2016-02-19 11:39:29 +02:00
|
|
|
const URLProtocol ff_crypto_protocol = {
|
2011-01-23 01:31:41 +02:00
|
|
|
.name = "crypto",
|
2012-10-09 21:13:14 +03:00
|
|
|
.url_open2 = crypto_open2,
|
2016-08-30 10:40:14 +02:00
|
|
|
.url_seek = crypto_seek,
|
2011-01-23 01:31:41 +02:00
|
|
|
.url_read = crypto_read,
|
2014-12-01 20:55:28 +02:00
|
|
|
.url_write = crypto_write,
|
2011-01-23 01:31:41 +02:00
|
|
|
.url_close = crypto_close,
|
|
|
|
.priv_data_size = sizeof(CryptoContext),
|
|
|
|
.priv_data_class = &crypto_class,
|
|
|
|
.flags = URL_PROTOCOL_FLAG_NESTED_SCHEME,
|
|
|
|
};
|