libpurple/plugins/perl/common/Cipher.xs

Mon, 03 Feb 2014 22:40:31 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 03 Feb 2014 22:40:31 +0530
branch
gtkdoc-conversion
changeset 35436
a69d2e5604c5
parent 35026
fde23518e1e5
child 36002
31a8779e91d4
permissions
-rw-r--r--

Swap @title and @short_description roles

11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
1 #include "module.h"
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
2
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
3 MODULE = Purple::Cipher PACKAGE = Purple::Cipher PREFIX = purple_cipher_
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
4 PROTOTYPES: ENABLE
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
5
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
6 BOOT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
7 {
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
8 HV *stash = gv_stashpv("Purple::Cipher::BatchMode", 1);
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
9
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
10 static const constiv *civ, const_iv[] = {
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
11 #define const_iv(name) {#name, (IV)PURPLE_CIPHER_BATCH_MODE_##name}
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
12 const_iv(ECB),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
13 const_iv(CBC),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
14 #undef const_iv
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
15 };
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
16
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
17 for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; )
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
18 newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv));
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
19 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
20
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
21 gchar_own*
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
22 purple_http_digest_calculate_response(algorithm, method, digest_uri, qop, entity, nonce, nonce_count, client_nonce, session_key)
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
23 const gchar* algorithm
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
24 const gchar* method
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
25 const gchar* digest_uri
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
26 const gchar* qop
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
27 const gchar* entity
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
28 const gchar* nonce
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
29 const gchar* nonce_count
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
30 const gchar* client_nonce
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
31 const gchar* session_key
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
32
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
33 gchar_own*
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
34 purple_http_digest_calculate_session_key(algorithm, username, realm, password, nonce, client_nonce)
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
35 const gchar* algorithm
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
36 const gchar* username
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
37 const gchar* realm
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
38 const gchar* password
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
39 const gchar* nonce
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
40 const gchar* client_nonce
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
41
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
42 void
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
43 purple_cipher_reset(cipher)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
44 Purple::Cipher cipher
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
45
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
46 void
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
47 purple_cipher_set_iv(Purple::Cipher cipher, guchar *iv, size_t length(iv))
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
48 PROTOTYPE: $$
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
49
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
50 void
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
51 purple_cipher_append(Purple::Cipher cipher, guchar *data, size_t length(data))
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
52 PROTOTYPE: $$
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
53
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
54 gboolean
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
55 purple_cipher_digest(cipher, digest)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
56 Purple::Cipher cipher
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
57 SV *digest
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
58 PREINIT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
59 guchar *buff = NULL;
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
60 size_t digest_size;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
61 CODE:
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
62 digest_size = purple_cipher_get_digest_size(cipher);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
63 SvUPGRADE_common(digest, SVt_PV);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
64 buff = (guchar *)SvGROW(digest, digest_size);
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
65 if (purple_cipher_digest(cipher, buff, digest_size)) {
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
66 SvCUR_set(digest, digest_size);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
67 SvPOK_only(digest);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
68 RETVAL = 1;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
69 } else {
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
70 SvSetSV_nosteal(digest, &PL_sv_undef);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
71 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
72 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
73 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
74 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
75
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
76 gboolean
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
77 purple_cipher_digest_to_str(cipher, digest_s)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
78 Purple::Cipher cipher
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
79 SV *digest_s
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
80 PREINIT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
81 gchar *buff = NULL;
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
82 size_t digest_size, str_len;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
83 CODE:
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
84 digest_size = purple_cipher_get_digest_size(cipher);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
85 str_len = 2 * digest_size;
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
86 SvUPGRADE_common(digest_s, SVt_PV);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
87 buff = SvGROW(digest_s, str_len + 1);
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
88 if (purple_cipher_digest_to_str(cipher, buff, str_len + 1)) {
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
89 SvCUR_set(digest_s, str_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
90 SvPOK_only(digest_s);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
91 RETVAL = 1;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
92 } else {
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
93 SvSetSV_nosteal(digest_s, &PL_sv_undef);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
94 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
95 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
96 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
97 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
98
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
99 gboolean
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
100 purple_cipher_encrypt(cipher, input, output)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
101 Purple::Cipher cipher
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
102 SV *input
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
103 SV *output
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
104 PREINIT:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
105 size_t input_len, output_len;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
106 ssize_t ret;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
107 guchar *buff = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
108 guchar *data = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
109 CODE:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
110 data = (guchar *)SvPV(input, input_len);
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
111 output_len = input_len + purple_cipher_get_block_size(cipher);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
112 SvUPGRADE_common(output, SVt_PV);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
113 buff = (guchar *)SvGROW(output, output_len);
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
114 ret = purple_cipher_encrypt(cipher, data, input_len, buff, output_len);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
115 if (ret >= 0) {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
116 RETVAL = 1;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
117 SvPOK_only(output);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
118 SvCUR_set(output, ret);
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
119 } else {
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
120 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
121 SvSetSV_nosteal(output, &PL_sv_undef);
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
122 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
123 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
124 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
125
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
126 gboolean
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
127 purple_cipher_decrypt(cipher, input, output)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
128 Purple::Cipher cipher
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
129 SV *input
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
130 SV *output
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
131 PREINIT:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
132 size_t input_len, output_len;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
133 ssize_t ret;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
134 guchar *buff = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
135 guchar *data = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
136 CODE:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
137 data = (guchar *)SvPV(input, input_len);
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
138 output_len = input_len + purple_cipher_get_block_size(cipher);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
139 SvUPGRADE_common(output, SVt_PV);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
140 buff = (guchar *)SvGROW(output, output_len);
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
141 ret = purple_cipher_decrypt(cipher, data, input_len, buff, output_len);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
142 if (ret >= 0) {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
143 RETVAL = 1;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
144 SvPOK_only(output);
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
145 SvCUR_set(output, ret);
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
146 } else {
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
147 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
148 SvSetSV_nosteal(output, &PL_sv_undef);
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
149 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
150 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
151 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
152
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
153 void
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
154 purple_cipher_set_salt(cipher, salt, len)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
155 Purple::Cipher cipher
11183
be87fe695c93 [gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents: 11130
diff changeset
156 guchar *salt
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
157 size_t len
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
158
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
159 void
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
160 purple_cipher_set_key(cipher, key, len)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
161 Purple::Cipher cipher
11183
be87fe695c93 [gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents: 11130
diff changeset
162 guchar *key
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
163 size_t len
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
164
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
165 size_t
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
166 purple_cipher_get_key_size(cipher)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
167 Purple::Cipher cipher
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
168
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
169 Purple::Cipher::BatchMode
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
170 purple_cipher_get_batch_mode(cipher)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
171 Purple::Cipher cipher
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
172
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
173 size_t
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
174 purple_cipher_get_block_size(cipher)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
175 Purple::Cipher cipher
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
176
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
177 void
34552
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
178 purple_cipher_set_batch_mode(cipher, mode)
d39fc37af80a Refactored libpurple/plugins/perl/common to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33912
diff changeset
179 Purple::Cipher cipher
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
180 Purple::Cipher::BatchMode mode
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
181
34606
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
182 MODULE = Purple::Cipher PACKAGE = Purple::AESCipher PREFIX = purple_aes_cipher_
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
183 PROTOTYPES: ENABLE
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
184
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
185 Purple::Cipher
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
186 purple_aes_cipher_new()
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
187
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
188 MODULE = Purple::Cipher PACKAGE = Purple::DES3Cipher PREFIX = purple_des3_cipher_
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
189 PROTOTYPES: ENABLE
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
190
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
191 Purple::Cipher
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
192 purple_des3_cipher_new()
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
193
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
194 MODULE = Purple::Cipher PACKAGE = Purple::DESCipher PREFIX = purple_des_cipher_
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
195 PROTOTYPES: ENABLE
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
196
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
197 Purple::Cipher
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
198 purple_des_cipher_new()
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
199
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
200 MODULE = Purple::Cipher PACKAGE = Purple::HMACCipher PREFIX = purple_hmac_cipher_
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
201 PROTOTYPES: ENABLE
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
202
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
203 Purple::Cipher
34607
d6983411079e Added cipher includes, and hash argument to _new() of PurpleHMACCipher and PurplePBKDF2Cipher
Ankit Vani <a@nevitus.org>
parents: 34606
diff changeset
204 purple_hmac_cipher_new(hash)
d6983411079e Added cipher includes, and hash argument to _new() of PurpleHMACCipher and PurplePBKDF2Cipher
Ankit Vani <a@nevitus.org>
parents: 34606
diff changeset
205 Purple::Hash hash
34606
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
206
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
207 MODULE = Purple::Cipher PACKAGE = Purple::PBKDF2Cipher PREFIX = purple_pbkdf2_cipher_
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
208 PROTOTYPES: ENABLE
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
209
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
210 Purple::Cipher
34607
d6983411079e Added cipher includes, and hash argument to _new() of PurpleHMACCipher and PurplePBKDF2Cipher
Ankit Vani <a@nevitus.org>
parents: 34606
diff changeset
211 purple_pbkdf2_cipher_new(hash)
d6983411079e Added cipher includes, and hash argument to _new() of PurpleHMACCipher and PurplePBKDF2Cipher
Ankit Vani <a@nevitus.org>
parents: 34606
diff changeset
212 Purple::Hash hash
34606
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
213
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
214 MODULE = Purple::Cipher PACKAGE = Purple::RC4Cipher PREFIX = purple_rc4_cipher_
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
215 PROTOTYPES: ENABLE
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
216
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
217 Purple::Cipher
bca53cda8ed5 Added ciphers and hashes _new functions to .xs files
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
218 purple_rc4_cipher_new()
35026
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
219
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
220 MODULE = Purple::Cipher PACKAGE = Purple::Hash PREFIX = purple_hash_
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
221 PROTOTYPES: ENABLE
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
222
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
223 gchar_own*
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
224 purple_http_digest_calculate_response(algorithm, method, digest_uri, qop, entity, nonce, nonce_count, client_nonce, session_key)
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
225 const gchar* algorithm
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
226 const gchar* method
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
227 const gchar* digest_uri
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
228 const gchar* qop
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
229 const gchar* entity
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
230 const gchar* nonce
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
231 const gchar* nonce_count
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
232 const gchar* client_nonce
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
233 const gchar* session_key
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
234
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
235 gchar_own*
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
236 purple_http_digest_calculate_session_key(algorithm, username, realm, password, nonce, client_nonce)
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
237 const gchar* algorithm
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
238 const gchar* username
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
239 const gchar* realm
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
240 const gchar* password
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
241 const gchar* nonce
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
242 const gchar* client_nonce
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
243
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
244 void
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
245 purple_hash_reset(hash)
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
246 Purple::Hash hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
247
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
248 void
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
249 purple_hash_append(Purple::Hash hash, guchar *data, size_t length(data))
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
250 PROTOTYPE: $$
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
251
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
252 gboolean
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
253 purple_hash_digest(hash, digest)
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
254 Purple::Hash hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
255 SV *digest
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
256 PREINIT:
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
257 guchar *buff = NULL;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
258 size_t digest_size;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
259 CODE:
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
260 digest_size = purple_hash_get_digest_size(hash);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
261 SvUPGRADE_common(digest, SVt_PV);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
262 buff = (guchar *)SvGROW(digest, digest_size);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
263 if (purple_hash_digest(hash, buff, digest_size)) {
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
264 SvCUR_set(digest, digest_size);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
265 SvPOK_only(digest);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
266 RETVAL = 1;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
267 } else {
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
268 SvSetSV_nosteal(digest, &PL_sv_undef);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
269 RETVAL = 0;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
270 }
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
271 OUTPUT:
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
272 RETVAL
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
273
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
274 gboolean
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
275 purple_hash_digest_to_str(hash, digest_s)
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
276 Purple::Hash hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
277 SV *digest_s
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
278 PREINIT:
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
279 gchar *buff = NULL;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
280 size_t digest_size, str_len;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
281 CODE:
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
282 digest_size = purple_hash_get_digest_size(hash);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
283 str_len = 2 * digest_size;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
284 SvUPGRADE_common(digest_s, SVt_PV);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
285 buff = SvGROW(digest_s, str_len + 1);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
286 if (purple_hash_digest_to_str(hash, buff, str_len + 1)) {
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
287 SvCUR_set(digest_s, str_len);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
288 SvPOK_only(digest_s);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
289 RETVAL = 1;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
290 } else {
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
291 SvSetSV_nosteal(digest_s, &PL_sv_undef);
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
292 RETVAL = 0;
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
293 }
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
294 OUTPUT:
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
295 RETVAL
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
296
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
297 size_t
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
298 purple_hash_get_block_size(hash)
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
299 Purple::Hash hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
300
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
301 MODULE = Purple::Hash PACKAGE = Purple::MD4Hash PREFIX = purple_md4_hash_
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
302 PROTOTYPES: ENABLE
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
303
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
304 Purple::Hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
305 purple_md4_hash_new()
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
306
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
307 MODULE = Purple::Hash PACKAGE = Purple::MD5Hash PREFIX = purple_md5_hash_
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
308 PROTOTYPES: ENABLE
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
309
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
310 Purple::Hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
311 purple_md5_hash_new()
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
312
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
313 MODULE = Purple::Hash PACKAGE = Purple::SHA1Hash PREFIX = purple_sha1_hash_
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
314 PROTOTYPES: ENABLE
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
315
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
316 Purple::Hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
317 purple_sha1_hash_new()
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
318
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
319 MODULE = Purple::Hash PACKAGE = Purple::SHA256Hash PREFIX = purple_sha256_hash_
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
320 PROTOTYPES: ENABLE
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
321
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
322 Purple::Hash
fde23518e1e5 Moved PurpleHash to cipher.[ch]
Ankit Vani <a@nevitus.org>
parents: 35001
diff changeset
323 purple_sha256_hash_new()

mercurial