Mercurial > pidgin
comparison src/protocols/simple/digcalc.c @ 11512:dc8b8db7f6e3
[gaim-migrate @ 13757]
warning fixes
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 11 Sep 2005 16:28:56 +0000 |
parents | e5bbe5070e04 |
children | 2cf6d4cf2cb0 |
comparison
equal
deleted
inserted
replaced
11511:123448afd216 | 11512:dc8b8db7f6e3 |
---|---|
69 GaimCipherContext *context; | 69 GaimCipherContext *context; |
70 HASH HA1; | 70 HASH HA1; |
71 | 71 |
72 cipher = gaim_ciphers_find_cipher("md5"); | 72 cipher = gaim_ciphers_find_cipher("md5"); |
73 context = gaim_cipher_context_new(cipher, NULL); | 73 context = gaim_cipher_context_new(cipher, NULL); |
74 gaim_cipher_context_append(context, pszUserName, strlen(pszUserName)); | 74 gaim_cipher_context_append(context, (guchar *)pszUserName, strlen(pszUserName)); |
75 gaim_cipher_context_append(context, ":", 1); | 75 gaim_cipher_context_append(context, (guchar *)":", 1); |
76 gaim_cipher_context_append(context, pszRealm, strlen(pszRealm)); | 76 gaim_cipher_context_append(context, (guchar *)pszRealm, strlen(pszRealm)); |
77 gaim_cipher_context_append(context, ":", 1); | 77 gaim_cipher_context_append(context, (guchar *)":", 1); |
78 gaim_cipher_context_append(context, pszPassword, strlen(pszPassword)); | 78 gaim_cipher_context_append(context, (guchar *)pszPassword, strlen(pszPassword)); |
79 gaim_cipher_context_digest(context, sizeof(HA1), HA1, NULL); | 79 gaim_cipher_context_digest(context, sizeof(HA1), HA1, NULL); |
80 if (strcmp(pszAlg, "md5-sess") == 0) { | 80 if (strcmp(pszAlg, "md5-sess") == 0) { |
81 context = gaim_cipher_context_new(cipher, NULL); | 81 context = gaim_cipher_context_new(cipher, NULL); |
82 gaim_cipher_context_append(context, HA1, HASHLEN); | 82 gaim_cipher_context_append(context, HA1, HASHLEN); |
83 gaim_cipher_context_append(context, ":", 1); | 83 gaim_cipher_context_append(context, (guchar *)":", 1); |
84 gaim_cipher_context_append(context, pszNonce, strlen(pszNonce)); | 84 gaim_cipher_context_append(context, (guchar *)pszNonce, strlen(pszNonce)); |
85 gaim_cipher_context_append(context, ":", 1); | 85 gaim_cipher_context_append(context, (guchar *)":", 1); |
86 gaim_cipher_context_append(context, pszCNonce, strlen(pszCNonce)); | 86 gaim_cipher_context_append(context, (guchar *)pszCNonce, strlen(pszCNonce)); |
87 gaim_cipher_context_digest(context, sizeof(HA1), HA1, NULL); | 87 gaim_cipher_context_digest(context, sizeof(HA1), HA1, NULL); |
88 }; | 88 }; |
89 CvtHex(HA1, SessionKey); | 89 CvtHex(HA1, SessionKey); |
90 gaim_cipher_context_destroy(context); | 90 gaim_cipher_context_destroy(context); |
91 }; | 91 }; |
110 HASHHEX HA2Hex; | 110 HASHHEX HA2Hex; |
111 | 111 |
112 // calculate H(A2) | 112 // calculate H(A2) |
113 cipher = gaim_ciphers_find_cipher("md5"); | 113 cipher = gaim_ciphers_find_cipher("md5"); |
114 context = gaim_cipher_context_new(cipher, NULL); | 114 context = gaim_cipher_context_new(cipher, NULL); |
115 gaim_cipher_context_append(context, pszMethod, strlen(pszMethod)); | 115 gaim_cipher_context_append(context, (guchar *)pszMethod, strlen(pszMethod)); |
116 gaim_cipher_context_append(context, ":", 1); | 116 gaim_cipher_context_append(context, (guchar *)":", 1); |
117 gaim_cipher_context_append(context, pszDigestUri, strlen(pszDigestUri)); | 117 gaim_cipher_context_append(context, (guchar *)pszDigestUri, strlen(pszDigestUri)); |
118 if (strcmp(pszQop, "auth-int") == 0) { | 118 if (strcmp(pszQop, "auth-int") == 0) { |
119 gaim_cipher_context_append(context, ":", 1); | 119 gaim_cipher_context_append(context, (guchar *)":", 1); |
120 gaim_cipher_context_append(context, HEntity, HASHHEXLEN); | 120 gaim_cipher_context_append(context, HEntity, HASHHEXLEN); |
121 }; | 121 }; |
122 gaim_cipher_context_digest(context, sizeof(HA2), HA2, NULL); | 122 gaim_cipher_context_digest(context, sizeof(HA2), HA2, NULL); |
123 CvtHex(HA2, HA2Hex); | 123 CvtHex(HA2, HA2Hex); |
124 | 124 |
125 gaim_cipher_context_destroy(context); | 125 gaim_cipher_context_destroy(context); |
126 // calculate response | 126 // calculate response |
127 context = gaim_cipher_context_new(cipher, NULL); | 127 context = gaim_cipher_context_new(cipher, NULL); |
128 gaim_cipher_context_append(context, HA1, HASHHEXLEN); | 128 gaim_cipher_context_append(context, HA1, HASHHEXLEN); |
129 gaim_cipher_context_append(context, ":", 1); | 129 gaim_cipher_context_append(context, (guchar *)":", 1); |
130 gaim_cipher_context_append(context, pszNonce, strlen(pszNonce)); | 130 gaim_cipher_context_append(context, (guchar *)pszNonce, strlen(pszNonce)); |
131 gaim_cipher_context_append(context, ":", 1); | 131 gaim_cipher_context_append(context, (guchar *)":", 1); |
132 if (*pszQop) { | 132 if (*pszQop) { |
133 gaim_cipher_context_append(context, pszNonceCount, strlen(pszNonceCount)); | 133 gaim_cipher_context_append(context, (guchar *)pszNonceCount, strlen(pszNonceCount)); |
134 gaim_cipher_context_append(context, ":", 1); | 134 gaim_cipher_context_append(context, (guchar *)":", 1); |
135 gaim_cipher_context_append(context, pszCNonce, strlen(pszCNonce)); | 135 gaim_cipher_context_append(context, (guchar *)pszCNonce, strlen(pszCNonce)); |
136 gaim_cipher_context_append(context, ":", 1); | 136 gaim_cipher_context_append(context, (guchar *)":", 1); |
137 gaim_cipher_context_append(context, pszQop, strlen(pszQop)); | 137 gaim_cipher_context_append(context, (guchar *)pszQop, strlen(pszQop)); |
138 gaim_cipher_context_append(context, ":", 1); | 138 gaim_cipher_context_append(context, (guchar *)":", 1); |
139 }; | 139 }; |
140 gaim_cipher_context_append(context, HA2Hex, HASHHEXLEN); | 140 gaim_cipher_context_append(context, HA2Hex, HASHHEXLEN); |
141 gaim_cipher_context_digest(context, sizeof(RespHash), RespHash, NULL); | 141 gaim_cipher_context_digest(context, sizeof(RespHash), RespHash, NULL); |
142 CvtHex(RespHash, Response); | 142 CvtHex(RespHash, Response); |
143 gaim_cipher_context_destroy(context); | 143 gaim_cipher_context_destroy(context); |