diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2021-08-02 10:11:41 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2021-08-02 10:11:41 +0200 |
commit | 6efb5e9f5e3cd3ec811ae832a67e1878c14f0dea (patch) | |
tree | b7c1a18b8bbc638ee12951d1d04db6d21bebcaed /extra | |
parent | 07674e6a741a82d2e30f9798f699209a6c34dfef (diff) | |
parent | ec8882b9ddbba2f9fc3571a1ac2ade0dabf412d9 (diff) | |
download | mariadb-git-6efb5e9f5e3cd3ec811ae832a67e1878c14f0dea.tar.gz |
Merge branch '10.5' into 10.6
Diffstat (limited to 'extra')
-rw-r--r-- | extra/innochecksum.cc | 199 | ||||
-rw-r--r-- | extra/mariabackup/CMakeLists.txt | 1 | ||||
-rw-r--r-- | extra/mariabackup/backup_mysql.cc | 2 | ||||
-rw-r--r-- | extra/mariabackup/innobackupex.cc | 2 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 4 | ||||
-rw-r--r-- | extra/my_print_defaults.c | 34 | ||||
-rw-r--r-- | extra/wolfssl/CMakeLists.txt | 24 | ||||
-rw-r--r-- | extra/wolfssl/user_settings.h.in | 21 | ||||
m--------- | extra/wolfssl/wolfssl | 0 |
9 files changed, 178 insertions, 109 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 6ca68c47834..ce3911502fb 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -60,9 +60,9 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */ /* Global variables */ static bool verbose; static bool just_count; -static unsigned long long start_page; -static unsigned long long end_page; -static unsigned long long do_page; +static uint32_t start_page; +static uint32_t end_page; +static uint32_t do_page; static bool use_end_page; static bool do_one_page; static my_bool do_leaf; @@ -72,9 +72,9 @@ static ulint physical_page_size; /* Page size in bytes on disk. */ ulong srv_page_size; ulong srv_page_size_shift; /* Current page number (0 based). */ -unsigned long long cur_page_num; +uint32_t cur_page_num; /* Current space. */ -unsigned long long cur_space; +uint32_t cur_space; /* Skip the checksum verification. */ static bool no_check; /* Enabled for rewrite checksum. */ @@ -439,11 +439,11 @@ is_page_corrupted( /* enable if page is corrupted. */ bool is_corrupted; /* use to store LSN values. */ - ulint logseq; - ulint logseqfield; - const uint16_t page_type = fil_page_get_type(buf); - uint key_version = buf_page_get_key_version(buf, flags); - ulint space_id = mach_read_from_4( + uint32_t logseq; + uint32_t logseqfield; + const uint16_t page_type = mach_read_from_2(buf+FIL_PAGE_TYPE); + uint32_t key_version = buf_page_get_key_version(buf, flags); + uint32_t space_id = mach_read_from_4( buf + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); ulint zip_size = fil_space_t::zip_size(flags); ulint is_compressed = fil_space_t::is_compressed(flags); @@ -461,8 +461,8 @@ is_page_corrupted( if (is_log_enabled) { fprintf(log_file, - "page id mismatch space::" ULINTPF - " page::%llu \n", + "page id mismatch space::" UINT32PF + " page::" UINT32PF " \n", space_id, cur_page_num); } @@ -491,13 +491,14 @@ is_page_corrupted( if (is_log_enabled) { fprintf(log_file, - "space::" ULINTPF " page::%llu" - "; log sequence number:first = " ULINTPF - "; second = " ULINTPF "\n", + "space::" UINT32PF " page::" UINT32PF + "; log sequence number:first = " UINT32PF + "; second = " UINT32PF "\n", space_id, cur_page_num, logseq, logseqfield); if (logseq != logseqfield) { fprintf(log_file, - "Fail; space::" ULINTPF " page::%llu" + "Fail; space::" UINT32PF + " page::" UINT32PF " invalid (fails log " "sequence number check)\n", space_id, cur_page_num); @@ -521,9 +522,9 @@ is_page_corrupted( if (is_corrupted && log_file) { fprintf(log_file, - "[page id: space=" ULINTPF - ", page_number=%llu] may be corrupted;" - " key_version=%u\n", + "[page id: space=" UINT32PF + ", page_number=" UINT32PF "] may be corrupted;" + " key_version=" UINT32PF "\n", space_id, cur_page_num, key_version); } } else { @@ -626,8 +627,8 @@ static bool update_checksum(byte* page, ulint flags) mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum); if (is_log_enabled) { - fprintf(log_file, "page::%llu; Updated checksum =" - " %u\n", cur_page_num, checksum); + fprintf(log_file, "page::" UINT32PF "; Updated checksum =" + " " UINT32PF "\n", cur_page_num, checksum); } } else if (use_full_crc32) { @@ -638,7 +639,7 @@ static bool update_checksum(byte* page, ulint flags) if (mach_read_from_4(c) == checksum) return false; mach_write_to_4(c, checksum); if (is_log_enabled) { - fprintf(log_file, "page::%llu; Updated checksum" + fprintf(log_file, "page::" UINT32PF "; Updated checksum" " = %u\n", cur_page_num, checksum); } return true; @@ -650,8 +651,9 @@ static bool update_checksum(byte* page, ulint flags) mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum); if (is_log_enabled) { - fprintf(log_file, "page::%llu; Updated checksum" - " = %u\n", cur_page_num, checksum); + fprintf(log_file, "page::" UINT32PF + "; Updated checksum = " UINT32PF "\n", + cur_page_num, checksum); } mach_write_to_4(page + physical_page_size - @@ -725,7 +727,8 @@ write_file( if (physical_page_size != fwrite(buf, 1, physical_page_size, file == stdin ? stdout : file)) { - fprintf(stderr, "Failed to write page::%llu to %s: %s\n", + fprintf(stderr, + "Failed to write page::" UINT32PF " to %s: %s\n", cur_page_num, filename, strerror(errno)); return(false); @@ -742,6 +745,16 @@ write_file( return(true); } +// checks using current xdes page whether the page is free +static inline bool is_page_free(const byte *xdes, ulint physical_page_size, + uint32_t page_no) +{ + const byte *des= + xdes + XDES_ARR_OFFSET + + XDES_SIZE * ((page_no & (physical_page_size - 1)) / FSP_EXTENT_SIZE); + return xdes_is_free(des, page_no % FSP_EXTENT_SIZE); +} + /* Parse the page and collect/dump the information about page type @param [in] page buffer page @@ -757,12 +770,10 @@ parse_page( bool is_encrypted) { unsigned long long id; - ulint undo_page_type; + uint16_t undo_page_type; char str[20]={'\0'}; ulint n_recs; - ulint page_no; - ulint left_page_no; - ulint right_page_no; + uint32_t page_no, left_page_no, right_page_no; ulint data_bytes; bool is_leaf; ulint size_range_id; @@ -777,7 +788,7 @@ parse_page( switch (fil_page_get_type(page)) { case FIL_PAGE_INDEX: { - uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); + uint32_t key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); page_type.n_fil_page_index++; /* If page is encrypted we can't read index header */ @@ -801,7 +812,7 @@ parse_page( is_leaf = (!*(const uint16*) (page + (PAGE_HEADER + PAGE_LEVEL))); if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tIndex page\t\t\t|" + fprintf(file, "#::" UINT32PF "\t\t|\t\tIndex page\t\t\t|" "\tindex id=%llu,", cur_page_num, id); fprintf(file, @@ -819,22 +830,13 @@ parse_page( size_range_id = SIZE_RANGES_FOR_PAGE + 1; } if (per_page_details) { - printf("index id=%llu page " ULINTPF " leaf %d n_recs " ULINTPF " data_bytes " ULINTPF + printf("index id=%llu page " UINT32PF " leaf %d n_recs " ULINTPF " data_bytes " ULINTPF "\n", id, page_no, is_leaf, n_recs, data_bytes); } /* update per-index statistics */ { - if (index_ids.count(id) == 0) { - index_ids[id] = per_index_stats(); - } - std::map<unsigned long long, per_index_stats>::iterator it; - it = index_ids.find(id); - per_index_stats &index = (it->second); - const byte* des = xdes + XDES_ARR_OFFSET - + XDES_SIZE * ((page_no & (physical_page_size - 1)) - / FSP_EXTENT_SIZE); - if (xdes_is_free(des, - page_no % FSP_EXTENT_SIZE)) { + per_index_stats &index = index_ids[id]; + if (is_page_free(xdes, physical_page_size, page_no)) { index.free_pages++; return; } @@ -862,8 +864,8 @@ parse_page( index.pages_in_size_range[size_range_id] ++; } } else { - fprintf(file, "#::%llu\t\t|\t\tEncrypted Index page\t\t\t|" - "\tkey_version %u,%s\n", cur_page_num, key_version, str); + fprintf(file, "#::" UINT32PF "\t\t|\t\tEncrypted Index page\t\t\t|" + "\tkey_version " UINT32PF ",%s\n", cur_page_num, key_version, str); } break; @@ -873,7 +875,7 @@ parse_page( undo_page_type = mach_read_from_2(page + TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_TYPE); if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tUndo log page\t\t\t|", + fprintf(file, "#::" UINT32PF "\t\t|\t\tUndo log page\t\t\t|", cur_page_num); } page_type.n_undo++; @@ -925,7 +927,7 @@ parse_page( case FIL_PAGE_INODE: page_type.n_fil_page_inode++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tInode page\t\t\t|" + fprintf(file, "#::" UINT32PF "\t\t|\t\tInode page\t\t\t|" "\t%s\n",cur_page_num, str); } break; @@ -933,7 +935,7 @@ parse_page( case FIL_PAGE_IBUF_FREE_LIST: page_type.n_fil_page_ibuf_free_list++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tInsert buffer free list" + fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert buffer free list" " page\t|\t%s\n", cur_page_num, str); } break; @@ -941,7 +943,7 @@ parse_page( case FIL_PAGE_TYPE_ALLOCATED: page_type.n_fil_page_type_allocated++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tFreshly allocated " + fprintf(file, "#::" UINT32PF "\t\t|\t\tFreshly allocated " "page\t\t|\t%s\n", cur_page_num, str); } break; @@ -949,7 +951,7 @@ parse_page( case FIL_PAGE_IBUF_BITMAP: page_type.n_fil_page_ibuf_bitmap++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tInsert Buffer " + fprintf(file, "#::" UINT32PF "\t\t|\t\tInsert Buffer " "Bitmap\t\t|\t%s\n", cur_page_num, str); } break; @@ -957,33 +959,31 @@ parse_page( case FIL_PAGE_TYPE_SYS: page_type.n_fil_page_type_sys++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tSystem page\t\t\t|" - "\t%s\n",cur_page_num, str); + fprintf(file, "#::" UINT32PF "\t\t|\t\tSystem page\t\t\t|" + "\t%s\n", cur_page_num, str); } break; case FIL_PAGE_TYPE_TRX_SYS: page_type.n_fil_page_type_trx_sys++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tTransaction system " + fprintf(file, "#::" UINT32PF "\t\t|\t\tTransaction system " "page\t\t|\t%s\n", cur_page_num, str); } break; case FIL_PAGE_TYPE_FSP_HDR: page_type.n_fil_page_type_fsp_hdr++; - memcpy(xdes, page, physical_page_size); if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tFile Space " + fprintf(file, "#::" UINT32PF "\t\t|\t\tFile Space " "Header\t\t|\t%s\n", cur_page_num, str); } break; case FIL_PAGE_TYPE_XDES: page_type.n_fil_page_type_xdes++; - memcpy(xdes, page, physical_page_size); if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tExtent descriptor " + fprintf(file, "#::" UINT32PF "\t\t|\t\tExtent descriptor " "page\t\t|\t%s\n", cur_page_num, str); } break; @@ -991,7 +991,7 @@ parse_page( case FIL_PAGE_TYPE_BLOB: page_type.n_fil_page_type_blob++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tBLOB page\t\t\t|\t%s\n", + fprintf(file, "#::" UINT32PF "\t\t|\t\tBLOB page\t\t\t|\t%s\n", cur_page_num, str); } break; @@ -999,7 +999,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB: page_type.n_fil_page_type_zblob++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tCompressed BLOB " + fprintf(file, "#::" UINT32PF "\t\t|\t\tCompressed BLOB " "page\t\t|\t%s\n", cur_page_num, str); } break; @@ -1007,7 +1007,7 @@ parse_page( case FIL_PAGE_TYPE_ZBLOB2: page_type.n_fil_page_type_zblob2++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tSubsequent Compressed " + fprintf(file, "#::" UINT32PF "\t\t|\t\tSubsequent Compressed " "BLOB page\t|\t%s\n", cur_page_num, str); } break; @@ -1015,7 +1015,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED: page_type.n_fil_page_type_page_compressed++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tPage compressed " + fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed " "page\t|\t%s\n", cur_page_num, str); } break; @@ -1023,7 +1023,7 @@ parse_page( case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED: page_type.n_fil_page_type_page_compressed_encrypted++; if (page_type_dump) { - fprintf(file, "#::%llu\t\t|\t\tPage compressed encrypted " + fprintf(file, "#::" UINT32PF "\t\t|\t\tPage compressed encrypted " "page\t|\t%s\n", cur_page_num, str); } break; @@ -1175,14 +1175,14 @@ static struct my_option innochecksum_options[] = { {"count", 'c', "Print the count of pages in the file and exits.", &just_count, &just_count, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"start_page", 's', "Start on this page number (0 based).", - &start_page, &start_page, 0, GET_ULL, REQUIRED_ARG, - 0, 0, ULLONG_MAX, 0, 1, 0}, + &start_page, &start_page, 0, GET_UINT, REQUIRED_ARG, + 0, 0, FIL_NULL, 0, 1, 0}, {"end_page", 'e', "End at this page number (0 based).", - &end_page, &end_page, 0, GET_ULL, REQUIRED_ARG, - 0, 0, ULLONG_MAX, 0, 1, 0}, + &end_page, &end_page, 0, GET_UINT, REQUIRED_ARG, + 0, 0, FIL_NULL, 0, 1, 0}, {"page", 'p', "Check only this page (0 based).", - &do_page, &do_page, 0, GET_ULL, REQUIRED_ARG, - 0, 0, ULLONG_MAX, 0, 1, 0}, + &do_page, &do_page, 0, GET_UINT, REQUIRED_ARG, + 0, 0, FIL_NULL, 0, 1, 0}, {"no-check", 'n', "Ignore the checksum verification.", &no_check, &no_check, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"allow-mismatches", 'a', "Maximum checksum mismatch allowed.", @@ -1340,14 +1340,14 @@ static bool check_encryption(const char* filename, const byte* page) return false; } - uint min_key_version = mach_read_from_4 + uint32_t min_key_version = mach_read_from_4 (page + offset + MAGIC_SZ + 2 + iv_length); - uint key_id = mach_read_from_4 + uint32_t key_id = mach_read_from_4 (page + offset + MAGIC_SZ + 2 + iv_length + 4); if (type == CRYPT_SCHEME_1 && is_log_enabled) { - fprintf(log_file,"Tablespace %s encrypted key_version %u key_id %u\n", + fprintf(log_file,"Tablespace %s encrypted key_version " UINT32PF " key_id " UINT32PF "\n", filename, min_key_version, key_id); } @@ -1369,7 +1369,7 @@ static int verify_checksum( { int exit_status = 0; if (is_page_corrupted(buf, is_encrypted, flags)) { - fprintf(stderr, "Fail: page::%llu invalid\n", + fprintf(stderr, "Fail: page::" UINT32PF " invalid\n", cur_page_num); (*mismatch_count)++; @@ -1443,7 +1443,7 @@ int main( /* size of file (has to be 64 bits) */ unsigned long long int size = 0; /* number of pages in file */ - ulint pages; + uint32_t pages; off_t offset = 0; /* count the no. of page corrupted. */ @@ -1636,36 +1636,38 @@ int main( } if (per_page_details) { - printf("page %llu ", cur_page_num); + printf("page " UINT32PF " ", cur_page_num); } + memcpy(xdes, buf, physical_page_size); + if (page_type_summary || page_type_dump) { parse_page(buf, xdes, fil_page_type, is_encrypted); } - pages = (ulint) (size / physical_page_size); + pages = uint32_t(size / physical_page_size); if (just_count) { - if (read_from_stdin) { - fprintf(stderr, "Number of pages:" ULINTPF "\n", pages); - } else { - printf("Number of pages:" ULINTPF "\n", pages); - } + fprintf(read_from_stdin ? stderr : stdout, + "Number of pages:" UINT32PF "\n", pages); continue; } else if (verbose && !read_from_stdin) { if (is_log_enabled) { fprintf(log_file, "file %s = %llu bytes " - "(" ULINTPF " pages)\n", filename, size, pages); + "(" UINT32PF " pages)\n", + filename, size, pages); if (do_one_page) { fprintf(log_file, "Innochecksum: " - "checking page::%llu;\n", + "checking page::" + UINT32PF ";\n", do_page); } } } else { if (is_log_enabled) { fprintf(log_file, "Innochecksum: checking " - "pages in range::%llu to %llu\n", + "pages in range::" UINT32PF + " to " UINT32PF "\n", start_page, use_end_page ? end_page : (pages - 1)); } @@ -1709,8 +1711,8 @@ int main( the desired page. */ partial_page_read = false; - offset = (off_t) start_page - * (off_t) physical_page_size; + offset = off_t(ulonglong(start_page) + * physical_page_size); if (IF_WIN(_fseeki64,fseeko)(fil_in, offset, SEEK_SET)) { perror("Error: Unable to seek to " @@ -1751,12 +1753,7 @@ int main( count++; if (!bytes || feof(fil_in)) { - fprintf(stderr, "Error: Unable " - "to seek to necessary " - "offset"); - - exit_status = 1; - goto my_exit; + goto unexpected_eof; } } } @@ -1772,6 +1769,15 @@ int main( partial_page_read = false; if (!bytes && feof(fil_in)) { + if (cur_page_num == start_page) { +unexpected_eof: + fputs("Error: Unable " + "to seek to necessary offset\n", + stderr); + + exit_status = 1; + goto my_exit; + } break; } @@ -1813,6 +1819,7 @@ first_non_zero: checksum verification.*/ if (!no_check && !skip_page + && !is_page_free(xdes, physical_page_size, cur_page_num) && (exit_status = verify_checksum( buf, is_encrypted, &mismatch_count, flags))) { @@ -1831,7 +1838,11 @@ first_non_zero: } if (per_page_details) { - printf("page %llu ", cur_page_num); + printf("page " UINT32PF " ", cur_page_num); + } + + if (page_get_page_no(buf) % physical_page_size == 0) { + memcpy(xdes, buf, physical_page_size); } if (page_type_summary || page_type_dump) { @@ -1847,10 +1858,10 @@ first_non_zero: if (!lastt) { lastt= now; } else if (now - lastt >= 1 && is_log_enabled) { - fprintf(log_file, "page::%llu " + fprintf(log_file, "page::" UINT32PF " " "okay: %.3f%% done\n", (cur_page_num - 1), - (float) cur_page_num / pages * 100); + (double) cur_page_num / pages * 100); lastt = now; } } diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index 41de993317e..5776a7ddab3 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -15,6 +15,7 @@ OPTION(WITH_MARIABACKUP "Include mariabackup" ON) +ADD_FEATURE_INFO(MARIABACKUP WITH_MARIABACKUP "MariaDB Backup Utility") IF(NOT WITH_MARIABACKUP) RETURN() ENDIF() diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index f287af82e6f..178860b610c 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -917,7 +917,7 @@ bool lock_tables(MYSQL *connection) if (have_galera_enabled) { - xb_mysql_query(connection, "SET SESSION wsrep_causal_reads=0", false); + xb_mysql_query(connection, "SET SESSION wsrep_sync_wait=0", false); } xb_mysql_query(connection, "BACKUP STAGE START", true); diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 99440faf864..20f87354fd0 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -309,7 +309,7 @@ static struct my_option ibx_long_options[] = {"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS, "This " "option, when specified, makes --copy-back or --move-back transfer " "files to non-empty directories. Note that no existing files will be " - "overwritten. If --copy-back or --nove-back has to copy a file from " + "overwritten. If --copy-back or --move-back has to copy a file from " "the backup directory which already exists in the destination " "directory, it will still fail with an error.", (uchar *) &opt_ibx_force_non_empty_dirs, diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 6e321dcb436..ff6fc6100e9 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -51,7 +51,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include <my_getopt.h> #include <mysql_com.h> #include <my_default.h> -#include <mysqld.h> +#include <sql_class.h> #include <fcntl.h> #include <string.h> @@ -1207,7 +1207,7 @@ struct my_option xb_client_options[]= { "This " "option, when specified, makes --copy-back or --move-back transfer " "files to non-empty directories. Note that no existing files will be " - "overwritten. If --copy-back or --nove-back has to copy a file from " + "overwritten. If --copy-back or --move-back has to copy a file from " "the backup directory which already exists in the destination " "directory, it will still fail with an error.", (uchar *) &opt_force_non_empty_dirs, (uchar *) &opt_force_non_empty_dirs, diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index f73ac7825b6..b7f52382721 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -141,28 +141,50 @@ static int get_options(int *argc,char ***argv) return 0; } +static char *make_args(const char *s1, const char *s2) +{ + char *s= malloc(strlen(s1) + strlen(s2) + 1); + strmov(strmov(s, s1), s2); + return s; +} int main(int argc, char **argv) { - int count, error, args_used; + int count= 0, error, no_defaults= 0; char **load_default_groups= 0, *tmp_arguments[6]; char **argument, **arguments, **org_argv; int nargs, i= 0; MY_INIT(argv[0]); org_argv= argv; - args_used= get_defaults_options(argv); - - /* Copy defaults-xxx arguments & program name */ - count=args_used; + if (*argv && !strcmp(*argv, "--no-defaults")) + { + argv++; + ++count; + no_defaults= 1; + } + /* Copy program name and --no-defaults if present*/ arguments= tmp_arguments; - memcpy((char*) arguments, (char*) org_argv, count * sizeof(*org_argv)); + memcpy((char*) arguments, (char*) org_argv, (++count)*sizeof(*org_argv)); arguments[count]= 0; /* Check out the args */ if (get_options(&argc,&argv)) cleanup_and_exit(1); + if (!no_defaults) + { + if (opt_defaults_file_used) + arguments[count++]= make_args("--defaults-file=", config_file); + if (my_defaults_extra_file) + arguments[count++]= make_args("--defaults-extra-file=", + my_defaults_extra_file); + if (my_defaults_group_suffix) + arguments[count++]= make_args("--defaults-group-suffix=", + my_defaults_group_suffix); + arguments[count]= 0; + } + nargs= argc + 1; if (opt_mysqld) nargs+= array_elements(mysqld_groups); diff --git a/extra/wolfssl/CMakeLists.txt b/extra/wolfssl/CMakeLists.txt index 0137d3539dc..b38d57d3710 100644 --- a/extra/wolfssl/CMakeLists.txt +++ b/extra/wolfssl/CMakeLists.txt @@ -50,7 +50,9 @@ SET(WOLFSSL_SOURCES ${WOLFSSL_SRCDIR}/tls.c ${WOLFSSL_SRCDIR}/wolfio.c ${WOLFSSL_SRCDIR}/ocsp.c - ${WOLFSSL_SRCDIR}/ssl.c) + ${WOLFSSL_SRCDIR}/ssl.c + ${WOLFSSL_SRCDIR}/tls13.c) + ADD_DEFINITIONS(-DWOLFSSL_LIB -DBUILDING_WOLFSSL) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/wolfssl) @@ -105,8 +107,9 @@ ${WOLFCRYPT_SRCDIR}/wolfmath.c ) # Use fastmath large number math library. -IF(NOT (MSVC AND CMAKE_C_COMPILER_ID MATCHES Clang) - AND (CMAKE_SIZEOF_VOID_P EQUAL 8)) +IF(NOT (MSVC AND CMAKE_C_COMPILER_ID MATCHES Clang)) + # Can't use clang-cl with WOLFSSL_FASTMATH + # due to https://bugs.llvm.org/show_bug.cgi?id=25305 SET(WOLFSSL_FASTMATH 1) ENDIF() @@ -117,6 +120,21 @@ IF(WOLFSSL_FASTMATH) # WolfSSL will use more stack space with it SET(FP_MAX_BITS 16384) SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCES} ${WOLFCRYPT_SRCDIR}/tfm.c) + IF((CMAKE_SIZEOF_VOID_P MATCHES 4) AND (CMAKE_SYSTEM_PROCESSOR MATCHES "86") + AND (NOT MSVC)) + # Workaround https://github.com/wolfSSL/wolfssl/issues/4245 + # On 32bit Intel, to satisfy inline assembly's wish for free registers + # 1. use -fomit-frame-pointer + # 2. With GCC 4, additionally use -fno-PIC, which works on x86 + # (modern GCC has PIC optimizations, that make it unnecessary) + # The following assumes GCC or Clang + SET(TFM_COMPILE_FLAGS "-fomit-frame-pointer") + IF(CMAKE_C_COMPILER_VERSION VERSION_LESS "5") + SET(TFM_COMPILE_FLAGS "${TFM_COMPILE_FLAGS} -fno-PIC") + ENDIF() + SET_SOURCE_FILES_PROPERTIES(${WOLFCRYPT_SRCDIR}/tfm.c + PROPERTIES COMPILE_FLAGS ${TFM_COMPILE_FLAGS}) + ENDIF() ELSE() SET(WOLFCRYPT_SOURCES ${WOLFCRYPT_SOURCES} ${WOLFCRYPT_SRCDIR}/integer.c) ENDIF() diff --git a/extra/wolfssl/user_settings.h.in b/extra/wolfssl/user_settings.h.in index 4adb27142d9..55b43655659 100644 --- a/extra/wolfssl/user_settings.h.in +++ b/extra/wolfssl/user_settings.h.in @@ -23,12 +23,29 @@ #define OPENSSL_ALL #define WOLFSSL_ALLOW_TLSV10 #define NO_OLD_TIMEVAL_NAME + +/* TLSv1.3 definitions (all needed to build) */ +#define WOLFSSL_TLS13 +#define HAVE_HKDF +#define HAVE_TLS_EXTENSIONS +#define HAVE_SUPPORTED_CURVES +#define HAVE_FFDHE_2048 +#define WC_RSA_PSS +/* End of TLSv1.3 defines */ + +/* Features we exclude */ +#define NO_DSA +#define NO_HC128 +#define NO_MD4 +#define NO_PSK +#define NO_RABBIT +#define NO_RC4 + /* FP_MAX_BITS is set high solely to satisfy ssl_8k_key.test WolfSSL will use more stack space with it, with fastmath */ -#define FP_MAX_BITS 16384 - +#cmakedefine FP_MAX_BITS 16384 #cmakedefine WOLFSSL_AESNI #cmakedefine USE_FAST_MATH #cmakedefine TFM_TIMING_RESISTANT diff --git a/extra/wolfssl/wolfssl b/extra/wolfssl/wolfssl -Subproject 9c87f979a7f1d3a6d786b260653d566c1d31a1c +Subproject add4a68465bcdad238bcf3e5f2771d8da05e628 |