Mercurial > pidgin
comparison src/cipher.c @ 13218:c01aa6ea4947
[gaim-migrate @ 15582]
Whitespace...
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Sat, 11 Feb 2006 05:18:48 +0000 |
| parents | e024601d45c7 |
| children | ff4e85e04adf |
comparison
equal
deleted
inserted
replaced
| 13217:502a4de3365c | 13218:c01aa6ea4947 |
|---|---|
| 75 | ((guint32)(b) [(i) + 2] << 16) \ | 75 | ((guint32)(b) [(i) + 2] << 16) \ |
| 76 | ((guint32)(b) [(i) + 3] << 24); \ | 76 | ((guint32)(b) [(i) + 3] << 24); \ |
| 77 } | 77 } |
| 78 #define MD5_PUT_GUINT32(n,b,i) { \ | 78 #define MD5_PUT_GUINT32(n,b,i) { \ |
| 79 (b)[(i) ] = (guchar)((n) ); \ | 79 (b)[(i) ] = (guchar)((n) ); \ |
| 80 (b)[(i) + 1] = (guchar)((n) >> 8); \ | 80 (b)[(i) + 1] = (guchar)((n) >> 8); \ |
| 81 (b)[(i) + 2] = (guchar)((n) >> 16); \ | 81 (b)[(i) + 2] = (guchar)((n) >> 16); \ |
| 82 (b)[(i) + 3] = (guchar)((n) >> 24); \ | 82 (b)[(i) + 3] = (guchar)((n) >> 24); \ |
| 83 } | 83 } |
| 84 | 84 |
| 85 static void | 85 static void |
| 470 md4_transform(ctx->hash, ctx->block); | 470 md4_transform(ctx->hash, ctx->block); |
| 471 } | 471 } |
| 472 | 472 |
| 473 static void | 473 static void |
| 474 md4_init(GaimCipherContext *context, gpointer extra) { | 474 md4_init(GaimCipherContext *context, gpointer extra) { |
| 475 struct MD4_Context *mctx; | 475 struct MD4_Context *mctx; |
| 476 mctx = g_new0(struct MD4_Context, 1); | 476 mctx = g_new0(struct MD4_Context, 1); |
| 477 gaim_cipher_context_set_data(context, mctx); | 477 gaim_cipher_context_set_data(context, mctx); |
| 478 gaim_cipher_context_reset(context, extra); | 478 gaim_cipher_context_reset(context, extra); |
| 479 | 479 |
| 480 mctx->hash[0] = 0x67452301; | 480 mctx->hash[0] = 0x67452301; |
| 481 mctx->hash[1] = 0xefcdab89; | 481 mctx->hash[1] = 0xefcdab89; |
| 482 mctx->hash[2] = 0x98badcfe; | 482 mctx->hash[2] = 0x98badcfe; |
| 483 mctx->hash[3] = 0x10325476; | 483 mctx->hash[3] = 0x10325476; |
| 484 mctx->byte_count = 0; | 484 mctx->byte_count = 0; |
| 485 } | 485 } |
| 486 | 486 |
| 487 static void | 487 static void |
| 488 md4_reset(GaimCipherContext *context, gpointer extra) { | 488 md4_reset(GaimCipherContext *context, gpointer extra) { |
| 489 struct MD4_Context *mctx; | 489 struct MD4_Context *mctx; |
| 490 | 490 |
| 491 mctx = gaim_cipher_context_get_data(context); | 491 mctx = gaim_cipher_context_get_data(context); |
| 492 | 492 |
| 493 mctx->hash[0] = 0x67452301; | 493 mctx->hash[0] = 0x67452301; |
| 494 mctx->hash[1] = 0xefcdab89; | 494 mctx->hash[1] = 0xefcdab89; |
| 495 mctx->hash[2] = 0x98badcfe; | 495 mctx->hash[2] = 0x98badcfe; |
| 496 mctx->hash[3] = 0x10325476; | 496 mctx->hash[3] = 0x10325476; |
| 497 mctx->byte_count = 0; | 497 mctx->byte_count = 0; |
| 498 } | 498 } |
| 562 | 562 |
| 563 static void | 563 static void |
| 564 md4_uninit(GaimCipherContext *context) { | 564 md4_uninit(GaimCipherContext *context) { |
| 565 struct MD4_Context *md4_context; | 565 struct MD4_Context *md4_context; |
| 566 | 566 |
| 567 gaim_cipher_context_reset(context, NULL); | 567 gaim_cipher_context_reset(context, NULL); |
| 568 | 568 |
| 569 md4_context = gaim_cipher_context_get_data(context); | 569 md4_context = gaim_cipher_context_get_data(context); |
| 570 memset(md4_context, 0, sizeof(md4_context)); | 570 memset(md4_context, 0, sizeof(md4_context)); |
| 571 | 571 |
| 572 g_free(md4_context); | 572 g_free(md4_context); |
| 573 md4_context = NULL; | 573 md4_context = NULL; |
| 574 } | 574 } |
| 982 | 982 |
| 983 static void | 983 static void |
| 984 des_uninit(GaimCipherContext *context) { | 984 des_uninit(GaimCipherContext *context) { |
| 985 struct _des_ctx *des_context; | 985 struct _des_ctx *des_context; |
| 986 | 986 |
| 987 des_context = gaim_cipher_context_get_data(context); | 987 des_context = gaim_cipher_context_get_data(context); |
| 988 memset(des_context, 0, sizeof(des_context)); | 988 memset(des_context, 0, sizeof(des_context)); |
| 989 | 989 |
| 990 g_free(des_context); | 990 g_free(des_context); |
| 991 des_context = NULL; | 991 des_context = NULL; |
| 992 } | 992 } |
| 1016 | 1016 |
| 1017 struct SHA1Context { | 1017 struct SHA1Context { |
| 1018 guint32 H[5]; | 1018 guint32 H[5]; |
| 1019 guint32 W[80]; | 1019 guint32 W[80]; |
| 1020 | 1020 |
| 1021 gint lenW; | 1021 gint lenW; |
| 1022 | 1022 |
| 1023 guint32 sizeHi; | 1023 guint32 sizeHi; |
| 1024 guint32 sizeLo; | 1024 guint32 sizeLo; |
| 1025 }; | 1025 }; |
| 1026 | 1026 |
