Module Name:    src
Committed By:   riastradh
Date:           Fri Jul 26 18:31:45 UTC 2024

Modified Files:
        src/sys/external/isc/libsodium/include: stdlib.h

Log Message:
sys/crypto/sodium: Tighten stdlib.h glue.

1. Make sure nothing uses malloc and free.  All of the routines we
   need should work in fixed-size, caller-allocated buffers and
   reasonable stack space.

2. Make panic message for abort() stub clearer.  There are calls to
   it, but they imply internal errors inside libsodium which should
   not happen unless there is an unrecoverable software bug in
   libsodium.

PR kern/58468


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/isc/libsodium/include/stdlib.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/isc/libsodium/include/stdlib.h
diff -u src/sys/external/isc/libsodium/include/stdlib.h:1.1 src/sys/external/isc/libsodium/include/stdlib.h:1.2
--- src/sys/external/isc/libsodium/include/stdlib.h:1.1	Thu Aug 20 21:20:16 2020
+++ src/sys/external/isc/libsodium/include/stdlib.h	Fri Jul 26 18:31:45 2024
@@ -2,7 +2,7 @@
 #include <sys/malloc.h>
 #undef malloc
 #undef free
-#define	malloc(size)	kern_malloc(size, 0)
-#define	free(addr)	kern_free(addr)
+#define	malloc(size)	__malloc_should_not_be_used
+#define	free(addr)	__free_should_not_be_used
 
-#define abort()		panic("abort")
+#define abort()		panic("libsodium internal error")

Reply via email to