Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for SQLeet full database encryption #93

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sqlite3.o
sqleet.o
43 changes: 22 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,39 @@
# is imported, Go will build the ./c/sqlite.c file that is included directly by
# static.go. However this is pretty slow ~30s. When developing this is very
# annoying. Use this Makefile to pre-build the sqlite3.o object and then build
# the package with the build tag linksqlite3, which will ignore static.go and
# the package with the build tag link, which will ignore static.go and
# use link.go instead to link against sqlite.o. This reduces compilation times
# down to <3 sec!
# down to < 3 sec!
#
# If you are using an editor that builds the project as you work on it, you'll
# want to build the sqlite3.o object and tell your editor to use the
# linksqlite3 go build tag when working on this project.
# For vim-go, use the command `GoBuildTags linksqlite3` or
# `let g:go_build_tags = # 'linksqlite3'`
# link go build tag when working on this project.
# For vim-go, use the command `GoBuildTags link` or
# `let g:go_build_tags = # 'link'`

export GOFLAGS=-tags=linksqlite3

.PHONY: clean all env test release
.PHONY: clean all env test sqleet test-all
all: sqlite3.o
go build ./...
go build -tags=link ./...

test-all: test test-sqleet

test: sqlite3.o
go test ./...
go test -tags=link ./...

test-race: sqlite3.o
go test -race ./...
env:
go env
go test -tags=link -race ./...

sqleet: sqleet.o
go build -tags=link,sqleet ./...

## This builds the package statically.
release:
go build -tags=!linksqlite3
test-sqleet: sqleet.o
go test -tags=link,sqleet ./

VPATH = ./c # Look in ./c for source files
test-race-sqleet: sqlite3.o
go test -tags=link,sqleet -race ./...

# Paths to look for source files
VPATH = ./c/sqlite ./c/sqleet

# !!! THESE DEFINES SHOULD MATCH sqlite.go for linux !!!
CFLAGS += -std=c99
Expand All @@ -67,8 +71,5 @@ CFLAGS += -DSQLITE_ENABLE_GEOPOLY
LDFLAGS = -ldl -lm
# !!! THESE DEFINES SHOULD MATCH sqlite.go !!!

sqlite3.o: sqlite3.c sqlite3.h sqlite3ext.h


clean:
rm -f sqlite3.o
rm -f sqlite3.o sqleet.o
14 changes: 14 additions & 0 deletions auth.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2018 David Crawshaw <[email protected]>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

package sqlite

// #include <stdint.h>
Expand Down
14 changes: 14 additions & 0 deletions auth_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2018 David Crawshaw <[email protected]>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

package sqlite_test

import (
Expand Down
14 changes: 14 additions & 0 deletions blocking_step.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright (c) 2018 David Crawshaw <[email protected]>
//
// Permission to use, copy, modify, and distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

// This file declares the wait_for_unlock_notify function.
// See the documentation on Stmt.Step.

Expand Down
7 changes: 4 additions & 3 deletions link.go → build.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

// +build linksqlite3

package sqlite

// #cgo LDFLAGS: sqlite3.o
// #cgo link,!sqleet LDFLAGS: sqlite3.o
// #cgo link,sqleet LDFLAGS: sqleet.o
// #cgo !link CFLAGS: -DCGO
// #cgo sqleet CFLAGS: -DCGO_SQLEET
import "C"
7 changes: 0 additions & 7 deletions c/dummy.go

This file was deleted.

Loading