- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)
1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,69 +0,0 @@ |
1 |
-/* |
|
2 |
- * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All |
|
3 |
- * rights reserved. |
|
4 |
- * |
|
5 |
- * License to copy and use this software is granted provided that it |
|
6 |
- * is identified as the "RSA Data Security, Inc. MD5 Message-Digest |
|
7 |
- * Algorithm" in all material mentioning or referencing this software |
|
8 |
- * or this function. |
|
9 |
- * |
|
10 |
- * License is also granted to make and use derivative works provided |
|
11 |
- * that such works are identified as "derived from the RSA Data |
|
12 |
- * Security, Inc. MD5 Message-Digest Algorithm" in all material |
|
13 |
- * mentioning or referencing the derived work. |
|
14 |
- * |
|
15 |
- * RSA Data Security, Inc. makes no representations concerning either |
|
16 |
- * the merchantability of this software or the suitability of this |
|
17 |
- * software for any particular purpose. It is provided "as is" |
|
18 |
- * without express or implied warranty of any kind. |
|
19 |
- * |
|
20 |
- * These notices must be retained in any copies of any part of this |
|
21 |
- * documentation and/or software. |
|
22 |
- */ |
|
23 |
- |
|
24 |
-/*! |
|
25 |
- * \file |
|
26 |
- * \brief Kamailio core :: md5 hash support |
|
27 |
- * \ingroup core |
|
28 |
- * Module: \ref core |
|
29 |
- */ |
|
30 |
- |
|
31 |
-#include <stdio.h> |
|
32 |
-#include <time.h> |
|
33 |
-#include <string.h> |
|
34 |
-#include "md5.h" |
|
35 |
-#include "md5utils.h" |
|
36 |
-#include "dprint.h" |
|
37 |
-#include "ut.h" |
|
38 |
- |
|
39 |
- |
|
40 |
-/*! |
|
41 |
- * \brief Calculate a MD5 digests over a string array |
|
42 |
- * |
|
43 |
- * Calculate a MD5 digests over a string array and stores the result in the |
|
44 |
- * destination char array. This function assumes 32 bytes in the destination |
|
45 |
- * buffer. |
|
46 |
- * \param dst destination |
|
47 |
- * \param src string input array |
|
48 |
- * \param size elements in the input array |
|
49 |
- */ |
|
50 |
-void MD5StringArray (char *dst, str src[], int size) |
|
51 |
-{ |
|
52 |
- MD5_CTX context; |
|
53 |
- unsigned char digest[16]; |
|
54 |
- int i; |
|
55 |
- int len; |
|
56 |
- char *s; |
|
57 |
- |
|
58 |
- MD5Init (&context); |
|
59 |
- for (i=0; i<size; i++) { |
|
60 |
- trim_len( len, s, src[i] ); |
|
61 |
- if (len > 0) |
|
62 |
- MD5Update (&context, s, len); |
|
63 |
- } |
|
64 |
- U_MD5Final (digest, &context); |
|
65 |
- |
|
66 |
- string2hex(digest, 16, dst ); |
|
67 |
- LM_DBG("MD5 calculated: %.*s\n", MD5_LEN, dst ); |
|
68 |
- |
|
69 |
-} |
* fix another bunch of gcc 4.5 'no real prototype' warnings by making the MD5
functions typesafe (removing this PROTO_LIST stuff)
* refactoring of function definitions to use a proper style, like everybody else
* remove not needed defines for datatypes, delete the then empty header completely
* remove the unneeded include of md5global.h from a few modules
* fix callers of MD5 utility functions which already use a proper type
* adapt format of RSA copyright notices to the common style as well
* add doxygen documentations to all functions and defines
* similar changes have been done in kamailio, but have been not ported to this
repository yet
... | ... |
@@ -1,94 +1,67 @@ |
1 |
-/* MDDRIVER.C - test driver for MD2, MD4 and MD5 |
|
2 |
- * |
|
3 |
- */ |
|
4 |
- |
|
5 |
- |
|
6 |
- |
|
7 |
-/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All |
|
8 |
-rights reserved. |
|
9 |
- |
|
10 |
-RSA Data Security, Inc. makes no representations concerning either |
|
11 |
-the merchantability of this software or the suitability of this |
|
12 |
-software for any particular purpose. It is provided "as is" |
|
13 |
-without express or implied warranty of any kind. |
|
14 |
- |
|
15 |
-These notices must be retained in any copies of any part of this |
|
16 |
-documentation and/or software. |
|
17 |
- */ |
|
18 |
- |
|
19 | 1 |
/* |
20 |
- |
|
21 |
-jku: added support to deal with vectors |
|
22 |
- |
|
23 |
-*/ |
|
2 |
+ * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All |
|
3 |
+ * rights reserved. |
|
4 |
+ * |
|
5 |
+ * License to copy and use this software is granted provided that it |
|
6 |
+ * is identified as the "RSA Data Security, Inc. MD5 Message-Digest |
|
7 |
+ * Algorithm" in all material mentioning or referencing this software |
|
8 |
+ * or this function. |
|
9 |
+ * |
|
10 |
+ * License is also granted to make and use derivative works provided |
|
11 |
+ * that such works are identified as "derived from the RSA Data |
|
12 |
+ * Security, Inc. MD5 Message-Digest Algorithm" in all material |
|
13 |
+ * mentioning or referencing the derived work. |
|
14 |
+ * |
|
15 |
+ * RSA Data Security, Inc. makes no representations concerning either |
|
16 |
+ * the merchantability of this software or the suitability of this |
|
17 |
+ * software for any particular purpose. It is provided "as is" |
|
18 |
+ * without express or implied warranty of any kind. |
|
19 |
+ * |
|
20 |
+ * These notices must be retained in any copies of any part of this |
|
21 |
+ * documentation and/or software. |
|
22 |
+ */ |
|
24 | 23 |
|
25 | 24 |
/*! |
26 | 25 |
* \file |
27 |
- * \brief SIP-router core :: |
|
26 |
+ * \brief SIP-router core :: md5 hash support |
|
28 | 27 |
* \ingroup core |
29 | 28 |
* Module: \ref core |
30 | 29 |
*/ |
31 | 30 |
|
32 |
-#define MD 5 |
|
33 |
- |
|
34 | 31 |
#include <stdio.h> |
35 | 32 |
#include <time.h> |
36 | 33 |
#include <string.h> |
37 |
-#include "md5global.h" |
|
38 | 34 |
#include "md5.h" |
39 | 35 |
#include "md5utils.h" |
40 | 36 |
#include "dprint.h" |
41 | 37 |
#include "ut.h" |
42 | 38 |
|
43 | 39 |
|
44 |
-/*static void MDString PROTO_LIST ((char *));*/ |
|
45 |
- |
|
46 |
-#define MD_CTX MD5_CTX |
|
47 |
-#define MDInit MD5Init |
|
48 |
-#define MDUpdate MD5Update |
|
49 |
-#define MDFinal MD5Final |
|
50 |
- |
|
51 |
- |
|
52 |
-/* Digests a string array and store the result in dst; assumes |
|
53 |
- 32 bytes in dst |
|
54 |
- */ |
|
40 |
+/*! |
|
41 |
+ * \brief Calculate a MD5 digests over a string array |
|
42 |
+ * |
|
43 |
+ * Calculate a MD5 digests over a string array and stores the result in the |
|
44 |
+ * destination char array. This function assumes 32 bytes in the destination |
|
45 |
+ * buffer. |
|
46 |
+ * \param dst destination |
|
47 |
+ * \param src string input array |
|
48 |
+ * \param size elements in the input array |
|
49 |
+ */ |
|
55 | 50 |
void MD5StringArray (char *dst, str src[], int size) |
56 | 51 |
{ |
57 |
- MD_CTX context; |
|
52 |
+ MD5_CTX context; |
|
58 | 53 |
unsigned char digest[16]; |
59 | 54 |
int i; |
60 | 55 |
int len; |
61 | 56 |
char *s; |
62 | 57 |
|
63 |
-/* |
|
64 |
-# ifdef EXTRA_DEBUG |
|
65 |
- int j; |
|
66 |
- int sum; |
|
67 |
-#endif |
|
68 |
-*/ |
|
69 |
- |
|
70 |
- MDInit (&context); |
|
58 |
+ MD5Init (&context); |
|
71 | 59 |
for (i=0; i<size; i++) { |
72 | 60 |
trim_len( len, s, src[i] ); |
73 |
-/* |
|
74 |
-# ifdef EXTRA_DEBUG |
|
75 |
- fprintf(stderr, "EXTRA_DEBUG: %d. (%d) {", i+1, len); |
|
76 |
- sum=0; |
|
77 |
- for (j=0; j<len; j++) { |
|
78 |
- fprintf( stderr, "%c ", *(s+j)); |
|
79 |
- sum+=*(s+j); |
|
80 |
- } |
|
81 |
- for (j=0; j<len; j++) { |
|
82 |
- fprintf( stderr, "%d ", *(s+j)); |
|
83 |
- sum+=*(s+j); |
|
84 |
- } |
|
85 |
- fprintf(stderr, " [%d]\n", sum ); |
|
86 |
-# endif |
|
87 |
-*/ |
|
88 | 61 |
if (len > 0) |
89 |
- MDUpdate (&context, s, len); |
|
62 |
+ MD5Update (&context, s, len); |
|
90 | 63 |
} |
91 |
- MDFinal (digest, &context); |
|
64 |
+ U_MD5Final (digest, &context); |
|
92 | 65 |
|
93 | 66 |
string2hex(digest, 16, dst ); |
94 | 67 |
DBG("DEBUG: MD5 calculated: %.*s\n", MD5_LEN, dst ); |
Please fill in after the :: to explain the function of this file.
... | ... |
@@ -45,7 +45,7 @@ jku: added support to deal with vectors |
45 | 45 |
/* Digests a string array and store the result in dst; assumes |
46 | 46 |
32 bytes in dst |
47 | 47 |
*/ |
48 |
-void MDStringArray (char *dst, str src[], int size) |
|
48 |
+void MD5StringArray (char *dst, str src[], int size) |
|
49 | 49 |
{ |
50 | 50 |
MD_CTX context; |
51 | 51 |
unsigned char digest[16]; |
Sponsored by: Sippy Software, Inc.
Debugging: mpatrol
... | ... |
@@ -80,8 +80,7 @@ void MDStringArray (char *dst, str src[], int size) |
80 | 80 |
} |
81 | 81 |
MDFinal (digest, &context); |
82 | 82 |
|
83 |
- for (i=0; i<16; i++) |
|
84 |
- sprintf(dst+i*2, "%02x", digest[i] ); |
|
83 |
+ string2hex(digest, 16, dst ); |
|
84 |
+ DBG("DEBUG: MD5 calculated: %.*s\n", MD5_LEN, dst ); |
|
85 | 85 |
|
86 |
- DBG("DEBUG: MD5 calculated: %32s\n", dst ); |
|
87 | 86 |
} |
... | ... |
@@ -28,8 +28,8 @@ jku: added support to deal with vectors |
28 | 28 |
#include "md5global.h" |
29 | 29 |
#include "md5.h" |
30 | 30 |
#include "md5utils.h" |
31 |
- |
|
32 | 31 |
#include "dprint.h" |
32 |
+#include "ut.h" |
|
33 | 33 |
|
34 | 34 |
|
35 | 35 |
static void MDString PROTO_LIST ((char *)); |
... | ... |
@@ -45,13 +45,38 @@ static void MDString PROTO_LIST ((char *)); |
45 | 45 |
*/ |
46 | 46 |
void MDStringArray (char *dst, str src[], int size) |
47 | 47 |
{ |
48 |
- MD_CTX context; |
|
49 |
- unsigned char digest[16]; |
|
50 |
- int i; |
|
48 |
+ MD_CTX context; |
|
49 |
+ unsigned char digest[16]; |
|
50 |
+ int i; |
|
51 |
+ int len; |
|
52 |
+ char *s; |
|
53 |
+ |
|
54 |
+/* |
|
55 |
+# ifdef EXTRA_DEBUG |
|
56 |
+ int j; |
|
57 |
+ int sum; |
|
58 |
+#endif |
|
59 |
+*/ |
|
51 | 60 |
|
52 |
- MDInit (&context); |
|
53 |
- for (i=0; i<size; i++) { |
|
54 |
- MDUpdate (&context, src[i].s, src[i].len); |
|
61 |
+ MDInit (&context); |
|
62 |
+ for (i=0; i<size; i++) { |
|
63 |
+ trim_len( len, s, src[i] ); |
|
64 |
+/* |
|
65 |
+# ifdef EXTRA_DEBUG |
|
66 |
+ fprintf(stderr, "EXTRA_DEBUG: %d. (%d) {", i+1, len); |
|
67 |
+ sum=0; |
|
68 |
+ for (j=0; j<len; j++) { |
|
69 |
+ fprintf( stderr, "%c ", *(s+j)); |
|
70 |
+ sum+=*(s+j); |
|
71 |
+ } |
|
72 |
+ for (j=0; j<len; j++) { |
|
73 |
+ fprintf( stderr, "%d ", *(s+j)); |
|
74 |
+ sum+=*(s+j); |
|
75 |
+ } |
|
76 |
+ fprintf(stderr, " [%d]\n", sum ); |
|
77 |
+# endif |
|
78 |
+*/ |
|
79 |
+ MDUpdate (&context, s, len); |
|
55 | 80 |
} |
56 | 81 |
MDFinal (digest, &context); |
57 | 82 |
|
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,62 @@ |
1 |
+/* MDDRIVER.C - test driver for MD2, MD4 and MD5 |
|
2 |
+ */ |
|
3 |
+ |
|
4 |
+ |
|
5 |
+/* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All |
|
6 |
+rights reserved. |
|
7 |
+ |
|
8 |
+RSA Data Security, Inc. makes no representations concerning either |
|
9 |
+the merchantability of this software or the suitability of this |
|
10 |
+software for any particular purpose. It is provided "as is" |
|
11 |
+without express or implied warranty of any kind. |
|
12 |
+ |
|
13 |
+These notices must be retained in any copies of any part of this |
|
14 |
+documentation and/or software. |
|
15 |
+ */ |
|
16 |
+ |
|
17 |
+/* |
|
18 |
+ |
|
19 |
+jku: added support to deal with vectors |
|
20 |
+ |
|
21 |
+*/ |
|
22 |
+ |
|
23 |
+#define MD 5 |
|
24 |
+ |
|
25 |
+#include <stdio.h> |
|
26 |
+#include <time.h> |
|
27 |
+#include <string.h> |
|
28 |
+#include "md5global.h" |
|
29 |
+#include "md5.h" |
|
30 |
+#include "md5utils.h" |
|
31 |
+ |
|
32 |
+#include "dprint.h" |
|
33 |
+ |
|
34 |
+ |
|
35 |
+static void MDString PROTO_LIST ((char *)); |
|
36 |
+ |
|
37 |
+#define MD_CTX MD5_CTX |
|
38 |
+#define MDInit MD5Init |
|
39 |
+#define MDUpdate MD5Update |
|
40 |
+#define MDFinal MD5Final |
|
41 |
+ |
|
42 |
+ |
|
43 |
+/* Digests a string array and store the result in dst; assumes |
|
44 |
+ 32 bytes in dst |
|
45 |
+ */ |
|
46 |
+void MDStringArray (char *dst, str src[], int size) |
|
47 |
+{ |
|
48 |
+ MD_CTX context; |
|
49 |
+ unsigned char digest[16]; |
|
50 |
+ int i; |
|
51 |
+ |
|
52 |
+ MDInit (&context); |
|
53 |
+ for (i=0; i<size; i++) { |
|
54 |
+ MDUpdate (&context, src[i].s, src[i].len); |
|
55 |
+ } |
|
56 |
+ MDFinal (digest, &context); |
|
57 |
+ |
|
58 |
+ for (i=0; i<16; i++) |
|
59 |
+ sprintf(dst+i*2, "%02x", digest[i] ); |
|
60 |
+ |
|
61 |
+ DBG("DEBUG: MD5 calculated: %32s\n", dst ); |
|
62 |
+} |