diff options
author | axtloss <axtlos@getcryst.al> | 2024-03-07 00:56:46 +0100 |
---|---|---|
committer | axtloss <axtlos@getcryst.al> | 2024-03-07 00:56:46 +0100 |
commit | c365a6bac14227a6e7e341ef8228365ca443d2fb (patch) | |
tree | 6c0fed4e74fb3198a3afb79fd7bebfa477c46a47 | |
parent | 0f5bd8e774b4746c27d9a573057d57770e1cf0de (diff) | |
download | fsverify-c365a6bac14227a6e7e341ef8228365ca443d2fb.tar.gz fsverify-c365a6bac14227a6e7e341ef8228365ca443d2fb.tar.bz2 |
Diffstat (limited to '')
-rwxr-xr-x | build.sh | 6 | ||||
-rw-r--r-- | fbwarn/src/parseBVG.c | 6 | ||||
-rw-r--r-- | fbwarn/src/parseBVG.h | 7 | ||||
-rw-r--r-- | verify/cmd/verify.go | 12 | ||||
-rw-r--r-- | verify/core/storage.go | 4 | ||||
-rw-r--r-- | verify/core/verification.go | 2 | ||||
-rw-r--r-- | verify/getScreensize.c | 2 | ||||
-rw-r--r-- | verifysetup/core/storage.go | 2 |
8 files changed, 28 insertions, 13 deletions
@@ -50,7 +50,8 @@ echo "Building raylib" git submodule init git submodule update cd raylib/src -make PLATFORM=PLATFORM_DRM RAYLIB_LIBTYPE=SHARED +#make PLATFORM=PLATFORM_DRM RAYLIB_LIBTYPE=SHARED +make RAYLIB_LIBTYPE=SHARED cd ../.. mkdir include cp raylib/src/libraylib.so fsverify_root/lib/libraylib.so @@ -59,7 +60,8 @@ cp raylib/src/raylib.h include/raylib.h echo "Building fbwarn" cd fbwarn autoreconf --install -./configure CFLAGS="-O2 -std=gnu99 -DEGL_NO_X11 -DLPATFORM_DRM -I../../include -L../../fsverify_root/lib" +#./configure CFLAGS="-O2 -std=gnu99 -DEGL_NO_X11 -DLPATFORM_DRM -I../../include -L../../fsverify_root/lib" +./configure CFLAGS="-O2 -std=gnu99 -I../../include -L../../fsverify_root/lib" make patchelf --replace-needed libraylib.so.500 /fsverify/lib/libraylib.so src/fbwarn cp src/fbwarn ../fsverify_root/bin/fbwarn diff --git a/fbwarn/src/parseBVG.c b/fbwarn/src/parseBVG.c index db25ddc..9b0a137 100644 --- a/fbwarn/src/parseBVG.c +++ b/fbwarn/src/parseBVG.c @@ -282,7 +282,7 @@ BVGCircle *BVGParseCircleSegment(char *argv[7]) { clr = parseColorFromHex(args[3]); result->drawSector=true; - result->centerX=x; result->centerY=y*scale; + result->centerX=x*scale; result->centerY=y*scale; result->color=*clr; result->radius=radius*scale; result->segments=segments; @@ -315,7 +315,7 @@ BVGRing *BVGParseRing(char *argv[8]) { result->centerX=x*scale; result->centerY=y*scale; - result->inRadius=innerRadius; result->outRadius=outerRadius; + result->inRadius=innerRadius*scale; result->outRadius=outerRadius*scale; result->startAngle=startAngle; result->endAngle=endAngle; result->segmets=segments; result->color=*clr; @@ -343,7 +343,7 @@ BVGEllipse *BVGParseEllipse(char *argv[6]) { args[5][strlen(args[5])-1] = '\0'; clr = parseColorFromHex(args[5]); - result->centerX=x; result->centerY=y; + result->centerX=x*scale; result->centerY=y*scale; result->horizontalRadius=horizontalRadius*scale; result->verticalRadius=verticalRadius*scale; result->fill=fill; diff --git a/fbwarn/src/parseBVG.h b/fbwarn/src/parseBVG.h index 1a90c78..120763a 100644 --- a/fbwarn/src/parseBVG.h +++ b/fbwarn/src/parseBVG.h @@ -19,6 +19,13 @@ void BVGDrawRectangle(BVGRectangle *rectangle); BVGRoundedRectangle *BVGParseRoundedRectangle(char *argv[9]); void BVGDrawRoundedRectangle(BVGRoundedRectangle *rectangle); BVGCircle *BVGParseCircle(char *argv[4]); +BVGCircle *BVGParseCircleSegment(char *argv[7]); void BVGDrawCircle(BVGCircle *circle); BVGRing *BVGParseRing(char *argv[8]); void BVGDrawRing(BVGRing *ring); +BVGEllipse *BVGParseEllipse(char *argv[6]); +void BVGDrawEllipse(BVGEllipse *ellipse); +BVGTriangle *BVGParseTriangle(char *argv[8]); +void BVGDrawTriangle(BVGTriangle *triangle); +BVGText *BVGParseText(char *argv[5]); +void BVGDrawText(BVGText *text); diff --git a/verify/cmd/verify.go b/verify/cmd/verify.go index e263afa..1d8a976 100644 --- a/verify/cmd/verify.go +++ b/verify/cmd/verify.go @@ -86,11 +86,13 @@ func validateThread(blockStart int, blockEnd int, bundleSize int, diskBytes []by func ValidateCommand(_ *cobra.Command, args []string) error { if len(args) != 1 { + core.WarnUser() return fmt.Errorf("Usage: fsverify verify [disk]") } header, err := core.ReadHeader(config.FsVerifyPart) if err != nil { + core.WarnUser() return err } @@ -98,23 +100,29 @@ func ValidateCommand(_ *cobra.Command, args []string) error { // this does not check if the partition has been tampered with // it only checks if the specified partition is even an fsverify partition if header.MagicNumber != 0xACAB { + core.WarnUser() return fmt.Errorf("sanity bit does not match. Expected %d, got %d", 0xACAB, header.MagicNumber) } fmt.Println("Reading DB") dbfile, err := core.ReadDB(config.FsVerifyPart) if err != nil { + core.WarnUser() return err } key, err := core.ReadKey() if err != nil { + fmt.Println(err) + core.WarnUser() return err } fmt.Println("Key: " + key) verified, err := core.VerifySignature(key, header.Signature, dbfile) if err != nil { + core.WarnUser() return err } else if !verified { + core.WarnUser() return fmt.Errorf("Signature verification failed\n") } else { fmt.Println("Signature verification success!") @@ -123,11 +131,13 @@ func ValidateCommand(_ *cobra.Command, args []string) error { fmt.Println("----") disk, err := os.Open(args[0]) if err != nil { + core.WarnUser() return err } defer disk.Close() diskInfo, err := disk.Stat() if err != nil { + core.WarnUser() return err } diskSize := diskInfo.Size() @@ -135,6 +145,7 @@ func ValidateCommand(_ *cobra.Command, args []string) error { // If the filesystem size has increased ever since the fsverify partition was created // it would mean that fsverify is not able to verify the entire partition, making it useless if header.FilesystemSize*header.FilesystemUnit != int(diskSize) { + core.WarnUser() return fmt.Errorf("disk size does not match disk size specified in header. Expected %d, got %d", header.FilesystemSize*header.FilesystemUnit, diskSize) } @@ -142,6 +153,7 @@ func ValidateCommand(_ *cobra.Command, args []string) error { diskBytes := make([]byte, diskSize) _, err = disk.Read(diskBytes) if err != nil { + core.WarnUser() return err } reader := bytes.NewReader(diskBytes) diff --git a/verify/core/storage.go b/verify/core/storage.go index 182e1ec..f1f9436 100644 --- a/verify/core/storage.go +++ b/verify/core/storage.go @@ -232,9 +232,7 @@ func GetNode(checksum string, db *bolt.DB) (Node, error) { func CopyByteArea(start int, end int, reader *bytes.Reader) ([]byte, error) { if end-start < 0 { return []byte{}, fmt.Errorf("tried creating byte slice with negative length. %d to %d total %d\n", start, end, end-start) - } else if end-start > 2000 { - return []byte{}, fmt.Errorf("tried creating byte slice with length over 2000. %d to %d total %d\n", start, end, end-start) - } + } bytes := make([]byte, end-start) n, err := reader.ReadAt(bytes, int64(start)) if err != nil { diff --git a/verify/core/verification.go b/verify/core/verification.go index 28b4e3b..5a95e75 100644 --- a/verify/core/verification.go +++ b/verify/core/verification.go @@ -106,8 +106,6 @@ func ReadKey() (string, error) { func ReadBlock(node Node, part *bytes.Reader, totalReadBlocks int) ([]byte, int, error) { if node.BlockEnd-node.BlockStart < 0 { return []byte{}, -1, fmt.Errorf("tried creating byte slice with negative length. %d to %d total %d\n", node.BlockStart, node.BlockEnd, node.BlockEnd-node.BlockStart) - } else if node.BlockEnd-node.BlockStart > 2000 { - return []byte{}, -1, fmt.Errorf("tried creating byte slice with length over 2000. %d to %d total %d\n", node.BlockStart, node.BlockEnd, node.BlockEnd-node.BlockStart) } block := make([]byte, node.BlockEnd-node.BlockStart) blockSize := node.BlockEnd - node.BlockStart diff --git a/verify/getScreensize.c b/verify/getScreensize.c index c383b71..56393b0 100644 --- a/verify/getScreensize.c +++ b/verify/getScreensize.c @@ -19,6 +19,6 @@ int main(void) { if (ioctl(fbfb, FBIOGET_VSCREENINFO, &vinfo) == -1) return 1; - printf("%d", vinfo.yres); + printf("%d", vinfo.xres); return 0; } diff --git a/verifysetup/core/storage.go b/verifysetup/core/storage.go index 33efa30..c15ebfe 100644 --- a/verifysetup/core/storage.go +++ b/verifysetup/core/storage.go @@ -15,8 +15,6 @@ import ( func ReadBlock(start int, end int, device *bytes.Reader) ([]byte, error) { if end-start < 0 { return []byte{}, fmt.Errorf("tried creating byte slice with negative length. %d to %d total %d\n", start, end, end-start) - } else if end-start > 2000 { - return []byte{}, fmt.Errorf("tried creating byte slice with length over 2000. %d to %d total %d\n", start, end, end-start) } block := make([]byte, end-start) _, err := device.Seek(int64(start), 0) |