File: 0022-Replace-custom-with-standard-memcpy.patch

package info (click to toggle)
cyrus-sasl2 2.1.28%2Bdfsg1-10
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,836 kB
  • sloc: ansic: 47,406; sh: 4,949; xml: 1,423; makefile: 735; python: 332
file content (62 lines) | stat: -rw-r--r-- 1,846 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
Origin: upstream, 4798f8cae5cedbe5c53ae034e0bbca50896e9094
From: Bastian Germann <bage@debian.org>
Date: Tue, 30 May 2023 14:12:22 +0200
Subject: Replace custom with standard memcpy

Signed-off-by: Bastian Germann <bage@debian.org>
---
 lib/md5.c | 27 ++++-----------------------
 1 file changed, 4 insertions(+), 23 deletions(-)

diff --git a/lib/md5.c b/lib/md5.c
index a53fa7ff..9afc65c5 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -33,25 +33,6 @@ documentation and/or software.
 # include <arpa/inet.h>
 #endif
 
-typedef unsigned char *POINTER;
-
-static void MD5_memcpy (POINTER, POINTER, unsigned int);
-
-/* Note: Replace "for loop" with standard memcpy if possible.
-
-        */
-
-static void MD5_memcpy (output, input, len)
-POINTER output;
-POINTER input;
-unsigned int len;
-{
-       unsigned int i; 
-
-       for (i = 0; i < len; i++) 
-	      output[i] = input[i]; 
-}
-
 void _sasl_hmac_md5_init(HMAC_MD5_CTX *hmac,
 			 const unsigned char *key,
 			 int key_len)
@@ -91,8 +72,8 @@ void _sasl_hmac_md5_init(HMAC_MD5_CTX *hmac,
   /* start out by storing key in pads */
   OPENSSL_cleanse(k_ipad, sizeof(k_ipad));
   OPENSSL_cleanse(k_opad, sizeof(k_opad));
-  MD5_memcpy( k_ipad, (POINTER)key, key_len);
-  MD5_memcpy( k_opad, (POINTER)key, key_len);
+  memcpy(k_ipad, key, key_len);
+  memcpy(k_opad, key, key_len);
 
   /* XOR key with ipad and opad values */
   for (i=0; i<64; i++) {
@@ -218,8 +199,8 @@ unsigned char *digest; /* caller digest to be filled in */
   /* start out by storing key in pads */
   OPENSSL_cleanse(k_ipad, sizeof(k_ipad));
   OPENSSL_cleanse(k_opad, sizeof(k_opad));
-  MD5_memcpy( k_ipad, (POINTER)key, key_len);
-  MD5_memcpy( k_opad, (POINTER)key, key_len);
+  memcpy(k_ipad, key, key_len);
+  memcpy(k_opad, key, key_len);
 
   /* XOR key with ipad and opad values */
   for (i=0; i<64; i++) {