You've already forked pgbackrest
							
							
				mirror of
				https://github.com/pgbackrest/pgbackrest.git
				synced 2025-10-30 23:37:45 +02:00 
			
		
		
		
	Move crypto module to common/crypto.
It makes sense for the crypto code to be in common since it is not pgBackRest-specific. Also combine the crypto tests into a single module.
This commit is contained in:
		| @@ -184,6 +184,10 @@ | ||||
|                     <release-item> | ||||
|                         <p>Move <code>compress</code> module to <code>common/compress</code>.</p> | ||||
|                     </release-item> | ||||
|  | ||||
|                     <release-item> | ||||
|                         <p>Move <code>crypto</code> module to <code>common/crypto</code>.</p> | ||||
|                     </release-item> | ||||
|                 </release-development-list> | ||||
|             </release-core-list> | ||||
|  | ||||
|   | ||||
| @@ -46,13 +46,13 @@ C includes | ||||
|  | ||||
| These includes are from the src directory.  There is no Perl-specific code in them. | ||||
| ***********************************************************************************************************************************/ | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/error.h" | ||||
| #include "common/lock.h" | ||||
| #include "config/config.h" | ||||
| #include "config/define.h" | ||||
| #include "config/load.h" | ||||
| #include "config/parse.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "perl/config.h" | ||||
| #include "postgres/pageChecksum.h" | ||||
| #include "storage/driver/posix/storage.h" | ||||
|   | ||||
| @@ -46,6 +46,9 @@ my @stryCFile = | ||||
|     'common/compress/gzip/common.c', | ||||
|     'common/compress/gzip/compress.c', | ||||
|     'common/compress/gzip/decompress.c', | ||||
|     'common/crypto/cipherBlock.c', | ||||
|     'common/crypto/common.c', | ||||
|     'common/crypto/hash.c', | ||||
|     'common/debug.c', | ||||
|     'common/encode.c', | ||||
|     'common/encode/base64.c', | ||||
| @@ -82,9 +85,6 @@ my @stryCFile = | ||||
|     'config/define.c', | ||||
|     'config/load.c', | ||||
|     'config/parse.c', | ||||
|     'crypto/cipherBlock.c', | ||||
|     'crypto/crypto.c', | ||||
|     'crypto/hash.c', | ||||
|     'perl/config.c', | ||||
|     'postgres/pageChecksum.c', | ||||
|     'storage/driver/posix/storage.c', | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Block Cipher XS Header | ||||
| ***********************************************************************************************************************************/ | ||||
| #include "common/crypto/cipherBlock.h" | ||||
| #include "common/memContext.h" | ||||
| #include "crypto/cipherBlock.h" | ||||
|  | ||||
| // Encrypt/decrypt modes | ||||
| #define CIPHER_MODE_ENCRYPT                                         ((int)cipherModeEncrypt) | ||||
|   | ||||
| @@ -1,8 +1,8 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Cryptographic Hashes XS Header | ||||
| ***********************************************************************************************************************************/ | ||||
| #include "common/crypto/hash.h" | ||||
| #include "common/memContext.h" | ||||
| #include "crypto/hash.h" | ||||
|  | ||||
| typedef struct CryptoHashXs | ||||
| { | ||||
|   | ||||
							
								
								
									
										48
									
								
								src/Makefile
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								src/Makefile
									
									
									
									
									
								
							| @@ -73,6 +73,9 @@ SRCS = \ | ||||
| 	common/compress/gzip/common.c \ | ||||
| 	common/compress/gzip/compress.c \ | ||||
| 	common/compress/gzip/decompress.c \ | ||||
| 	common/crypto/cipherBlock.c \ | ||||
| 	common/crypto/common.c \ | ||||
| 	common/crypto/hash.c \ | ||||
| 	common/debug.c \ | ||||
| 	common/encode.c \ | ||||
| 	common/encode/base64.c \ | ||||
| @@ -120,9 +123,6 @@ SRCS = \ | ||||
| 	config/load.c \ | ||||
| 	config/parse.c \ | ||||
| 	config/protocol.c \ | ||||
| 	crypto/cipherBlock.c \ | ||||
| 	crypto/hash.c \ | ||||
| 	crypto/crypto.c \ | ||||
| 	info/info.c \ | ||||
| 	info/infoArchive.c \ | ||||
| 	info/infoBackup.c \ | ||||
| @@ -201,13 +201,13 @@ clean: | ||||
| command/archive/common.o: command/archive/common.c command/archive/common.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c command/archive/common.c -o command/archive/common.o | ||||
|  | ||||
| command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/cipherBlock.h crypto/crypto.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| command/archive/get/file.o: command/archive/get/file.c command/archive/common.h command/archive/get/file.h command/control/control.h common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/crypto/cipherBlock.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c command/archive/get/file.c -o command/archive/get/file.o | ||||
|  | ||||
| command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/archive/get/protocol.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h crypto/crypto.h perl/exec.h postgres/interface.h protocol/client.h protocol/command.h protocol/helper.h protocol/parallel.h protocol/parallelJob.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| command/archive/get/get.o: command/archive/get/get.c command/archive/common.h command/archive/get/file.h command/archive/get/protocol.h command/command.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h perl/exec.h postgres/interface.h protocol/client.h protocol/command.h protocol/helper.h protocol/parallel.h protocol/parallelJob.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c command/archive/get/get.c -o command/archive/get/get.o | ||||
|  | ||||
| command/archive/get/protocol.o: command/archive/get/protocol.c command/archive/get/file.h command/archive/get/protocol.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/crypto.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| command/archive/get/protocol.o: command/archive/get/protocol.c command/archive/get/file.h command/archive/get/protocol.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h protocol/server.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c command/archive/get/protocol.c -o command/archive/get/protocol.o | ||||
|  | ||||
| command/archive/push/push.o: command/archive/push/push.c command/archive/common.h command/command.h common/assert.h common/debug.h common/error.auto.h common/error.h common/fork.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/wait.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| @@ -222,7 +222,7 @@ command/control/control.o: command/control/control.c command/control/control.h c | ||||
| command/help/help.o: command/help/help.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h version.h | ||||
| 	$(CC) $(CFLAGS) -c command/help/help.c -o command/help/help.o | ||||
|  | ||||
| command/info/info.o: command/info/info.c command/archive/common.h command/info/info.h common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h crypto/crypto.h crypto/hash.h info/info.h info/infoArchive.h info/infoBackup.h info/infoPg.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| command/info/info.o: command/info/info.c command/archive/common.h command/info/info.h common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h info/info.h info/infoArchive.h info/infoBackup.h info/infoPg.h perl/exec.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c command/info/info.c -o command/info/info.o | ||||
|  | ||||
| command/local/local.o: command/local/local.c command/archive/get/protocol.h common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/handleRead.h common/io/handleWrite.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h | ||||
| @@ -240,6 +240,15 @@ common/compress/gzip/compress.o: common/compress/gzip/compress.c common/assert.h | ||||
| common/compress/gzip/decompress.o: common/compress/gzip/decompress.c common/assert.h common/compress/gzip/common.h common/compress/gzip/decompress.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) -c common/compress/gzip/decompress.c -o common/compress/gzip/decompress.o | ||||
|  | ||||
| common/crypto/cipherBlock.o: common/crypto/cipherBlock.c common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) -c common/crypto/cipherBlock.c -o common/crypto/cipherBlock.o | ||||
|  | ||||
| common/crypto/common.o: common/crypto/common.c common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) -c common/crypto/common.c -o common/crypto/common.o | ||||
|  | ||||
| common/crypto/hash.o: common/crypto/hash.c common/assert.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) -c common/crypto/hash.c -o common/crypto/hash.o | ||||
|  | ||||
| common/debug.o: common/debug.c common/assert.h common/debug.h common/error.auto.h common/error.h common/logLevel.h common/stackTrace.h common/type/convert.h | ||||
| 	$(CC) $(CFLAGS) -c common/debug.c -o common/debug.o | ||||
|  | ||||
| @@ -306,7 +315,7 @@ common/io/io.o: common/io/io.c common/assert.h common/debug.h common/error.auto. | ||||
| common/io/read.o: common/io/read.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| 	$(CC) $(CFLAGS) -c common/io/read.c -o common/io/read.o | ||||
|  | ||||
| common/io/tls/client.o: common/io/tls/client.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h crypto/crypto.h | ||||
| common/io/tls/client.o: common/io/tls/client.c common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/read.intern.h common/io/tls/client.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h common/wait.h | ||||
| 	$(CC) $(CFLAGS) -c common/io/tls/client.c -o common/io/tls/client.o | ||||
|  | ||||
| common/io/write.o: common/io/write.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/write.h common/io/write.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h | ||||
| @@ -381,28 +390,19 @@ config/parse.o: config/parse.c common/assert.h common/debug.h common/error.auto. | ||||
| config/protocol.o: config/protocol.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/io.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/protocol.h protocol/client.h protocol/command.h protocol/server.h | ||||
| 	$(CC) $(CFLAGS) -c config/protocol.c -o config/protocol.o | ||||
|  | ||||
| crypto/cipherBlock.o: crypto/cipherBlock.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h crypto/cipherBlock.h crypto/crypto.h | ||||
| 	$(CC) $(CFLAGS) -c crypto/cipherBlock.c -o crypto/cipherBlock.o | ||||
|  | ||||
| crypto/crypto.o: crypto/crypto.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/stackTrace.h common/type/convert.h crypto/crypto.h | ||||
| 	$(CC) $(CFLAGS) -c crypto/crypto.c -o crypto/crypto.o | ||||
|  | ||||
| crypto/hash.o: crypto/hash.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/filter.intern.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h | ||||
| 	$(CC) $(CFLAGS) -c crypto/hash.c -o crypto/hash.o | ||||
|  | ||||
| info/info.o: info/info.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/cipherBlock.h crypto/crypto.h crypto/hash.h info/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h | ||||
| info/info.o: info/info.c common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h version.h | ||||
| 	$(CC) $(CFLAGS) -c info/info.c -o info/info.o | ||||
|  | ||||
| info/infoArchive.o: info/infoArchive.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| info/infoArchive.o: info/infoArchive.c common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/infoArchive.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c info/infoArchive.c -o info/infoArchive.o | ||||
|  | ||||
| info/infoBackup.o: info/infoBackup.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| info/infoBackup.o: info/infoBackup.c common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoBackup.h info/infoManifest.h info/infoPg.h postgres/interface.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c info/infoBackup.c -o info/infoBackup.o | ||||
|  | ||||
| info/infoManifest.o: info/infoManifest.c common/error.auto.h common/error.h common/memContext.h common/type/buffer.h common/type/string.h info/infoManifest.h | ||||
| 	$(CC) $(CFLAGS) -c info/infoManifest.c -o info/infoManifest.o | ||||
|  | ||||
| info/infoPg.o: info/infoPg.c common/assert.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h crypto/crypto.h crypto/hash.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| info/infoPg.o: info/infoPg.c common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/ini.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h info/info.h info/infoPg.h postgres/interface.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| 	$(CC) $(CFLAGS) -c info/infoPg.c -o info/infoPg.o | ||||
|  | ||||
| main.o: main.c command/archive/get/get.h command/archive/push/push.h command/command.h command/help/help.h command/info/info.h command/local/local.h command/remote/remote.h common/assert.h common/debug.h common/error.auto.h common/error.h common/exit.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h perl/exec.h postgres/interface.h version.h | ||||
| @@ -411,7 +411,7 @@ main.o: main.c command/archive/get/get.h command/archive/push/push.h command/com | ||||
| perl/config.o: perl/config.c common/assert.h common/debug.h common/error.auto.h common/error.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h | ||||
| 	$(CC) $(CFLAGS) -c perl/config.c -o perl/config.o | ||||
|  | ||||
| perl/exec.o: perl/exec.c ../libc/LibC.h common/assert.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h crypto/cipherBlock.h crypto/crypto.h crypto/hash.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh | ||||
| perl/exec.o: perl/exec.c ../libc/LibC.h common/assert.h common/crypto/cipherBlock.h common/crypto/common.h common/crypto/hash.h common/debug.h common/encode.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/load.h config/parse.h perl/config.h perl/embed.auto.c perl/exec.h perl/libc.auto.c postgres/pageChecksum.h storage/driver/posix/fileRead.h storage/driver/posix/fileWrite.h storage/driver/posix/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h version.h ../libc/xs/common/encode.xsh ../libc/xs/crypto/cipherBlock.xsh ../libc/xs/crypto/hash.xsh | ||||
| 	$(CC) $(CFLAGS) -c perl/exec.c -o perl/exec.o | ||||
|  | ||||
| postgres/interface.o: postgres/interface.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h postgres/interface.h postgres/interface/v083.h postgres/interface/v084.h postgres/interface/v090.h postgres/interface/v091.h postgres/interface/v092.h postgres/interface/v093.h postgres/interface/v094.h postgres/interface/v095.h postgres/interface/v096.h postgres/interface/v100.h postgres/interface/v110.h postgres/version.h storage/fileRead.h storage/fileWrite.h storage/helper.h storage/info.h storage/storage.h | ||||
| @@ -459,7 +459,7 @@ protocol/client.o: protocol/client.c common/assert.h common/debug.h common/error | ||||
| protocol/command.o: protocol/command.c common/assert.h common/debug.h common/error.auto.h common/error.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/command.h | ||||
| 	$(CC) $(CFLAGS) -c protocol/command.c -o protocol/command.o | ||||
|  | ||||
| protocol/helper.o: protocol/helper.c common/assert.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h config/protocol.h crypto/crypto.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h | ||||
| protocol/helper.o: protocol/helper.c common/assert.h common/crypto/common.h common/debug.h common/error.auto.h common/error.h common/exec.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/lock.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h config/config.auto.h config/config.h config/define.auto.h config/define.h config/exec.h config/protocol.h protocol/client.h protocol/command.h protocol/helper.h protocol/server.h | ||||
| 	$(CC) $(CFLAGS) -c protocol/helper.c -o protocol/helper.o | ||||
|  | ||||
| protocol/parallel.o: protocol/parallel.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/json.h common/type/keyValue.h common/type/list.h common/type/string.h common/type/variant.h common/type/variantList.h protocol/client.h protocol/command.h protocol/parallel.h protocol/parallelJob.h | ||||
| @@ -495,7 +495,7 @@ storage/driver/remote/storage.o: storage/driver/remote/storage.c common/assert.h | ||||
| storage/driver/s3/fileRead.o: storage/driver/s3/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/read.intern.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h storage/driver/s3/fileRead.h storage/driver/s3/storage.h storage/fileRead.h storage/fileRead.intern.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h | ||||
| 	$(CC) $(CFLAGS) -c storage/driver/s3/fileRead.c -o storage/driver/s3/fileRead.o | ||||
|  | ||||
| storage/driver/s3/storage.o: storage/driver/s3/storage.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h crypto/hash.h storage/driver/s3/fileRead.h storage/driver/s3/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h | ||||
| storage/driver/s3/storage.o: storage/driver/s3/storage.c common/assert.h common/crypto/hash.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/http/client.h common/io/http/common.h common/io/http/header.h common/io/http/query.h common/io/read.h common/io/write.h common/log.h common/logLevel.h common/memContext.h common/regExp.h common/stackTrace.h common/time.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/stringList.h common/type/variant.h common/type/variantList.h common/type/xml.h storage/driver/s3/fileRead.h storage/driver/s3/storage.h storage/fileRead.h storage/fileWrite.h storage/info.h storage/storage.h storage/storage.intern.h | ||||
| 	$(CC) $(CFLAGS) -c storage/driver/s3/storage.c -o storage/driver/s3/storage.o | ||||
|  | ||||
| storage/fileRead.o: storage/fileRead.c common/assert.h common/debug.h common/error.auto.h common/error.h common/io/filter/filter.h common/io/filter/group.h common/io/read.h common/log.h common/logLevel.h common/memContext.h common/stackTrace.h common/type/buffer.h common/type/convert.h common/type/keyValue.h common/type/string.h common/type/variant.h common/type/variantList.h storage/fileRead.h storage/fileRead.intern.h | ||||
|   | ||||
| @@ -6,11 +6,11 @@ Archive Get File | ||||
| #include "command/control/control.h" | ||||
| #include "common/compress/gzip/common.h" | ||||
| #include "common/compress/gzip/decompress.h" | ||||
| #include "common/crypto/cipherBlock.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/io/filter/group.h" | ||||
| #include "common/log.h" | ||||
| #include "config/config.h" | ||||
| #include "crypto/cipherBlock.h" | ||||
| #include "info/infoArchive.h" | ||||
| #include "postgres/interface.h" | ||||
| #include "storage/helper.h" | ||||
|   | ||||
| @@ -4,8 +4,8 @@ Archive Get File | ||||
| #ifndef COMMAND_ARCHIVE_GET_FILE_H | ||||
| #define COMMAND_ARCHIVE_GET_FILE_H | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/type/string.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "storage/storage.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
|   | ||||
| @@ -14,7 +14,7 @@ Info Command | ||||
| #include "common/memContext.h" | ||||
| #include "common/type/json.h" | ||||
| #include "config/config.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "common/crypto/common.h" | ||||
| #include "info/info.h" | ||||
| #include "info/infoArchive.h" | ||||
| #include "info/infoBackup.h" | ||||
|   | ||||
| @@ -6,12 +6,12 @@ Block Cipher | ||||
| #include <openssl/evp.h> | ||||
| #include <openssl/err.h> | ||||
| 
 | ||||
