Lines Matching refs:ret
32 void *ret = OPENSSL_malloc(num); in OPENSSL_zalloc() local
34 if (ret != NULL) in OPENSSL_zalloc()
35 memset(ret, 0, num); in OPENSSL_zalloc()
36 return ret; in OPENSSL_zalloc()
207 int ret; in sb_aes_init() local
214 ret = EVP_CipherInit(ctx, EVP_aes_128_cbc(), ictx->image_key, iv, enc); in sb_aes_init()
215 if (ret == 1) { in sb_aes_init()
219 return ret; in sb_aes_init()
226 int ret, outlen; in sb_aes_crypt() local
234 ret = EVP_CipherUpdate(ctx, outbuf, &outlen, in_data, in_len); in sb_aes_crypt()
235 if (!ret) { in sb_aes_crypt()
236 ret = -EINVAL; in sb_aes_crypt()
245 return ret; in sb_aes_crypt()
255 int ret; in sb_aes_reinit() local
260 ret = sb_aes_deinit(ctx); in sb_aes_reinit()
261 if (!ret) in sb_aes_reinit()
262 return ret; in sb_aes_reinit()
304 struct tm *ret; in sb_get_time() local
305 ret = gmtime_r(&seconds_to_now, tm); in sb_get_time()
306 return ret ? 0 : -EINVAL; in sb_get_time()
443 long ret; in sb_load_file() local
456 ret = fseek(fp, 0, SEEK_END); in sb_load_file()
457 if (ret < 0) in sb_load_file()
464 ret = fseek(fp, 0, SEEK_SET); in sb_load_file()
465 if (ret < 0) in sb_load_file()
566 int ret; in sb_build_dcd() local
572 ret = sb_grow_dcd(dctx, 4); in sb_build_dcd()
573 if (ret) in sb_build_dcd()
581 ret = -EINVAL; in sb_build_dcd()
586 ret = sb_token_to_long(tok, &id); in sb_build_dcd()
587 if (ret) { in sb_build_dcd()
613 return ret; in sb_build_dcd()
622 int ret; in sb_build_dcd_block() local
630 ret = sb_grow_dcd(dctx, 8); in sb_build_dcd_block()
631 if (ret) in sb_build_dcd_block()
632 return ret; in sb_build_dcd_block()
634 ret = sb_grow_dcd(dctx, 4); in sb_build_dcd_block()
635 if (ret) in sb_build_dcd_block()
636 return ret; in sb_build_dcd_block()
649 ret = sb_grow_dcd(dctx, 12); in sb_build_dcd_block()
650 if (ret) in sb_build_dcd_block()
651 return ret; in sb_build_dcd_block()
667 ret = -EINVAL; in sb_build_dcd_block()
672 ret = sb_token_to_long(tok, &address); in sb_build_dcd_block()
673 if (ret) { in sb_build_dcd_block()
683 ret = -EINVAL; in sb_build_dcd_block()
688 ret = sb_token_to_long(tok, &value); in sb_build_dcd_block()
689 if (ret) { in sb_build_dcd_block()
707 return ret; in sb_build_dcd_block()
717 int ret; in sb_build_section() local
728 ret = -EINVAL; in sb_build_section()
733 ret = sb_token_to_long(tok, &id); in sb_build_section()
734 if (ret) { in sb_build_section()
782 return ret; in sb_build_section()
870 int ret, is_ivt = 0, is_dcd = 0; in sb_build_command_load() local
886 ret = -EINVAL; in sb_build_command_load()
900 ret = -EINVAL; in sb_build_command_load()
906 ret = sb_token_to_long(tok, &dest); in sb_build_command_load()
907 if (ret) { in sb_build_command_load()
919 ret = -EINVAL; in sb_build_command_load()
927 ret = sb_token_to_long(tok, &ivtep); in sb_build_command_load()
929 if (ret) { in sb_build_command_load()
938 ret = -ENOMEM; in sb_build_command_load()
953 ret = sb_token_to_long(tok, &dcdid); in sb_build_command_load()
955 if (ret) { in sb_build_command_load()
977 ret = -ENOMEM; in sb_build_command_load()
990 ret = sb_load_file(cctx, tok); in sb_build_command_load()
991 if (ret) { in sb_build_command_load()
1033 return ret; in sb_build_command_load()
1044 int ret; in sb_build_command_fill() local
1059 ret = -EINVAL; in sb_build_command_fill()
1064 ret = sb_token_to_long(tok, &address); in sb_build_command_fill()
1065 if (ret) { in sb_build_command_fill()
1075 ret = -EINVAL; in sb_build_command_fill()
1080 ret = sb_token_to_long(tok, &pattern); in sb_build_command_fill()
1081 if (ret) { in sb_build_command_fill()
1091 ret = -EINVAL; in sb_build_command_fill()
1096 ret = sb_token_to_long(tok, &length); in sb_build_command_fill()
1097 if (ret) { in sb_build_command_fill()
1130 return ret; in sb_build_command_fill()
1143 int ret; in sb_build_command_jump_call() local
1160 ret = -EINVAL; in sb_build_command_jump_call()
1171 ret = -EINVAL; in sb_build_command_jump_call()
1176 ret = sb_token_to_long(tok, &dest); in sb_build_command_jump_call()
1177 if (ret) { in sb_build_command_jump_call()
1185 ret = sb_token_to_long(tok, &arg); in sb_build_command_jump_call()
1186 if (ret) { in sb_build_command_jump_call()
1221 return ret; in sb_build_command_jump_call()
1243 int ret; in sb_build_command_mode() local
1260 ret = -EINVAL; in sb_build_command_mode()
1282 ret = -EINVAL; in sb_build_command_mode()
1311 return ret; in sb_build_command_mode()
1454 int ret; in sb_parse_line() local
1496 ret = sb_build_command_nop(ictx); in sb_parse_line()
1498 ret = sb_build_command_tag(ictx, cmd); in sb_parse_line()
1500 ret = sb_build_command_load(ictx, cmd); in sb_parse_line()
1502 ret = sb_build_command_fill(ictx, cmd); in sb_parse_line()
1504 ret = sb_build_command_jump(ictx, cmd); in sb_parse_line()
1506 ret = sb_build_command_call(ictx, cmd); in sb_parse_line()
1508 ret = sb_build_command_mode(ictx, cmd); in sb_parse_line()
1538 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1541 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1544 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1547 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1550 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1553 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1556 ret = sb_build_dcd_block(ictx, cmd, in sb_parse_line()
1559 ret = sb_build_dcd_block(ictx, cmd, SB_DCD_NOOP); in sb_parse_line()
1578 if (ictx->in_section && !ret) { in sb_parse_line()
1584 return ret; in sb_parse_line()
1628 int ret; in sb_build_tree_from_cfg() local
1630 ret = sb_load_cmdfile(ictx); in sb_build_tree_from_cfg()
1631 if (ret) in sb_build_tree_from_cfg()
1632 return ret; in sb_build_tree_from_cfg()
1634 ret = sb_prefill_image_header(ictx); in sb_build_tree_from_cfg()
1635 if (ret) in sb_build_tree_from_cfg()
1636 return ret; in sb_build_tree_from_cfg()
1638 ret = sb_postfill_image_header(ictx); in sb_build_tree_from_cfg()
1639 if (ret) in sb_build_tree_from_cfg()
1640 return ret; in sb_build_tree_from_cfg()
1642 ret = sb_fixup_sections_and_tags(ictx); in sb_build_tree_from_cfg()
1643 if (ret) in sb_build_tree_from_cfg()
1644 return ret; in sb_build_tree_from_cfg()
1656 int sz, ret = 0; in sb_verify_image_header() local
1686 ret = -EINVAL; in sb_verify_image_header()
1687 soprintf(ictx, "%s Image header checksum: %s\n", stat[!!ret], in sb_verify_image_header()
1688 ret ? "BAD" : "OK"); in sb_verify_image_header()
1689 if (ret) in sb_verify_image_header()
1690 return ret; in sb_verify_image_header()
1694 ret = -EINVAL; in sb_verify_image_header()
1696 stat[!!ret], hdr->signature1, hdr->signature2); in sb_verify_image_header()
1697 if (ret) in sb_verify_image_header()
1698 return ret; in sb_verify_image_header()
1702 ret = -EINVAL; in sb_verify_image_header()
1703 soprintf(ictx, "%s Image version: v%i.%i\n", stat[!!ret], in sb_verify_image_header()
1705 if (ret) in sb_verify_image_header()
1706 return ret; in sb_verify_image_header()
1708 ret = sb_get_time(hdr->timestamp_us / 1000000, &tm); in sb_verify_image_header()
1711 stat[!!ret], tm.tm_hour, tm.tm_min, tm.tm_sec, in sb_verify_image_header()
1713 if (ret) in sb_verify_image_header()
1714 return ret; in sb_verify_image_header()
1726 ret = -EINVAL; in sb_verify_image_header()
1727 soprintf(ictx, "%s Image flags: %s\n", stat[!!ret], in sb_verify_image_header()
1730 if (ret) in sb_verify_image_header()
1731 return ret; in sb_verify_image_header()
1734 ret = -EINVAL; in sb_verify_image_header()
1735 soprintf(ictx, "%s Drive tag: %i\n", stat[!!ret], in sb_verify_image_header()
1737 if (ret) in sb_verify_image_header()
1738 return ret; in sb_verify_image_header()
1742 ret = -EINVAL; in sb_verify_image_header()
1743 soprintf(ictx, "%s Image header size (blocks): %i\n", stat[!!ret], in sb_verify_image_header()
1745 if (ret) in sb_verify_image_header()
1746 return ret; in sb_verify_image_header()
1750 ret = -EINVAL; in sb_verify_image_header()
1751 soprintf(ictx, "%s Section header size (blocks): %i\n", stat[!!ret], in sb_verify_image_header()
1753 if (ret) in sb_verify_image_header()
1754 return ret; in sb_verify_image_header()
1756 soprintf(ictx, "%s Sections count: %i\n", stat[!!ret], in sb_verify_image_header()
1758 soprintf(ictx, "%s First bootable section %i\n", stat[!!ret], in sb_verify_image_header()
1762 ret = -EINVAL; in sb_verify_image_header()
1763 soprintf(ictx, "%s Image size (blocks): %i\n", stat[!!ret], in sb_verify_image_header()
1765 if (ret) in sb_verify_image_header()
1766 return ret; in sb_verify_image_header()
1770 ret = -EINVAL; in sb_verify_image_header()
1771 soprintf(ictx, "%s Key dict offset (blocks): %i\n", stat[!!ret], in sb_verify_image_header()
1773 if (ret) in sb_verify_image_header()
1774 return ret; in sb_verify_image_header()
1777 ret = -EINVAL; in sb_verify_image_header()
1778 soprintf(ictx, "%s Number of encryption keys: %i\n", stat[!!ret], in sb_verify_image_header()
1780 if (ret) in sb_verify_image_header()
1781 return ret; in sb_verify_image_header()
1787 ret = -EINVAL; in sb_verify_image_header()
1788 soprintf(ictx, "%s First TAG block (blocks): %i\n", stat[!!ret], in sb_verify_image_header()
1790 if (ret) in sb_verify_image_header()
1791 return ret; in sb_verify_image_header()
1814 int ret; in sb_verify_command() local
1822 ret = 0; in sb_verify_command()
1824 ret = -EINVAL; in sb_verify_command()
1825 csum = ret ? "checksum BAD" : "checksum OK"; in sb_verify_command()
1830 return ret; in sb_verify_command()
1836 return ret; in sb_verify_command()
1899 return ret; in sb_verify_command()
1907 int ret; in sb_verify_commands() local
1933 ret = sb_verify_command(ictx, cctx, fp, &tsize); in sb_verify_commands()
1934 if (ret) in sb_verify_commands()
1946 int ret; in sb_verify_sections_cmds() local
2008 ret = sb_verify_commands(ictx, sctx, fp); in sb_verify_sections_cmds()
2009 if (ret) in sb_verify_sections_cmds()
2010 return ret; in sb_verify_sections_cmds()
2028 int ret; in sb_verify_image_end() local
2053 ret = memcmp(digest, ictx->digest, 20) ? -EINVAL : 0; in sb_verify_image_end()
2055 if (ret) in sb_verify_image_end()
2060 return ret; in sb_verify_image_end()
2067 int ret; in sb_build_tree_from_img() local
2079 ret = fseek(fp, 0, SEEK_END); in sb_build_tree_from_img()
2080 if (ret < 0) in sb_build_tree_from_img()
2087 ret = fseek(fp, 0, SEEK_SET); in sb_build_tree_from_img()
2088 if (ret < 0) in sb_build_tree_from_img()
2102 ret = sb_verify_image_header(ictx, fp, filesize); in sb_build_tree_from_img()
2103 if (ret) in sb_build_tree_from_img()
2107 ret = sb_verify_sections_cmds(ictx, fp); in sb_build_tree_from_img()
2108 if (ret) in sb_build_tree_from_img()
2111 ret = sb_verify_image_end(ictx, fp, filesize); in sb_build_tree_from_img()
2112 if (ret) in sb_build_tree_from_img()
2115 ret = 0; in sb_build_tree_from_img()
2119 soprintf(ictx, "Verification %s\n", ret ? "FAILED" : "PASSED"); in sb_build_tree_from_img()
2125 return ret; in sb_build_tree_from_img()
2206 int ret; in mxsimage_verify_print_header() local
2214 ret = sb_build_tree_from_img(&ctx); in mxsimage_verify_print_header()
2217 return ret; in mxsimage_verify_print_header()
2323 int ret; in mxsimage_generate() local
2334 ret = sb_build_tree_from_cfg(&ctx); in mxsimage_generate()
2335 if (ret) in mxsimage_generate()
2338 ret = sb_encrypt_image(&ctx); in mxsimage_generate()
2339 if (!ret) in mxsimage_generate()
2340 ret = sb_build_image(&ctx, tparams); in mxsimage_generate()
2345 return ret; in mxsimage_generate()