-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstream.h
More file actions
25 lines (19 loc) · 680 Bytes
/
Copy pathstream.h
File metadata and controls
25 lines (19 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// SPDX-License-Identifier: MIT
// Copyright (c) 2020 William Wennerström
#include <curl/curl.h>
#include <stdbool.h>
#define AESGCM_URL_NONCE_LEN 24
#define AESGCM_URL_KEY_LEN 64
#define HTTPS_URL_SCHEME "https://"
#define HTTPS_URL_SCHEME_LEN (size_t)(sizeof("https://") - 1)
struct stream_data {
char *buffer;
size_t buffer_pos;
size_t actual_size;
size_t expected_size;
};
typedef struct stream_data STREAM;
size_t stream_read(void *buffer, size_t bytes, STREAM *stream);
STREAM *stream_open(const char *url, bool insecure);
char *parse_aesgcm_url(char *url, unsigned char *nonce, size_t nonce_size,
unsigned char *key, size_t key_size);