libarchive-static 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/extconf.rb +2 -9
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
- data/ext/libarchive-0.1.1/ext/config.h +23 -0
- data/ext/libarchive-0.1.1/ext/config.log +230 -0
- data/ext/libarchive-0.1.1/ext/config.status +671 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
- data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
- data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +0 -1
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
- data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
- data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
- data/ext/libarchive-3.6.2/Makefile.in +16892 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
- data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
- data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
- data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
- data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
- data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
- data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
- data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
- data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
- data/ext/libarchive-3.6.2/config.h.in +1504 -0
- data/ext/libarchive-3.6.2/configure +25558 -0
- data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
- data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
- data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
- data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
- data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
- data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
- data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
- data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
- data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
- data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
- data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
- data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
- data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
- data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
- data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
- data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
- data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
- data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
- data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
- data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
- data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
- data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
- data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
- data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
- data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
- data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
- data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
- data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
- data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
- data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
- data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
- data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
- data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
- data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
- data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
- data/ext/libarchive-static-makefile +144 -80
- data/ext/libarchive-static-wrapper-makefile +1 -1
- data/ext/zlib-1.2.13/Makefile.in +404 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
- data/ext/zlib-1.2.13/configure +922 -0
- data/ext/zlib-1.2.13/crc32.c +1125 -0
- data/ext/zlib-1.2.13/crc32.h +9446 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
- data/ext/zlib-1.2.13/gzread.c +650 -0
- data/ext/zlib-1.2.13/gzwrite.c +677 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
- data/ext/zlib-1.2.13/uncompr.c +93 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
- metadata +244 -137
- data/ext/libarchive-0.1.1/libarchive.c +0 -1762
- data/ext/libarchive-2.8.4/Makefile.in +0 -7076
- data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
- data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
- data/ext/libarchive-2.8.4/config.h.in +0 -772
- data/ext/libarchive-2.8.4/configure +0 -17916
- data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
- data/ext/zlib-1.2.5/Makefile.in +0 -257
- data/ext/zlib-1.2.5/configure +0 -596
- data/ext/zlib-1.2.5/crc32.c +0 -442
- data/ext/zlib-1.2.5/crc32.h +0 -441
- data/ext/zlib-1.2.5/example.c +0 -565
- data/ext/zlib-1.2.5/gzread.c +0 -653
- data/ext/zlib-1.2.5/gzwrite.c +0 -531
- data/ext/zlib-1.2.5/minigzip.c +0 -440
- data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -0,0 +1,369 @@
|
|
1
|
+
/*
|
2
|
+
BLAKE2 reference source code package - reference C implementations
|
3
|
+
|
4
|
+
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
5
|
+
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
6
|
+
your option. The terms of these licenses can be found at:
|
7
|
+
|
8
|
+
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
9
|
+
- OpenSSL license : https://www.openssl.org/source/license.html
|
10
|
+
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
More information about the BLAKE2 hash function can be found at
|
13
|
+
https://blake2.net.
|
14
|
+
*/
|
15
|
+
|
16
|
+
#include "archive_platform.h"
|
17
|
+
|
18
|
+
#include <stdint.h>
|
19
|
+
#include <string.h>
|
20
|
+
#include <stdio.h>
|
21
|
+
|
22
|
+
#include "archive_blake2.h"
|
23
|
+
#include "archive_blake2_impl.h"
|
24
|
+
|
25
|
+
static const uint32_t blake2s_IV[8] =
|
26
|
+
{
|
27
|
+
0x6A09E667UL, 0xBB67AE85UL, 0x3C6EF372UL, 0xA54FF53AUL,
|
28
|
+
0x510E527FUL, 0x9B05688CUL, 0x1F83D9ABUL, 0x5BE0CD19UL
|
29
|
+
};
|
30
|
+
|
31
|
+
static const uint8_t blake2s_sigma[10][16] =
|
32
|
+
{
|
33
|
+
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 } ,
|
34
|
+
{ 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 } ,
|
35
|
+
{ 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 } ,
|
36
|
+
{ 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 } ,
|
37
|
+
{ 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 } ,
|
38
|
+
{ 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 } ,
|
39
|
+
{ 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 } ,
|
40
|
+
{ 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 } ,
|
41
|
+
{ 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 } ,
|
42
|
+
{ 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13 , 0 } ,
|
43
|
+
};
|
44
|
+
|
45
|
+
static void blake2s_set_lastnode( blake2s_state *S )
|
46
|
+
{
|
47
|
+
S->f[1] = (uint32_t)-1;
|
48
|
+
}
|
49
|
+
|
50
|
+
/* Some helper functions, not necessarily useful */
|
51
|
+
static int blake2s_is_lastblock( const blake2s_state *S )
|
52
|
+
{
|
53
|
+
return S->f[0] != 0;
|
54
|
+
}
|
55
|
+
|
56
|
+
static void blake2s_set_lastblock( blake2s_state *S )
|
57
|
+
{
|
58
|
+
if( S->last_node ) blake2s_set_lastnode( S );
|
59
|
+
|
60
|
+
S->f[0] = (uint32_t)-1;
|
61
|
+
}
|
62
|
+
|
63
|
+
static void blake2s_increment_counter( blake2s_state *S, const uint32_t inc )
|
64
|
+
{
|
65
|
+
S->t[0] += inc;
|
66
|
+
S->t[1] += ( S->t[0] < inc );
|
67
|
+
}
|
68
|
+
|
69
|
+
static void blake2s_init0( blake2s_state *S )
|
70
|
+
{
|
71
|
+
size_t i;
|
72
|
+
memset( S, 0, sizeof( blake2s_state ) );
|
73
|
+
|
74
|
+
for( i = 0; i < 8; ++i ) S->h[i] = blake2s_IV[i];
|
75
|
+
}
|
76
|
+
|
77
|
+
/* init2 xors IV with input parameter block */
|
78
|
+
int blake2s_init_param( blake2s_state *S, const blake2s_param *P )
|
79
|
+
{
|
80
|
+
const unsigned char *p = ( const unsigned char * )( P );
|
81
|
+
size_t i;
|
82
|
+
|
83
|
+
blake2s_init0( S );
|
84
|
+
|
85
|
+
/* IV XOR ParamBlock */
|
86
|
+
for( i = 0; i < 8; ++i )
|
87
|
+
S->h[i] ^= load32( &p[i * 4] );
|
88
|
+
|
89
|
+
S->outlen = P->digest_length;
|
90
|
+
return 0;
|
91
|
+
}
|
92
|
+
|
93
|
+
|
94
|
+
/* Sequential blake2s initialization */
|
95
|
+
int blake2s_init( blake2s_state *S, size_t outlen )
|
96
|
+
{
|
97
|
+
blake2s_param P[1];
|
98
|
+
|
99
|
+
/* Move interval verification here? */
|
100
|
+
if ( ( !outlen ) || ( outlen > BLAKE2S_OUTBYTES ) ) return -1;
|
101
|
+
|
102
|
+
P->digest_length = (uint8_t)outlen;
|
103
|
+
P->key_length = 0;
|
104
|
+
P->fanout = 1;
|
105
|
+
P->depth = 1;
|
106
|
+
store32( &P->leaf_length, 0 );
|
107
|
+
store32( &P->node_offset, 0 );
|
108
|
+
store16( &P->xof_length, 0 );
|
109
|
+
P->node_depth = 0;
|
110
|
+
P->inner_length = 0;
|
111
|
+
/* memset(P->reserved, 0, sizeof(P->reserved) ); */
|
112
|
+
memset( P->salt, 0, sizeof( P->salt ) );
|
113
|
+
memset( P->personal, 0, sizeof( P->personal ) );
|
114
|
+
return blake2s_init_param( S, P );
|
115
|
+
}
|
116
|
+
|
117
|
+
int blake2s_init_key( blake2s_state *S, size_t outlen, const void *key, size_t keylen )
|
118
|
+
{
|
119
|
+
blake2s_param P[1];
|
120
|
+
|
121
|
+
if ( ( !outlen ) || ( outlen > BLAKE2S_OUTBYTES ) ) return -1;
|
122
|
+
|
123
|
+
if ( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1;
|
124
|
+
|
125
|
+
P->digest_length = (uint8_t)outlen;
|
126
|
+
P->key_length = (uint8_t)keylen;
|
127
|
+
P->fanout = 1;
|
128
|
+
P->depth = 1;
|
129
|
+
store32( &P->leaf_length, 0 );
|
130
|
+
store32( &P->node_offset, 0 );
|
131
|
+
store16( &P->xof_length, 0 );
|
132
|
+
P->node_depth = 0;
|
133
|
+
P->inner_length = 0;
|
134
|
+
/* memset(P->reserved, 0, sizeof(P->reserved) ); */
|
135
|
+
memset( P->salt, 0, sizeof( P->salt ) );
|
136
|
+
memset( P->personal, 0, sizeof( P->personal ) );
|
137
|
+
|
138
|
+
if( blake2s_init_param( S, P ) < 0 ) return -1;
|
139
|
+
|
140
|
+
{
|
141
|
+
uint8_t block[BLAKE2S_BLOCKBYTES];
|
142
|
+
memset( block, 0, BLAKE2S_BLOCKBYTES );
|
143
|
+
memcpy( block, key, keylen );
|
144
|
+
blake2s_update( S, block, BLAKE2S_BLOCKBYTES );
|
145
|
+
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
|
146
|
+
}
|
147
|
+
return 0;
|
148
|
+
}
|
149
|
+
|
150
|
+
#define G(r,i,a,b,c,d) \
|
151
|
+
do { \
|
152
|
+
a = a + b + m[blake2s_sigma[r][2*i+0]]; \
|
153
|
+
d = rotr32(d ^ a, 16); \
|
154
|
+
c = c + d; \
|
155
|
+
b = rotr32(b ^ c, 12); \
|
156
|
+
a = a + b + m[blake2s_sigma[r][2*i+1]]; \
|
157
|
+
d = rotr32(d ^ a, 8); \
|
158
|
+
c = c + d; \
|
159
|
+
b = rotr32(b ^ c, 7); \
|
160
|
+
} while(0)
|
161
|
+
|
162
|
+
#define ROUND(r) \
|
163
|
+
do { \
|
164
|
+
G(r,0,v[ 0],v[ 4],v[ 8],v[12]); \
|
165
|
+
G(r,1,v[ 1],v[ 5],v[ 9],v[13]); \
|
166
|
+
G(r,2,v[ 2],v[ 6],v[10],v[14]); \
|
167
|
+
G(r,3,v[ 3],v[ 7],v[11],v[15]); \
|
168
|
+
G(r,4,v[ 0],v[ 5],v[10],v[15]); \
|
169
|
+
G(r,5,v[ 1],v[ 6],v[11],v[12]); \
|
170
|
+
G(r,6,v[ 2],v[ 7],v[ 8],v[13]); \
|
171
|
+
G(r,7,v[ 3],v[ 4],v[ 9],v[14]); \
|
172
|
+
} while(0)
|
173
|
+
|
174
|
+
static void blake2s_compress( blake2s_state *S, const uint8_t in[BLAKE2S_BLOCKBYTES] )
|
175
|
+
{
|
176
|
+
uint32_t m[16];
|
177
|
+
uint32_t v[16];
|
178
|
+
size_t i;
|
179
|
+
|
180
|
+
for( i = 0; i < 16; ++i ) {
|
181
|
+
m[i] = load32( in + i * sizeof( m[i] ) );
|
182
|
+
}
|
183
|
+
|
184
|
+
for( i = 0; i < 8; ++i ) {
|
185
|
+
v[i] = S->h[i];
|
186
|
+
}
|
187
|
+
|
188
|
+
v[ 8] = blake2s_IV[0];
|
189
|
+
v[ 9] = blake2s_IV[1];
|
190
|
+
v[10] = blake2s_IV[2];
|
191
|
+
v[11] = blake2s_IV[3];
|
192
|
+
v[12] = S->t[0] ^ blake2s_IV[4];
|
193
|
+
v[13] = S->t[1] ^ blake2s_IV[5];
|
194
|
+
v[14] = S->f[0] ^ blake2s_IV[6];
|
195
|
+
v[15] = S->f[1] ^ blake2s_IV[7];
|
196
|
+
|
197
|
+
ROUND( 0 );
|
198
|
+
ROUND( 1 );
|
199
|
+
ROUND( 2 );
|
200
|
+
ROUND( 3 );
|
201
|
+
ROUND( 4 );
|
202
|
+
ROUND( 5 );
|
203
|
+
ROUND( 6 );
|
204
|
+
ROUND( 7 );
|
205
|
+
ROUND( 8 );
|
206
|
+
ROUND( 9 );
|
207
|
+
|
208
|
+
for( i = 0; i < 8; ++i ) {
|
209
|
+
S->h[i] = S->h[i] ^ v[i] ^ v[i + 8];
|
210
|
+
}
|
211
|
+
}
|
212
|
+
|
213
|
+
#undef G
|
214
|
+
#undef ROUND
|
215
|
+
|
216
|
+
int blake2s_update( blake2s_state *S, const void *pin, size_t inlen )
|
217
|
+
{
|
218
|
+
const unsigned char * in = (const unsigned char *)pin;
|
219
|
+
if( inlen > 0 )
|
220
|
+
{
|
221
|
+
size_t left = S->buflen;
|
222
|
+
size_t fill = BLAKE2S_BLOCKBYTES - left;
|
223
|
+
if( inlen > fill )
|
224
|
+
{
|
225
|
+
S->buflen = 0;
|
226
|
+
memcpy( S->buf + left, in, fill ); /* Fill buffer */
|
227
|
+
blake2s_increment_counter( S, BLAKE2S_BLOCKBYTES );
|
228
|
+
blake2s_compress( S, S->buf ); /* Compress */
|
229
|
+
in += fill; inlen -= fill;
|
230
|
+
while(inlen > BLAKE2S_BLOCKBYTES) {
|
231
|
+
blake2s_increment_counter(S, BLAKE2S_BLOCKBYTES);
|
232
|
+
blake2s_compress( S, in );
|
233
|
+
in += BLAKE2S_BLOCKBYTES;
|
234
|
+
inlen -= BLAKE2S_BLOCKBYTES;
|
235
|
+
}
|
236
|
+
}
|
237
|
+
memcpy( S->buf + S->buflen, in, inlen );
|
238
|
+
S->buflen += inlen;
|
239
|
+
}
|
240
|
+
return 0;
|
241
|
+
}
|
242
|
+
|
243
|
+
int blake2s_final( blake2s_state *S, void *out, size_t outlen )
|
244
|
+
{
|
245
|
+
uint8_t buffer[BLAKE2S_OUTBYTES] = {0};
|
246
|
+
size_t i;
|
247
|
+
|
248
|
+
if( out == NULL || outlen < S->outlen )
|
249
|
+
return -1;
|
250
|
+
|
251
|
+
if( blake2s_is_lastblock( S ) )
|
252
|
+
return -1;
|
253
|
+
|
254
|
+
blake2s_increment_counter( S, ( uint32_t )S->buflen );
|
255
|
+
blake2s_set_lastblock( S );
|
256
|
+
memset( S->buf + S->buflen, 0, BLAKE2S_BLOCKBYTES - S->buflen ); /* Padding */
|
257
|
+
blake2s_compress( S, S->buf );
|
258
|
+
|
259
|
+
for( i = 0; i < 8; ++i ) /* Output full hash to temp buffer */
|
260
|
+
store32( buffer + sizeof( S->h[i] ) * i, S->h[i] );
|
261
|
+
|
262
|
+
memcpy( out, buffer, outlen );
|
263
|
+
secure_zero_memory(buffer, sizeof(buffer));
|
264
|
+
return 0;
|
265
|
+
}
|
266
|
+
|
267
|
+
int blake2s( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
|
268
|
+
{
|
269
|
+
blake2s_state S[1];
|
270
|
+
|
271
|
+
/* Verify parameters */
|
272
|
+
if ( NULL == in && inlen > 0 ) return -1;
|
273
|
+
|
274
|
+
if ( NULL == out ) return -1;
|
275
|
+
|
276
|
+
if ( NULL == key && keylen > 0) return -1;
|
277
|
+
|
278
|
+
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
279
|
+
|
280
|
+
if( keylen > BLAKE2S_KEYBYTES ) return -1;
|
281
|
+
|
282
|
+
if( keylen > 0 )
|
283
|
+
{
|
284
|
+
if( blake2s_init_key( S, outlen, key, keylen ) < 0 ) return -1;
|
285
|
+
}
|
286
|
+
else
|
287
|
+
{
|
288
|
+
if( blake2s_init( S, outlen ) < 0 ) return -1;
|
289
|
+
}
|
290
|
+
|
291
|
+
blake2s_update( S, ( const uint8_t * )in, inlen );
|
292
|
+
blake2s_final( S, out, outlen );
|
293
|
+
return 0;
|
294
|
+
}
|
295
|
+
|
296
|
+
#if defined(SUPERCOP)
|
297
|
+
int crypto_hash( unsigned char *out, unsigned char *in, unsigned long long inlen )
|
298
|
+
{
|
299
|
+
return blake2s( out, BLAKE2S_OUTBYTES, in, inlen, NULL, 0 );
|
300
|
+
}
|
301
|
+
#endif
|
302
|
+
|
303
|
+
#if defined(BLAKE2S_SELFTEST)
|
304
|
+
#include <string.h>
|
305
|
+
#include "blake2-kat.h"
|
306
|
+
int main( void )
|
307
|
+
{
|
308
|
+
uint8_t key[BLAKE2S_KEYBYTES];
|
309
|
+
uint8_t buf[BLAKE2_KAT_LENGTH];
|
310
|
+
size_t i, step;
|
311
|
+
|
312
|
+
for( i = 0; i < BLAKE2S_KEYBYTES; ++i )
|
313
|
+
key[i] = ( uint8_t )i;
|
314
|
+
|
315
|
+
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
316
|
+
buf[i] = ( uint8_t )i;
|
317
|
+
|
318
|
+
/* Test simple API */
|
319
|
+
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
320
|
+
{
|
321
|
+
uint8_t hash[BLAKE2S_OUTBYTES];
|
322
|
+
blake2s( hash, BLAKE2S_OUTBYTES, buf, i, key, BLAKE2S_KEYBYTES );
|
323
|
+
|
324
|
+
if( 0 != memcmp( hash, blake2s_keyed_kat[i], BLAKE2S_OUTBYTES ) )
|
325
|
+
{
|
326
|
+
goto fail;
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
/* Test streaming API */
|
331
|
+
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
|
332
|
+
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
|
333
|
+
uint8_t hash[BLAKE2S_OUTBYTES];
|
334
|
+
blake2s_state S;
|
335
|
+
uint8_t * p = buf;
|
336
|
+
size_t mlen = i;
|
337
|
+
int err = 0;
|
338
|
+
|
339
|
+
if( (err = blake2s_init_key(&S, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
340
|
+
goto fail;
|
341
|
+
}
|
342
|
+
|
343
|
+
while (mlen >= step) {
|
344
|
+
if ( (err = blake2s_update(&S, p, step)) < 0 ) {
|
345
|
+
goto fail;
|
346
|
+
}
|
347
|
+
mlen -= step;
|
348
|
+
p += step;
|
349
|
+
}
|
350
|
+
if ( (err = blake2s_update(&S, p, mlen)) < 0) {
|
351
|
+
goto fail;
|
352
|
+
}
|
353
|
+
if ( (err = blake2s_final(&S, hash, BLAKE2S_OUTBYTES)) < 0) {
|
354
|
+
goto fail;
|
355
|
+
}
|
356
|
+
|
357
|
+
if (0 != memcmp(hash, blake2s_keyed_kat[i], BLAKE2S_OUTBYTES)) {
|
358
|
+
goto fail;
|
359
|
+
}
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
puts( "ok" );
|
364
|
+
return 0;
|
365
|
+
fail:
|
366
|
+
puts("error");
|
367
|
+
return -1;
|
368
|
+
}
|
369
|
+
#endif
|
@@ -0,0 +1,361 @@
|
|
1
|
+
/*
|
2
|
+
BLAKE2 reference source code package - reference C implementations
|
3
|
+
|
4
|
+
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
|
5
|
+
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
|
6
|
+
your option. The terms of these licenses can be found at:
|
7
|
+
|
8
|
+
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
|
9
|
+
- OpenSSL license : https://www.openssl.org/source/license.html
|
10
|
+
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
|
12
|
+
More information about the BLAKE2 hash function can be found at
|
13
|
+
https://blake2.net.
|
14
|
+
*/
|
15
|
+
|
16
|
+
#include "archive_platform.h"
|
17
|
+
|
18
|
+
#include <stdlib.h>
|
19
|
+
#include <string.h>
|
20
|
+
#include <stdio.h>
|
21
|
+
|
22
|
+
#if defined(_OPENMP)
|
23
|
+
#include <omp.h>
|
24
|
+
#endif
|
25
|
+
|
26
|
+
#include "archive_blake2.h"
|
27
|
+
#include "archive_blake2_impl.h"
|
28
|
+
|
29
|
+
#define PARALLELISM_DEGREE 8
|
30
|
+
|
31
|
+
/*
|
32
|
+
blake2sp_init_param defaults to setting the expecting output length
|
33
|
+
from the digest_length parameter block field.
|
34
|
+
|
35
|
+
In some cases, however, we do not want this, as the output length
|
36
|
+
of these instances is given by inner_length instead.
|
37
|
+
*/
|
38
|
+
static int blake2sp_init_leaf_param( blake2s_state *S, const blake2s_param *P )
|
39
|
+
{
|
40
|
+
int err = blake2s_init_param(S, P);
|
41
|
+
S->outlen = P->inner_length;
|
42
|
+
return err;
|
43
|
+
}
|
44
|
+
|
45
|
+
static int blake2sp_init_leaf( blake2s_state *S, size_t outlen, size_t keylen, uint32_t offset )
|
46
|
+
{
|
47
|
+
blake2s_param P[1];
|
48
|
+
P->digest_length = (uint8_t)outlen;
|
49
|
+
P->key_length = (uint8_t)keylen;
|
50
|
+
P->fanout = PARALLELISM_DEGREE;
|
51
|
+
P->depth = 2;
|
52
|
+
store32( &P->leaf_length, 0 );
|
53
|
+
store32( &P->node_offset, offset );
|
54
|
+
store16( &P->xof_length, 0 );
|
55
|
+
P->node_depth = 0;
|
56
|
+
P->inner_length = BLAKE2S_OUTBYTES;
|
57
|
+
memset( P->salt, 0, sizeof( P->salt ) );
|
58
|
+
memset( P->personal, 0, sizeof( P->personal ) );
|
59
|
+
return blake2sp_init_leaf_param( S, P );
|
60
|
+
}
|
61
|
+
|
62
|
+
static int blake2sp_init_root( blake2s_state *S, size_t outlen, size_t keylen )
|
63
|
+
{
|
64
|
+
blake2s_param P[1];
|
65
|
+
P->digest_length = (uint8_t)outlen;
|
66
|
+
P->key_length = (uint8_t)keylen;
|
67
|
+
P->fanout = PARALLELISM_DEGREE;
|
68
|
+
P->depth = 2;
|
69
|
+
store32( &P->leaf_length, 0 );
|
70
|
+
store32( &P->node_offset, 0 );
|
71
|
+
store16( &P->xof_length, 0 );
|
72
|
+
P->node_depth = 1;
|
73
|
+
P->inner_length = BLAKE2S_OUTBYTES;
|
74
|
+
memset( P->salt, 0, sizeof( P->salt ) );
|
75
|
+
memset( P->personal, 0, sizeof( P->personal ) );
|
76
|
+
return blake2s_init_param( S, P );
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
int blake2sp_init( blake2sp_state *S, size_t outlen )
|
81
|
+
{
|
82
|
+
size_t i;
|
83
|
+
|
84
|
+
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
85
|
+
|
86
|
+
memset( S->buf, 0, sizeof( S->buf ) );
|
87
|
+
S->buflen = 0;
|
88
|
+
S->outlen = outlen;
|
89
|
+
|
90
|
+
if( blake2sp_init_root( S->R, outlen, 0 ) < 0 )
|
91
|
+
return -1;
|
92
|
+
|
93
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
94
|
+
if( blake2sp_init_leaf( S->S[i], outlen, 0, (uint32_t)i ) < 0 ) return -1;
|
95
|
+
|
96
|
+
S->R->last_node = 1;
|
97
|
+
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
|
98
|
+
return 0;
|
99
|
+
}
|
100
|
+
|
101
|
+
int blake2sp_init_key( blake2sp_state *S, size_t outlen, const void *key, size_t keylen )
|
102
|
+
{
|
103
|
+
size_t i;
|
104
|
+
|
105
|
+
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
106
|
+
|
107
|
+
if( !key || !keylen || keylen > BLAKE2S_KEYBYTES ) return -1;
|
108
|
+
|
109
|
+
memset( S->buf, 0, sizeof( S->buf ) );
|
110
|
+
S->buflen = 0;
|
111
|
+
S->outlen = outlen;
|
112
|
+
|
113
|
+
if( blake2sp_init_root( S->R, outlen, keylen ) < 0 )
|
114
|
+
return -1;
|
115
|
+
|
116
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
117
|
+
if( blake2sp_init_leaf( S->S[i], outlen, keylen, (uint32_t)i ) < 0 ) return -1;
|
118
|
+
|
119
|
+
S->R->last_node = 1;
|
120
|
+
S->S[PARALLELISM_DEGREE - 1]->last_node = 1;
|
121
|
+
{
|
122
|
+
uint8_t block[BLAKE2S_BLOCKBYTES];
|
123
|
+
memset( block, 0, BLAKE2S_BLOCKBYTES );
|
124
|
+
memcpy( block, key, keylen );
|
125
|
+
|
126
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
127
|
+
blake2s_update( S->S[i], block, BLAKE2S_BLOCKBYTES );
|
128
|
+
|
129
|
+
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
|
130
|
+
}
|
131
|
+
return 0;
|
132
|
+
}
|
133
|
+
|
134
|
+
|
135
|
+
int blake2sp_update( blake2sp_state *S, const void *pin, size_t inlen )
|
136
|
+
{
|
137
|
+
const unsigned char * in = (const unsigned char *)pin;
|
138
|
+
size_t left = S->buflen;
|
139
|
+
size_t fill = sizeof( S->buf ) - left;
|
140
|
+
size_t i;
|
141
|
+
|
142
|
+
if( left && inlen >= fill )
|
143
|
+
{
|
144
|
+
memcpy( S->buf + left, in, fill );
|
145
|
+
|
146
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
147
|
+
blake2s_update( S->S[i], S->buf + i * BLAKE2S_BLOCKBYTES, BLAKE2S_BLOCKBYTES );
|
148
|
+
|
149
|
+
in += fill;
|
150
|
+
inlen -= fill;
|
151
|
+
left = 0;
|
152
|
+
}
|
153
|
+
|
154
|
+
#if defined(_OPENMP)
|
155
|
+
#pragma omp parallel shared(S), num_threads(PARALLELISM_DEGREE)
|
156
|
+
#else
|
157
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
158
|
+
#endif
|
159
|
+
{
|
160
|
+
#if defined(_OPENMP)
|
161
|
+
size_t i = omp_get_thread_num();
|
162
|
+
#endif
|
163
|
+
size_t inlen__ = inlen;
|
164
|
+
const unsigned char *in__ = ( const unsigned char * )in;
|
165
|
+
in__ += i * BLAKE2S_BLOCKBYTES;
|
166
|
+
|
167
|
+
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES )
|
168
|
+
{
|
169
|
+
blake2s_update( S->S[i], in__, BLAKE2S_BLOCKBYTES );
|
170
|
+
in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
171
|
+
inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
in += inlen - inlen % ( PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES );
|
176
|
+
inlen %= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
177
|
+
|
178
|
+
if( inlen > 0 )
|
179
|
+
memcpy( S->buf + left, in, inlen );
|
180
|
+
|
181
|
+
S->buflen = left + inlen;
|
182
|
+
return 0;
|
183
|
+
}
|
184
|
+
|
185
|
+
|
186
|
+
int blake2sp_final( blake2sp_state *S, void *out, size_t outlen )
|
187
|
+
{
|
188
|
+
uint8_t hash[PARALLELISM_DEGREE][BLAKE2S_OUTBYTES];
|
189
|
+
size_t i;
|
190
|
+
|
191
|
+
if(out == NULL || outlen < S->outlen) {
|
192
|
+
return -1;
|
193
|
+
}
|
194
|
+
|
195
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
196
|
+
{
|
197
|
+
if( S->buflen > i * BLAKE2S_BLOCKBYTES )
|
198
|
+
{
|
199
|
+
size_t left = S->buflen - i * BLAKE2S_BLOCKBYTES;
|
200
|
+
|
201
|
+
if( left > BLAKE2S_BLOCKBYTES ) left = BLAKE2S_BLOCKBYTES;
|
202
|
+
|
203
|
+
blake2s_update( S->S[i], S->buf + i * BLAKE2S_BLOCKBYTES, left );
|
204
|
+
}
|
205
|
+
|
206
|
+
blake2s_final( S->S[i], hash[i], BLAKE2S_OUTBYTES );
|
207
|
+
}
|
208
|
+
|
209
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
210
|
+
blake2s_update( S->R, hash[i], BLAKE2S_OUTBYTES );
|
211
|
+
|
212
|
+
return blake2s_final( S->R, out, S->outlen );
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
int blake2sp( void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen )
|
217
|
+
{
|
218
|
+
uint8_t hash[PARALLELISM_DEGREE][BLAKE2S_OUTBYTES];
|
219
|
+
blake2s_state S[PARALLELISM_DEGREE][1];
|
220
|
+
blake2s_state FS[1];
|
221
|
+
size_t i;
|
222
|
+
|
223
|
+
/* Verify parameters */
|
224
|
+
if ( NULL == in && inlen > 0 ) return -1;
|
225
|
+
|
226
|
+
if ( NULL == out ) return -1;
|
227
|
+
|
228
|
+
if ( NULL == key && keylen > 0) return -1;
|
229
|
+
|
230
|
+
if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
|
231
|
+
|
232
|
+
if( keylen > BLAKE2S_KEYBYTES ) return -1;
|
233
|
+
|
234
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
235
|
+
if( blake2sp_init_leaf( S[i], outlen, keylen, (uint32_t)i ) < 0 ) return -1;
|
236
|
+
|
237
|
+
S[PARALLELISM_DEGREE - 1]->last_node = 1; /* mark last node */
|
238
|
+
|
239
|
+
if( keylen > 0 )
|
240
|
+
{
|
241
|
+
uint8_t block[BLAKE2S_BLOCKBYTES];
|
242
|
+
memset( block, 0, BLAKE2S_BLOCKBYTES );
|
243
|
+
memcpy( block, key, keylen );
|
244
|
+
|
245
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
246
|
+
blake2s_update( S[i], block, BLAKE2S_BLOCKBYTES );
|
247
|
+
|
248
|
+
secure_zero_memory( block, BLAKE2S_BLOCKBYTES ); /* Burn the key from stack */
|
249
|
+
}
|
250
|
+
|
251
|
+
#if defined(_OPENMP)
|
252
|
+
#pragma omp parallel shared(S,hash), num_threads(PARALLELISM_DEGREE)
|
253
|
+
#else
|
254
|
+
|
255
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
256
|
+
#endif
|
257
|
+
{
|
258
|
+
#if defined(_OPENMP)
|
259
|
+
size_t i = omp_get_thread_num();
|
260
|
+
#endif
|
261
|
+
size_t inlen__ = inlen;
|
262
|
+
const unsigned char *in__ = ( const unsigned char * )in;
|
263
|
+
in__ += i * BLAKE2S_BLOCKBYTES;
|
264
|
+
|
265
|
+
while( inlen__ >= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES )
|
266
|
+
{
|
267
|
+
blake2s_update( S[i], in__, BLAKE2S_BLOCKBYTES );
|
268
|
+
in__ += PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
269
|
+
inlen__ -= PARALLELISM_DEGREE * BLAKE2S_BLOCKBYTES;
|
270
|
+
}
|
271
|
+
|
272
|
+
if( inlen__ > i * BLAKE2S_BLOCKBYTES )
|
273
|
+
{
|
274
|
+
const size_t left = inlen__ - i * BLAKE2S_BLOCKBYTES;
|
275
|
+
const size_t len = left <= BLAKE2S_BLOCKBYTES ? left : BLAKE2S_BLOCKBYTES;
|
276
|
+
blake2s_update( S[i], in__, len );
|
277
|
+
}
|
278
|
+
|
279
|
+
blake2s_final( S[i], hash[i], BLAKE2S_OUTBYTES );
|
280
|
+
}
|
281
|
+
|
282
|
+
if( blake2sp_init_root( FS, outlen, keylen ) < 0 )
|
283
|
+
return -1;
|
284
|
+
|
285
|
+
FS->last_node = 1;
|
286
|
+
|
287
|
+
for( i = 0; i < PARALLELISM_DEGREE; ++i )
|
288
|
+
blake2s_update( FS, hash[i], BLAKE2S_OUTBYTES );
|
289
|
+
|
290
|
+
return blake2s_final( FS, out, outlen );
|
291
|
+
}
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
#if defined(BLAKE2SP_SELFTEST)
|
296
|
+
#include <string.h>
|
297
|
+
#include "blake2-kat.h"
|
298
|
+
int main( void )
|
299
|
+
{
|
300
|
+
uint8_t key[BLAKE2S_KEYBYTES];
|
301
|
+
uint8_t buf[BLAKE2_KAT_LENGTH];
|
302
|
+
size_t i, step;
|
303
|
+
|
304
|
+
for( i = 0; i < BLAKE2S_KEYBYTES; ++i )
|
305
|
+
key[i] = ( uint8_t )i;
|
306
|
+
|
307
|
+
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
308
|
+
buf[i] = ( uint8_t )i;
|
309
|
+
|
310
|
+
/* Test simple API */
|
311
|
+
for( i = 0; i < BLAKE2_KAT_LENGTH; ++i )
|
312
|
+
{
|
313
|
+
uint8_t hash[BLAKE2S_OUTBYTES];
|
314
|
+
blake2sp( hash, BLAKE2S_OUTBYTES, buf, i, key, BLAKE2S_KEYBYTES );
|
315
|
+
|
316
|
+
if( 0 != memcmp( hash, blake2sp_keyed_kat[i], BLAKE2S_OUTBYTES ) )
|
317
|
+
{
|
318
|
+
goto fail;
|
319
|
+
}
|
320
|
+
}
|
321
|
+
|
322
|
+
/* Test streaming API */
|
323
|
+
for(step = 1; step < BLAKE2S_BLOCKBYTES; ++step) {
|
324
|
+
for (i = 0; i < BLAKE2_KAT_LENGTH; ++i) {
|
325
|
+
uint8_t hash[BLAKE2S_OUTBYTES];
|
326
|
+
blake2sp_state S;
|
327
|
+
uint8_t * p = buf;
|
328
|
+
size_t mlen = i;
|
329
|
+
int err = 0;
|
330
|
+
|
331
|
+
if( (err = blake2sp_init_key(&S, BLAKE2S_OUTBYTES, key, BLAKE2S_KEYBYTES)) < 0 ) {
|
332
|
+
goto fail;
|
333
|
+
}
|
334
|
+
|
335
|
+
while (mlen >= step) {
|
336
|
+
if ( (err = blake2sp_update(&S, p, step)) < 0 ) {
|
337
|
+
goto fail;
|
338
|
+
}
|
339
|
+
mlen -= step;
|
340
|
+
p += step;
|
341
|
+
}
|
342
|
+
if ( (err = blake2sp_update(&S, p, mlen)) < 0) {
|
343
|
+
goto fail;
|
344
|
+
}
|
345
|
+
if ( (err = blake2sp_final(&S, hash, BLAKE2S_OUTBYTES)) < 0) {
|
346
|
+
goto fail;
|
347
|
+
}
|
348
|
+
|
349
|
+
if (0 != memcmp(hash, blake2sp_keyed_kat[i], BLAKE2S_OUTBYTES)) {
|
350
|
+
goto fail;
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|
354
|
+
|
355
|
+
puts( "ok" );
|
356
|
+
return 0;
|
357
|
+
fail:
|
358
|
+
puts("error");
|
359
|
+
return -1;
|
360
|
+
}
|
361
|
+
#endif
|