On Tue, 24 Sep 2013, Anton Khirnov wrote:
On Thu, 19 Sep 2013 12:43:02 +0300, Martin Storsjö <mar...@martin.st> wrote:
Partially based on a patch by Peter Ross.
---
libavformat/tls.c | 46 +++++++++++++++++++++++++++++++++++++++-------
1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/libavformat/tls.c b/libavformat/tls.c
index 55b7416..9d53a66 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -23,6 +23,7 @@
#include "url.h"
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
+#include "libavutil/parseutils.h"
#if CONFIG_GNUTLS
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
@@ -69,6 +70,9 @@ typedef struct {
int fd;
char *ca_file;
int verify;
+ char *cert;
+ char *key;
+ int listen;
} TLSContext;
#define OFFSET(x) offsetof(TLSContext, x)
@@ -77,6 +81,9 @@ typedef struct {
static const AVOption options[] = {
{"ca_file", "Certificate Authority database file", OFFSET(ca_file),
AV_OPT_TYPE_STRING, .flags = D|E },
{"tls_verify", "Verify the peer certificate", OFFSET(verify),
AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, .flags = D|E },
+ {"cert", "Certificate file", OFFSET(cert),
AV_OPT_TYPE_STRING, .flags = D|E },
+ {"key", "Private key file", OFFSET(key),
AV_OPT_TYPE_STRING, .flags = D|E },
Shouldn't those be TYPE_BINARY?
They're key/cert file names, not the actual data (same for the CA
database). Supporting passing the actual data instead would of course be
nice as well. Should we perhaps rename these to cert_file/key_file then,
or keep these short and set the other ones to cert_data/key_data?
(If you pass them as data instead of a file name, a string should probably
be ok since we assume that it's in PEM format anyway.)
// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel