From: winlin <winlin...@gmail.com> See RFC5280 4.1.2.2
Co-authored-by: Jack Lau <jacklau1...@qq.com> Signed-off-by: winlin <winlin...@gmail.com> --- libavformat/tls_openssl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/tls_openssl.c b/libavformat/tls_openssl.c index 2a01fb387d..285ea166ac 100644 --- a/libavformat/tls_openssl.c +++ b/libavformat/tls_openssl.c @@ -311,7 +311,8 @@ static int openssl_gen_certificate(EVP_PKEY *pkey, X509 **cert, char **fingerpri goto enomem_end; } - serial = (int)av_get_random_seed(); + // According to RFC5280 4.1.2.2, The serial number MUST be a positive integer + serial = (int)(av_get_random_seed() & 0x7FFFFFFF); if (ASN1_INTEGER_set(X509_get_serialNumber(*cert), serial) != 1) { av_log(NULL, AV_LOG_ERROR, "TLS: Failed to set serial, %s\n", ERR_error_string(ERR_get_error(), NULL)); goto einval_end; -- 2.49.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".