| #include "common/crypto/cipherBlock.h" | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/io/filter/filter.intern.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "crypto/cipherBlock.h" | ||||
| #include "crypto/crypto.h" | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| Filter type constant | ||||
| @@ -89,9 +89,8 @@ cipherBlockNewC(CipherMode mode, const char *cipherName, const unsigned char *pa | ||||
|     ASSERT(pass != NULL); | ||||
|     ASSERT(passSize > 0); | ||||
| 
 | ||||
|     // Only need to init once.
 | ||||
|     if (!cryptoIsInit()) | ||||
|         cryptoInit(); | ||||
|     // Init crypto subsystem
 | ||||
|     cryptoInit(); | ||||
| 
 | ||||
|     // Lookup cipher by name.  This means the ciphers passed in must exactly match a name expected by OpenSSL.  This is a good
 | ||||
|     // thing since the name required by the openssl command-line tool will match what is used by pgBackRest.
 | ||||
| @@ -1,8 +1,8 @@ | ||||
| /***********************************************************************************************************************************
 | ||||
| Block Cipher Header | ||||
| ***********************************************************************************************************************************/ | ||||
| #ifndef CRYPTO_CIPHERBLOCK_H | ||||
| #define CRYPTO_CIPHERBLOCK_H | ||||
| #ifndef COMMON_CRYPTO_CIPHERBLOCK_H | ||||
| #define COMMON_CRYPTO_CIPHERBLOCK_H | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| CipherBlock object | ||||
| @@ -11,7 +11,7 @@ typedef struct CipherBlock CipherBlock; | ||||
| 
 | ||||
| #include "common/io/filter/filter.h" | ||||
| #include "common/type/buffer.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "common/crypto/common.h" | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| Constructor | ||||
| @@ -10,7 +10,7 @@ Crypto Common | ||||
| #include "common/debug.h" | ||||
| #include "common/error.h" | ||||
| #include "common/log.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "common/crypto/common.h" | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| Cipher types | ||||
| @@ -1,8 +1,8 @@ | ||||
| /***********************************************************************************************************************************
 | ||||
| Crypto Common | ||||
| ***********************************************************************************************************************************/ | ||||
| #ifndef CRYPTO_CRYPTO_H | ||||
| #define CRYPTO_CRYPTO_H | ||||
| #ifndef COMMON_CRYPTO_COMMON_H | ||||
| #define COMMON_CRYPTO_COMMON_H | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| Cipher modes | ||||
| @@ -7,12 +7,12 @@ Cryptographic Hash | ||||
| #include <openssl/err.h> | ||||
| #include <openssl/hmac.h> | ||||
| 
 | ||||
| #include "common/crypto/hash.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/io/filter/filter.intern.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "crypto/hash.h" | ||||
| #include "common/crypto/common.h" | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| Filter type constant | ||||
| @@ -51,9 +51,8 @@ cryptoHashNew(const String *type) | ||||
| 
 | ||||
|     ASSERT(type != NULL); | ||||
| 
 | ||||
|     // Only need to init once
 | ||||
|     if (!cryptoIsInit()) | ||||
|         cryptoInit(); | ||||
|     // Init crypto subsystem
 | ||||
|     cryptoInit(); | ||||
| 
 | ||||
|     // Allocate memory to hold process state
 | ||||
|     CryptoHash *this = NULL; | ||||
| @@ -3,8 +3,8 @@ Cryptographic Hash | ||||
| 
 | ||||
| Generate a hash (sha1, md5, etc.) from a string, Buffer, or using an IoFilter. | ||||
| ***********************************************************************************************************************************/ | ||||
| #ifndef CRYPTO_HASH_H | ||||
| #define CRYPTO_HASH_H | ||||
| #ifndef COMMON_CRYPTO_HASH_H | ||||
| #define COMMON_CRYPTO_HASH_H | ||||
| 
 | ||||
| /***********************************************************************************************************************************
 | ||||
| Hash object | ||||
| @@ -14,6 +14,7 @@ TLS Client | ||||
| #include <openssl/ssl.h> | ||||
| #include <openssl/x509v3.h> | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/log.h" | ||||
| #include "common/io/tls/client.h" | ||||
| @@ -24,7 +25,6 @@ TLS Client | ||||
| #include "common/time.h" | ||||
| #include "common/type/keyValue.h" | ||||
| #include "common/wait.h" | ||||
| #include "crypto/crypto.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Object type | ||||
|   | ||||
| @@ -5,12 +5,12 @@ Info Handler | ||||
| #include <stdlib.h> | ||||
| #include <string.h> | ||||
|  | ||||
| #include "common/crypto/cipherBlock.h" | ||||
| #include "common/crypto/hash.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/ini.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "crypto/cipherBlock.h" | ||||
| #include "crypto/hash.h" | ||||
| #include "info/info.h" | ||||
| #include "storage/helper.h" | ||||
| #include "version.h" | ||||
|   | ||||
| @@ -9,9 +9,8 @@ Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| typedef struct Info Info; | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/ini.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "crypto/hash.h" | ||||
| #include "storage/storage.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
|   | ||||
| @@ -9,8 +9,8 @@ Object type | ||||
| ***********************************************************************************************************************************/ | ||||
| typedef struct InfoArchive InfoArchive; | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/type/string.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "info/infoPg.h" | ||||
| #include "storage/storage.h" | ||||
|  | ||||
|   | ||||
| @@ -11,9 +11,9 @@ typedef struct InfoPg InfoPg; | ||||
|  | ||||
| #include <stdint.h> | ||||
|  | ||||
| #include "crypto/crypto.h" | ||||
| #include "storage/storage.h" | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/ini.h" | ||||
| #include "storage/storage.h" | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Constants | ||||
|   | ||||
| @@ -54,13 +54,13 @@ C includes | ||||
|  | ||||
| These includes are from the src directory.  There is no Perl-specific code in them. | ||||
| ***********************************************************************************************************************************/ | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/error.h" | ||||
| #include "common/lock.h" | ||||
| #include "config/config.h" | ||||
| #include "config/define.h" | ||||
| #include "config/load.h" | ||||
| #include "config/parse.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "perl/config.h" | ||||
| #include "postgres/pageChecksum.h" | ||||
| #include "storage/driver/posix/storage.h" | ||||
|   | ||||
| @@ -1,10 +1,10 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Protocol Helper | ||||
| ***********************************************************************************************************************************/ | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/exec.h" | ||||
| #include "common/memContext.h" | ||||
| #include "crypto/crypto.h" | ||||
| #include "config/config.h" | ||||
| #include "config/exec.h" | ||||
| #include "config/protocol.h" | ||||
|   | ||||
| @@ -3,13 +3,13 @@ S3 Storage Driver | ||||
| ***********************************************************************************************************************************/ | ||||
| #include <time.h> | ||||
|  | ||||
| #include "common/crypto/hash.h" | ||||
| #include "common/debug.h" | ||||
| #include "common/io/http/common.h" | ||||
| #include "common/log.h" | ||||
| #include "common/memContext.h" | ||||
| #include "common/regExp.h" | ||||
| #include "common/type/xml.h" | ||||
| #include "crypto/hash.h" | ||||
| #include "storage/driver/s3/fileRead.h" | ||||
| #include "storage/driver/s3/storage.h" | ||||
|  | ||||
|   | ||||
| @@ -240,6 +240,15 @@ unit: | ||||
|           common/compress/gzip/compress: full | ||||
|           common/compress/gzip/decompress: full | ||||
|  | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: crypto | ||||
|         total: 3 | ||||
|  | ||||
|         coverage: | ||||
|           common/crypto/cipherBlock: full | ||||
|           common/crypto/common: full | ||||
|           common/crypto/hash: full | ||||
|  | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: exec | ||||
|         total: 1 | ||||
| @@ -315,31 +324,6 @@ unit: | ||||
|         coverage: | ||||
|           Common/Log: partial | ||||
|  | ||||
|   # ******************************************************************************************************************************** | ||||
|   - name: crypto | ||||
|  | ||||
|     test: | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: crypto | ||||
|         total: 4 | ||||
|  | ||||
|         coverage: | ||||
|           crypto/crypto: full | ||||
|  | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: hash | ||||
|         total: 3 | ||||
|  | ||||
|         coverage: | ||||
|           crypto/hash: full | ||||
|  | ||||
|       # ---------------------------------------------------------------------------------------------------------------------------- | ||||
|       - name: cipher-block | ||||
|         total: 2 | ||||
|  | ||||
|         coverage: | ||||
|           crypto/cipherBlock: full | ||||
|  | ||||
|   # ******************************************************************************************************************************** | ||||
|   - name: postgres | ||||
|  | ||||
|   | ||||
| @@ -9,10 +9,10 @@ Tls Test Harness | ||||
| #include <openssl/conf.h> | ||||
| #include <openssl/ssl.h> | ||||
|  | ||||
| #include "common/crypto/common.h" | ||||
| #include "common/error.h" | ||||
| #include "common/type/buffer.h" | ||||
| #include "common/wait.h" | ||||
| #include "crypto/crypto.h" | ||||
|  | ||||
| #include "common/harnessTls.h" | ||||
|  | ||||
|   | ||||
| @@ -24,7 +24,56 @@ testRun(void) | ||||
|     const Buffer *testPlainText = bufNewStr(strNew(TEST_PLAINTEXT)); | ||||
| 
 | ||||
|     // *****************************************************************************************************************************
 | ||||
|     if (testBegin("blockCipherNew() and blockCipherFree()")) | ||||
|     if (testBegin("Common")) | ||||
|     { | ||||
|         TEST_RESULT_BOOL(cryptoIsInit(), false, "crypto is not initialized"); | ||||
|         TEST_RESULT_VOID(cryptoInit(), "initialize crypto"); | ||||
|         TEST_RESULT_BOOL(cryptoIsInit(), true, "crypto is initialized"); | ||||
|         TEST_RESULT_VOID(cryptoInit(), "initialize crypto again"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         cryptoInit(); | ||||
| 
 | ||||
|         TEST_RESULT_VOID(cryptoError(false, "no error here"), "no error"); | ||||
| 
 | ||||
|         EVP_MD_CTX *context = EVP_MD_CTX_create(); | ||||
|         TEST_ERROR( | ||||
|             cryptoError(EVP_DigestInit_ex(context, NULL, NULL) != 1, "unable to initialize hash context"), CryptoError, | ||||
|             "unable to initialize hash context: [101187723] no digest set"); | ||||
|         EVP_MD_CTX_destroy(context); | ||||
| 
 | ||||
|         TEST_ERROR(cryptoError(true, "no error"), CryptoError, "no error: [0] no details available"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_ERROR(cipherType(strNew(BOGUS_STR)), AssertError, "invalid cipher name 'BOGUS'"); | ||||
|         TEST_RESULT_UINT(cipherType(strNew("none")), cipherTypeNone, "none type"); | ||||
|         TEST_RESULT_UINT(cipherType(strNew("aes-256-cbc")), cipherTypeAes256Cbc, "aes-256-cbc type"); | ||||
| 
 | ||||
|         TEST_ERROR(cipherTypeName((CipherType)2), AssertError, "invalid cipher type 2"); | ||||
|         TEST_RESULT_STR(strPtr(cipherTypeName(cipherTypeNone)), "none", "none name"); | ||||
|         TEST_RESULT_STR(strPtr(cipherTypeName(cipherTypeAes256Cbc)), "aes-256-cbc", "aes-256-cbc name"); | ||||
| 
 | ||||
|         // Test if the buffer was overrun
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         size_t bufferSize = 256; | ||||
|         unsigned char *buffer = memNew(bufferSize + 1); | ||||
| 
 | ||||
|         cryptoRandomBytes(buffer, bufferSize); | ||||
|         TEST_RESULT_BOOL(buffer[bufferSize] == 0, true, "check that buffer did not overrun (though random byte could be 0)"); | ||||
| 
 | ||||
|         // Count bytes that are not zero (there shouldn't be all zeroes)
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         int nonZeroTotal = 0; | ||||
| 
 | ||||
|         for (unsigned int charIdx = 0; charIdx < bufferSize; charIdx++) | ||||
|             if (buffer[charIdx] != 0)                               // {uncovered - ok if there are no zeros}
 | ||||
|                 nonZeroTotal++; | ||||
| 
 | ||||
|         TEST_RESULT_INT_NE(nonZeroTotal, 0, "check that there are non-zero values in the buffer"); | ||||
|     } | ||||
| 
 | ||||
|     // *****************************************************************************************************************************
 | ||||
|     if (testBegin("CipherBlock")) | ||||
|     { | ||||
|         // Cipher and digest errors
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
| @@ -53,11 +102,7 @@ testRun(void) | ||||
| 
 | ||||
|         TEST_RESULT_VOID(cipherBlockFree(cipherBlock), "free cipher block"); | ||||
|         TEST_RESULT_VOID(cipherBlockFree(NULL), "free null cipher block"); | ||||
|     } | ||||
| 
 | ||||
|     // *****************************************************************************************************************************
 | ||||
|     if (testBegin("Encrypt and Decrypt")) | ||||
|     { | ||||
|         // Encrypt
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         Buffer *encryptBuffer = bufNew(TEST_BUFFER_SIZE); | ||||
| @@ -243,5 +288,67 @@ testRun(void) | ||||
|         cipherBlockFree(blockDecrypt); | ||||
|     } | ||||
| 
 | ||||
|     // *****************************************************************************************************************************
 | ||||
|     if (testBegin("CryptoHash")) | ||||
|     { | ||||
|         CryptoHash *hash = NULL; | ||||
|         IoFilter *hashFilter = NULL; | ||||
| 
 | ||||
|         TEST_ERROR(cryptoHashNew(strNew(BOGUS_STR)), AssertError, "unable to load hash 'BOGUS'"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA1)), "create sha1 hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(hash), "    free hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(NULL), "    free null hash"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA1)), "create sha1 hash"); | ||||
|         TEST_RESULT_STR(strPtr(bufHex(cryptoHash(hash))), "da39a3ee5e6b4b0d3255bfef95601890afd80709", "    check empty hash"); | ||||
|         TEST_RESULT_STR(strPtr(bufHex(cryptoHash(hash))), "da39a3ee5e6b4b0d3255bfef95601890afd80709", "    check empty hash again"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(hash), "    free hash"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA1)), "create sha1 hash"); | ||||
|         TEST_ASSIGN(hashFilter, cryptoHashFilter(hash), "create sha1 hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashProcessC(hash, (const unsigned char *)"1", 1), "    add 1"); | ||||
|         TEST_RESULT_VOID(cryptoHashProcessStr(hash, strNew("2")), "    add 2"); | ||||
|         TEST_RESULT_VOID(ioFilterProcessIn(hashFilter, bufNewZ("3")), "    add 3"); | ||||
|         TEST_RESULT_VOID(ioFilterProcessIn(hashFilter, bufNewZ("4")), "    add 4"); | ||||
|         TEST_RESULT_VOID(ioFilterProcessIn(hashFilter, bufNewZ("5")), "    add 5"); | ||||
| 
 | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(varStr(ioFilterResult(hashFilter))), "8cb2237d0679ca88db6464eac60da96345513964", "    check small hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(hash), "    free hash"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_MD5)), "create md5 hash"); | ||||
|         TEST_RESULT_STR(strPtr(bufHex(cryptoHash(hash))), "d41d8cd98f00b204e9800998ecf8427e", "    check empty hash"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA256)), "create sha256 hash"); | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(bufHex(cryptoHash(hash))), "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | ||||
|             "    check empty hash"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(bufHex(cryptoHashOne(strNew(HASH_TYPE_SHA1), bufNewZ("12345")))), "8cb2237d0679ca88db6464eac60da96345513964", | ||||
|             "    check small hash"); | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(bufHex(cryptoHashOneStr(strNew(HASH_TYPE_SHA1), strNew("12345")))), "8cb2237d0679ca88db6464eac60da96345513964", | ||||
|             "    check small hash"); | ||||
| 
 | ||||
