libpurple/plugins/perl/common/Cipher.xs

Fri, 04 Oct 2013 11:51:07 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Fri, 04 Oct 2013 11:51:07 +0200
changeset 34455
cdc53b913dd4
parent 33912
01e0d716a28e
child 35001
85144a4a7942
permissions
-rw-r--r--

Clang warnings: gg prpl and perl's SvUPGRADE

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 HV *cipher_caps = gv_stashpv("Purple::Cipher::Caps", 1);
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
10
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
11 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
12 #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
13 const_iv(ECB),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
14 const_iv(CBC),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
15 #undef const_iv
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
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
18 static const constiv bm_const_iv[] = {
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
19 #define const_iv(name) {#name, (IV)PURPLE_CIPHER_CAPS_##name}
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
20 const_iv(SET_OPT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
21 const_iv(GET_OPT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
22 const_iv(INIT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
23 const_iv(RESET),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
24 const_iv(UNINIT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
25 const_iv(SET_IV),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
26 const_iv(APPEND),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
27 const_iv(DIGEST),
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
28 const_iv(GET_DIGEST_SIZE),
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
29 const_iv(ENCRYPT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
30 const_iv(DECRYPT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
31 const_iv(SET_SALT),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
32 const_iv(GET_SALT_SIZE),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
33 const_iv(SET_KEY),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
34 const_iv(GET_KEY_SIZE),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
35 const_iv(SET_BATCH_MODE),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
36 const_iv(GET_BATCH_MODE),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
37 const_iv(GET_BLOCK_SIZE),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
38 const_iv(UNKNOWN),
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
39 #undef const_iv
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
40 };
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
41
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
42 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
43 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
44
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
45 for (civ = bm_const_iv + sizeof(bm_const_iv) / sizeof(bm_const_iv[0]); civ-- > bm_const_iv; )
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
46 newCONSTSUB(cipher_caps, (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
47 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
48
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
49 const gchar *
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
50 purple_cipher_get_name(cipher)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
51 Purple::Cipher cipher
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
52
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
53 guint
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
54 purple_cipher_get_capabilities(cipher)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
55 Purple::Cipher cipher
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
56
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
57 gboolean
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
58 purple_cipher_digest_region(name, data_sv, data_len, digest)
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
59 const gchar *name
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
60 SV *data_sv
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
61 size_t data_len
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
62 SV *digest
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
63 PREINIT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
64 guchar *buff = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
65 guchar *data = NULL;
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
66 ssize_t digest_len;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
67 size_t max_digest_len = 100;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
68 CODE:
27158
1d1bd4413f82 Various perl warning fixes as well as real fixes to gconstpointer functions
Paul Aurich <darkrain42@pidgin.im>
parents: 23983
diff changeset
69 data = (guchar *)SvPV(data_sv, data_len);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
70 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
71 buff = (guchar *)SvGROW(digest, max_digest_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
72 digest_len = purple_cipher_digest_region(name, data, data_len, buff, max_digest_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
73 if(digest_len == -1) {
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
74 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
75 RETVAL = 0;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
76 } else {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
77 SvCUR_set(digest, digest_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
78 SvPOK_only(digest);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
79 RETVAL = 1;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
80 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
81 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
82 RETVAL
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
83
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
84 gchar_own*
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
85 purple_cipher_http_digest_calculate_response(algorithm, method, digest_uri, qop, entity, nonce, nonce_count, client_nonce, session_key)
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
86 const gchar* algorithm
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
87 const gchar* method
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
88 const gchar* digest_uri
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
89 const gchar* qop
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
90 const gchar* entity
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
91 const gchar* nonce
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
92 const gchar* nonce_count
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
93 const gchar* client_nonce
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
94 const gchar* session_key
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 gchar_own*
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
97 purple_cipher_http_digest_calculate_session_key(algorithm, username, realm, password, nonce, client_nonce)
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
98 const gchar* algorithm
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
99 const gchar* username
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
100 const gchar* realm
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
101 const gchar* password
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
102 const gchar* nonce
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
103 const gchar* client_nonce
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
104
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
105 MODULE = Purple::Cipher PACKAGE = Purple::Ciphers PREFIX = purple_ciphers_
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
106 PROTOTYPES: ENABLE
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
107
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
108 Purple::Cipher
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
109 purple_ciphers_find_cipher(name)
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
110 gchar * name
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
111
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
112 Purple::Cipher
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
113 purple_ciphers_register_cipher(name, ops)
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
114 gchar * name
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
115 Purple::Cipher::Ops ops
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
116
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
117 gboolean
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
118 purple_ciphers_unregister_cipher(cipher)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
119 Purple::Cipher cipher
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
120
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
121 void
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
122 purple_ciphers_get_ciphers()
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
123 PREINIT:
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
124 GList *l;
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
125 PPCODE:
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
126 for (l = purple_ciphers_get_ciphers(); l != NULL; l = l->next) {
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
127 XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Cipher")));
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
128 }
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
129
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
130 Purple::Handle
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
131 purple_ciphers_get_handle()
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
132
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
133 MODULE = Purple::Cipher PACKAGE = Purple::Cipher::Context PREFIX = purple_cipher_context_
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
134 PROTOTYPES: ENABLE
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
135
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
136 void
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
137 purple_cipher_context_set_option(context, name, value)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
138 Purple::Cipher::Context context
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
139 gchar *name
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
140 gpointer value
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
141
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
142 gpointer
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
143 purple_cipher_context_get_option(context, name)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
144 Purple::Cipher::Context context
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
145 gchar *name
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
146
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
147 Purple::Cipher::Context
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
148 purple_cipher_context_new(klass, cipher, extra = NULL)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
149 Purple::Cipher cipher
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
150 void *extra
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
151 C_ARGS: cipher, extra
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
152
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
153 Purple::Cipher::Context
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
154 purple_cipher_context_new_by_name(klass, name, extra = NULL)
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
155 gchar *name
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
156 void *extra
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
157 C_ARGS: name, extra
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
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
160 purple_cipher_context_reset(context, extra = NULL)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
161 Purple::Cipher::Context context
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
162 gpointer extra
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
163
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
164 void
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
165 purple_cipher_context_destroy(context)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
166 Purple::Cipher::Context context
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
167
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
168 void
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
169 purple_cipher_context_set_iv(Purple::Cipher::Context context, guchar *iv, size_t length(iv))
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
170 PROTOTYPE: $$
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
171
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
172 void
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
173 purple_cipher_context_append(Purple::Cipher::Context context, guchar *data, size_t length(data))
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
174 PROTOTYPE: $$
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
175
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
176 gboolean
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
177 purple_cipher_context_digest(context, digest)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
178 Purple::Cipher::Context context
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
179 SV *digest
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
180 PREINIT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
181 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
182 size_t digest_size;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
183 CODE:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
184 digest_size = purple_cipher_context_get_digest_size(context);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
185 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
186 buff = (guchar *)SvGROW(digest, digest_size);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
187 if (purple_cipher_context_digest(context, buff, digest_size)) {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
188 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
189 SvPOK_only(digest);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
190 RETVAL = 1;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
191 } else {
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
192 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
193 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
194 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
195 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
196 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
197
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
198 gboolean
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
199 purple_cipher_context_digest_to_str(context, digest_s)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
200 Purple::Cipher::Context context
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
201 SV *digest_s
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
202 PREINIT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
203 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
204 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
205 CODE:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
206 digest_size = purple_cipher_context_get_digest_size(context);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
207 str_len = 2 * digest_size;
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
208 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
209 buff = SvGROW(digest_s, str_len + 1);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
210 if (purple_cipher_context_digest_to_str(context, buff, str_len + 1)) {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
211 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
212 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
213 RETVAL = 1;
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
214 } else {
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
215 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
216 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
217 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
218 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
219 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
220
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
221 gboolean
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
222 purple_cipher_context_encrypt(context, input, output)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
223 Purple::Cipher::Context context
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
224 SV *input
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
225 SV *output
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
226 PREINIT:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
227 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
228 ssize_t ret;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
229 guchar *buff = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
230 guchar *data = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
231 CODE:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
232 data = (guchar *)SvPV(input, input_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
233 output_len = input_len + purple_cipher_context_get_block_size(context);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
234 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
235 buff = (guchar *)SvGROW(output, output_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
236 ret = purple_cipher_context_encrypt(context, data, input_len, buff, output_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
237 if (ret >= 0) {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
238 RETVAL = 1;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
239 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
240 SvCUR_set(output, ret);
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
241 } else {
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
242 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
243 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
244 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
245 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
246 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
247
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
248 gboolean
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
249 purple_cipher_context_decrypt(context, input, output)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
250 Purple::Cipher::Context context
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
251 SV *input
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
252 SV *output
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
253 PREINIT:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
254 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
255 ssize_t ret;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
256 guchar *buff = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
257 guchar *data = NULL;
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
258 CODE:
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
259 data = (guchar *)SvPV(input, input_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
260 output_len = input_len + purple_cipher_context_get_block_size(context);
34455
cdc53b913dd4 Clang warnings: gg prpl and perl's SvUPGRADE
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 33912
diff changeset
261 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
262 buff = (guchar *)SvGROW(output, output_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
263 ret = purple_cipher_context_decrypt(context, data, input_len, buff, output_len);
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
264 if (ret >= 0) {
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
265 RETVAL = 1;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
266 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
267 SvCUR_set(output, ret);
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
268 } else {
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
269 RETVAL = 0;
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
270 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
271 }
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
272 OUTPUT:
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
273 RETVAL
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
274
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
275 void
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
276 purple_cipher_context_set_salt(context, salt, len)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
277 Purple::Cipher::Context context
11183
be87fe695c93 [gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents: 11130
diff changeset
278 guchar *salt
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
279 size_t len
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
280
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
281 size_t
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
282 purple_cipher_context_get_salt_size(context)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
283 Purple::Cipher::Context context
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
284
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
285 void
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
286 purple_cipher_context_set_key(context, key, len)
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
287 Purple::Cipher::Context context
11183
be87fe695c93 [gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents: 11130
diff changeset
288 guchar *key
33912
01e0d716a28e ciphers cleanup: fix perl compilation; better purple_cipher_digest_region
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 27158
diff changeset
289 size_t len
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
290
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
291 size_t
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
292 purple_cipher_context_get_key_size(context)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
293 Purple::Cipher::Context context
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
294
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
295 void
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
296 purple_cipher_context_set_data(context, data)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
297 Purple::Cipher::Context context
11118
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
298 gpointer data
36db35a9da56 [gaim-migrate @ 13174]
John H. Kelm <johnkelm@gmail.com>
parents:
diff changeset
299
12777
68ba8956a3d7 [gaim-migrate @ 15124]
Etan Reisner <deryni@pidgin.im>
parents: 11290
diff changeset
300 gpointer
15894
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
301 purple_cipher_context_get_data(context)
765ec644ac47 Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents: 15435
diff changeset
302 Purple::Cipher::Context context
23982
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
303
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
304 Purple::Cipher::BatchMode
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
305 purple_cipher_context_get_batch_mode(context)
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
306 Purple::Cipher::Context context
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
307
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
308 size_t
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
309 purple_cipher_context_get_block_size(context)
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
310 Purple::Cipher::Context context
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
311
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
312 void
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
313 purple_cipher_context_set_batch_mode(context, mode)
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
314 Purple::Cipher::Context context
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
315 Purple::Cipher::BatchMode mode
204b6e71f403 Some Perl bindings fixes and additions from Zsombor Welker.
Daniel Atallah <datallah@pidgin.im>
parents: 15894
diff changeset
316

mercurial