File: 01_md.patch

package info (click to toggle)
grub2 2.14~git20250718.0e36779-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 60,688 kB
  • sloc: ansic: 541,811; asm: 68,074; sh: 9,803; cpp: 2,095; makefile: 1,895; python: 1,518; sed: 446; lex: 393; yacc: 268; awk: 85; lisp: 54; perl: 31
file content (124 lines) | stat: -rw-r--r-- 2,904 bytes parent folder | download
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
--- a/grub-core/lib/libgcrypt-grub/cipher/md.c
+++ b/grub-core/lib/libgcrypt-grub/cipher/md.c
@@ -20,11 +20,25 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
+#include <config.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
 
 
 #include "g10lib.h"
 #include "cipher.h"
 
+#define _gcry_md_selftest(a,b,c) 0
+typedef struct gcry_md_list
+{
+  const gcry_md_spec_t *spec;
+  struct gcry_md_list *next;
+  size_t actual_struct_size;     /* Allocated size of this structure. */
+  PROPERLY_ALIGNED_TYPE context[1];
+} GcryDigestEntry;
+
 
 /* This is the list of the digest implementations included in
    libgcrypt.  */
@@ -53,7 +67,6 @@
 static void md_close (gcry_md_hd_t a);
 static void md_write (gcry_md_hd_t a, const void *inbuf, size_t inlen);
 static byte *md_read( gcry_md_hd_t a, int algo );
-static int md_get_algo( gcry_md_hd_t a );
 static int md_digest_length( int algo );
 static void md_start_debug ( gcry_md_hd_t a, const char *suffix );
 static void md_stop_debug ( gcry_md_hd_t a );
@@ -186,9 +199,6 @@
 
   if (! err)
     {
-      /* Hmmm, should we really do that? - yes [-wk] */
-      _gcry_fast_random_poll ();
-
       if (algo)
 	{
 	  err = md_enable (hd, algo);
@@ -437,14 +447,6 @@
 {
   GcryDigestEntry *r;
 
-  if (a->ctx->debug)
-    {
-      if (a->bufpos && fwrite (a->buf, a->bufpos, 1, a->ctx->debug) != 1)
-	BUG();
-      if (inlen && fwrite (inbuf, inlen, 1, a->ctx->debug) != 1)
-	BUG();
-    }
-
   for (r = a->ctx->list; r; r = r->next)
     {
       if (a->bufpos)
@@ -695,6 +697,7 @@
       return;
     }
 
+#if 0
   if (spec->hash_buffers != NULL)
     {
       gcry_buffer_t iov;
@@ -711,6 +714,7 @@
       spec->hash_buffers (digest, spec->mdlen, &iov, 1);
     }
   else
+#endif
     {
       /* For the others we do not have a fast function, so we use the
          normal functions. */
@@ -893,43 +896,15 @@
 static void
 md_start_debug ( gcry_md_hd_t md, const char *suffix )
 {
-  static int idx=0;
-  char buf[50];
-
-  if (fips_mode ())
-    return;
-
-  if ( md->ctx->debug )
-    {
-      log_debug("Oops: md debug already started\n");
-      return;
-    }
-  idx++;
-  snprintf (buf, DIM(buf)-1, "dbgmd-%05d.%.10s", idx, suffix );
-  md->ctx->debug = fopen(buf, "w");
-  if ( !md->ctx->debug )
-    log_debug("md debug: can't open %s\n", buf );
+  (void) md;
+  (void) suffix;
 }
 
 
 static void
 md_stop_debug( gcry_md_hd_t md )
 {
-  if ( md->ctx->debug )
-    {
-      if ( md->bufpos )
-        md_write ( md, NULL, 0 );
-      fclose (md->ctx->debug);
-      md->ctx->debug = NULL;
-    }
-
-  {  /* a kludge to pull in the __muldi3 for Solaris */
-    volatile u32 a = (u32)(uintptr_t)md;
-    volatile u64 b = 42;
-    volatile u64 c;
-    c = a * b;
-    (void)c;
-  }
+  (void) md;
 }