| 1686 | } |
| 1687 | |
| 1688 | static int do_adobe_auth(RTMPContext *rt, const char *user, const char *salt, |
| 1689 | const char *opaque, const char *challenge) |
| 1690 | { |
| 1691 | uint8_t hash[16]; |
| 1692 | char hashstr[AV_BASE64_SIZE(sizeof(hash))], challenge2[10]; |
| 1693 | struct AVMD5 *md5 = av_md5_alloc(); |
| 1694 | if (!md5) |
| 1695 | return AVERROR(ENOMEM); |
| 1696 | |
| 1697 | snprintf(challenge2, sizeof(challenge2), "%08x", av_get_random_seed()); |
| 1698 | |
| 1699 | av_md5_init(md5); |
| 1700 | av_md5_update(md5, user, strlen(user)); |
| 1701 | av_md5_update(md5, salt, strlen(salt)); |
| 1702 | av_md5_update(md5, rt->password, strlen(rt->password)); |
| 1703 | av_md5_final(md5, hash); |
| 1704 | av_base64_encode(hashstr, sizeof(hashstr), hash, |
| 1705 | sizeof(hash)); |
| 1706 | av_md5_init(md5); |
| 1707 | av_md5_update(md5, hashstr, strlen(hashstr)); |
| 1708 | if (opaque) |
| 1709 | av_md5_update(md5, opaque, strlen(opaque)); |
| 1710 | else if (challenge) |
| 1711 | av_md5_update(md5, challenge, strlen(challenge)); |
| 1712 | av_md5_update(md5, challenge2, strlen(challenge2)); |
| 1713 | av_md5_final(md5, hash); |
| 1714 | av_base64_encode(hashstr, sizeof(hashstr), hash, |
| 1715 | sizeof(hash)); |
| 1716 | snprintf(rt->auth_params, sizeof(rt->auth_params), |
| 1717 | "?authmod=%s&user=%s&challenge=%s&response=%s", |
| 1718 | "adobe", user, challenge2, hashstr); |
| 1719 | if (opaque) |
| 1720 | av_strlcatf(rt->auth_params, sizeof(rt->auth_params), |
| 1721 | "&opaque=%s", opaque); |
| 1722 | |
| 1723 | av_free(md5); |
| 1724 | return 0; |
| 1725 | } |
| 1726 | |
| 1727 | static int do_llnw_auth(RTMPContext *rt, const char *user, const char *nonce) |
| 1728 | { |
no test coverage detected