"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/crypto-vectors.c" between
cryptsetup-2.3.6.tar.xz and cryptsetup-2.4.0.tar.xz

About: cryptsetup is a utility used to conveniently setup disk encryption based on the dm-crypt kernel module. These include plain dm-crypt volumes, LUKS volumes, loop-AES and TrueCrypt compatible format.

crypto-vectors.c  (cryptsetup-2.3.6.tar.xz):crypto-vectors.c  (cryptsetup-2.4.0.tar.xz)
skipping to change at line 26 skipping to change at line 26
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include "crypto_backend.h" #include "crypto_backend/crypto_backend.h"
#ifndef ARRAY_SIZE #ifndef ARRAY_SIZE
# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif #endif
static void printhex(const char *s, const char *buf, size_t len) static void printhex(const char *s, const char *buf, size_t len)
{ {
size_t i; size_t i;
printf("%s: ", s); printf("%s: ", s);
skipping to change at line 1234 skipping to change at line 1234
} }
crypt_storage_destroy(storage); crypt_storage_destroy(storage);
} }
printf("\n"); printf("\n");
} }
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
static int check_hash(const char *hash)
{
struct crypt_hash *h;
if (crypt_hash_size(hash) < 0)
return EXIT_FAILURE;
if (crypt_hash_init(&h, hash))
return EXIT_FAILURE;
crypt_hash_destroy(h);
return EXIT_SUCCESS;
}
static int default_alg_test(void)
{
printf("Defaults: [LUKS1 hash %s] ", DEFAULT_LUKS1_HASH);
if (check_hash(DEFAULT_LUKS1_HASH))
return EXIT_FAILURE;
printf("[PLAIN hash %s] ", DEFAULT_PLAIN_HASH);
if (check_hash(DEFAULT_PLAIN_HASH))
return EXIT_FAILURE;
printf("[VERITY hash %s] ", DEFAULT_VERITY_HASH);
if (check_hash(DEFAULT_VERITY_HASH))
return EXIT_FAILURE;
printf("[OK]\n");
return EXIT_SUCCESS;
}
static void __attribute__((noreturn)) exit_test(const char *msg, int r) static void __attribute__((noreturn)) exit_test(const char *msg, int r)
{ {
if (msg) if (msg)
printf("%s\n", msg); printf("%s\n", msg);
crypt_backend_destroy(); crypt_backend_destroy();
exit(r); exit(r);
} }
int main(__attribute__ ((unused)) int argc, __attribute__ ((unused))char *argv[] ) int main(__attribute__ ((unused)) int argc, __attribute__ ((unused))char *argv[] )
{ {
skipping to change at line 1271 skipping to change at line 1304
if (hmac_test()) if (hmac_test())
exit_test("HMAC test failed.", EXIT_FAILURE); exit_test("HMAC test failed.", EXIT_FAILURE);
if (cipher_test()) if (cipher_test())
exit_test("CIPHER test failed.", EXIT_FAILURE); exit_test("CIPHER test failed.", EXIT_FAILURE);
if (cipher_iv_test()) if (cipher_iv_test())
exit_test("IV test failed.", EXIT_FAILURE); exit_test("IV test failed.", EXIT_FAILURE);
if (default_alg_test())
exit_test("Default compiled-in algorithms test failed.", EXIT_FAI
LURE);
exit_test(NULL, EXIT_SUCCESS); exit_test(NULL, EXIT_SUCCESS);
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)