Hi Markus, Thanks for pointing that error. Since I maintain the package I saw a lot of warnings about signedness. Looking at buildd's page seems that the building process stops when trying to compile the tests. Before split and conversion to format version 3 the source didn't build the simple test suite (dh_auto_test) as it does now. Moreover, it never built successfully on s390x and hurd-i386[0].
I can disable it with DEB_BUILD_OPTIONS += nocheck but not sure if this would be enough, there're a lot of warnings! I did some changes to upstream's source to clean all warnings, from test and library itself. But my knowledge about cryptography is limited and these changes might create problems in the implementation. Diff attached. Looking deeper I found errors in documentation. Examples doesn't work. I must contact upstream urgently. What's the best procedure to fix this as soon as possible? Regards, [0] https://buildd.debian.org/status/logs.php?pkg=libgringotts
diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/libgrg_crypt.c libgringotts-1.2.1_mod/src/libgrg_crypt.c --- libgringotts-1.2.1/src/libgrg_crypt.c 2003-04-24 13:33:28.000000000 +0200 +++ libgringotts-1.2.1_mod/src/libgrg_crypt.c 2014-01-25 12:23:52.394804846 +0100 @@ -132,7 +132,7 @@ return ret; } -unsigned char * +char * grg2mcrypt (const grg_crypt_algo algo) { switch (algo) @@ -170,13 +170,13 @@ validate_mem (const GRG_CTX gctx, const void *mem, const long memDim) { unsigned char vers; - char *tmp; + unsigned char *tmp; long rem; if (!gctx || !mem) return GRG_ARGUMENT_ERR; - tmp = (char *) mem; + tmp = (unsigned char *) mem; rem = (memDim >= 0) ? memDim : strlen (mem); //checks the ID header @@ -222,13 +222,13 @@ if (gctx->hash_algo == GRG_SHA1) key = grg_memdup (((*dim == - 24) ? keystruct-> - key_192_sha : keystruct->key_256_sha), + 24) ? (unsigned char *)keystruct-> + key_192_sha : (unsigned char *)keystruct->key_256_sha), *dim); else key = grg_memdup (((*dim == - 24) ? keystruct-> - key_192_ripe : keystruct->key_256_ripe), + 24) ? (unsigned char *)keystruct-> + key_192_ripe : (unsigned char *)keystruct->key_256_ripe), *dim); return key; @@ -241,14 +241,14 @@ unsigned char *IV, *ecdata, *curdata, *dimdata, *key, *CRC32b; int dIV, len, curlen, keylen, err; char *tmp; - long oDim; + unsigned long oDim; MCRYPT mod; len = memDim - LIBGRG_DATA_POS; tmp = ((char *) mem) + LIBGRG_DATA_POS; dIV = grg_get_block_size_static (gctx->crypt_algo); - IV = grg_memdup (tmp, dIV); + IV = grg_memdup ((unsigned char *)tmp, dIV); if (!IV){ return GRG_MEM_ALLOCATION_ERR; } @@ -256,7 +256,7 @@ tmp += dIV; len -= dIV; - ecdata = grg_memdup (tmp, len); + ecdata = grg_memdup ((unsigned char *)tmp, len); if (!ecdata) { grg_unsafe_free (IV); @@ -347,9 +347,8 @@ } if (gctx->comp_algo) //bz2 - err = BZ2_bzBuffToBuffDecompress ((unsigned char *) - tmpData, (unsigned int *) &oDim, - (unsigned char *) curdata, curlen, + err = BZ2_bzBuffToBuffDecompress ((char *)tmpData, (unsigned int *) &oDim, + (char *) curdata, curlen, USE_BZ2_SMALL_MEM, 0); else //zlib err = uncompress (tmpData, &oDim, curdata, curlen); @@ -387,7 +386,8 @@ long *memDim, const unsigned char *origData, const long origDim) { - unsigned char *compData, *chunk, *toCRC1, *CRC1, *toEnc, *key, *IV, + char *compData; + unsigned char *chunk, *toCRC1, *CRC1, *toEnc, *key, *IV, *toCRC2, *CRC2, algo; unsigned int dIV, dKey, err; long compDim, uncDim; @@ -396,7 +396,7 @@ if (!gctx || !keystruct || !origData) return GRG_ARGUMENT_ERR; - uncDim = (origDim < 0) ? strlen (origData) : origDim; + uncDim = (origDim < 0) ? strlen ((char *)origData) : origDim; if (gctx->comp_lvl) { @@ -414,12 +414,12 @@ err = BZ2_bzBuffToBuffCompress (compData, (unsigned int *) &compDim, - (unsigned char *) + (char *) origData, uncDim, gctx->comp_lvl * 3, 0, 0); else - err = compress2 (compData, &compDim, origData, uncDim, + err = compress2 ((Bytef *)compData, (uLongf *)&compDim, origData, uncDim, gctx->comp_lvl * 3); if (err < 0) @@ -433,7 +433,7 @@ else { compDim = uncDim; - compData = grg_memdup (origData, uncDim); + compData = (char *)grg_memdup (origData, uncDim); if (!compData) return GRG_MEM_ALLOCATION_ERR; } @@ -488,7 +488,7 @@ return GRG_MEM_ALLOCATION_ERR; } - key = select_key (gctx, keystruct, &dKey); + key = select_key (gctx, keystruct, (int *)&dKey); if (!key) { grg_unsafe_free (IV); @@ -591,7 +591,7 @@ } int -grg_validate_file (const GRG_CTX gctx, const unsigned char *path) +grg_validate_file (const GRG_CTX gctx, const char *path) { int fd, res; @@ -639,7 +639,7 @@ } int -grg_update_gctx_from_file (GRG_CTX gctx, const unsigned char *path) +grg_update_gctx_from_file (GRG_CTX gctx, const char *path) { int fd, res; @@ -691,7 +691,7 @@ int grg_decrypt_file (const GRG_CTX gctx, const GRG_KEY keystruct, - const unsigned char *path, unsigned char **origData, + const char *path, unsigned char **origData, long *origDim) { int fd, res; @@ -743,7 +743,7 @@ int grg_encrypt_file (const GRG_CTX gctx, const GRG_KEY keystruct, - const unsigned char *path, const unsigned char *origData, + const char *path, const unsigned char *origData, const long origDim) { int fd, res; diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/libgrg_crypt.h libgringotts-1.2.1_mod/src/libgrg_crypt.h --- libgringotts-1.2.1/src/libgrg_crypt.h 2003-04-24 13:26:09.000000000 +0200 +++ libgringotts-1.2.1_mod/src/libgrg_crypt.h 2014-01-24 21:48:57.759749438 +0100 @@ -50,6 +50,6 @@ #define FALSE 0 #define TRUE !FALSE -unsigned char *grg2mcrypt (const grg_crypt_algo algo); +char *grg2mcrypt (const grg_crypt_algo algo); #endif diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/libgrg_structs.c libgringotts-1.2.1_mod/src/libgrg_structs.c --- libgringotts-1.2.1/src/libgrg_structs.c 2003-04-24 13:37:14.000000000 +0200 +++ libgringotts-1.2.1_mod/src/libgrg_structs.c 2014-01-25 21:38:32.431202359 +0100 @@ -60,7 +60,7 @@ } GRG_CTX -grg_context_initialize (const unsigned char *header, +grg_context_initialize (const char *header, const grg_crypt_algo crypt_algo, const grg_hash_algo hash_algo, const grg_comp_algo comp_algo, @@ -101,7 +101,7 @@ } GRG_CTX -grg_context_initialize_defaults (const unsigned char *header) +grg_context_initialize_defaults (const char *header) { return grg_context_initialize (header, GRG_SERPENT, GRG_RIPEMD_160, GRG_ZLIB, GRG_LVL_BEST, @@ -195,7 +195,7 @@ } GRG_KEY -grg_key_gen (const unsigned char *pwd, const int pwd_len) +grg_key_gen (const char *pwd, const int pwd_len) { GRG_KEY key; int real_pwd_len; diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/libgrg_tmp.c libgringotts-1.2.1_mod/src/libgrg_tmp.c --- libgringotts-1.2.1/src/libgrg_tmp.c 2003-04-24 13:26:09.000000000 +0200 +++ libgringotts-1.2.1_mod/src/libgrg_tmp.c 2014-01-25 12:03:11.466859442 +0100 @@ -106,7 +106,7 @@ if (mcrypt_generic_init (tf->crypt, tf->key, tf->dKey, tf->IV) < 0) return GRG_WRITE_ENC_INIT_ERR; - dim = (data_len < 0) ? strlen (data) : data_len; + dim = (data_len < 0) ? strlen ((char *)data) : data_len; tocrypt = grg_memconcat (2, gctx->header, HEADER_LEN, data, dim); if (!tocrypt) diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/libgrg_utils.c libgringotts-1.2.1_mod/src/libgrg_utils.c --- libgringotts-1.2.1/src/libgrg_utils.c 2003-04-24 13:37:37.000000000 +0200 +++ libgringotts-1.2.1_mod/src/libgrg_utils.c 2014-01-25 21:52:09.239166422 +0100 @@ -127,10 +127,10 @@ * * Returns: a newly-allocated string, to be free()'d afterwards */ -unsigned char * +char * grg_get_version (void) { - return (unsigned char *) strdup (LIBGRG_VERSION); + return (char *) strdup (LIBGRG_VERSION); } /** @@ -222,7 +222,7 @@ return; if (csize < 0) - csize = strlen (toOverwrite); + csize = strlen ((char *)toOverwrite); #ifdef HAVE__DEV_RANDOM read (gctx->rnd, toOverwrite, csize); @@ -304,7 +304,7 @@ return; if (gctx) - grg_rnd_seq_direct (gctx, pntr, (dim >= 0) ? dim : strlen (pntr)); + grg_rnd_seq_direct (gctx, (unsigned char *)pntr, (dim >= 0) ? dim : strlen (pntr)); free (pntr); } @@ -346,7 +346,7 @@ * Returns: a double between 0 and 1, inclusive */ double -grg_ascii_pwd_quality (const unsigned char *pwd, const long pwd_len) +grg_ascii_pwd_quality (const char *pwd, const long pwd_len) { int A = FALSE, a = FALSE, n = FALSE, p = FALSE; long i = 0; @@ -434,7 +434,7 @@ * Returns: a double between 0 and 1, inclusive */ double -grg_file_pwd_quality (const unsigned char *pwd_path) +grg_file_pwd_quality (const char *pwd_path) { double ret; int pdf; @@ -487,7 +487,7 @@ if (!in) return NULL; - origlen = (inlen >= 0) ? inlen : strlen (in); + origlen = (inlen >= 0) ? inlen : strlen ((char *)in); olen = (origlen + 2) / 3 * 4 + 1; out = (unsigned char *) malloc (olen); if (!out) @@ -533,7 +533,7 @@ if (!in) return NULL; - tmpinlen = (inlen >= 0) ? inlen : strlen (in); + tmpinlen = (inlen >= 0) ? inlen : strlen ((char *)in); olen = tmpinlen / 4 * 3; if (in[tmpinlen - 1] == '=') @@ -586,7 +586,7 @@ ret[olen] = '\0'; - return ret; + return (unsigned char *)ret; } int @@ -643,7 +643,7 @@ grg_rnd_seq_direct (gctx, mem + j - SHRED_BLOCK_SIZE, SHRED_BLOCK_SIZE); grg_rnd_seq_direct (gctx, mem + dim - rem, rem); */ - grg_rnd_seq_direct (gctx, mem, dim); + grg_rnd_seq_direct (gctx, (unsigned char *)mem, dim); fsync (fd); } diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/libgringotts.h libgringotts-1.2.1_mod/src/libgringotts.h --- libgringotts-1.2.1/src/libgringotts.h 2003-04-24 13:26:09.000000000 +0200 +++ libgringotts-1.2.1_mod/src/libgringotts.h 2014-01-25 21:39:01.795201067 +0100 @@ -118,7 +118,7 @@ // General purpose functions -unsigned char *grg_get_version (void); +char *grg_get_version (void); unsigned int grg_get_int_version (void); // Security related functions @@ -128,16 +128,16 @@ const unsigned int size); unsigned char grg_rnd_chr (const GRG_CTX gctx); void grg_free (const GRG_CTX gctx, void *alloc_data, const long dim); -double grg_ascii_pwd_quality (const unsigned char *pwd, const long pwd_len); -double grg_file_pwd_quality (const unsigned char *pwd_path); +double grg_ascii_pwd_quality (const char *pwd, const long pwd_len); +double grg_file_pwd_quality (const char *pwd_path); // libGringotts context (GRG_CTX) related functions -GRG_CTX grg_context_initialize (const unsigned char *header, +GRG_CTX grg_context_initialize (const char *header, const grg_crypt_algo crypt_algo, const grg_hash_algo hash_algo, const grg_comp_algo comp_algo, const grg_comp_ratio comp_lvl, const grg_security_lvl sec_lvl); -GRG_CTX grg_context_initialize_defaults (const unsigned char *header); +GRG_CTX grg_context_initialize_defaults (const char *header); void grg_context_free (GRG_CTX gctx); grg_crypt_algo grg_ctx_get_crypt_algo (const GRG_CTX gctx); @@ -160,19 +160,19 @@ // libGringotts keyholder (GRG_KEY) related functions -GRG_KEY grg_key_gen (const unsigned char *pwd, const int pwd_len); +GRG_KEY grg_key_gen (const char *pwd, const int pwd_len); GRG_KEY grg_key_clone (const GRG_KEY src); int grg_key_compare (const GRG_KEY k1, const GRG_KEY k2); void grg_key_free (const GRG_CTX gctx, GRG_KEY key); // File encryption/decryption functions -int grg_validate_file (const GRG_CTX gctx, const unsigned char *path); -int grg_update_gctx_from_file (GRG_CTX gctx, const unsigned char *path); +int grg_validate_file (const GRG_CTX gctx, const char *path); +int grg_update_gctx_from_file (GRG_CTX gctx, const char *path); int grg_decrypt_file (const GRG_CTX gctx, const GRG_KEY keystruct, - const unsigned char *path, unsigned char **origData, + const char *path, unsigned char **origData, long *origDim); int grg_encrypt_file (const GRG_CTX gctx, const GRG_KEY keystruct, - const unsigned char *path, + const char *path, const unsigned char *origData, const long origDim); // Their "direct" versions, requiring a file descriptor instead of a path diff -ENwbur -x 'Make*' libgringotts-1.2.1/src/test.c libgringotts-1.2.1_mod/src/test.c --- libgringotts-1.2.1/src/test.c 2003-04-24 13:26:09.000000000 +0200 +++ libgringotts-1.2.1_mod/src/test.c 2014-01-25 21:49:35.551173184 +0100 @@ -143,7 +143,8 @@ static int test6() {//base-64 coding and decoding of a very long binary string at random - int ret, olen; + int ret; + unsigned int olen; unsigned char *orig, *based, *debased; olen = TEST_DIM; @@ -152,7 +153,7 @@ based = grg_encode64 (orig, olen, NULL); debased = grg_decode64 (based, -1, &olen); - if (strncmp (orig, debased, olen) == 0) + if (strncmp ((char *)orig, (char *)debased, olen) == 0) ret = OK; else ret = KO; @@ -177,8 +178,8 @@ if (r1 == r2 && r2 == r3) return KO; - rs1 = grg_rnd_seq (gctx, TEST_DIM); - rs2 = grg_rnd_seq (gctx, TEST_DIM); + rs1 = (char *)grg_rnd_seq (gctx, TEST_DIM); + rs2 = (char *)grg_rnd_seq (gctx, TEST_DIM); if (memcmp (rs1, rs2, TEST_DIM) == 0) { free (rs1); @@ -187,7 +188,7 @@ } memcpy (rs1, rs2, TEST_DIM); - grg_rnd_seq_direct (gctx, rs1, TEST_DIM); + grg_rnd_seq_direct (gctx, (unsigned char *)rs1, TEST_DIM); if (memcmp (rs1, rs2, TEST_DIM) == 0) ret = KO; @@ -254,7 +255,7 @@ p6 = grg_ascii_pwd_quality (PWD6, -1), p7 = grg_ascii_pwd_quality (PWD7, -1), p8 = grg_ascii_pwd_quality (PWD8, -1); - char *PWD9 = grg_rnd_seq (gctx, 256); + char *PWD9 = (char *)grg_rnd_seq (gctx, 256); double p9 = grg_ascii_pwd_quality (PWD9, 256); free (PWD9); @@ -334,10 +335,9 @@ {//data encoding and decoding in memory unsigned char *data = grg_rnd_seq (gctx, TEST_DIM), *data2; void *stone = NULL; - int ret, rval, d; + int ret, rval; long fdim, ffdim; - d=TEST_DIM; ret=grg_encrypt_mem(gctx, key, &stone, &fdim, data, TEST_DIM); if (ret < 0){ free (data); @@ -515,7 +515,7 @@ int ret, rval; unsigned int fdim; long ffdim; - unsigned char *data = grg_decode64(ENC_STRING, -1, &fdim), *data2; + unsigned char *data = grg_decode64((unsigned char *)ENC_STRING, -1, &fdim), *data2; ret=grg_decrypt_mem(gctx, key, data, fdim, &data2, &ffdim); if (ret < 0){
pgp_HJIocRD8C.pgp
Description: PGP signature