Skip to contentSkip to conversation

erofs-utils: lib: fix base64 for tarerofs

PATCH New Gao Xiang 1 participant 1 message Sep 10, 2025 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: lib: fix base64 for tarerofs

The old kernel fscrypt variant (fs/crypto/fname.c) was not real RFC 4648 base64, see kernel commit ba47b515f594 ("fscrypt: align Base64 encoding with RFC 4648 base64url").

Fixes c0063a73b01b ("erofs-utils: lib: support importing xattrs from tarerofs")
---
 lib/Makefile.am       |  3 +-
 lib/base64.c          | 69 +++++++++++++++++++++++++++++++++++++++++++
 lib/liberofs_base64.h |  9 ++++++
 lib/tar.c             | 45 ++--------------------------
 4 files changed, 83 insertions(+), 43 deletions(-)
 create mode 100644 lib/base64.c
 create mode 100644 lib/liberofs_base64.h
lib/Makefile.am +2 -1
index 87454e3..daf937c 100644
@@ -27,6 +27,7 @@ noinst_HEADERS = $(top_srcdir)/include/erofs_fs.h \
       $(top_srcdir)/include/erofs/fragments.h \
       $(top_srcdir)/include/erofs/rebuild.h \
       $(top_srcdir)/include/erofs/importer.h \
+      $(top_srcdir)/lib/liberofs_base64.h \
       $(top_srcdir)/lib/liberofs_cache.h \
       $(top_srcdir)/lib/liberofs_private.h \
       $(top_srcdir)/lib/liberofs_xxhash.h \
@@ -40,7 +41,7 @@ liberofs_la_SOURCES = config.c io.c cache.c super.c inode.c xattr.c exclude.c \
 		      compress_hints.c hashmap.c sha256.c blobchunk.c dir.c \
 		      fragments.c dedupe.c uuid_unparse.c uuid.c tar.c \
 		      block_list.c rebuild.c diskbuf.c bitops.c dedupe_ext.c \
-		      vmdk.c metabox.c global.c importer.c
+		      vmdk.c metabox.c global.c importer.c base64.c
 
 liberofs_la_CFLAGS = -Wall ${libuuid_CFLAGS} -I$(top_srcdir)/include
 liberofs_la_LDFLAGS =
lib/base64.c new file +69 -0

69 lines not on this page · raw message

lib/liberofs_base64.h new file +9 -0
new file mode 100644
index 0000000..bcadb5f
@@ -0,0 +1,9 @@
+#ifndef __EROFS_LIB_LIBEROFS_BASE64_H
+#define __EROFS_LIB_LIBEROFS_BASE64_H
+
+#include "erofs/defs.h"
+
+int erofs_base64_encode(const u8 *src, int srclen, char *dst);
+int erofs_base64_decode(const char *src, int len, u8 *dst);
+
+#endif
lib/tar.c +3 -42

63 lines not on this page · raw message

Signature · 1 line
2.43.5