commit b70a79e758ba4e7f22daa7ed369766d31ccf23c2
parent 240980d1258bf0380609e45c30f9584ecb1dbd80
Author: sin <sin@2f30.org>
Date: Mon, 21 Mar 2016 18:36:06 +0000
Add nocrypto mode for debugging
Diffstat:
M | stun.c | | | 29 | +++++++++++++++++++++++++++++ |
1 file changed, 29 insertions(+), 0 deletions(-)
diff --git a/stun.c b/stun.c
@@ -77,6 +77,35 @@ aesdec(EVP_CIPHER_CTX *ectx, unsigned char *plaintext,
return plen + flen;
}
+/* useful for debugging purposes */
+#ifdef NOCRYPTO
+#define aesinit dummyinit
+#define aesenc dummyenc
+#define aesdec dummydec
+#endif
+
+int
+dummyinit(unsigned char *pw, int pwlen, EVP_CIPHER_CTX *ectx, EVP_CIPHER_CTX *dctx)
+{
+ return 0;
+}
+
+int
+dummyenc(EVP_CIPHER_CTX *ectx, unsigned char *ciphertext,
+ unsigned char *plaintext, int len)
+{
+ memcpy(ciphertext, plaintext, len);
+ return len;
+}
+
+int
+dummydec(EVP_CIPHER_CTX *ectx, unsigned char *plaintext,
+ unsigned char *ciphertext, int len)
+{
+ memcpy(plaintext, ciphertext, len);
+ return len;
+}
+
int
opentun(char *tundev)
{