Skip to content

Commit

Permalink
fixed encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
arut committed Sep 1, 2014
1 parent 997f24c commit 5e1d735
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions hls/ngx_rtmp_mpegts.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,18 +122,19 @@ ngx_rtmp_mpegts_write_file(ngx_rtmp_mpegts_file_t *file, u_char *in,
for ( ;; ) {
n = in_size & ~0x0f;

if (n == 0) {
break;
}
if (n > 0) {
if (n > out_size) {
n = out_size;
}

if (n > out_size) {
n = out_size;
}
AES_cbc_encrypt(in, out, n, &file->key, file->iv, AES_ENCRYPT);

AES_cbc_encrypt(in, out, n, &file->key, file->iv, AES_ENCRYPT);
in += n;
in_size -= n;

in += n;
in_size -= n;
} else if (out == buf) {
break;
}

rc = ngx_write_fd(file->fd, buf, out - buf + n);
if (rc < 0) {
Expand Down

0 comments on commit 5e1d735

Please sign in to comment.