From gitlab at videolan.org Fri Nov 15 15:02:49 2024 From: gitlab at videolan.org (Christophe Massiot (@cmassiot)) Date: Fri, 15 Nov 2024 16:02:49 +0100 Subject: [bTSstream-devel] [Git][videolan/bitstream][master] SRT: avoid variable shadowing Message-ID: <67376299beb42_2b114ffa0ecf41871035@gitlab.mail> Christophe Massiot pushed to branch master at VideoLAN / bitstream Commits: 8f98b461 by Rafa?l Carr? at 2024-11-15T11:47:31+01:00 SRT: avoid variable shadowing warning: declaration of ?ext? shadows a previous local [-Wshadow] - - - - - 1 changed file: - haivision/srt.h Changes: ===================================== haivision/srt.h ===================================== @@ -535,16 +535,16 @@ static inline bool srt_check_handshake(const uint8_t *cif, size_t n) uint16_t ext = srt_get_handshake_extension(cif); if (v == SRT_HANDSHAKE_VERSION && ext && ext != SRT_MAGIC_CODE) { - const uint8_t *ext = srt_get_handshake_extension_buf((uint8_t*)cif); + const uint8_t *ext_buf = srt_get_handshake_extension_buf((uint8_t*)cif); while (n) { if (n < SRT_HANDSHAKE_CIF_EXTENSION_MIN_SIZE) return false; n -= SRT_HANDSHAKE_CIF_EXTENSION_MIN_SIZE; - uint16_t extension_len = 4 * srt_get_handshake_extension_len(ext); + uint16_t extension_len = 4 * srt_get_handshake_extension_len(ext_buf); if (n < extension_len) return false; n -= extension_len; - ext += SRT_HANDSHAKE_CIF_EXTENSION_MIN_SIZE + extension_len; + ext_buf += SRT_HANDSHAKE_CIF_EXTENSION_MIN_SIZE + extension_len; } } View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/8f98b46179750f4c135dce40fc4da175c5755ef6 -- View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/8f98b46179750f4c135dce40fc4da175c5755ef6 You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance From gitlab at videolan.org Fri Nov 15 15:04:31 2024 From: gitlab at videolan.org (Christophe Massiot (@cmassiot)) Date: Fri, 15 Nov 2024 16:04:31 +0100 Subject: [bTSstream-devel] [Git][videolan/bitstream][master] srt: AES GCM Message-ID: <673762ff9dc2f_2b114ffa0ecf418724da@gitlab.mail> Christophe Massiot pushed to branch master at VideoLAN / bitstream Commits: 1a29d709 by Rafa?l Carr? at 2024-11-15T15:04:22+00:00 srt: AES GCM Due to be released with SRT 1.6.0 - - - - - 1 changed file: - haivision/srt.h Changes: ===================================== haivision/srt.h ===================================== @@ -633,8 +633,16 @@ static inline uint16_t srt_get_handshake_extension_sender_tsbpd_delay(const uint #define SRT_KMREQ_COMMON_SIZE 32 -#define SRT_KMREQ_CIPHER_NONE 0 -#define SRT_KMREQ_CIPHER_AES 2 +#define SRT_KMREQ_CIPHER_NONE 0 +#define SRT_KMREQ_CIPHER_AES_ECB 1 +#define SRT_KMREQ_CIPHER_AES_CTR 2 +#define SRT_KMREQ_CIPHER_AES_CBC 3 +#define SRT_KMREQ_CIPHER_AES_GCM 4 + +#define SRT_KMREQ_CIPHER_AES SRT_KMREQ_CIPHER_AES_CTR + +#define SRT_KMREQ_AUTH_NONE 0 +#define SRT_KMREQ_AUTH_AES_GCM 1 static inline uint8_t srt_km_get_kk(const uint8_t *km) { @@ -656,6 +664,16 @@ static inline void srt_km_set_cipher(uint8_t *km, const uint8_t cipher) km[8] = cipher; } +static inline uint8_t srt_km_get_auth(const uint8_t *km) +{ + return km[9]; +} + +static inline void srt_km_set_auth(uint8_t *km, const uint8_t auth) +{ + km[9] = auth; +} + static inline uint8_t srt_km_get_klen(const uint8_t *km) { return km[15]; @@ -709,10 +727,14 @@ static inline bool srt_check_km(const uint8_t *km, size_t n) return false; uint8_t cipher = srt_km_get_cipher(km); - if (cipher != SRT_KMREQ_CIPHER_NONE && cipher != SRT_KMREQ_CIPHER_AES) + if (cipher != SRT_KMREQ_CIPHER_NONE && cipher != SRT_KMREQ_CIPHER_AES_CTR && cipher != SRT_KMREQ_CIPHER_AES_GCM) + return false; + + uint8_t auth = srt_km_get_auth(km); + if (auth != SRT_KMREQ_AUTH_NONE && auth != SRT_KMREQ_AUTH_AES_GCM) return false; - if (km[9]) // Auth == 0 + if (cipher == SRT_KMREQ_CIPHER_AES_GCM && auth != SRT_KMREQ_AUTH_AES_GCM) return false; if (km[10] != 2) // SE View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/1a29d709aeeb4a80d2f9e2b5fcb27c4e223a113b -- View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/1a29d709aeeb4a80d2f9e2b5fcb27c4e223a113b You're receiving this email because of your account on code.videolan.org. VideoLAN code repository instance