comparison src/blowfish.c @ 26863:6ee19c6ae8a2 v8.2.3960

patch 8.2.3960: error messages are spread out Commit: https://github.com/vim/vim/commit/f1474d801bbdb73406dd3d1f931f515f99e86dfa Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 31 19:59:55 2021 +0000 patch 8.2.3960: error messages are spread out Problem: Error messages are spread out. Solution: Move more errors to errors.h.
author Bram Moolenaar <Bram@vim.org>
date Fri, 31 Dec 2021 21:15:02 +0100
parents fc859aea8cec
children 50555279168b
comparison
equal deleted inserted replaced
26862:e91b94a101d1 26863:6ee19c6ae8a2
414 414
415 // Convert the key from 64 hex chars to 32 binary chars. 415 // Convert the key from 64 hex chars to 32 binary chars.
416 keylen = (int)STRLEN(key) / 2; 416 keylen = (int)STRLEN(key) / 2;
417 if (keylen == 0) 417 if (keylen == 0)
418 { 418 {
419 iemsg(_("E831: bf_key_init() called with empty password")); 419 iemsg(_(e_bf_key_init_called_with_empty_password));
420 return; 420 return;
421 } 421 }
422 for (i = 0; i < keylen; i++) 422 for (i = 0; i < keylen; i++)
423 { 423 {
424 sscanf((char *)&key[i * 2], "%2x", &u); 424 sscanf((char *)&key[i * 2], "%2x", &u);
517 517
518 // We can't simply use sizeof(UINT32_T), it would generate a compiler 518 // We can't simply use sizeof(UINT32_T), it would generate a compiler
519 // warning. 519 // warning.
520 if (ui != 0xffffffffUL || ui + 1 != 0) { 520 if (ui != 0xffffffffUL || ui + 1 != 0) {
521 err++; 521 err++;
522 emsg(_("E820: sizeof(uint32_t) != 4")); 522 emsg(_(e_sizeof_uint32_isnot_four));
523 } 523 }
524 524
525 if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) 525 if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a))
526 err++; 526 err++;
527 527
538 memcpy(bk.uc, bf_test_data[i].plaintxt, 8); 538 memcpy(bk.uc, bf_test_data[i].plaintxt, 8);
539 bf_e_cblock(&state, bk.uc); 539 bf_e_cblock(&state, bk.uc);
540 if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) 540 if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0)
541 { 541 {
542 if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) 542 if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0)
543 emsg(_("E817: Blowfish big/little endian use wrong")); 543 emsg(_(e_blowfish_big_little_endian_use_wrong));
544 err++; 544 err++;
545 } 545 }
546 } 546 }
547 547
548 return err > 0 ? FAIL : OK; 548 return err > 0 ? FAIL : OK;
670 int 670 int
671 blowfish_self_test(void) 671 blowfish_self_test(void)
672 { 672 {
673 if (sha256_self_test() == FAIL) 673 if (sha256_self_test() == FAIL)
674 { 674 {
675 emsg(_("E818: sha256 test failed")); 675 emsg(_(e_sha256_test_failed));
676 return FAIL; 676 return FAIL;
677 } 677 }
678 if (bf_self_test() == FAIL) 678 if (bf_self_test() == FAIL)
679 { 679 {
680 emsg(_("E819: Blowfish test failed")); 680 emsg(_(e_blowfish_test_failed));
681 return FAIL; 681 return FAIL;
682 } 682 }
683 return OK; 683 return OK;
684 } 684 }
685 #endif // FEAT_CRYPT 685 #endif // FEAT_CRYPT