mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
module-raop-sink: Add Apple-Challenge only if RSA encrypted
Only add Apple-Challenge header once on ANNOUNCE, and only if RSA encrypted.
This commit is contained in:
parent
a8f5d20384
commit
c4a18d6c5c
1 changed files with 9 additions and 8 deletions
|
|
@ -1367,10 +1367,17 @@ static int rtsp_do_announce(struct impl *impl)
|
|||
break;
|
||||
|
||||
case CRYPTO_RSA:
|
||||
if ((res = pw_getrandom(impl->aes_key, sizeof(impl->aes_key), 0)) < 0 ||
|
||||
uint8_t rac[16];
|
||||
char sac[16*4];
|
||||
|
||||
if ((res = pw_getrandom(rac, sizeof(rac), 0)) < 0 ||
|
||||
(res = pw_getrandom(impl->aes_key, sizeof(impl->aes_key), 0)) < 0 ||
|
||||
(res = pw_getrandom(impl->aes_iv, sizeof(impl->aes_iv), 0)) < 0)
|
||||
return res;
|
||||
|
||||
base64_encode(rac, sizeof(rac), sac, '\0');
|
||||
pw_properties_set(impl->headers, "Apple-Challenge", sac);
|
||||
|
||||
rsa_len = rsa_encrypt(impl->aes_key, 16, rsakey);
|
||||
if (rsa_len < 0)
|
||||
return -rsa_len;
|
||||
|
|
@ -1517,16 +1524,13 @@ static void rtsp_connected(void *data)
|
|||
{
|
||||
struct impl *impl = data;
|
||||
uint32_t sci[2];
|
||||
uint8_t rac[16];
|
||||
char sac[16*4];
|
||||
int res;
|
||||
|
||||
pw_log_info("connected");
|
||||
|
||||
impl->connected = true;
|
||||
|
||||
if ((res = pw_getrandom(sci, sizeof(sci), 0)) < 0 ||
|
||||
(res = pw_getrandom(rac, sizeof(rac), 0)) < 0) {
|
||||
if ((res = pw_getrandom(sci, sizeof(sci), 0)) < 0) {
|
||||
pw_log_error("error generating random data: %s", spa_strerror(res));
|
||||
return;
|
||||
}
|
||||
|
|
@ -1534,9 +1538,6 @@ static void rtsp_connected(void *data)
|
|||
pw_properties_setf(impl->headers, "Client-Instance",
|
||||
"%08x%08x", sci[0], sci[1]);
|
||||
|
||||
base64_encode(rac, sizeof(rac), sac, '\0');
|
||||
pw_properties_set(impl->headers, "Apple-Challenge", sac);
|
||||
|
||||
pw_properties_set(impl->headers, "User-Agent", DEFAULT_USER_AGENT);
|
||||
|
||||
pw_rtsp_client_send(impl->rtsp, "OPTIONS", &impl->headers->dict,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue