Mercurial > pidgin
comparison src/protocols/msn/user.c @ 10684:72a5babfa8b4
[gaim-migrate @ 12231]
the cipher api that grim has been working on for ages is finally done!! big
congrats and thanks to him!!
lots of modified files in this commit. it builds here.
moved the md5 files to src/protocols/oscar so that it continues to depend
on nothing in gaim. everything else uses the new centralized cipher api.
I'm not sure if src/md5.* needs to be removed or not, so I left it there.
someone let me know or do it directly.
someone check if these need to be added to potfiles.in
and let there be much rejoicing!
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 11 Mar 2005 13:05:31 +0000 |
parents | 0f7452b1f777 |
children | b256ce6b85b8 |
comparison
equal
deleted
inserted
replaced
10683:e11f3e1599d4 | 10684:72a5babfa8b4 |
---|---|
174 { | 174 { |
175 msn_user_set_object(user, NULL); | 175 msn_user_set_object(user, NULL); |
176 } | 176 } |
177 else if ((fp = g_fopen(filename, "rb")) != NULL) | 177 else if ((fp = g_fopen(filename, "rb")) != NULL) |
178 { | 178 { |
179 GaimCipherContext *ctx; | |
179 unsigned char *buf; | 180 unsigned char *buf; |
180 SHA_CTX ctx; | |
181 gsize len; | 181 gsize len; |
182 unsigned char *base64; | 182 unsigned char *base64; |
183 unsigned char digest[20]; | 183 unsigned char digest[20]; |
184 | 184 |
185 if (msnobj == NULL) | 185 if (msnobj == NULL) |
201 fclose(fp); | 201 fclose(fp); |
202 | 202 |
203 /* Compute the SHA1D field. */ | 203 /* Compute the SHA1D field. */ |
204 memset(digest, 0, sizeof(digest)); | 204 memset(digest, 0, sizeof(digest)); |
205 | 205 |
206 shaInit(&ctx); | 206 ctx = gaim_cipher_context_new_by_name("sha1", NULL); |
207 shaUpdate(&ctx, buf, st.st_size); | 207 gaim_cipher_context_append(ctx, buf, st.st_size); |
208 shaFinal(&ctx, digest); | 208 gaim_cipher_context_digest(ctx, NULL, digest); |
209 g_free(buf); | 209 g_free(buf); |
210 | 210 |
211 base64 = gaim_base64_encode(digest, sizeof(digest)); | 211 base64 = gaim_base64_encode(digest, sizeof(digest)); |
212 msn_object_set_sha1d(msnobj, base64); | 212 msn_object_set_sha1d(msnobj, base64); |
213 g_free(base64); | 213 g_free(base64); |
224 msn_object_get_friendly(msnobj), | 224 msn_object_get_friendly(msnobj), |
225 msn_object_get_sha1d(msnobj)); | 225 msn_object_get_sha1d(msnobj)); |
226 | 226 |
227 memset(digest, 0, sizeof(digest)); | 227 memset(digest, 0, sizeof(digest)); |
228 | 228 |
229 shaInit(&ctx); | 229 gaim_cipher_context_reset(ctx, NULL); |
230 shaUpdate(&ctx, buf, strlen(buf)); | 230 gaim_cipher_context_append(ctx, buf, strlen(buf)); |
231 shaFinal(&ctx, digest); | 231 gaim_cipher_context_digest(ctx, NULL, digest); |
232 gaim_cipher_context_destroy(ctx); | |
232 g_free(buf); | 233 g_free(buf); |
233 | 234 |
234 base64 = gaim_base64_encode(digest, sizeof(digest)); | 235 base64 = gaim_base64_encode(digest, sizeof(digest)); |
235 msn_object_set_sha1c(msnobj, base64); | 236 msn_object_set_sha1c(msnobj, base64); |
236 g_free(base64); | 237 g_free(base64); |