|         // -------------------------------------------------------------------------------------------------------------------------
 | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr( | ||||
|                 bufHex( | ||||
|                     cryptoHmacOne( | ||||
|                         strNew(HASH_TYPE_SHA256), | ||||
|                         bufNewZ("AWS4wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), | ||||
|                         bufNewZ("20170412")))), | ||||
|             "8b05c497afe9e1f42c8ada4cb88392e118649db1e5c98f0f0fb0a158bdd2dd76", | ||||
|             "    check hmac"); | ||||
|     } | ||||
| 
 | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
| } | ||||
| @@ -1,73 +0,0 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Test Crypto Common | ||||
| ***********************************************************************************************************************************/ | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Test Run | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| testRun(void) | ||||
| { | ||||
|     FUNCTION_HARNESS_VOID(); | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("cryptoInit() and cryptoIsInit()")) | ||||
|     { | ||||
|         TEST_RESULT_BOOL(cryptoIsInit(), false, "crypto is not initialized"); | ||||
|         TEST_RESULT_VOID(cryptoInit(), "initialize crypto"); | ||||
|         TEST_RESULT_BOOL(cryptoIsInit(), true, "crypto is initialized"); | ||||
|         TEST_RESULT_VOID(cryptoInit(), "initialize crypto again"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("cryptoError")) | ||||
|     { | ||||
|         cryptoInit(); | ||||
|  | ||||
|         TEST_RESULT_VOID(cryptoError(false, "no error here"), "no error"); | ||||
|  | ||||
|         EVP_MD_CTX *context = EVP_MD_CTX_create(); | ||||
|         TEST_ERROR( | ||||
|             cryptoError(EVP_DigestInit_ex(context, NULL, NULL) != 1, "unable to initialize hash context"), CryptoError, | ||||
|             "unable to initialize hash context: [101187723] no digest set"); | ||||
|         EVP_MD_CTX_destroy(context); | ||||
|  | ||||
|         TEST_ERROR(cryptoError(true, "no error"), CryptoError, "no error: [0] no details available"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("cipherType() and cipherTypeName()")) | ||||
|     { | ||||
|         TEST_ERROR(cipherType(strNew(BOGUS_STR)), AssertError, "invalid cipher name 'BOGUS'"); | ||||
|         TEST_RESULT_UINT(cipherType(strNew("none")), cipherTypeNone, "none type"); | ||||
|         TEST_RESULT_UINT(cipherType(strNew("aes-256-cbc")), cipherTypeAes256Cbc, "aes-256-cbc type"); | ||||
|  | ||||
|         TEST_ERROR(cipherTypeName((CipherType)2), AssertError, "invalid cipher type 2"); | ||||
|         TEST_RESULT_STR(strPtr(cipherTypeName(cipherTypeNone)), "none", "none name"); | ||||
|         TEST_RESULT_STR(strPtr(cipherTypeName(cipherTypeAes256Cbc)), "aes-256-cbc", "aes-256-cbc name"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("cryptoRandomBytes()")) | ||||
|     { | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         // Test if the buffer was overrun | ||||
|         size_t bufferSize = 256; | ||||
|         unsigned char *buffer = memNew(bufferSize + 1); | ||||
|  | ||||
|         cryptoRandomBytes(buffer, bufferSize); | ||||
|         TEST_RESULT_BOOL(buffer[bufferSize] == 0, true, "check that buffer did not overrun (though random byte could be 0)"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         // Count bytes that are not zero (there shouldn't be all zeroes) | ||||
|         int nonZeroTotal = 0; | ||||
|  | ||||
|         for (unsigned int charIdx = 0; charIdx < bufferSize; charIdx++) | ||||
|             if (buffer[charIdx] != 0)                               // {uncovered - ok if there are no zeros} | ||||
|                 nonZeroTotal++; | ||||
|  | ||||
|         TEST_RESULT_INT_NE(nonZeroTotal, 0, "check that there are non-zero values in the buffer"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
| } | ||||
| @@ -1,82 +0,0 @@ | ||||
| /*********************************************************************************************************************************** | ||||
| Test Cryptographic Hashes | ||||
| ***********************************************************************************************************************************/ | ||||
|  | ||||
| /*********************************************************************************************************************************** | ||||
| Test Run | ||||
| ***********************************************************************************************************************************/ | ||||
| void | ||||
| testRun(void) | ||||
| { | ||||
|     FUNCTION_HARNESS_VOID(); | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("CryptoHash")) | ||||
|     { | ||||
|         CryptoHash *hash = NULL; | ||||
|         IoFilter *hashFilter = NULL; | ||||
|  | ||||
|         TEST_ERROR(cryptoHashNew(strNew(BOGUS_STR)), AssertError, "unable to load hash 'BOGUS'"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA1)), "create sha1 hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(hash), "    free hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(NULL), "    free null hash"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA1)), "create sha1 hash"); | ||||
|         TEST_RESULT_STR(strPtr(bufHex(cryptoHash(hash))), "da39a3ee5e6b4b0d3255bfef95601890afd80709", "    check empty hash"); | ||||
|         TEST_RESULT_STR(strPtr(bufHex(cryptoHash(hash))), "da39a3ee5e6b4b0d3255bfef95601890afd80709", "    check empty hash again"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(hash), "    free hash"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA1)), "create sha1 hash"); | ||||
|         TEST_ASSIGN(hashFilter, cryptoHashFilter(hash), "create sha1 hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashProcessC(hash, (const unsigned char *)"1", 1), "    add 1"); | ||||
|         TEST_RESULT_VOID(cryptoHashProcessStr(hash, strNew("2")), "    add 2"); | ||||
|         TEST_RESULT_VOID(ioFilterProcessIn(hashFilter, bufNewZ("3")), "    add 3"); | ||||
|         TEST_RESULT_VOID(ioFilterProcessIn(hashFilter, bufNewZ("4")), "    add 4"); | ||||
|         TEST_RESULT_VOID(ioFilterProcessIn(hashFilter, bufNewZ("5")), "    add 5"); | ||||
|  | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(varStr(ioFilterResult(hashFilter))), "8cb2237d0679ca88db6464eac60da96345513964", "    check small hash"); | ||||
|         TEST_RESULT_VOID(cryptoHashFree(hash), "    free hash"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_MD5)), "create md5 hash"); | ||||
|         TEST_RESULT_STR(strPtr(bufHex(cryptoHash(hash))), "d41d8cd98f00b204e9800998ecf8427e", "    check empty hash"); | ||||
|  | ||||
|         // ------------------------------------------------------------------------------------------------------------------------- | ||||
|         TEST_ASSIGN(hash, cryptoHashNew(strNew(HASH_TYPE_SHA256)), "create sha256 hash"); | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(bufHex(cryptoHash(hash))), "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", | ||||
|             "    check empty hash"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("cryptoHashOne*()")) | ||||
|     { | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(bufHex(cryptoHashOne(strNew(HASH_TYPE_SHA1), bufNewZ("12345")))), "8cb2237d0679ca88db6464eac60da96345513964", | ||||
|             "    check small hash"); | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr(bufHex(cryptoHashOneStr(strNew(HASH_TYPE_SHA1), strNew("12345")))), "8cb2237d0679ca88db6464eac60da96345513964", | ||||
|             "    check small hash"); | ||||
|     } | ||||
|  | ||||
|     // ***************************************************************************************************************************** | ||||
|     if (testBegin("cryptoHmacOne()")) | ||||
|     { | ||||
|         TEST_RESULT_STR( | ||||
|             strPtr( | ||||
|                 bufHex( | ||||
|                     cryptoHmacOne( | ||||
|                         strNew(HASH_TYPE_SHA256), | ||||
|                         bufNewZ("AWS4wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"), | ||||
|                         bufNewZ("20170412")))), | ||||
|             "8b05c497afe9e1f42c8ada4cb88392e118649db1e5c98f0f0fb0a158bdd2dd76", | ||||
|             "    check hmac"); | ||||
|     } | ||||
|  | ||||
|     FUNCTION_HARNESS_RESULT_VOID(); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user