1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge with mariaDB 5.5.23: bzr merge lp:maria/5.5

This commit is contained in:
Seppo Jaakola
2012-04-26 13:59:35 +03:00
621 changed files with 14792 additions and 4405 deletions

View File

@ -1139,3 +1139,4 @@ libmysqld/gcalc_slicescan.cc
libmysqld/gcalc_tools.cc libmysqld/gcalc_tools.cc
sql/share/errmsg.sys sql/share/errmsg.sys
sql/share/mysql sql/share/mysql
install_manifest.txt

View File

@ -148,6 +148,7 @@ fi
# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro # Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
# LINT_INIT(), which is only useful for silencing spurious warnings # LINT_INIT(), which is only useful for silencing spurious warnings
# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind. # of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
valgrind_flags="-DHAVE_valgrind -USAFEMALLOC"
valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized" valgrind_flags="$valgrind_flags -UFORCE_INIT_OF_VARS -Wno-uninitialized"
valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max" valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
valgrind_configs="--with-valgrind" valgrind_configs="--with-valgrind"

View File

@ -1,5 +1,5 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. # Copyright (c) 2006, 2012, Oracle and/or its affiliates.
# Copyright (c) 2008-2011 Monty Program Ab # Copyright (c) 2008, 2012 Monty Program Ab
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5 MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=21 MYSQL_VERSION_PATCH=23
MYSQL_VERSION_EXTRA= MYSQL_VERSION_EXTRA=

View File

@ -1,4 +1,4 @@
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -100,6 +100,7 @@ int main(int argc,char *argv[])
char operation[16]; char operation[16];
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
plugin_data.name= 0; // initialize name plugin_data.name= 0; // initialize name
/* /*

View File

@ -255,7 +255,7 @@ get_one_option(int optid, const struct my_option *opt,
puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010")); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));
puts("MariaDB utility for upgrading databases to new MariaDB versions.\n"); puts("MariaDB utility for upgrading databases to new MariaDB versions.\n");
my_print_help(my_long_options); my_print_help(my_long_options);
exit(0); die(0);
break; break;
case '#': case '#':

View File

@ -307,6 +307,7 @@ int main(int argc,char *argv[])
MY_INIT(argv[0]); MY_INIT(argv[0]);
mysql_init(&mysql); mysql_init(&mysql);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
if ((error= load_defaults("my",load_default_groups,&argc,&argv))) if ((error= load_defaults("my",load_default_groups,&argc,&argv)))
goto err1; goto err1;
save_argv = argv; /* Save for free_defaults */ save_argv = argv; /* Save for free_defaults */
@ -329,6 +330,8 @@ int main(int argc,char *argv[])
(void) signal(SIGINT,endprog); /* Here if abort */ (void) signal(SIGINT,endprog); /* Here if abort */
(void) signal(SIGTERM,endprog); /* Here if abort */ (void) signal(SIGTERM,endprog); /* Here if abort */
sf_leaking_memory=0; /* from now on we cleanup properly */
if (opt_compress) if (opt_compress)
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
if (opt_connect_timeout) if (opt_connect_timeout)

View File

@ -975,6 +975,7 @@ int main(int argc, char **argv)
char **defaults_argv; char **defaults_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
/* /*
** Check out the args ** Check out the args
*/ */
@ -984,6 +985,7 @@ int main(int argc, char **argv)
defaults_argv= argv; defaults_argv= argv;
if (get_options(&argc, &argv)) if (get_options(&argc, &argv))
goto end1; goto end1;
sf_leaking_memory=0; /* from now on we cleanup properly */
ret= EX_MYSQLERR; ret= EX_MYSQLERR;
if (dbConnect(current_host, current_user, opt_password)) if (dbConnect(current_host, current_user, opt_password))

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2000, 2011, Oracle and/or its affiliates. Copyright (c) 2000, 2012, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -590,17 +590,17 @@ void check_io(FILE *file)
static void print_version(void) static void print_version(void)
{ {
printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname,DUMP_VERSION, printf("%s Ver %s Distrib %s, for %s (%s)\n",my_progname_short,DUMP_VERSION,
MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE); MYSQL_SERVER_VERSION,SYSTEM_TYPE,MACHINE_TYPE);
} /* print_version */ } /* print_version */
static void short_usage_sub(void) static void short_usage_sub(void)
{ {
printf("Usage: %s [OPTIONS] database [tables]\n", my_progname); printf("Usage: %s [OPTIONS] database [tables]\n", my_progname_short);
printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n", printf("OR %s [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]\n",
my_progname); my_progname_short);
printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname); printf("OR %s [OPTIONS] --all-databases [OPTIONS]\n", my_progname_short);
} }
@ -620,7 +620,7 @@ static void usage(void)
static void short_usage(void) static void short_usage(void)
{ {
short_usage_sub(); short_usage_sub();
printf("For more options, use %s --help\n", my_progname); printf("For more options, use %s --help\n", my_progname_short);
} }
@ -947,7 +947,7 @@ static int get_options(int *argc, char ***argv)
fields_terminated)) fields_terminated))
{ {
fprintf(stderr, fprintf(stderr,
"%s: You must use option --tab with --fields-...\n", my_progname); "%s: You must use option --tab with --fields-...\n", my_progname_short);
return(EX_USAGE); return(EX_USAGE);
} }
@ -965,7 +965,7 @@ static int get_options(int *argc, char ***argv)
if (opt_single_transaction && opt_lock_all_tables) if (opt_single_transaction && opt_lock_all_tables)
{ {
fprintf(stderr, "%s: You can't use --single-transaction and " fprintf(stderr, "%s: You can't use --single-transaction and "
"--lock-all-tables at the same time.\n", my_progname); "--lock-all-tables at the same time.\n", my_progname_short);
return(EX_USAGE); return(EX_USAGE);
} }
if (opt_master_data) if (opt_master_data)
@ -977,14 +977,14 @@ static int get_options(int *argc, char ***argv)
lock_tables= 0; lock_tables= 0;
if (enclosed && opt_enclosed) if (enclosed && opt_enclosed)
{ {
fprintf(stderr, "%s: You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n", my_progname); fprintf(stderr, "%s: You can't use ..enclosed.. and ..optionally-enclosed.. at the same time.\n", my_progname_short);
return(EX_USAGE); return(EX_USAGE);
} }
if ((opt_databases || opt_alldbs) && path) if ((opt_databases || opt_alldbs) && path)
{ {
fprintf(stderr, fprintf(stderr,
"%s: --databases or --all-databases can't be used with --tab.\n", "%s: --databases or --all-databases can't be used with --tab.\n",
my_progname); my_progname_short);
return(EX_USAGE); return(EX_USAGE);
} }
if (strcmp(default_charset, charset_info->csname) && if (strcmp(default_charset, charset_info->csname) &&
@ -1036,7 +1036,7 @@ static void die(int error_num, const char* fmt_reason, ...)
my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args); my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
va_end(args); va_end(args);
fprintf(stderr, "%s: %s\n", my_progname, buffer); fprintf(stderr, "%s: %s\n", my_progname_short, buffer);
fflush(stderr); fflush(stderr);
ignore_errors= 0; /* force the exit */ ignore_errors= 0; /* force the exit */
@ -1070,7 +1070,7 @@ static void maybe_die(int error_num, const char* fmt_reason, ...)
my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args); my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
va_end(args); va_end(args);
fprintf(stderr, "%s: %s\n", my_progname, buffer); fprintf(stderr, "%s: %s\n", my_progname_short, buffer);
fflush(stderr); fflush(stderr);
maybe_exit(error_num); maybe_exit(error_num);
@ -2152,7 +2152,7 @@ static uint dump_events_for_db(char *db)
if (create_delimiter(row[3], delimiter, sizeof(delimiter)) == NULL) if (create_delimiter(row[3], delimiter, sizeof(delimiter)) == NULL)
{ {
fprintf(stderr, "%s: Warning: Can't create delimiter for event '%s'\n", fprintf(stderr, "%s: Warning: Can't create delimiter for event '%s'\n",
my_progname, event_name); my_progname_short, event_name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -2367,10 +2367,10 @@ static uint dump_routines_for_db(char *db)
{ {
if (opt_xml) if (opt_xml)
{ {
if (i) // Procedures. if (i) /* Procedures. */
print_xml_row(sql_file, "routine", routine_res, &row, print_xml_row(sql_file, "routine", routine_res, &row,
"Create Procedure"); "Create Procedure");
else // Functions. else /* Functions. */
print_xml_row(sql_file, "routine", routine_res, &row, print_xml_row(sql_file, "routine", routine_res, &row,
"Create Function"); "Create Function");
continue; continue;
@ -2766,7 +2766,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
else else
{ {
verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n", verbose_msg("%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n",
my_progname, mysql_error(mysql)); my_progname_short, mysql_error(mysql));
my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table); my_snprintf(query_buff, sizeof(query_buff), show_fields_stmt, db, table);
@ -2877,7 +2877,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
goto continue_xml; goto continue_xml;
} }
fprintf(stderr, "%s: Can't get keys for table %s (%s)\n", fprintf(stderr, "%s: Can't get keys for table %s (%s)\n",
my_progname, result_table, mysql_error(mysql)); my_progname_short, result_table, mysql_error(mysql));
if (path) if (path)
my_fclose(sql_file, MYF(MY_WME)); my_fclose(sql_file, MYF(MY_WME));
DBUG_RETURN(0); DBUG_RETURN(0);
@ -3533,7 +3533,7 @@ static void dump_table(char *table, char *db)
if (mysql_num_fields(res) != num_fields) if (mysql_num_fields(res) != num_fields)
{ {
fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n", fprintf(stderr,"%s: Error in field count for table: %s ! Aborting.\n",
my_progname, result_table); my_progname_short, result_table);
error= EX_CONSCHECK; error= EX_CONSCHECK;
goto err; goto err;
} }
@ -3798,7 +3798,7 @@ static void dump_table(char *table, char *db)
{ {
my_snprintf(buf, sizeof(buf), my_snprintf(buf, sizeof(buf),
"%s: Error %d: %s when dumping table %s at row: %ld\n", "%s: Error %d: %s when dumping table %s at row: %ld\n",
my_progname, my_progname_short,
mysql_errno(mysql), mysql_errno(mysql),
mysql_error(mysql), mysql_error(mysql),
result_table, result_table,
@ -3992,8 +3992,8 @@ static int dump_tablespaces(char* ts_where)
DBUG_RETURN(0); DBUG_RETURN(0);
} }
my_printf_error(0, "Error: '%s' when trying to dump tablespaces", fprintf(stderr, "%s: Error: '%s' when trying to dump tablespaces\n",
MYF(0), mysql_error(mysql)); my_progname_short, mysql_error(mysql));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -4138,8 +4138,8 @@ static int dump_all_databases()
if (mysql_query(mysql, "SHOW DATABASES") || if (mysql_query(mysql, "SHOW DATABASES") ||
!(tableres= mysql_store_result(mysql))) !(tableres= mysql_store_result(mysql)))
{ {
my_printf_error(0, "Error: Couldn't execute 'SHOW DATABASES': %s", fprintf(stderr, "%s: Error: Couldn't execute 'SHOW DATABASES': %s\n",
MYF(0), mysql_error(mysql)); my_progname_short, mysql_error(mysql));
return 1; return 1;
} }
while ((row= mysql_fetch_row(tableres))) while ((row= mysql_fetch_row(tableres)))
@ -4666,8 +4666,8 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos)
if (!ignore_errors) if (!ignore_errors)
{ {
/* SHOW MASTER STATUS reports nothing and --force is not enabled */ /* SHOW MASTER STATUS reports nothing and --force is not enabled */
my_printf_error(0, "Error: Binlogging on server not active", fprintf(stderr, "%s: Error: Binlogging on server not active\n",
MYF(0)); my_progname_short);
maybe_exit(EX_MYSQLERR); maybe_exit(EX_MYSQLERR);
return 1; return 1;
} }
@ -4750,7 +4750,7 @@ static int do_show_slave_status(MYSQL *mysql_con)
if (!ignore_errors) if (!ignore_errors)
{ {
/* SHOW SLAVE STATUS reports nothing and --force is not enabled */ /* SHOW SLAVE STATUS reports nothing and --force is not enabled */
my_printf_error(0, "Error: Slave not set up", MYF(0)); fprintf(stderr, "%s: Error: Slave not set up\n", my_progname_short);
} }
mysql_free_result(slave); mysql_free_result(slave);
return 1; return 1;
@ -4810,7 +4810,7 @@ static int do_start_slave_sql(MYSQL *mysql_con)
/* now, start slave if stopped */ /* now, start slave if stopped */
if (mysql_query_with_error_report(mysql_con, 0, "START SLAVE")) if (mysql_query_with_error_report(mysql_con, 0, "START SLAVE"))
{ {
my_printf_error(0, "Error: Unable to start slave", MYF(0)); fprintf(stderr, "%s: Error: Unable to start slave\n", my_progname_short);
return 1; return 1;
} }
return(0); return(0);
@ -5452,8 +5452,9 @@ int main(int argc, char **argv)
char bin_log_name[FN_REFLEN]; char bin_log_name[FN_REFLEN];
int exit_code; int exit_code;
int consistent_binlog_pos= 0; int consistent_binlog_pos= 0;
MY_INIT("mysqldump"); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
compatible_mode_normal_str[0]= 0; compatible_mode_normal_str[0]= 0;
default_charset= (char *)mysql_universal_client_charset; default_charset= (char *)mysql_universal_client_charset;
bzero((char*) &ignore_table, sizeof(ignore_table)); bzero((char*) &ignore_table, sizeof(ignore_table));
@ -5464,6 +5465,7 @@ int main(int argc, char **argv)
free_resources(); free_resources();
exit(exit_code); exit(exit_code);
} }
sf_leaking_memory=0; /* from now on we cleanup properly */
/* /*
Disable comments in xml mode if 'comments' option is not explicitly used. Disable comments in xml mode if 'comments' option is not explicitly used.

View File

@ -613,6 +613,7 @@ int main(int argc, char **argv)
{ {
int error=0; int error=0;
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
if (load_defaults("my",load_default_groups,&argc,&argv)) if (load_defaults("my",load_default_groups,&argc,&argv))
return 1; return 1;
@ -623,6 +624,7 @@ int main(int argc, char **argv)
free_defaults(argv_to_free); free_defaults(argv_to_free);
return(1); return(1);
} }
sf_leaking_memory=0; /* from now on we cleanup properly */
#ifdef HAVE_LIBPTHREAD #ifdef HAVE_LIBPTHREAD
if (opt_use_threads && !lock_tables) if (opt_use_threads && !lock_tables)

View File

@ -67,11 +67,13 @@ int main(int argc, char **argv)
char *wild; char *wild;
MYSQL mysql; MYSQL mysql;
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
if (load_defaults("my",load_default_groups,&argc,&argv)) if (load_defaults("my",load_default_groups,&argc,&argv))
exit(1); exit(1);
get_options(&argc,&argv); get_options(&argc,&argv);
sf_leaking_memory=0; /* from now on we cleanup properly */
wild=0; wild=0;
if (argc) if (argc)
{ {

View File

@ -317,6 +317,7 @@ int main(int argc, char **argv)
option_string *eptr; option_string *eptr;
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
if (load_defaults("my",load_default_groups,&argc,&argv)) if (load_defaults("my",load_default_groups,&argc,&argv))
{ {
@ -330,6 +331,7 @@ int main(int argc, char **argv)
my_end(0); my_end(0);
exit(1); exit(1);
} }
sf_leaking_memory=0; /* from now on we cleanup properly */
/* Seed the random number generator if we will be using it. */ /* Seed the random number generator if we will be using it. */
if (auto_generate_sql) if (auto_generate_sql)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2000, 2010, Oracle and/or its affiliates. Copyright (c) 2000, 2011, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by

View File

@ -55,6 +55,17 @@ IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK)
VERBATIM VERBATIM
) )
ADD_CUSTOM_TARGET(abi_update
COMMAND ${CMAKE_COMMAND}
-DCOMPILER=${COMPILER}
-DABI_UPDATE=1
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-DBINARY_DIR=${CMAKE_BINARY_DIR}
"-DABI_HEADERS=${API_PREPROCESSOR_HEADER}"
-P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake
VERBATIM
)
ADD_CUSTOM_TARGET(abi_check_all ADD_CUSTOM_TARGET(abi_check_all
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DCOMPILER=${COMPILER} -DCOMPILER=${COMPILER}

View File

@ -1,4 +1,4 @@
# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by

View File

@ -75,8 +75,12 @@ FOREACH(file ${ABI_HEADERS})
EXECUTE_PROCESS( EXECUTE_PROCESS(
COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE result) COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE result)
IF(NOT ${result} EQUAL 0) IF(NOT ${result} EQUAL 0)
IF(ABI_UPDATE)
EXECUTE_PROCESS(COMMAND mv -v ${abi_check_out} ${file}.pp)
ELSE(ABI_UPDATE)
MESSAGE(FATAL_ERROR MESSAGE(FATAL_ERROR
"ABI check found difference between ${file}.pp and ${abi_check_out}") "ABI check found difference between ${file}.pp and ${abi_check_out}")
ENDIF(ABI_UPDATE)
ENDIF() ENDIF()
FILE(REMOVE ${abi_check_out}) FILE(REMOVE ${abi_check_out})
ENDFOREACH() ENDFOREACH()

View File

@ -115,7 +115,7 @@ SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
SET(INSTALL_LIBDIR_STANDALONE "lib") SET(INSTALL_LIBDIR_STANDALONE "lib")
SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin") SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
# #
SET(INSTALL_INCLUDEDIR_STANDALONE "include") SET(INSTALL_INCLUDEDIR_STANDALONE "include/mysql")
# #
SET(INSTALL_DOCDIR_STANDALONE "docs") SET(INSTALL_DOCDIR_STANDALONE "docs")
SET(INSTALL_DOCREADMEDIR_STANDALONE ".") SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
@ -198,7 +198,7 @@ SET(INSTALL_SCRIPTDIR_SVR4 "scripts")
SET(INSTALL_LIBDIR_SVR4 "lib") SET(INSTALL_LIBDIR_SVR4 "lib")
SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin") SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin")
# #
SET(INSTALL_INCLUDEDIR_SVR4 "include") SET(INSTALL_INCLUDEDIR_SVR4 "include/mysql")
# #
SET(INSTALL_DOCDIR_SVR4 "docs") SET(INSTALL_DOCDIR_SVR4 "docs")
SET(INSTALL_DOCREADMEDIR_SVR4 ".") SET(INSTALL_DOCREADMEDIR_SVR4 ".")

View File

@ -1,4 +1,4 @@
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@ -40,15 +40,24 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
IF(CMAKE_GENERATOR MATCHES "Visual Studio") IF(CMAKE_GENERATOR MATCHES "Visual Studio")
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location}) STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
ENDIF() ENDIF()
IF(ARG_COMPONENT STREQUAL "Server" AND (target MATCHES "mysqld" OR type MATCHES "MODULE"))
set(comp "")
IF(ARG_COMPONENT STREQUAL "Server")
IF(target MATCHES "mysqld" OR type MATCHES "MODULE")
#MESSAGE("PDB: ${targets}") #MESSAGE("PDB: ${targets}")
SET(comp Server) SET(comp Server)
ELSEIF(ARG_COMPONENT MATCHES Development ENDIF()
ENDIF()
IF(NOT comp MATCHES Server)
IF(ARG_COMPONENT MATCHES Development
OR ARG_COMPONENT MATCHES SharedLibraries OR ARG_COMPONENT MATCHES SharedLibraries
OR ARG_COMPONENT MATCHES Embedded) OR ARG_COMPONENT MATCHES Embedded)
SET(comp Debuginfo) SET(comp Debuginfo)
ELSE() ENDIF()
ENDIF()
IF(NOT comp)
SET(comp Debuginfo_archive_only) # not in MSI SET(comp Debuginfo_archive_only) # not in MSI
ENDIF() ENDIF()
INSTALL(FILES ${pdb_location} DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp}) INSTALL(FILES ${pdb_location} DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp})

View File

@ -120,8 +120,13 @@ CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY) ${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY)
# Copy spec files # Copy spec files
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/mysql.${VERSION}.spec SET(SPECFILENAME "mysql.${VERSION}.spec")
${PACKAGE_DIR}/support-files/mysql.${VERSION}.spec COPYONLY) IF("${VERSION}" MATCHES "-ndb-")
STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
SET(SPECFILENAME "mysql-cluster-${NDBVERSION}.spec")
ENDIF()
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/${SPECFILENAME}
${PACKAGE_DIR}/support-files/${SPECFILENAME} COPYONLY)
# Add documentation, if user has specified where to find them # Add documentation, if user has specified where to find them
IF(MYSQL_DOCS_LOCATION) IF(MYSQL_DOCS_LOCATION)

View File

@ -57,7 +57,10 @@ MACRO(GET_MYSQL_VERSION)
MESSAGE("-- MariaDB ${VERSION}") MESSAGE("-- MariaDB ${VERSION}")
SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
STRING(REPLACE "-" "_" MYSQL_RPM_VERSION "${VERSION}") # Use NDBVERSION irregardless of whether this is Cluster or not, if not
# then the regex will be ignored anyway.
STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
STRING(REPLACE "-" "_" MYSQL_RPM_VERSION "${NDBVERSION}")
MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}") MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}")
MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION) MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
@ -93,6 +96,10 @@ ENDIF()
IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME) IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME)
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}")
IF("${VERSION}" MATCHES "-ndb-")
STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mysql-cluster-gpl-${NDBVERSION}")
ENDIF()
ENDIF() ENDIF()
SET(CPACK_PACKAGE_CONTACT "MariaDB team <info@montyprogram.com>") SET(CPACK_PACKAGE_CONTACT "MariaDB team <info@montyprogram.com>")
SET(CPACK_PACKAGE_VENDOR "Monty Program AB") SET(CPACK_PACKAGE_VENDOR "Monty Program AB")

View File

@ -137,6 +137,7 @@ SET(HAVE_PATHS_H CACHE INTERNAL "")
SET(HAVE_PCLOSE CACHE INTERNAL "") SET(HAVE_PCLOSE CACHE INTERNAL "")
SET(HAVE_PERROR 1 CACHE INTERNAL "") SET(HAVE_PERROR 1 CACHE INTERNAL "")
SET(HAVE_PEERCRED CACHE INTERNAL "") SET(HAVE_PEERCRED CACHE INTERNAL "")
SET(HAVE_PAM_APPL_H CACHE INTERNAL "")
SET(HAVE_POLL_H CACHE INTERNAL "") SET(HAVE_POLL_H CACHE INTERNAL "")
SET(HAVE_POPEN CACHE INTERNAL "") SET(HAVE_POPEN CACHE INTERNAL "")
SET(HAVE_POLL CACHE INTERNAL "") SET(HAVE_POLL CACHE INTERNAL "")
@ -248,6 +249,7 @@ SET(HAVE_STRING_H 1 CACHE INTERNAL "")
SET(HAVE_STRLCAT CACHE INTERNAL "") SET(HAVE_STRLCAT CACHE INTERNAL "")
SET(HAVE_STRLCPY CACHE INTERNAL "") SET(HAVE_STRLCPY CACHE INTERNAL "")
SET(HAVE_STRNCASECMP CACHE INTERNAL "") SET(HAVE_STRNCASECMP CACHE INTERNAL "")
SET(HAVE_STRNDUP CACHE INTERNAL "")
IF(MSVC_VERSION GREATER 1310) IF(MSVC_VERSION GREATER 1310)
SET(HAVE_STRNLEN 1 CACHE INTERNAL "") SET(HAVE_STRNLEN 1 CACHE INTERNAL "")
ENDIF() ENDIF()

View File

@ -123,7 +123,14 @@ IF(NOT VERSION)
SET(PRODUCT_TAG) SET(PRODUCT_TAG)
ENDIF() ENDIF()
IF("${VERSION}" MATCHES "-ndb-")
STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
SET(package_name "mysql-cluster${PRODUCT_TAG}-${NDBVERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
ELSE()
SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
ENDIF()
MESSAGE("-- Packaging as: ${package_name}")
# Sometimes package suffix is added (something like "-icc-glibc23") # Sometimes package suffix is added (something like "-icc-glibc23")
IF(PACKAGE_SUFFIX) IF(PACKAGE_SUFFIX)

View File

@ -210,7 +210,10 @@ MACRO (MYSQL_CHECK_READLINE)
IF(WITH_READLINE) IF(WITH_READLINE)
MYSQL_USE_BUNDLED_READLINE() MYSQL_USE_BUNDLED_READLINE()
ELSE() ELSE()
# OSX includes incompatible readline lib
IF (NOT APPLE)
MYSQL_FIND_SYSTEM_READLINE() MYSQL_FIND_SYSTEM_READLINE()
ENDIF()
IF(NOT USE_NEW_READLINE_INTERFACE) IF(NOT USE_NEW_READLINE_INTERFACE)
MYSQL_FIND_SYSTEM_LIBEDIT() MYSQL_FIND_SYSTEM_LIBEDIT()
IF(NOT USE_LIBEDIT_INTERFACE) IF(NOT USE_LIBEDIT_INTERFACE)

View File

@ -49,7 +49,7 @@
TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */ TODO : Verify if FreeBSD & AIX stores ISO 10646 in wchar_t. */
#if !defined(__NetBSD__) && !defined(__sun) \ #if !defined(__NetBSD__) && !defined(__sun) \
&& !(defined(__APPLE__) && defined(__MACH__)) \ && !(defined(__APPLE__) && defined(__MACH__)) \
&& !defined(__FreeBSD__) && !defined(_AIX) && !defined(__FreeBSD__) && !defined(_AIX) && !defined(__OpenBSD__)
#ifndef __STDC_ISO_10646__ #ifndef __STDC_ISO_10646__
/* In many places it is assumed that the first 127 code points are ASCII /* In many places it is assumed that the first 127 code points are ASCII
* compatible, so ensure wchar_t indeed does ISO 10646 and not some other * compatible, so ensure wchar_t indeed does ISO 10646 and not some other

View File

@ -64,7 +64,7 @@ static char sccsid[] = "@(#)unvis.c 8.1 (Berkeley) 6/4/93";
#include "np/vis.h" #include "np/vis.h"
#ifdef __weak_alias #ifdef __weak_alias
__weak_alias(strnunvisx,_strnunvisx) __weak_alias(strnunvisx,_strnunvisx);
#endif #endif
#if !HAVE_VIS #if !HAVE_VIS

View File

@ -77,7 +77,7 @@
#include <stdlib.h> #include <stdlib.h>
#ifdef __weak_alias #ifdef __weak_alias
__weak_alias(strvisx,_strvisx) __weak_alias(strvisx,_strvisx);
#endif #endif
#if !HAVE_VIS || !HAVE_SVIS #if !HAVE_VIS || !HAVE_SVIS

View File

@ -589,6 +589,8 @@
#cmakedefine WITH_MYISAM_STORAGE_ENGINE 1 #cmakedefine WITH_MYISAM_STORAGE_ENGINE 1
#cmakedefine WITH_MYISAMMRG_STORAGE_ENGINE 1 #cmakedefine WITH_MYISAMMRG_STORAGE_ENGINE 1
#cmakedefine WITH_HEAP_STORAGE_ENGINE 1 #cmakedefine WITH_HEAP_STORAGE_ENGINE 1
#cmakedefine WITH_INNOBASE_STORAGE_ENGINE 1
#cmakedefine WITH_XTRADB_STORAGE_ENGINE 1
#cmakedefine WITH_CSV_STORAGE_ENGINE 1 #cmakedefine WITH_CSV_STORAGE_ENGINE 1
#cmakedefine WITH_PARTITION_STORAGE_ENGINE 1 #cmakedefine WITH_PARTITION_STORAGE_ENGINE 1
#cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1 #cmakedefine WITH_PERFSCHEMA_STORAGE_ENGINE 1

View File

@ -149,7 +149,9 @@ IF(UNIX)
SET(CMAKE_REQUIRED_LIBRARIES SET(CMAKE_REQUIRED_LIBRARIES
${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT}) ${LIBM} ${LIBNSL} ${LIBBIND} ${LIBCRYPT} ${LIBSOCKET} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT})
IF(CMAKE_REQUIRED_LIBRARIES)
LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES) LIST(REMOVE_DUPLICATES CMAKE_REQUIRED_LIBRARIES)
ENDIF()
LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT}) LINK_LIBRARIES(${CMAKE_THREAD_LIBS_INIT})
OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF) OPTION(WITH_LIBWRAP "Compile with tcp wrappers support" OFF)
@ -397,6 +399,7 @@ CHECK_FUNCTION_EXISTS (pread HAVE_PREAD)
CHECK_FUNCTION_EXISTS (pthread_attr_create HAVE_PTHREAD_ATTR_CREATE) CHECK_FUNCTION_EXISTS (pthread_attr_create HAVE_PTHREAD_ATTR_CREATE)
CHECK_FUNCTION_EXISTS (pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE) CHECK_FUNCTION_EXISTS (pthread_attr_getstacksize HAVE_PTHREAD_ATTR_GETSTACKSIZE)
CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE) CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE)
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE) CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE) CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK) CHECK_FUNCTION_EXISTS (pthread_condattr_setclock HAVE_PTHREAD_CONDATTR_SETCLOCK)
@ -435,7 +438,6 @@ CHECK_FUNCTION_EXISTS (strlcat HAVE_STRLCAT)
CHECK_FUNCTION_EXISTS (strsignal HAVE_STRSIGNAL) CHECK_FUNCTION_EXISTS (strsignal HAVE_STRSIGNAL)
CHECK_FUNCTION_EXISTS (fgetln HAVE_FGETLN) CHECK_FUNCTION_EXISTS (fgetln HAVE_FGETLN)
CHECK_FUNCTION_EXISTS (strpbrk HAVE_STRPBRK) CHECK_FUNCTION_EXISTS (strpbrk HAVE_STRPBRK)
CHECK_FUNCTION_EXISTS (strsep HAVE_STRSEP)
CHECK_FUNCTION_EXISTS (strstr HAVE_STRSTR) CHECK_FUNCTION_EXISTS (strstr HAVE_STRSTR)
CHECK_FUNCTION_EXISTS (strtok_r HAVE_STRTOK_R) CHECK_FUNCTION_EXISTS (strtok_r HAVE_STRTOK_R)
CHECK_FUNCTION_EXISTS (strtol HAVE_STRTOL) CHECK_FUNCTION_EXISTS (strtol HAVE_STRTOL)

View File

@ -27,7 +27,7 @@ TARGET_LINK_LIBRARIES(tests dbug)
ADD_EXECUTABLE(factorial my_main.c factorial.c) ADD_EXECUTABLE(factorial my_main.c factorial.c)
TARGET_LINK_LIBRARIES(factorial dbug) TARGET_LINK_LIBRARIES(factorial dbug)
IF(NOT WIN32) IF(NOT WIN32 AND NOT CMAKE_GENERATOR MATCHES Xcode)
FIND_PROGRAM(GROFF groff) FIND_PROGRAM(GROFF groff)
FIND_PROGRAM(NROFF nroff) FIND_PROGRAM(NROFF nroff)
SET(OUTPUT_INC output1.r output2.r output3.r output4.r output5.r) SET(OUTPUT_INC output1.r output2.r output3.r output4.r output5.r)
@ -63,5 +63,5 @@ IF(NOT WIN32)
ADD_CUSTOM_TARGET(t ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/user.t) ADD_CUSTOM_TARGET(t ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/user.t)
ENDIF(NROFF) ENDIF(NROFF)
ENDIF(NOT WIN32) ENDIF()

View File

@ -171,6 +171,20 @@ struct link {
#define MATCHED 65536 #define MATCHED 65536
#define NOT_MATCHED 0 #define NOT_MATCHED 0
/*
* Debugging settings can be shared between threads.
* But FILE* streams cannot normally be shared - what if
* one thread closes a stream, while another thread still uses it?
* As a workaround, we have shared FILE pointers with reference counters
*/
typedef struct {
FILE *file;
uint used;
} sFILE;
sFILE shared_stdout = { 0, 1 << 30 }, *sstdout = &shared_stdout;
sFILE shared_stderr = { 0, 1 << 30 }, *sstderr = &shared_stderr;
/* /*
* Debugging settings can be pushed or popped off of a * Debugging settings can be pushed or popped off of a
* stack which is implemented as a linked list. Note * stack which is implemented as a linked list. Note
@ -186,7 +200,7 @@ struct settings {
uint maxdepth; /* Current maximum trace depth */ uint maxdepth; /* Current maximum trace depth */
uint delay; /* Delay after each output line */ uint delay; /* Delay after each output line */
uint sub_level; /* Sub this from code_state->level */ uint sub_level; /* Sub this from code_state->level */
FILE *out_file; /* Current output stream */ sFILE *out_file; /* Current output stream */
char name[FN_REFLEN]; /* Name of output file */ char name[FN_REFLEN]; /* Name of output file */
struct link *functions; /* List of functions */ struct link *functions; /* List of functions */
struct link *keywords; /* List of debug keywords */ struct link *keywords; /* List of debug keywords */
@ -251,11 +265,11 @@ static void FreeList(struct link *linkp);
/* OpenClose debug output stream */ /* OpenClose debug output stream */
static void DBUGOpenFile(CODE_STATE *,const char *, const char *, int); static void DBUGOpenFile(CODE_STATE *,const char *, const char *, int);
static void DBUGCloseFile(CODE_STATE *cs, FILE *fp); static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value);
/* Push current debug settings */ /* Push current debug settings */
static void PushState(CODE_STATE *cs); static void PushState(CODE_STATE *cs);
/* Free memory associated with debug state. */ /* Free memory associated with debug state. */
static void FreeState (CODE_STATE *cs, struct settings *state, int free_state); static void FreeState (CODE_STATE *cs, int free_state);
/* Test for tracing enabled */ /* Test for tracing enabled */
static int DoTrace(CODE_STATE *cs); static int DoTrace(CODE_STATE *cs);
/* /*
@ -328,9 +342,11 @@ static CODE_STATE *code_state(void)
if (!init_done) if (!init_done)
{ {
init_done=TRUE; init_done=TRUE;
sstdout->file= stdout;
sstderr->file= stderr;
pthread_mutex_init(&THR_LOCK_dbug, NULL); pthread_mutex_init(&THR_LOCK_dbug, NULL);
bzero(&init_settings, sizeof(init_settings)); bzero(&init_settings, sizeof(init_settings));
init_settings.out_file=stderr; init_settings.out_file= sstderr;
init_settings.flags=OPEN_APPEND; init_settings.flags=OPEN_APPEND;
} }
@ -455,12 +471,12 @@ static int DbugParse(CODE_STATE *cs, const char *control)
rel= control[0] == '+' || control[0] == '-'; rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next))) if ((!rel || (!stack->out_file && !stack->next)))
{ {
FreeState(cs, stack, 0); FreeState(cs, 0);
stack->flags= 0; stack->flags= 0;
stack->delay= 0; stack->delay= 0;
stack->maxdepth= 0; stack->maxdepth= 0;
stack->sub_level= 0; stack->sub_level= 0;
stack->out_file= stderr; stack->out_file= sstderr;
stack->functions= NULL; stack->functions= NULL;
stack->keywords= NULL; stack->keywords= NULL;
stack->processes= NULL; stack->processes= NULL;
@ -472,22 +488,17 @@ static int DbugParse(CODE_STATE *cs, const char *control)
stack->maxdepth= stack->next->maxdepth; stack->maxdepth= stack->next->maxdepth;
stack->sub_level= stack->next->sub_level; stack->sub_level= stack->next->sub_level;
strcpy(stack->name, stack->next->name); strcpy(stack->name, stack->next->name);
stack->out_file= stack->next->out_file;
stack->out_file->used++;
if (stack->next == &init_settings) if (stack->next == &init_settings)
{ {
/* /* never share with the global parent - it can change under your feet */
Never share with the global parent - it can change under your feet.
Reset out_file to stderr to prevent sharing of trace files between
global and session settings.
*/
stack->out_file= stderr;
stack->functions= ListCopy(init_settings.functions); stack->functions= ListCopy(init_settings.functions);
stack->keywords= ListCopy(init_settings.keywords); stack->keywords= ListCopy(init_settings.keywords);
stack->processes= ListCopy(init_settings.processes); stack->processes= ListCopy(init_settings.processes);
} }
else else
{ {
stack->out_file= stack->next->out_file;
stack->functions= stack->next->functions; stack->functions= stack->next->functions;
stack->keywords= stack->next->keywords; stack->keywords= stack->next->keywords;
stack->processes= stack->next->processes; stack->processes= stack->next->processes;
@ -581,10 +592,8 @@ static int DbugParse(CODE_STATE *cs, const char *control)
case 'o': case 'o':
if (sign < 0) if (sign < 0)
{ {
if (!is_shared(stack, out_file)) DBUGCloseFile(cs, sstderr);
DBUGCloseFile(cs, stack->out_file);
stack->flags &= ~FLUSH_ON_WRITE; stack->flags &= ~FLUSH_ON_WRITE;
stack->out_file= stderr;
break; break;
} }
if (c == 'a' || c == 'A') if (c == 'a' || c == 'A')
@ -884,18 +893,15 @@ void _db_set_init_(const char *control)
void _db_pop_() void _db_pop_()
{ {
struct settings *discard;
uint old_fflags; uint old_fflags;
CODE_STATE *cs; CODE_STATE *cs;
get_code_state_or_return; get_code_state_or_return;
discard= cs->stack; if (cs->stack != &init_settings)
if (discard != &init_settings)
{ {
old_fflags=fflags(cs); old_fflags=fflags(cs);
cs->stack= discard->next; FreeState(cs, 1);
FreeState(cs, discard, 1);
FixTraceFlags(old_fflags, cs); FixTraceFlags(old_fflags, cs);
} }
} }
@ -1009,7 +1015,7 @@ int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
op_str_to_buf( op_str_to_buf(
((cs->stack->flags & FLUSH_ON_WRITE ? 0 : 32) | ((cs->stack->flags & FLUSH_ON_WRITE ? 0 : 32) |
(cs->stack->flags & OPEN_APPEND ? 'A' : 'O')), (cs->stack->flags & OPEN_APPEND ? 'A' : 'O')),
cs->stack->name, cs->stack->out_file != stderr); cs->stack->name, cs->stack->out_file != sstderr);
op_list_to_buf('p', cs->stack->processes, cs->stack->processes); op_list_to_buf('p', cs->stack->processes, cs->stack->processes);
op_bool_to_buf('P', cs->stack->flags & PROCESS_ON); op_bool_to_buf('P', cs->stack->flags & PROCESS_ON);
op_bool_to_buf('r', cs->stack->sub_level != 0); op_bool_to_buf('r', cs->stack->sub_level != 0);
@ -1125,7 +1131,7 @@ void _db_enter_(const char *_func_, const char *_file_,
pthread_mutex_lock(&THR_LOCK_dbug); pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, _line_); DoPrefix(cs, _line_);
Indent(cs, cs->level); Indent(cs, cs->level);
(void) fprintf(cs->stack->out_file, ">%s\n", cs->func); (void) fprintf(cs->stack->out_file->file, ">%s\n", cs->func);
DbugFlush(cs); /* This does a unlock */ DbugFlush(cs); /* This does a unlock */
} }
break; break;
@ -1182,7 +1188,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_)
pthread_mutex_lock(&THR_LOCK_dbug); pthread_mutex_lock(&THR_LOCK_dbug);
DoPrefix(cs, _line_); DoPrefix(cs, _line_);
Indent(cs, cs->level); Indent(cs, cs->level);
(void) fprintf(cs->stack->out_file, "<%s\n", cs->func); (void) fprintf(cs->stack->out_file->file, "<%s\n", cs->func);
DbugFlush(cs); DbugFlush(cs);
} }
} }
@ -1271,9 +1277,9 @@ void _db_doprnt_(const char *format,...)
if (TRACING) if (TRACING)
Indent(cs, cs->level + 1); Indent(cs, cs->level + 1);
else else
(void) fprintf(cs->stack->out_file, "%s: ", cs->func); (void) fprintf(cs->stack->out_file->file, "%s: ", cs->func);
(void) fprintf(cs->stack->out_file, "%s: ", cs->u_keyword); (void) fprintf(cs->stack->out_file->file, "%s: ", cs->u_keyword);
DbugVfprintf(cs->stack->out_file, format, args); DbugVfprintf(cs->stack->out_file->file, format, args);
DbugFlush(cs); DbugFlush(cs);
errno=save_errno; errno=save_errno;
} }
@ -1333,9 +1339,9 @@ void _db_dump_(uint _line_, const char *keyword,
} }
else else
{ {
fprintf(cs->stack->out_file, "%s: ", cs->func); fprintf(cs->stack->out_file->file, "%s: ", cs->func);
} }
(void) fprintf(cs->stack->out_file, "%s: Memory: 0x%lx Bytes: (%ld)\n", (void) fprintf(cs->stack->out_file->file, "%s: Memory: 0x%lx Bytes: (%ld)\n",
keyword, (ulong) memory, (long) length); keyword, (ulong) memory, (long) length);
pos=0; pos=0;
@ -1344,14 +1350,14 @@ void _db_dump_(uint _line_, const char *keyword,
uint tmp= *((unsigned char*) memory++); uint tmp= *((unsigned char*) memory++);
if ((pos+=3) >= 80) if ((pos+=3) >= 80)
{ {
fputc('\n',cs->stack->out_file); fputc('\n',cs->stack->out_file->file);
pos=3; pos=3;
} }
fputc(_dig_vec_upper[((tmp >> 4) & 15)], cs->stack->out_file); fputc(_dig_vec_upper[((tmp >> 4) & 15)], cs->stack->out_file->file);
fputc(_dig_vec_upper[tmp & 15], cs->stack->out_file); fputc(_dig_vec_upper[tmp & 15], cs->stack->out_file->file);
fputc(' ',cs->stack->out_file); fputc(' ',cs->stack->out_file->file);
} }
(void) fputc('\n',cs->stack->out_file); (void) fputc('\n',cs->stack->out_file->file);
DbugFlush(cs); DbugFlush(cs);
} }
else if (!cs->locked) else if (!cs->locked)
@ -1578,8 +1584,9 @@ static void PushState(CODE_STATE *cs)
* state. If free_state is set, also free 'state' * state. If free_state is set, also free 'state'
* *
*/ */
static void FreeState(CODE_STATE *cs, struct settings *state, int free_state) static void FreeState(CODE_STATE *cs, int free_state)
{ {
struct settings *state= cs->stack;
if (!is_shared(state, keywords)) if (!is_shared(state, keywords))
FreeList(state->keywords); FreeList(state->keywords);
if (!is_shared(state, functions)) if (!is_shared(state, functions))
@ -1587,13 +1594,14 @@ static void FreeState(CODE_STATE *cs, struct settings *state, int free_state)
if (!is_shared(state, processes)) if (!is_shared(state, processes))
FreeList(state->processes); FreeList(state->processes);
if (!is_shared(state, out_file)) DBUGCloseFile(cs, NULL);
DBUGCloseFile(cs, state->out_file);
else
(void) fflush(state->out_file);
if (free_state) if (free_state)
free((void*) state); {
struct settings *next= state->next;
free(state);
cs->stack= next;
}
} }
@ -1616,9 +1624,7 @@ static void FreeState(CODE_STATE *cs, struct settings *state, int free_state)
*/ */
void _db_end_() void _db_end_()
{ {
struct settings *discard; CODE_STATE *cs, dummy_cs;
static struct settings tmp;
CODE_STATE *cs;
/* /*
Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was
called after dbug was initialized called after dbug was initialized
@ -1627,24 +1633,18 @@ void _db_end_()
cs= code_state(); cs= code_state();
if (cs) if (cs)
while ((discard= cs->stack))
{ {
if (discard == &init_settings) while (cs->stack && cs->stack != &init_settings)
break; FreeState(cs, 1);
cs->stack= discard->next; }
FreeState(cs, discard, 1); else
{
cs= &dummy_cs;
bzero(cs, sizeof(*cs));
} }
tmp= init_settings;
init_settings.flags= OPEN_APPEND; cs->stack= &init_settings;
init_settings.out_file= stderr; FreeState(cs, 0);
init_settings.maxdepth= 0;
init_settings.delay= 0;
init_settings.sub_level= 0;
init_settings.functions= 0;
init_settings.keywords= 0;
init_settings.processes= 0;
FreeState(cs, &tmp, 0);
} }
@ -1683,7 +1683,7 @@ FILE *_db_fp_(void)
{ {
CODE_STATE *cs; CODE_STATE *cs;
get_code_state_or_return NULL; get_code_state_or_return NULL;
return cs->stack->out_file; return cs->stack->out_file->file;
} }
/* /*
@ -1744,9 +1744,9 @@ static void Indent(CODE_STATE *cs, int indent)
for (count= 0; count < indent ; count++) for (count= 0; count < indent ; count++)
{ {
if ((count % INDENT) == 0) if ((count % INDENT) == 0)
fputc('|',cs->stack->out_file); fputc('|',cs->stack->out_file->file);
else else
fputc(' ',cs->stack->out_file); fputc(' ',cs->stack->out_file->file);
} }
} }
@ -1805,10 +1805,10 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
cs->lineno++; cs->lineno++;
if (cs->stack->flags & PID_ON) if (cs->stack->flags & PID_ON)
{ {
(void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name()); (void) fprintf(cs->stack->out_file->file, "%-7s: ", my_thread_name());
} }
if (cs->stack->flags & NUMBER_ON) if (cs->stack->flags & NUMBER_ON)
(void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno); (void) fprintf(cs->stack->out_file->file, "%5d: ", cs->lineno);
if (cs->stack->flags & TIMESTAMP_ON) if (cs->stack->flags & TIMESTAMP_ON)
{ {
#ifdef __WIN__ #ifdef __WIN__
@ -1816,7 +1816,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
in system ticks, 10 ms intervals. See my_getsystime.c for high res */ in system ticks, 10 ms intervals. See my_getsystime.c for high res */
SYSTEMTIME loc_t; SYSTEMTIME loc_t;
GetLocalTime(&loc_t); GetLocalTime(&loc_t);
(void) fprintf (cs->stack->out_file, (void) fprintf (cs->stack->out_file->file,
/* "%04d-%02d-%02d " */ /* "%04d-%02d-%02d " */
"%02d:%02d:%02d.%06d ", "%02d:%02d:%02d.%06d ",
/*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/ /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/
@ -1828,7 +1828,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
{ {
if ((tm_p= localtime((const time_t *)&tv.tv_sec))) if ((tm_p= localtime((const time_t *)&tv.tv_sec)))
{ {
(void) fprintf (cs->stack->out_file, (void) fprintf (cs->stack->out_file->file,
/* "%04d-%02d-%02d " */ /* "%04d-%02d-%02d " */
"%02d:%02d:%02d.%06d ", "%02d:%02d:%02d.%06d ",
/*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/ /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/
@ -1839,13 +1839,13 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
#endif #endif
} }
if (cs->stack->flags & PROCESS_ON) if (cs->stack->flags & PROCESS_ON)
(void) fprintf(cs->stack->out_file, "%s: ", cs->process); (void) fprintf(cs->stack->out_file->file, "%s: ", cs->process);
if (cs->stack->flags & FILE_ON) if (cs->stack->flags & FILE_ON)
(void) fprintf(cs->stack->out_file, "%14s: ", BaseName(cs->file)); (void) fprintf(cs->stack->out_file->file, "%14s: ", BaseName(cs->file));
if (cs->stack->flags & LINE_ON) if (cs->stack->flags & LINE_ON)
(void) fprintf(cs->stack->out_file, "%5d: ", _line_); (void) fprintf(cs->stack->out_file->file, "%5d: ", _line_);
if (cs->stack->flags & DEPTH_ON) if (cs->stack->flags & DEPTH_ON)
(void) fprintf(cs->stack->out_file, "%4d: ", cs->level); (void) fprintf(cs->stack->out_file->file, "%4d: ", cs->level);
} }
@ -1884,9 +1884,7 @@ static void DBUGOpenFile(CODE_STATE *cs,
name=cs->stack->name; name=cs->stack->name;
if (strcmp(name, "-") == 0) if (strcmp(name, "-") == 0)
{ {
if (!is_shared(cs->stack, out_file)) DBUGCloseFile(cs, sstdout);
DBUGCloseFile(cs, cs->stack->out_file);
cs->stack->out_file= stdout;
cs->stack->flags |= FLUSH_ON_WRITE; cs->stack->flags |= FLUSH_ON_WRITE;
cs->stack->name[0]=0; cs->stack->name[0]=0;
} }
@ -1908,9 +1906,10 @@ static void DBUGOpenFile(CODE_STATE *cs,
} }
else else
{ {
if (!is_shared(cs->stack, out_file)) sFILE *sfp= (sFILE *)DbugMalloc(sizeof(sFILE));
DBUGCloseFile(cs, cs->stack->out_file); sfp->file= fp;
cs->stack->out_file= fp; sfp->used= 1;
DBUGCloseFile(cs, sfp);
} }
} }
} }
@ -1934,16 +1933,30 @@ static void DBUGOpenFile(CODE_STATE *cs,
* *
*/ */
static void DBUGCloseFile(CODE_STATE *cs, FILE *fp) static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
{ {
if (cs && fp && fp != stderr && fp != stdout && fclose(fp) == EOF) sFILE *fp;
{ if (!cs || !cs->stack || !cs->stack->out_file)
return;
if (!cs->locked) if (!cs->locked)
pthread_mutex_lock(&THR_LOCK_dbug); pthread_mutex_lock(&THR_LOCK_dbug);
(void) fprintf(cs->stack->out_file, ERR_CLOSE, cs->process);
fp= cs->stack->out_file;
if (--fp->used == 0)
{
if (fclose(fp->file) == EOF)
{
(void) fprintf(stderr, ERR_CLOSE, cs->process);
perror(""); perror("");
DbugFlush(cs);
} }
else
{
free(fp);
}
}
cs->stack->out_file= new_value;
if (!cs->locked)
pthread_mutex_unlock(&THR_LOCK_dbug);
} }
@ -2111,7 +2124,7 @@ static void DbugFlush(CODE_STATE *cs)
{ {
if (cs->stack->flags & FLUSH_ON_WRITE) if (cs->stack->flags & FLUSH_ON_WRITE)
{ {
(void) fflush(cs->stack->out_file); (void) fflush(cs->stack->out_file->file);
if (cs->stack->delay) if (cs->stack->delay)
(void) Delay(cs->stack->delay); (void) Delay(cs->stack->delay);
} }
@ -2126,7 +2139,7 @@ void _db_flush_()
{ {
CODE_STATE *cs; CODE_STATE *cs;
get_code_state_or_return; get_code_state_or_return;
(void) fflush(cs->stack->out_file); (void) fflush(cs->stack->out_file->file);
} }

View File

@ -38,10 +38,10 @@ int func1()
int main (int argc, char *argv[]) int main (int argc, char *argv[])
{ {
int i;
#ifdef DBUG_OFF #ifdef DBUG_OFF
return 1; return 1;
#endif #else
int i;
if (argc == 1) if (argc == 1)
return 0; return 0;
@ -83,4 +83,5 @@ int main (int argc, char *argv[])
DBUG_SET(""); /* to not have my_end() in the traces */ DBUG_SET(""); /* to not have my_end() in the traces */
my_end(0); my_end(0);
return 0; return 0;
#endif /* DBUG_OFF */
} }

View File

@ -169,8 +169,6 @@ install: build
# libmysqlclient-dev: forgotten header file since 3.23.25? # libmysqlclient-dev: forgotten header file since 3.23.25?
cp $(BUILDDIR)/include/my_config.h $(TMP)/usr/include/mysql/ cp $(BUILDDIR)/include/my_config.h $(TMP)/usr/include/mysql/
cp include/my_dir.h $(TMP)/usr/include/mysql/ cp include/my_dir.h $(TMP)/usr/include/mysql/
mv $(TMP)/usr/include/mysql/mysql/*.h $(TMP)/usr/include/mysql/
mv $(TMP)/usr/include/mysql/mysql/psi $(TMP)/usr/include/mysql/
# mysql-common: We provide our own version of this package for # mysql-common: We provide our own version of this package for
# completeness, but we can use an existing version; mariadb-specic # completeness, but we can use an existing version; mariadb-specic

View File

@ -169,8 +169,6 @@ install: build
# libmysqlclient-dev: forgotten header file since 3.23.25? # libmysqlclient-dev: forgotten header file since 3.23.25?
cp $(BUILDDIR)/include/my_config.h $(TMP)/usr/include/mysql/ cp $(BUILDDIR)/include/my_config.h $(TMP)/usr/include/mysql/
cp include/my_dir.h $(TMP)/usr/include/mysql/ cp include/my_dir.h $(TMP)/usr/include/mysql/
mv $(TMP)/usr/include/mysql/mysql/*.h $(TMP)/usr/include/mysql/
mv $(TMP)/usr/include/mysql/mysql/psi $(TMP)/usr/include/mysql/
# mysql-common: We provide our own version of this package for # mysql-common: We provide our own version of this package for
# completeness, but we can use an existing version; mariadb-specic # completeness, but we can use an existing version; mariadb-specic

View File

@ -67,7 +67,7 @@ static struct my_option my_long_options[] =
{"defaults-extra-file", 'e', {"defaults-extra-file", 'e',
"Read this file after the global config file and before the config " "Read this file after the global config file and before the config "
"file in the users home directory; should be the first option", "file in the users home directory; should be the first option",
&my_defaults_extra_file, &my_defaults_extra_file, 0, (void *)&my_defaults_extra_file, (void *)&my_defaults_extra_file, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"defaults-group-suffix", 'g', {"defaults-group-suffix", 'g',
"In addition to the given groups, read also groups with this suffix", "In addition to the given groups, read also groups with this suffix",
@ -75,8 +75,8 @@ static struct my_option my_long_options[] =
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"extra-file", 'e', {"extra-file", 'e',
"Deprecated. Synonym for --defaults-extra-file.", "Deprecated. Synonym for --defaults-extra-file.",
&my_defaults_extra_file, (void *)&my_defaults_extra_file,
&my_defaults_extra_file, 0, GET_STR, (void *)&my_defaults_extra_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"no-defaults", 'n', "Return an empty string (useful for scripts).", {"no-defaults", 'n', "Return an empty string (useful for scripts).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},

View File

@ -1,13 +1,19 @@
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Installation Instructions
Foundation, Inc. *************************
This file is free documentation; the Free Software Foundation gives Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it. unlimited permission to copy, distribute and modify it.
Basic Installation Basic Installation
================== ==================
These are generic installation instructions. Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses various system-dependent variables used during compilation. It uses
@ -20,9 +26,9 @@ debugging `configure').
It can also use an optional file (typically called `config.cache' It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale disabled by default to prevent problems with accidental use of stale
cache files.) cache files.
If you need to do unusual things to compile the package, please try If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail to figure out how `configure' could check whether to do them, and mail
@ -32,20 +38,17 @@ some point `config.cache' contains results you don't want to keep, you
may remove or edit it. may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You only need `configure' by a program called `autoconf'. You need `configure.ac' if
`configure.ac' if you want to change it or regenerate `configure' using you want to change it or regenerate `configure' using a newer version
a newer version of `autoconf'. of `autoconf'.
The simplest way to compile this package is: The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type 1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're `./configure' to configure the package for your system.
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some Running `configure' might take a while. While running, it prints
messages telling which features it is checking for. some messages telling which features it is checking for.
2. Type `make' to compile the package. 2. Type `make' to compile the package.
@ -67,51 +70,49 @@ The simplest way to compile this package is:
Compilers and Options Compilers and Options
===================== =====================
Some systems require unusual options for compilation or linking that Some systems require unusual options for compilation or linking that the
the `configure' script does not know about. Run `./configure --help' `configure' script does not know about. Run `./configure --help' for
for details on some of the pertinent environment variables. details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here by setting variables in the command line or in the environment. Here
is an example: is an example:
./configure CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details. *Note Defining Variables::, for more details.
Compiling For Multiple Architectures Compiling For Multiple Architectures
==================================== ====================================
You can compile the package for more than one kind of computer at the You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that own directory. To do this, you can use GNU `make'. `cd' to the
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not support the `VPATH' With a non-GNU `make', it is safer to compile the package for one
variable, you have to compile the package for one architecture at a architecture at a time in the source code directory. After you have
time in the source code directory. After you have installed the installed the package for one architecture, use `make distclean' before
package for one architecture, use `make distclean' before reconfiguring reconfiguring for another architecture.
for another architecture.
Installation Names Installation Names
================== ==================
By default, `make install' will install the package's files in By default, `make install' installs the package's commands under
`/usr/local/bin', `/usr/local/man', etc. You can specify an `/usr/local/bin', include files under `/usr/local/include', etc. You
installation prefix other than `/usr/local' by giving `configure' the can specify an installation prefix other than `/usr/local' by giving
option `--prefix=PATH'. `configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PATH as the prefix for installing programs and libraries. PREFIX as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix. Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. you can set and what kinds of files go in them.
@ -122,7 +123,7 @@ option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features Optional Features
================= =================
Some packages pay attention to `--enable-FEATURE' options to Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package. `configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The is something like `gnu-as' or `x' (for the X Window System). The
@ -137,11 +138,11 @@ you can use the `configure' options `--x-includes=DIR' and
Specifying the System Type Specifying the System Type
========================== ==========================
There may be some features `configure' cannot figure out There may be some features `configure' cannot figure out automatically,
automatically, but needs to determine by the type of machine the package but needs to determine by the type of machine the package will run on.
will run on. Usually, assuming the package is built to be run on the Usually, assuming the package is built to be run on the _same_
_same_ architectures, `configure' can figure that out, but if it prints architectures, `configure' can figure that out, but if it prints a
a message saying it cannot guess the machine type, give it the message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system `--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form: type, such as `sun4', or a canonical name which has the form:
@ -156,7 +157,7 @@ where SYSTEM can have one of these forms:
need to know the machine type. need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should If you are _building_ compiler tools for cross-compiling, you should
use the `--target=TYPE' option to select the type of system they will use the option `--target=TYPE' to select the type of system they will
produce code for. produce code for.
If you want to _use_ a cross compiler, that generates code for a If you want to _use_ a cross compiler, that generates code for a
@ -167,9 +168,9 @@ eventually be run) with `--host=TYPE'.
Sharing Defaults Sharing Defaults
================ ================
If you want to set default values for `configure' scripts to share, If you want to set default values for `configure' scripts to share, you
you can create a site shell script called `config.site' that gives can create a site shell script called `config.site' that gives default
default values for variables like `CC', `cache_file', and `prefix'. values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then `configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the `PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script. `CONFIG_SITE' environment variable to the location of the site script.
@ -178,7 +179,7 @@ A warning: not all `configure' scripts look for a site script.
Defining Variables Defining Variables
================== ==================
Variables not defined in a site shell script can be set in the Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set variables may be lost. In order to avoid this problem, you should set
@ -186,14 +187,18 @@ them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc ./configure CC=/usr/local2/bin/gcc
will cause the specified gcc to be used as the C compiler (unless it is causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script). overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation `configure' Invocation
====================== ======================
`configure' recognizes the following options to control how it `configure' recognizes the following options to control how it operates.
operates.
`--help' `--help'
`-h' `-h'

View File

@ -1,3 +1,120 @@
*** Note, Please read ***
yaSSL takes a different approach to certificate verification than OpenSSL does.
The default policy for the client is to verify the server, this means that if
you don't load CAs to verify the server you'll get a connect error, unable to
verify. It you want to mimic OpenSSL behavior of not verifying the server and
reducing security you can do this by calling:
SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
before calling SSL_new();
*** end Note ***
yaSSL Release notes, version 2.1.2 (9/2/2011)
This release of yaSSL contains bug fixes, better non-blocking support with
SSL_write, and OpenSSL RSA public key format support.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 2.0.0 (7/6/2010)
This release of yaSSL contains bug fixes, new testing certs,
and a security patch for a potential heap overflow on forged application
data processing. Vulnerability discovered by Matthieu Bonetti from VUPEN
Security http://www.vupen.com.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.9.9 (1/26/2010)
This release of yaSSL contains bug fixes, the removal of assert() s and
a security patch for a buffer overflow possibility in certificate name
processing.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.9.8 (10/14/09)
This release of yaSSL contains bug fixes and adds new stream ciphers
Rabbit and HC-128
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.9.6 (11/13/08)
This release of yaSSL contains bug fixes, adds autconf shared library
support and has better server suite detection based on certficate and
private key.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.9.2 (9/24/08)
This release of yaSSL contains bug fixes and improved certificate verify
callback support.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.8.8 (5/7/08)
This release of yaSSL contains bug fixes, and better socket handling.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.8.6 (1/31/08)
This release of yaSSL contains bug fixes, and fixes security problems
associated with using SSL 2.0 client hellos and improper input handling.
Please upgrade to this version if you are using a previous one.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.7.5 (10/15/07)
This release of yaSSL contains bug fixes, adds MSVC 2005 project support,
GCC 4.2 support, IPV6 support and test, and new test certificates.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.7.2 (8/20/07)
This release of yaSSL contains bug fixes and adds initial OpenVPN support.
Just configure at this point and beginning of build.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.6.8 (4/16/07)
This release of yaSSL contains bug fixes and adds SHA-256, SHA-512, SHA-224,
and SHA-384.
See normal build instructions below under 1.0.6.
See libcurl build instructions below under 1.3.0 and note in 1.5.8.
*****************yaSSL Release notes, version 1.6.0 (2/22/07) *****************yaSSL Release notes, version 1.6.0 (2/22/07)
This release of yaSSL contains bug fixes, portability enhancements, and This release of yaSSL contains bug fixes, portability enhancements, and
@ -13,7 +130,7 @@ See libcurl build instructions below under 1.3.0 and note in 1.5.8.
Since yaSSL now supports zlib, as does libcur, the libcurl build test can Since yaSSL now supports zlib, as does libcurl, the libcurl build test can
fail if yaSSL is built with zlib support since the zlib library isn't fail if yaSSL is built with zlib support since the zlib library isn't
passed. You can do two things to fix this: passed. You can do two things to fix this:
@ -518,7 +635,7 @@ in the source and include files.
********************* *********************
Contact: please send comments or questions to Todd A Ouska at todd@yassl.com Contact: please send comments or questions to Todd A Ouska at todd@yassl.com
and/or Larry Stefonic at larry@yassl.com or 425-741-6858. and/or Larry Stefonic at larry@yassl.com.

View File

@ -1,53 +1,56 @@
Certificate: Certificate:
Data: Data:
Version: 3 (0x2) Version: 3 (0x2)
Serial Number: 0 (0x0) Serial Number:
8a:37:22:65:73:f5:aa:e8
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com Issuer: C=US, ST=Montana, L=Bozeman, O=sawtooth, OU=consulting, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
Validity Validity
Not Before: Mar 7 03:10:11 2005 GMT Not Before: Jun 30 18:47:10 2010 GMT
Not After : Apr 1 03:10:11 2046 GMT Not After : Mar 26 18:47:10 2013 GMT
Subject: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com Subject: C=US, ST=Montana, L=Bozeman, O=sawtooth, OU=consulting, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
Subject Public Key Info: Subject Public Key Info:
Public Key Algorithm: rsaEncryption Public Key Algorithm: rsaEncryption
RSA Public Key: (512 bit) RSA Public Key: (512 bit)
Modulus (512 bit): Modulus (512 bit):
00:ef:c1:e3:9a:3c:6e:6e:cb:26:6f:05:be:e0:cb: 00:97:30:b9:1a:92:ef:25:4f:ca:4c:11:31:95:1a:
57:a0:4b:68:e6:1b:f9:95:db:01:92:aa:6e:a6:b5: e1:c0:10:19:0a:20:b9:37:80:1a:57:38:02:4e:1b:
2d:b1:2b:50:fd:db:13:f2:c5:d8:b8:4f:75:28:53: c5:0f:28:4f:da:e3:c9:16:aa:50:bd:4a:fb:b7:71:
72:e8:e5:11:9d:bb:c3:4f:4f:09:fd:4c:e7:46:d5: c7:35:cc:63:81:c1:dd:9d:33:f9:38:16:88:32:a0:
1d:bb:35:02:af aa:56:23:03:a3
Exponent: 65537 (0x10001) Exponent: 65537 (0x10001)
X509v3 extensions: X509v3 extensions:
X509v3 Subject Key Identifier: X509v3 Subject Key Identifier:
1D:EF:A1:B8:81:78:12:47:E8:57:06:08:74:18:F7:D3:AA:D8:F7:BD 3B:66:FD:A0:40:C6:F4:E2:70:CF:21:1A:0C:4F:67:FE:B7:4B:42:09
X509v3 Authority Key Identifier: X509v3 Authority Key Identifier:
keyid:1D:EF:A1:B8:81:78:12:47:E8:57:06:08:74:18:F7:D3:AA:D8:F7:BD keyid:3B:66:FD:A0:40:C6:F4:E2:70:CF:21:1A:0C:4F:67:FE:B7:4B:42:09
DirName:/C=US/ST=Oregon/L=Portland/O=sawtooth/CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com DirName:/C=US/ST=Montana/L=Bozeman/O=sawtooth/OU=consulting/CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
serial:00 serial:8A:37:22:65:73:F5:AA:E8
X509v3 Basic Constraints: X509v3 Basic Constraints:
CA:TRUE CA:TRUE
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: md5WithRSAEncryption
d9:77:e3:07:d9:2e:ec:2f:9b:8e:9e:ca:b4:00:0b:ef:c7:74: 32:65:a2:b1:dc:6d:e0:8d:8b:c8:58:29:8e:b8:18:4b:62:88:
cb:f4:f6:44:2f:02:75:17:a5:74:3e:26:b2:26:fd:1f:ab:3a: 13:67:f8:6c:75:46:75:8f:8a:19:a6:a3:d5:3c:fc:57:4e:7a:
df:d5:e3:05:14:08:d0:8c:1d:c9:3e:e1:59:6f:b3:38:5d:af: 68:a9:fc:93:dc:ae:29:7d:bb:4e:ec:ea:55:fa:a4:e3:00:61:
78:60:e3:c5:6a:69:96:80:7d:00 f4:b0:34:6d:d1:d5:a4:64:24:f8
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIC7zCCApmgAwIBAgIBADANBgkqhkiG9w0BAQQFADCBiTELMAkGA1UEBhMCVVMx MIIDQDCCAuqgAwIBAgIJAIo3ImVz9aroMA0GCSqGSIb3DQEBBAUAMIGeMQswCQYD
DzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxETAPBgNVBAoTCHNh VQQGEwJVUzEQMA4GA1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjERMA8G
d3Rvb3RoMSQwIgYDVQQDExt3d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAb A1UEChMIc2F3dG9vdGgxEzARBgNVBAsTCmNvbnN1bHRpbmcxJDAiBgNVBAMTG3d3
BgkqhkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMB4XDTA1MDMwNzAzMTAxMVoXDTQ2 dy5zYXd0b290aC1jb25zdWx0aW5nLmNvbTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5
MDQwMTAzMTAxMVowgYkxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAP YXNzbC5jb20wHhcNMTAwNjMwMTg0NzEwWhcNMTMwMzI2MTg0NzEwWjCBnjELMAkG
BgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290aDEkMCIGA1UEAxMbd3d3 A1UEBhMCVVMxEDAOBgNVBAgTB01vbnRhbmExEDAOBgNVBAcTB0JvemVtYW4xETAP
LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlh BgNVBAoTCHNhd3Rvb3RoMRMwEQYDVQQLEwpjb25zdWx0aW5nMSQwIgYDVQQDExt3
c3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDvweOaPG5uyyZvBb7gy1eg d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A
S2jmG/mV2wGSqm6mtS2xK1D92xPyxdi4T3UoU3Lo5RGdu8NPTwn9TOdG1R27NQKv eWFzc2wuY29tMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJcwuRqS7yVPykwRMZUa
AgMBAAGjgekwgeYwHQYDVR0OBBYEFB3vobiBeBJH6FcGCHQY99Oq2Pe9MIG2BgNV 4cAQGQoguTeAGlc4Ak4bxQ8oT9rjyRaqUL1K+7dxxzXMY4HB3Z0z+TgWiDKgqlYj
HSMEga4wgauAFB3vobiBeBJH6FcGCHQY99Oq2Pe9oYGPpIGMMIGJMQswCQYDVQQG A6MCAwEAAaOCAQcwggEDMB0GA1UdDgQWBBQ7Zv2gQMb04nDPIRoMT2f+t0tCCTCB
EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDERMA8GA1UE 0wYDVR0jBIHLMIHIgBQ7Zv2gQMb04nDPIRoMT2f+t0tCCaGBpKSBoTCBnjELMAkG
ChMIc2F3dG9vdGgxJDAiBgNVBAMTG3d3dy5zYXd0b290aC1jb25zdWx0aW5nLmNv A1UEBhMCVVMxEDAOBgNVBAgTB01vbnRhbmExEDAOBgNVBAcTB0JvemVtYW4xETAP
bTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb22CAQAwDAYDVR0TBAUwAwEB BgNVBAoTCHNhd3Rvb3RoMRMwEQYDVQQLEwpjb25zdWx0aW5nMSQwIgYDVQQDExt3
/zANBgkqhkiG9w0BAQQFAANBANl34wfZLuwvm46eyrQAC+/HdMv09kQvAnUXpXQ+ d3cuc2F3dG9vdGgtY29uc3VsdGluZy5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A
JrIm/R+rOt/V4wUUCNCMHck+4Vlvszhdr3hg48VqaZaAfQA= eWFzc2wuY29tggkAijciZXP1qugwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQQF
AANBADJlorHcbeCNi8hYKY64GEtiiBNn+Gx1RnWPihmmo9U8/FdOemip/JPcril9
u07s6lX6pOMAYfSwNG3R1aRkJPg=
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -0,0 +1,9 @@
-----BEGIN RSA PRIVATE KEY-----
MIIBOQIBAAJBAJcwuRqS7yVPykwRMZUa4cAQGQoguTeAGlc4Ak4bxQ8oT9rjyRaq
UL1K+7dxxzXMY4HB3Z0z+TgWiDKgqlYjA6MCAwEAAQJAEQ9TY7c+uuQU/J5YDO4a
mRR37tegbq3Kyxqrz+p8QuhqLDtVh13GaF7rVU70vyNHm+cgihUyzho/PViAkPBo
qQIhAMU8/RDhDLgL5BxID4sxKIVBtg+imFSbyKVyg7oQLUcXAiEAxDu94O45Cf4a
np9R0thumY/QqWpCkycWAB7fFEuaf1UCIEH+bg4/vqm2ENUFp23DPPOZUPlaRe3J
UhFJh5mx3/RxAiBq++8vfHFYg1Lb/BxOCXVy/zdRxf753ytdcXdJx1Y56QIgVgpN
FNfYJofQfWaP96sjlc0usrT28uceHx0QmHqolVc=
-----END RSA PRIVATE KEY-----

Binary file not shown.

View File

@ -1,52 +1,55 @@
Certificate: Certificate:
Data: Data:
Version: 3 (0x2) Version: 3 (0x2)
Serial Number: 0 (0x0) Serial Number:
c5:d7:6c:11:36:f0:35:e1
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, CN=www.yassl.com/emailAddress=info@yassl.com Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=programming, CN=www.yassl.com/emailAddress=info@yassl.com
Validity Validity
Not Before: Mar 7 03:00:31 2005 GMT Not Before: Jun 30 18:39:39 2010 GMT
Not After : Apr 1 03:00:31 2046 GMT Not After : Mar 26 18:39:40 2013 GMT
Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, CN=www.yassl.com/emailAddress=info@yassl.com Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=programming, CN=www.yassl.com/emailAddress=info@yassl.com
Subject Public Key Info: Subject Public Key Info:
Public Key Algorithm: rsaEncryption Public Key Algorithm: rsaEncryption
RSA Public Key: (512 bit) RSA Public Key: (512 bit)
Modulus (512 bit): Modulus (512 bit):
00:cd:1f:78:47:f8:b8:d6:08:bf:bd:7c:23:61:86: 00:bd:51:4a:14:fd:6a:19:84:0c:33:38:fc:27:32:
36:28:ac:ee:3c:a8:9a:94:e6:d5:26:e8:71:50:b2: 9c:97:0b:fc:a4:18:60:69:4e:d9:d8:78:50:0b:e9:
26:8b:1c:1e:3f:75:b2:d3:b3:67:95:0c:fd:76:28: 20:5d:d6:1d:70:1c:0c:24:9f:23:82:cc:3a:01:d5:
65:d5:ce:12:82:9e:06:00:a2:09:dd:ce:3a:26:dd: 97:17:b2:73:6c:86:cf:b5:f1:e5:ce:68:0c:d9:a2:
46:2a:a0:45:71 12:39:7c:f2:53
Exponent: 65537 (0x10001) Exponent: 65537 (0x10001)
X509v3 extensions: X509v3 extensions:
X509v3 Subject Key Identifier: X509v3 Subject Key Identifier:
AE:25:5E:FA:4D:A3:5B:2B:87:DE:F1:2A:F5:42:C0:FF:CE:B5:B4:AD 5C:F7:29:21:69:7A:09:78:9E:7B:CD:53:42:02:EC:CE:29:0D:11:DF
X509v3 Authority Key Identifier: X509v3 Authority Key Identifier:
keyid:AE:25:5E:FA:4D:A3:5B:2B:87:DE:F1:2A:F5:42:C0:FF:CE:B5:B4:AD keyid:5C:F7:29:21:69:7A:09:78:9E:7B:CD:53:42:02:EC:CE:29:0D:11:DF
DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL/CN=www.yassl.com/emailAddress=info@yassl.com DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL/OU=programming/CN=www.yassl.com/emailAddress=info@yassl.com
serial:00 serial:C5:D7:6C:11:36:F0:35:E1
X509v3 Basic Constraints: X509v3 Basic Constraints:
CA:TRUE CA:TRUE
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: md5WithRSAEncryption
59:19:ae:1b:4e:65:9e:ca:f1:b8:3d:ff:c7:5e:15:86:10:97: b4:a5:f1:71:26:4d:b9:ff:54:f3:09:1f:ac:e1:19:59:e5:ec:
8c:3e:22:32:ab:4e:75:a7:70:83:f2:fb:2f:af:fe:26:28:e9: 57:e3:f1:0b:b2:8f:f3:29:eb:6b:c6:fa:27:33:3e:91:d0:77:
4f:d4:c9:49:7c:6f:51:7e:2a:ff:a0:5b:25:45:2e:66:d9:0d: 43:c9:ce:1e:0f:71:07:a9:f7:26:e0:7e:ff:30:7d:52:0a:e1:
92:94:e5:b8:60:c6:67:1a:f3:03 80:48:46:bb:99:e9:d9:77:ce:75
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIICtzCCAmGgAwIBAgIBADANBgkqhkiG9w0BAQQFADB4MQswCQYDVQQGEwJVUzEP MIIDDjCCArigAwIBAgIJAMXXbBE28DXhMA0GCSqGSIb3DQEBBAUAMIGOMQswCQYD
MA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwGA1UEChMFeWFT VQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwG
U0wxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkqhkiG9w0BCQEWDmluZm9A A1UEChMFeWFTU0wxFDASBgNVBAsTC3Byb2dyYW1taW5nMRYwFAYDVQQDEw13d3cu
eWFzc2wuY29tMB4XDTA1MDMwNzAzMDAzMVoXDTQ2MDQwMTAzMDAzMVoweDELMAkG eWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0xMDA2
A1UEBhMCVVMxDzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxhbmQxDjAM MzAxODM5MzlaFw0xMzAzMjYxODM5NDBaMIGOMQswCQYDVQQGEwJVUzEPMA0GA1UE
BgNVBAoTBXlhU1NMMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcN CBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDEOMAwGA1UEChMFeWFTU0wxFDAS
AQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDNH3hH BgNVBAsTC3Byb2dyYW1taW5nMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJ
+LjWCL+9fCNhhjYorO48qJqU5tUm6HFQsiaLHB4/dbLTs2eVDP12KGXVzhKCngYA KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgC
ogndzjom3UYqoEVxAgMBAAGjgdUwgdIwHQYDVR0OBBYEFK4lXvpNo1srh97xKvVC QQC9UUoU/WoZhAwzOPwnMpyXC/ykGGBpTtnYeFAL6SBd1h1wHAwknyOCzDoB1ZcX
wP/OtbStMIGiBgNVHSMEgZowgZeAFK4lXvpNo1srh97xKvVCwP/OtbStoXykejB4 snNshs+18eXOaAzZohI5fPJTAgMBAAGjgfYwgfMwHQYDVR0OBBYEFFz3KSFpegl4
MQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFu nnvNU0IC7M4pDRHfMIHDBgNVHSMEgbswgbiAFFz3KSFpegl4nnvNU0IC7M4pDRHf
ZDEOMAwGA1UEChMFeWFTU0wxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkq oYGUpIGRMIGOMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH
hkiG9w0BCQEWDmluZm9AeWFzc2wuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZI EwhQb3J0bGFuZDEOMAwGA1UEChMFeWFTU0wxFDASBgNVBAsTC3Byb2dyYW1taW5n
hvcNAQEEBQADQQBZGa4bTmWeyvG4Pf/HXhWGEJeMPiIyq051p3CD8vsvr/4mKOlP MRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlh
1MlJfG9Rfir/oFslRS5m2Q2SlOW4YMZnGvMD c3NsLmNvbYIJAMXXbBE28DXhMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQAD
QQC0pfFxJk25/1TzCR+s4RlZ5exX4/ELso/zKetrxvonMz6R0HdDyc4eD3EHqfcm
4H7/MH1SCuGASEa7menZd851
-----END CERTIFICATE----- -----END CERTIFICATE-----

Binary file not shown.

View File

@ -1,9 +1,9 @@
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIBOgIBAAJBAM0feEf4uNYIv718I2GGNiis7jyompTm1SbocVCyJoscHj91stOz MIIBPAIBAAJBAL1RShT9ahmEDDM4/CcynJcL/KQYYGlO2dh4UAvpIF3WHXAcDCSf
Z5UM/XYoZdXOEoKeBgCiCd3OOibdRiqgRXECAwEAAQJAXwa6OVVvg7Bv63+MAI0l I4LMOgHVlxeyc2yGz7Xx5c5oDNmiEjl88lMCAwEAAQJAVGHWLlLhpqvXsEEXCvWh
n/hlMfLGEj9R9gFvJXwywPSEQhijOZmedpHALufFPNHtwba9dmbqMkBAw9JDaAgg HCYono+K8YVGzhiaPSTU212fCoQryIxsXQKGBjhFdZm96DZWp+Vd/t/u+B4ZeaqY
QQIhAO+mBaSmoG5AYVKYQZiASe/2wMZjaQSN+zFLyF97OX8ZAiEA2x5iRmXUkbOT +QIhAOBEfbFtdZqk5OmbbRsRVPI7+YYmubgY1TVIPqmxHQ4NAiEA2BrTQkjOb3ul
8Td/vx8R9mq9W5CJu+cN+SWGwTYhPBkCIGZFM6NQeKaUUvQshdHO7b66Twpa4jZP A/SZO04fJUZsm7Ng92FWHDJsRancSd8CIQCmGbQqZBK1TamJZ6dAY+7RViAx/p6Q
YSNoc9pLe/4BAiB+jIvBkKo2A/rbg2waG32qTXdTXKTPiuA9Fnk/OV30cQIhANuA vjuzMeXPUrFdRQIhAMkfBhg9bCqjFyt8PBPOm/vz8+ZgZlE0/JAXeV7IPCVfAiEA
uMdo+T+rYcNGJ1hCYKDe9JWBpNfSQ+H/A7sWuW8L gZwCFm1ghGxmaoB424YC4DHeDeN/g9xwJHT7EuM9Mvc=
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,12 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-CBC,B9D8FB94E38635AB
e7bVyzL1RF6p7hl8GDaOrRTcgB4ip+pWWUcnNf6y2tsuAQx/c/Bd5c9ZDc3L5AXC
oOAzWYB+ay1vWkmAQB4ivFS5QzGDf8870d4FbOejwmgPhiHdZNw5xNwscAN6ps0v
dFaUrR9nzWmbycsQCjXZGIZtGFCtXkA8Gdl5OMO4o+rzM0muNPS5fb++x7oNl1YG
gjReu2sQ85dPfMlnoHhr8Pz9LBcxVyOmcqtmT0SOSuPcoj6aDtcZ+EY9MQf6SR9E
ysmrJKMtp+ABgXglAj5hbT0dMpoJ2KpJYk62JAh/A6DDyv5YYUI0W57xY5+QzaV+
YXnIvqwLjJ3cXEV4YH7ozLHAESgnAAUoQsin42rrRKt7GxjSdBoFhWjH69V2nl65
LYRNjE1O5BBEX+rz0S+fe2ZZgT17kUr7eLZCq15J+L5xWQ7R4ERc0w==
-----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,12 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,BDE979D13CCC0ABD
N7yz2JV13EmQ7MZPL5wamid5+G1V1gp8FKqMemAC5JDxonS/W9oViMLUcxbfPTDx
FznKdYSVTIQ7vv3ofmDG4MEyV/2C568N2kdtAw+jTfrZFN+IU9CI+W+In/nacirF
02sAcvDMofustnooKNOO7/iyb5+3vRvEt5vSSRQn5WuSQ9sUKjuzoLs/lbf7fyAt
4NeqfI3rYBZXxiUOLITOGXzGNRuFoY+o2uDCfelLAJ8uhiVG6ME3LeJEo1dT5lZ8
CSJOLPasKg0iG4V7olM4j9FvAfZr48RRsSfUen756Jo2HpI4bad8LKhFYIdNs2Au
WwKLmjpo6QB9hBmRshR04rEXPdrgTqLBExCE08PyaGYnWU8ggWritCeBzDQFj/n4
sI+NO0Mymuvg98e5RpO52lg3Xnqv9RIK3guLFOmI6aEHC0PS4WwOEQ==
-----END RSA PRIVATE KEY-----

View File

@ -1,13 +1,14 @@
Certificate: Certificate:
Data: Data:
Version: 3 (0x2) Version: 3 (0x2)
Serial Number: 0 (0x0) Serial Number:
ce:df:23:31:64:b4:13:da
Signature Algorithm: dsaWithSHA1 Signature Algorithm: dsaWithSHA1
Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL DSA, CN=yaSSL DSA/emailAddress=info@yassl.com Issuer: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=testing, CN=www.yassl.com/emailAddress=info@yassl.com
Validity Validity
Not Before: Mar 7 03:22:00 2005 GMT Not Before: Jun 30 18:56:38 2010 GMT
Not After : Apr 1 03:22:00 2046 GMT Not After : Mar 26 18:56:39 2013 GMT
Subject: C=US, ST=Oregon, L=Portland, O=yaSSL DSA, CN=yaSSL DSA/emailAddress=info@yassl.com Subject: C=US, ST=Oregon, L=Portland, O=yaSSL, OU=testing, CN=www.yassl.com/emailAddress=info@yassl.com
Subject Public Key Info: Subject Public Key Info:
Public Key Algorithm: dsaEncryption Public Key Algorithm: dsaEncryption
DSA Public Key: DSA Public Key:
@ -37,32 +38,33 @@ Certificate:
BE:F9:8C:5D:D6:1C:B4:EE:81:DD:36:56:0A:21:E4:61:44:73:E9:E2 BE:F9:8C:5D:D6:1C:B4:EE:81:DD:36:56:0A:21:E4:61:44:73:E9:E2
X509v3 Authority Key Identifier: X509v3 Authority Key Identifier:
keyid:BE:F9:8C:5D:D6:1C:B4:EE:81:DD:36:56:0A:21:E4:61:44:73:E9:E2 keyid:BE:F9:8C:5D:D6:1C:B4:EE:81:DD:36:56:0A:21:E4:61:44:73:E9:E2
DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL DSA/CN=yaSSL DSA/emailAddress=info@yassl.com DirName:/C=US/ST=Oregon/L=Portland/O=yaSSL/OU=testing/CN=www.yassl.com/emailAddress=info@yassl.com
serial:00 serial:CE:DF:23:31:64:B4:13:DA
X509v3 Basic Constraints: X509v3 Basic Constraints:
CA:TRUE CA:TRUE
Signature Algorithm: dsaWithSHA1 Signature Algorithm: dsaWithSHA1
30:2c:02:14:7e:5e:94:fc:7f:ca:81:ab:b3:32:f7:21:83:48: 30:2d:02:14:00:a3:21:20:34:6a:2c:f9:fb:76:d7:20:c9:c0:
48:5f:0a:f1:13:ca:02:14:73:54:32:14:51:22:bf:0b:ec:d7: 35:1b:64:9a:c2:83:02:15:00:a4:59:ac:6d:da:85:48:ff:f5:
6a:6a:fa:a7:1d:46:b4:c2:a3:b5 0d:49:72:c8:cd:91:fc:ec:2f:5c:63
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIDMjCCAvKgAwIBAgIBADAJBgcqhkjOOAQDMHgxCzAJBgNVBAYTAlVTMQ8wDQYD MIIDfjCCAz2gAwIBAgIJAM7fIzFktBPaMAkGByqGSM44BAMwgYoxCzAJBgNVBAYT
VQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMRIwEAYDVQQKEwl5YVNTTCBE AlVTMQ8wDQYDVQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMQ4wDAYDVQQK
U0ExEjAQBgNVBAMTCXlhU1NMIERTQTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNz EwV5YVNTTDEQMA4GA1UECxMHdGVzdGluZzEWMBQGA1UEAxMNd3d3Lnlhc3NsLmNv
bC5jb20wHhcNMDUwMzA3MDMyMjAwWhcNNDYwNDAxMDMyMjAwWjB4MQswCQYDVQQG bTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb20wHhcNMTAwNjMwMTg1NjM4
EwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQHEwhQb3J0bGFuZDESMBAGA1UE WhcNMTMwMzI2MTg1NjM5WjCBijELMAkGA1UEBhMCVVMxDzANBgNVBAgTBk9yZWdv
ChMJeWFTU0wgRFNBMRIwEAYDVQQDEwl5YVNTTCBEU0ExHTAbBgkqhkiG9w0BCQEW bjERMA8GA1UEBxMIUG9ydGxhbmQxDjAMBgNVBAoTBXlhU1NMMRAwDgYDVQQLEwd0
DmluZm9AeWFzc2wuY29tMIHwMIGoBgcqhkjOOAQBMIGcAkEAmSlpgMk8mGhFqYL+ ZXN0aW5nMRYwFAYDVQQDEw13d3cueWFzc2wuY29tMR0wGwYJKoZIhvcNAQkBFg5p
Z+uViMW0DNYmRZUZLKAgW37faencww/zYQolm/IhAWrNqow358pm21b0D3160Ri5 bmZvQHlhc3NsLmNvbTCB8DCBqAYHKoZIzjgEATCBnAJBAJkpaYDJPJhoRamC/mfr
Qv0bEQIVAK0lKasKnwkcwa0DIHZ/prfdTQMJAkASiJna59ALk5vm7jwhf5yztI2l lYjFtAzWJkWVGSygIFt+32np3MMP82EKJZvyIQFqzaqMN+fKZttW9A99etEYuUL9
jOI3gD8X0YFPvfBxtjIIVN2/AeKzdwZkdYoE1nk5sQIDA8YGdOWQBQoQRhkxA0MA GxECFQCtJSmrCp8JHMGtAyB2f6a33U0DCQJAEoiZ2ufQC5Ob5u48IX+cs7SNpYzi
AkAEhKAmMXIM6E9dUxdisYDKwBZfwx7qxdmYOPm+VlNHaM4IIlccuw13kc9bNu3z N4A/F9GBT73wcbYyCFTdvwHis3cGZHWKBNZ5ObECAwPGBnTlkAUKEEYZMQNDAAJA
JIKQis2QfNt3+Rctc3Pvu7mCo4HVMIHSMB0GA1UdDgQWBBS++Yxd1hy07oHdNlYK BISgJjFyDOhPXVMXYrGAysAWX8Me6sXZmDj5vlZTR2jOCCJXHLsNd5HPWzbt8ySC
IeRhRHPp4jCBogYDVR0jBIGaMIGXgBS++Yxd1hy07oHdNlYKIeRhRHPp4qF8pHow kIrNkHzbd/kXLXNz77u5gqOB8jCB7zAdBgNVHQ4EFgQUvvmMXdYctO6B3TZWCiHk
eDELMAkGA1UEBhMCVVMxDzANBgNVBAgTBk9yZWdvbjERMA8GA1UEBxMIUG9ydGxh YURz6eIwgb8GA1UdIwSBtzCBtIAUvvmMXdYctO6B3TZWCiHkYURz6eKhgZCkgY0w
bmQxEjAQBgNVBAoTCXlhU1NMIERTQTESMBAGA1UEAxMJeWFTU0wgRFNBMR0wGwYJ gYoxCzAJBgNVBAYTAlVTMQ8wDQYDVQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRs
KoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbYIBADAMBgNVHRMEBTADAQH/MAkGByqG YW5kMQ4wDAYDVQQKEwV5YVNTTDEQMA4GA1UECxMHdGVzdGluZzEWMBQGA1UEAxMN
SM44BAMDLwAwLAIUfl6U/H/KgauzMvchg0hIXwrxE8oCFHNUMhRRIr8L7Ndqavqn d3d3Lnlhc3NsLmNvbTEdMBsGCSqGSIb3DQEJARYOaW5mb0B5YXNzbC5jb22CCQDO
HUa0wqO1 3yMxZLQT2jAMBgNVHRMEBTADAQH/MAkGByqGSM44BAMDMAAwLQIUAKMhIDRqLPn7
dtcgycA1G2SawoMCFQCkWaxt2oVI//UNSXLIzZH87C9cYw==
-----END CERTIFICATE----- -----END CERTIFICATE-----

Binary file not shown.

View File

@ -3,36 +3,37 @@ Certificate:
Version: 1 (0x0) Version: 1 (0x0)
Serial Number: 1 (0x1) Serial Number: 1 (0x1)
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: md5WithRSAEncryption
Issuer: C=US, ST=Oregon, L=Portland, O=sawtooth, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com Issuer: C=US, ST=Montana, L=Bozeman, O=sawtooth, OU=consulting, CN=www.sawtooth-consulting.com/emailAddress=info@yassl.com
Validity Validity
Not Before: Mar 8 03:00:47 2005 GMT Not Before: Jun 30 18:52:17 2010 GMT
Not After : Apr 2 03:00:47 2046 GMT Not After : Mar 26 18:52:17 2013 GMT
Subject: C=US, ST=Oregon, L=Portland, O=taoSoftDev, CN=www.taosoftdev.com/emailAddress=info@yassl.com Subject: C=US, ST=Montana, L=Bozeman, O=yaSSL, OU=support, CN=www.yassl.com/emailAddress=info@yassl.com
Subject Public Key Info: Subject Public Key Info:
Public Key Algorithm: rsaEncryption Public Key Algorithm: rsaEncryption
RSA Public Key: (512 bit) RSA Public Key: (512 bit)
Modulus (512 bit): Modulus (512 bit):
00:a4:68:bb:bc:b7:27:5f:3c:f5:78:c6:1a:af:b9: 00:c6:7b:c0:68:81:2f:de:82:3f:f9:ac:c3:86:4a:
95:fc:7e:61:1f:a8:81:0a:ca:43:88:9a:03:e0:d0: 66:b7:ec:d4:f1:f6:64:21:ff:f5:a2:34:42:d0:38:
a6:79:70:16:34:b9:7c:75:54:ca:70:19:66:38:be: 9f:c6:dd:3b:6e:26:65:6a:54:96:dd:d2:7b:eb:36:
6e:28:7e:a5:ff:6b:3c:83:2f:39:42:c3:15:f3:bd: a2:ae:7e:2a:9e:7e:56:a5:b6:87:9f:15:c7:18:66:
f2:25:93:22:e7 7e:16:77:e2:a7
Exponent: 65537 (0x10001) Exponent: 65537 (0x10001)
Signature Algorithm: md5WithRSAEncryption Signature Algorithm: md5WithRSAEncryption
36:72:12:3b:ac:e4:58:83:09:86:4f:71:2a:3a:0d:8a:05:27: 58:a9:98:e7:16:52:4c:40:e7:e1:47:92:19:1b:3a:8f:97:6c:
75:f3:3e:62:4f:ab:b8:70:20:cd:ad:70:ab:91:11:68:f8:82: 7b:b7:b0:cb:20:6d:ad:b5:d3:47:58:d8:e4:f2:3e:32:e9:ef:
33:e2:78:85:a8:16:f5:66:bd:68:2c:5a:26:15:12:1e:6e:83: 87:77:e5:54:36:f4:8d:50:8d:07:b4:77:45:ea:9d:a4:33:36:
c7:6d:62:b9:c3:ff:e1:86:e4:e6 9b:0b:e0:74:58:11:c5:01:7b:4d
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9zCCAaECAQEwDQYJKoZIhvcNAQEEBQAwgYkxCzAJBgNVBAYTAlVTMQ8wDQYD MIICFDCCAb4CAQEwDQYJKoZIhvcNAQEEBQAwgZ4xCzAJBgNVBAYTAlVTMRAwDgYD
VQQIEwZPcmVnb24xETAPBgNVBAcTCFBvcnRsYW5kMREwDwYDVQQKEwhzYXd0b290 VQQIEwdNb250YW5hMRAwDgYDVQQHEwdCb3plbWFuMREwDwYDVQQKEwhzYXd0b290
aDEkMCIGA1UEAxMbd3d3LnNhd3Rvb3RoLWNvbnN1bHRpbmcuY29tMR0wGwYJKoZI aDETMBEGA1UECxMKY29uc3VsdGluZzEkMCIGA1UEAxMbd3d3LnNhd3Rvb3RoLWNv
hvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0wNTAzMDgwMzAwNDdaFw00NjA0MDIw bnN1bHRpbmcuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTAeFw0x
MzAwNDdaMIGCMQswCQYDVQQGEwJVUzEPMA0GA1UECBMGT3JlZ29uMREwDwYDVQQH MDA2MzAxODUyMTdaFw0xMzAzMjYxODUyMTdaMIGKMQswCQYDVQQGEwJVUzEQMA4G
EwhQb3J0bGFuZDETMBEGA1UEChMKdGFvU29mdERldjEbMBkGA1UEAxMSd3d3LnRh A1UECBMHTW9udGFuYTEQMA4GA1UEBxMHQm96ZW1hbjEOMAwGA1UEChMFeWFTU0wx
b3NvZnRkZXYuY29tMR0wGwYJKoZIhvcNAQkBFg5pbmZvQHlhc3NsLmNvbTBcMA0G EDAOBgNVBAsTB3N1cHBvcnQxFjAUBgNVBAMTDXd3dy55YXNzbC5jb20xHTAbBgkq
CSqGSIb3DQEBAQUAA0sAMEgCQQCkaLu8tydfPPV4xhqvuZX8fmEfqIEKykOImgPg hkiG9w0BCQEWDmluZm9AeWFzc2wuY29tMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJB
0KZ5cBY0uXx1VMpwGWY4vm4ofqX/azyDLzlCwxXzvfIlkyLnAgMBAAEwDQYJKoZI AMZ7wGiBL96CP/msw4ZKZrfs1PH2ZCH/9aI0QtA4n8bdO24mZWpUlt3Se+s2oq5+
hvcNAQEEBQADQQA2chI7rORYgwmGT3EqOg2KBSd18z5iT6u4cCDNrXCrkRFo+IIz Kp5+VqW2h58VxxhmfhZ34qcCAwEAATANBgkqhkiG9w0BAQQFAANBAFipmOcWUkxA
4niFqBb1Zr1oLFomFRIeboPHbWK5w//hhuTm 5+FHkhkbOo+XbHu3sMsgba2100dY2OTyPjLp74d35VQ29I1QjQe0d0XqnaQzNpsL
4HRYEcUBe00=
-----END CERTIFICATE----- -----END CERTIFICATE-----

View File

@ -1,9 +1,9 @@
-----BEGIN RSA PRIVATE KEY----- -----BEGIN RSA PRIVATE KEY-----
MIIBOQIBAAJBAKRou7y3J1889XjGGq+5lfx+YR+ogQrKQ4iaA+DQpnlwFjS5fHVU MIIBOwIBAAJBAMZ7wGiBL96CP/msw4ZKZrfs1PH2ZCH/9aI0QtA4n8bdO24mZWpU
ynAZZji+bih+pf9rPIMvOULDFfO98iWTIucCAwEAAQJABLVvMw931DV1vljGKORC lt3Se+s2oq5+Kp5+VqW2h58VxxhmfhZ34qcCAwEAAQJBAJSbGxgjgV+rTZL2Ev58
1HF2LKbx0zJJzt7CX6z6J54vcE79K3NYXdU6o7/j1WTtfD47tFG+4ljGvSYPmrCI viN/IoB25cm/Bn4Heu7DNn2A2kpdGX2cCaf7rEQoIKCiHxvopvxOcd/7nLS/gNli
2QIhANfiY6is6JUJGGgeMxyWeQRPXfaE9Yrk6OhxHhpYf5CTAiEAwvWraeLPy/NE dCECIQD/cX/9fvB1Uajw0fmvwNON9+3P9uJSqpig90zL32pwjQIhAMbqee9TBMN4
B+0w80mh8tCv2tpuKaYMOG53XpYX3N0CIDy/Bj3rUZLGOWjqvoUXzjupPY5lgVYw TxXbgWqA92PrCXe8WDZ3PwoJqdR6MRUDAiEAny+TDF1z6hiWiGTCDgXDkKBlwgjf
7Vyin87YAiUjAiAgM8X5em5KSMc+6+2+8bWfTtsNMjEqDfRMyepLpE0SvQIgTSYL p5aKgR077XzwLu0CICVpWEGg1ZaF/CnaPP7w/pZ2UDOK4vRrfRnAM4bY7H5NAiBS
WWfcZoRUPDM9GEuQ40nifVNjobzvjTW4aYyHCEI= 1eXJ/MCZ2uPfpl7XK2BU9P69KdKUk5WHxdRchVvcDg==
-----END RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----

View File

@ -0,0 +1,12 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-CBC,08132C1FFF5BC8CC
gsvuAsGmB8AkR23M25w4E6wuywfBey1Jqh3g71gJcnsUYwynex9dvfAU0lTowOXh
sb7ld1KNjEMzrht9AC1IC0iE1rLqvRQZOdJ7h3n7aHZQ4a/HjcwAhqJq0ZW45m6Q
mpoO5fRISjx2VbKFRUz6Xj2x0/do3IjQhpuUDVrTFFe1sEySM6APZ6CVpcnTOyPR
ADyLDKzOi2E+sj1UXs58pct56FaqTIZPUEflICU3k6q9FPU6gsYANRLfzegclkv4
JAx6mKVSJuYnjCCppx8WBwGJa1J1GcYRJ3qFfdbUzL4bcXTvoFkJEnDkHsXgDUS6
xmT0XGT3IMaW8cwQ8KD8m5YYI/L26Mas/w3eA2ekyMR8pYICjXp/YZtcKxxkQSVE
Uv/+D+20KbNAHIW5Mrxf61cX/CggGEbVP8ZhDY1flh8=
-----END RSA PRIVATE KEY-----

View File

@ -47,4 +47,16 @@ to convert rsa private PEM to DER :
b) openssl rsa -in key.pem -outform DER -out key.der b) openssl rsa -in key.pem -outform DER -out key.der
**** To encrypt rsa key already in pem **********
a) openssl rsa <server-key.pem.bak -des >server-keyEnc.pem
note location of des, pass = yassl123
*** To make a public key from a private key ******
openssl rsa -in 1024rsa.priv -pubout -out 1024rsa.pub

View File

@ -36,15 +36,20 @@ void ClientError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
void NonBlockingSSL_Connect(SSL* ssl, SSL_CTX* ctx, SOCKET_T& sockfd) void NonBlockingSSL_Connect(SSL* ssl, SSL_CTX* ctx, SOCKET_T& sockfd)
{ {
int ret = SSL_connect(ssl); int ret = SSL_connect(ssl);
while (ret =! SSL_SUCCESS && SSL_get_error(ssl, 0) == int err = SSL_get_error(ssl, 0);
SSL_ERROR_WANT_READ) { while (ret != SSL_SUCCESS && (err == SSL_ERROR_WANT_READ ||
printf("... client would block\n"); err == SSL_ERROR_WANT_WRITE)) {
if (err == SSL_ERROR_WANT_READ)
printf("... client would read block\n");
else
printf("... client would write block\n");
#ifdef _WIN32 #ifdef _WIN32
Sleep(1000); Sleep(1000);
#else #else
sleep(1); sleep(1);
#endif #endif
ret = SSL_connect(ssl); ret = SSL_connect(ssl);
err = SSL_get_error(ssl, 0);
} }
if (ret != SSL_SUCCESS) if (ret != SSL_SUCCESS)
ClientError(ctx, ssl, sockfd, "SSL_connect failed"); ClientError(ctx, ssl, sockfd, "SSL_connect failed");
@ -81,6 +86,7 @@ void client_test(void* args)
#ifdef NON_BLOCKING #ifdef NON_BLOCKING
NonBlockingSSL_Connect(ssl, ctx, sockfd); NonBlockingSSL_Connect(ssl, ctx, sockfd);
#else #else
// if you get an error here see note at top of README
if (SSL_connect(ssl) != SSL_SUCCESS) if (SSL_connect(ssl) != SSL_SUCCESS)
ClientError(ctx, ssl, sockfd, "SSL_connect failed"); ClientError(ctx, ssl, sockfd, "SSL_connect failed");
#endif #endif

View File

@ -77,7 +77,7 @@ void echoclient_test(void* args)
while (fgets(send, sizeof(send), fin)) { while (fgets(send, sizeof(send), fin)) {
int sendSz = strlen(send) + 1; int sendSz = (int)strlen(send) + 1;
if (SSL_write(ssl, send, sendSz) != sendSz) if (SSL_write(ssl, send, sendSz) != sendSz)
EchoClientError(ctx, ssl, sockfd, "SSL_write failed"); EchoClientError(ctx, ssl, sockfd, "SSL_write failed");

View File

@ -93,11 +93,11 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
#endif #endif
while (!shutdown) { while (!shutdown) {
sockaddr_in client; SOCKADDR_IN_T client;
socklen_t client_len = sizeof(client); socklen_t client_len = sizeof(client);
SOCKET_T clientfd = accept(sockfd, (sockaddr*)&client, SOCKET_T clientfd = accept(sockfd, (sockaddr*)&client,
(ACCEPT_THIRD_T)&client_len); (ACCEPT_THIRD_T)&client_len);
if (clientfd == -1) { if (clientfd == (SOCKET_T) -1) {
SSL_CTX_free(ctx); SSL_CTX_free(ctx);
tcp_close(sockfd); tcp_close(sockfd);
err_sys("tcp accept failed"); err_sys("tcp accept failed");

View File

@ -35,15 +35,20 @@ void ServerError(SSL_CTX* ctx, SSL* ssl, SOCKET_T& sockfd, const char* msg)
void NonBlockingSSL_Accept(SSL* ssl, SSL_CTX* ctx, SOCKET_T& clientfd) void NonBlockingSSL_Accept(SSL* ssl, SSL_CTX* ctx, SOCKET_T& clientfd)
{ {
int ret = SSL_accept(ssl); int ret = SSL_accept(ssl);
while (ret != SSL_SUCCESS && SSL_get_error(ssl, 0) == int err = SSL_get_error(ssl, 0);
SSL_ERROR_WANT_READ) { while (ret != SSL_SUCCESS && (err == SSL_ERROR_WANT_READ ||
printf("... server would block\n"); err == SSL_ERROR_WANT_WRITE)) {
if (err == SSL_ERROR_WANT_READ)
printf("... server would read block\n");
else
printf("... server would write block\n");
#ifdef _WIN32 #ifdef _WIN32
Sleep(1000); Sleep(1000);
#else #else
sleep(1); sleep(1);
#endif #endif
ret = SSL_accept(ssl); ret = SSL_accept(ssl);
err = SSL_get_error(ssl, 0);
} }
if (ret != SSL_SUCCESS) if (ret != SSL_SUCCESS)
ServerError(ctx, ssl, clientfd, "SSL_accept failed"); ServerError(ctx, ssl, clientfd, "SSL_accept failed");

View File

@ -46,12 +46,6 @@ typedef unsigned int uint;
const uint AUTO = 0xFEEDBEEF; const uint AUTO = 0xFEEDBEEF;
// Checking Policy should implement a check function that tests whether the
// index is within the size limit of the array
struct Check {
void check(uint i, uint limit);
};
struct NoCheck { struct NoCheck {
void check(uint, uint); void check(uint, uint);
@ -66,7 +60,7 @@ struct NoCheck {
* write to the buffer bulk wise and have the correct size * write to the buffer bulk wise and have the correct size
*/ */
class input_buffer : public Check { class input_buffer : public NoCheck {
uint size_; // number of elements in buffer uint size_; // number of elements in buffer
uint current_; // current offset position in buffer uint current_; // current offset position in buffer
byte* buffer_; // storage for buffer byte* buffer_; // storage for buffer
@ -132,7 +126,7 @@ private:
* Not using vector because need checked []access and the ability to * Not using vector because need checked []access and the ability to
* write to the buffer bulk wise and retain correct size * write to the buffer bulk wise and retain correct size
*/ */
class output_buffer : public Check { class output_buffer : public NoCheck {
uint current_; // current offset and elements in buffer uint current_; // current offset and elements in buffer
byte* buffer_; // storage for buffer byte* buffer_; // storage for buffer
byte* end_; // end of storage marker byte* end_; // end of storage marker

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2005-2007 MySQL AB, 2008 Sun Microsystems, Inc. Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms. Use is subject to license terms.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -35,7 +35,7 @@
#include "rsa.h" #include "rsa.h"
#define YASSL_VERSION "1.7.2" #define YASSL_VERSION "2.2.0"
#if defined(__cplusplus) #if defined(__cplusplus)
@ -107,6 +107,15 @@ RSA* RSA_generate_key(int, unsigned long, void(*)(int, int, void*), void*);
/* X509 stuff, different file? */ /* X509 stuff, different file? */
/* because mySQL dereferences to use error and current_cert, even after calling
* get functions for local references */
typedef struct X509_STORE_CTX {
int error;
int error_depth;
X509* current_cert;
} X509_STORE_CTX;
typedef struct X509_STORE X509_STORE; typedef struct X509_STORE X509_STORE;
typedef struct X509_LOOKUP X509_LOOKUP; typedef struct X509_LOOKUP X509_LOOKUP;
typedef struct X509_OBJECT { char c; } X509_OBJECT; typedef struct X509_OBJECT { char c; } X509_OBJECT;
@ -125,16 +134,6 @@ typedef struct BIO BIO;
/* because mySQL dereferences to use error and current_cert, even after calling
* get functions for local references */
typedef struct X509_STORE_CTX {
int error;
int error_depth;
X509* current_cert;
} X509_STORE_CTX;
X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX*); X509* X509_STORE_CTX_get_current_cert(X509_STORE_CTX*);
int X509_STORE_CTX_get_error(X509_STORE_CTX*); int X509_STORE_CTX_get_error(X509_STORE_CTX*);
int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*); int X509_STORE_CTX_get_error_depth(X509_STORE_CTX*);
@ -205,7 +204,7 @@ SSL* SSL_new(SSL_CTX*);
int SSL_set_fd (SSL*, YASSL_SOCKET_T); int SSL_set_fd (SSL*, YASSL_SOCKET_T);
YASSL_SOCKET_T SSL_get_fd(const SSL*); YASSL_SOCKET_T SSL_get_fd(const SSL*);
int SSL_connect(SSL*); /* if you get an error from connect int SSL_connect(SSL*); /* if you get an error from connect
see note at top of REAMDE */ see note at top of README */
int SSL_write(SSL*, const void*, int); int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int); int SSL_read(SSL*, void*, int);
int SSL_accept(SSL*); int SSL_accept(SSL*);
@ -351,11 +350,11 @@ enum { /* ssl Constants */
SSL_ERROR_ZERO_RETURN = 84, SSL_ERROR_ZERO_RETURN = 84,
SSL_ERROR_SSL = 85, SSL_ERROR_SSL = 85,
SSL_SENT_SHUTDOWN = 90, SSL_ST_CONNECT = 90,
SSL_RECEIVED_SHUTDOWN = 91, SSL_ST_ACCEPT = 91,
SSL_CB_LOOP = 92, SSL_CB_LOOP = 92,
SSL_ST_CONNECT = 93, SSL_SENT_SHUTDOWN = 93,
SSL_ST_ACCEPT = 94, SSL_RECEIVED_SHUTDOWN = 94,
SSL_CB_ALERT = 95, SSL_CB_ALERT = 95,
SSL_CB_READ = 96, SSL_CB_READ = 96,
SSL_CB_HANDSHAKE_DONE = 97 SSL_CB_HANDSHAKE_DONE = 97

View File

@ -26,7 +26,6 @@
#ifndef yaSSL_SOCKET_WRAPPER_HPP #ifndef yaSSL_SOCKET_WRAPPER_HPP
#define yaSSL_SOCKET_WRAPPER_HPP #define yaSSL_SOCKET_WRAPPER_HPP
#include <assert.h>
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -73,7 +72,8 @@ public:
uint get_ready() const; uint get_ready() const;
socket_t get_fd() const; socket_t get_fd() const;
uint send(const byte* buf, unsigned int len, int flags = 0) const; uint send(const byte* buf, unsigned int len, unsigned int& sent,
int flags = 0);
uint receive(byte* buf, unsigned int len, int flags = 0); uint receive(byte* buf, unsigned int len, int flags = 0);
bool wait(); bool wait();

View File

@ -532,10 +532,13 @@ class Buffers {
public: public:
typedef STL::list<input_buffer*> inputList; typedef STL::list<input_buffer*> inputList;
typedef STL::list<output_buffer*> outputList; typedef STL::list<output_buffer*> outputList;
int prevSent; // previous plain text bytes sent when got WANT_WRITE
int plainSz; // plain text bytes in buffer to send when got WANT_WRITE
private: private:
inputList dataList_; // list of users app data / handshake inputList dataList_; // list of users app data / handshake
outputList handShakeList_; // buffered handshake msgs outputList handShakeList_; // buffered handshake msgs
input_buffer* rawInput_; // buffered raw input yet to process input_buffer* rawInput_; // buffered raw input yet to process
output_buffer* output_; // WANT_WRITE buffered output
public: public:
Buffers(); Buffers();
~Buffers(); ~Buffers();
@ -548,6 +551,8 @@ public:
void SetRawInput(input_buffer*); // takes ownership void SetRawInput(input_buffer*); // takes ownership
input_buffer* TakeRawInput(); // takes ownership input_buffer* TakeRawInput(); // takes ownership
void SetOutput(output_buffer*); // takes ownership
output_buffer* TakeOutput(); // takes ownership
private: private:
Buffers(const Buffers&); // hide copy Buffers(const Buffers&); // hide copy
Buffers& operator=(const Buffers&); // and assign Buffers& operator=(const Buffers&); // and assign
@ -652,6 +657,7 @@ public:
void deriveKeys(); void deriveKeys();
void deriveTLSKeys(); void deriveTLSKeys();
void Send(const byte*, uint); void Send(const byte*, uint);
void SendWriteBuffered();
uint bufferedData(); uint bufferedData();
uint get_SEQIncrement(bool); uint get_SEQIncrement(bool);

View File

@ -26,7 +26,6 @@
#define yaSSL_TYPES_HPP #define yaSSL_TYPES_HPP
#include <stddef.h> #include <stddef.h>
#include <assert.h>
#include "type_traits.hpp" #include "type_traits.hpp"
@ -37,6 +36,13 @@
#endif #endif
#ifdef _MSC_VER
// disable conversion warning
// 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
#pragma warning(disable:4244 4996)
#endif
namespace yaSSL { namespace yaSSL {
#define YASSL_LIB #define YASSL_LIB
@ -82,10 +88,10 @@ namespace yaSSL {
#define NEW_YS new (yaSSL::ys) #define NEW_YS new (yaSSL::ys)
// to resolve compiler generated operator delete on base classes with // to resolve compiler generated operator delete on base classes with
// virtual destructors (when on stack), make sure doesn't get called // virtual destructors (when on stack)
class virtual_base { class virtual_base {
public: public:
static void operator delete(void*) { assert(0); } static void operator delete(void*) { }
}; };

View File

@ -35,14 +35,6 @@ namespace yaSSL {
// Checking Policy should implement a check function that tests whether the
// index is within the size limit of the array
void Check::check(uint i, uint limit)
{
assert(i < limit);
}
void NoCheck::check(uint, uint) void NoCheck::check(uint, uint)
{ {
@ -86,7 +78,6 @@ input_buffer::~input_buffer()
// users can pass defualt zero length buffer and then allocate // users can pass defualt zero length buffer and then allocate
void input_buffer::allocate(uint s) void input_buffer::allocate(uint s)
{ {
assert(!buffer_); // find realloc error
buffer_ = NEW_YS byte[s]; buffer_ = NEW_YS byte[s];
end_ = buffer_ + s; end_ = buffer_ + s;
} }
@ -144,7 +135,6 @@ void input_buffer::set_current(uint i)
// user passes in AUTO index for ease of use // user passes in AUTO index for ease of use
const byte& input_buffer::operator[](uint i) const byte& input_buffer::operator[](uint i)
{ {
assert (i == AUTO);
check(current_, size_); check(current_, size_);
return buffer_[current_++]; return buffer_[current_++];
} }
@ -241,7 +231,6 @@ void output_buffer::set_current(uint c)
// users can pass defualt zero length buffer and then allocate // users can pass defualt zero length buffer and then allocate
void output_buffer::allocate(uint s) void output_buffer::allocate(uint s)
{ {
assert(!buffer_); // find realloc error
buffer_ = NEW_YS byte[s]; end_ = buffer_ + s; buffer_ = NEW_YS byte[s]; end_ = buffer_ + s;
} }
@ -257,7 +246,6 @@ const byte* output_buffer::get_buffer() const
// user passes in AUTO as index for ease of use // user passes in AUTO as index for ease of use
byte& output_buffer::operator[](uint i) byte& output_buffer::operator[](uint i)
{ {
assert(i == AUTO);
check(current_, get_capacity()); check(current_, get_capacity());
return buffer_[current_++]; return buffer_[current_++];
} }

View File

@ -250,7 +250,8 @@ int CertManager::Validate()
TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length()); TaoCrypt::Source source((*last)->get_buffer(), (*last)->get_length());
TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
if (int err = cert.GetError().What()) int err = cert.GetError().What();
if ( err )
return err; return err;
const TaoCrypt::PublicKey& key = cert.GetPublicKey(); const TaoCrypt::PublicKey& key = cert.GetPublicKey();
@ -266,7 +267,7 @@ int CertManager::Validate()
TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_); TaoCrypt::CertDecoder cert(source, true, &signers_, verifyNone_);
int err = cert.GetError().What(); int err = cert.GetError().What();
if ( err ) if ( err && err != TaoCrypt::SIG_OTHER_E)
return err; return err;
uint sz = cert.GetPublicKey().size(); uint sz = cert.GetPublicKey().size();
@ -327,7 +328,6 @@ int CertManager::SetPrivateKey(const x509& key)
// Store OpenSSL type peer's cert // Store OpenSSL type peer's cert
void CertManager::setPeerX509(X509* x) void CertManager::setPeerX509(X509* x)
{ {
assert(peerX509_ == 0);
if (x == 0) return; if (x == 0) return;
X509_NAME* issuer = x->GetIssuer(); X509_NAME* issuer = x->GetIssuer();

View File

@ -528,6 +528,7 @@ void ProcessOldClientHello(input_buffer& input, SSL& ssl)
input.read(len, sizeof(len)); input.read(len, sizeof(len));
uint16 randomLen; uint16 randomLen;
ato16(len, randomLen); ato16(len, randomLen);
if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN || if (ch.suite_len_ > MAX_SUITE_SZ || sessionLen > ID_LEN ||
randomLen > RAN_LEN) { randomLen > RAN_LEN) {
ssl.SetError(bad_input); ssl.SetError(bad_input);
@ -790,8 +791,7 @@ void processReply(SSL& ssl)
{ {
if (ssl.GetError()) return; if (ssl.GetError()) return;
if (DoProcessReply(ssl)) if (DoProcessReply(ssl)) {
{
// didn't complete process // didn't complete process
if (!ssl.getSocket().IsNonBlocking()) { if (!ssl.getSocket().IsNonBlocking()) {
// keep trying now, blocking ok // keep trying now, blocking ok
@ -857,6 +857,7 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer)
if (ssl.GetError()) return; if (ssl.GetError()) return;
ServerKeyExchange sk(ssl); ServerKeyExchange sk(ssl);
sk.build(ssl); sk.build(ssl);
if (ssl.GetError()) return;
RecordLayerHeader rlHeader; RecordLayerHeader rlHeader;
HandShakeHeader hsHeader; HandShakeHeader hsHeader;
@ -875,8 +876,7 @@ void sendServerKeyExchange(SSL& ssl, BufferOutput buffer)
// send change cipher // send change cipher
void sendChangeCipher(SSL& ssl, BufferOutput buffer) void sendChangeCipher(SSL& ssl, BufferOutput buffer)
{ {
if (ssl.getSecurity().get_parms().entity_ == server_end) if (ssl.getSecurity().get_parms().entity_ == server_end) {
{
if (ssl.getSecurity().get_resuming()) if (ssl.getSecurity().get_resuming())
ssl.verifyState(clientKeyExchangeComplete); ssl.verifyState(clientKeyExchangeComplete);
else else
@ -929,12 +929,22 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
// send data // send data
int sendData(SSL& ssl, const void* buffer, int sz) int sendData(SSL& ssl, const void* buffer, int sz)
{ {
int sent = 0;
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ)) if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl.SetError(no_error); ssl.SetError(no_error);
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_WRITE)) {
ssl.SetError(no_error);
ssl.SendWriteBuffered();
if (!ssl.GetError()) {
// advance sent to prvevious sent + plain size just sent
sent = ssl.useBuffers().prevSent + ssl.useBuffers().plainSz;
}
}
ssl.verfiyHandShakeComplete(); ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return -1; if (ssl.GetError()) return -1;
int sent = 0;
for (;;) { for (;;) {
int len = min(sz - sent, MAX_RECORD_SIZE); int len = min(sz - sent, MAX_RECORD_SIZE);
@ -943,6 +953,8 @@ int sendData(SSL& ssl, const void* buffer, int sz)
Data data; Data data;
if (sent == sz) break;
if (ssl.CompressionOn()) { if (ssl.CompressionOn()) {
if (Compress(static_cast<const opaque*>(buffer) + sent, len, if (Compress(static_cast<const opaque*>(buffer) + sent, len,
tmp) == -1) { tmp) == -1) {
@ -957,9 +969,14 @@ int sendData(SSL& ssl, const void* buffer, int sz)
buildMessage(ssl, out, data); buildMessage(ssl, out, data);
ssl.Send(out.get_buffer(), out.get_size()); ssl.Send(out.get_buffer(), out.get_size());
if (ssl.GetError()) return -1; if (ssl.GetError()) {
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_WRITE)) {
ssl.useBuffers().plainSz = len;
ssl.useBuffers().prevSent = sent;
}
return -1;
}
sent += len; sent += len;
if (sent == sz) break;
} }
ssl.useLog().ShowData(sent, true); ssl.useLog().ShowData(sent, true);
return sent; return sent;

0
extra/yassl/src/make.bat Normal file → Executable file
View File

View File

@ -109,19 +109,28 @@ uint Socket::get_ready() const
} }
uint Socket::send(const byte* buf, unsigned int sz, int flags) const uint Socket::send(const byte* buf, unsigned int sz, unsigned int& written,
int flags)
{ {
const byte* pos = buf; const byte* pos = buf;
const byte* end = pos + sz; const byte* end = pos + sz;
wouldBlock_ = false;
while (pos != end) { while (pos != end) {
int sent = ::send(socket_, reinterpret_cast<const char *>(pos), int sent = ::send(socket_, reinterpret_cast<const char *>(pos),
static_cast<int>(end - pos), flags); static_cast<int>(end - pos), flags);
if (sent == -1) {
if (sent == -1) if (get_lastError() == SOCKET_EWOULDBLOCK ||
get_lastError() == SOCKET_EAGAIN) {
wouldBlock_ = true; // would have blocked this time only
nonBlocking_ = true; // nonblocking, win32 only way to tell
return 0; return 0;
}
return static_cast<uint>(-1);
}
pos += sent; pos += sent;
written += sent;
} }
return sz; return sz;

View File

@ -252,6 +252,15 @@ int SSL_connect(SSL* ssl)
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ)) if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl->SetError(no_error); ssl->SetError(no_error);
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_WRITE)) {
ssl->SetError(no_error);
ssl->SendWriteBuffered();
if (!ssl->GetError())
ssl->useStates().UseConnect() =
ConnectState(ssl->getStates().GetConnect() + 1);
}
ClientState neededState; ClientState neededState;
switch (ssl->getStates().GetConnect()) { switch (ssl->getStates().GetConnect()) {
@ -267,6 +276,10 @@ int SSL_connect(SSL* ssl)
while (ssl->getStates().getClient() < neededState) { while (ssl->getStates().getClient() < neededState) {
if (ssl->GetError()) break; if (ssl->GetError()) break;
processReply(*ssl); processReply(*ssl);
// if resumption failed, reset needed state
if (neededState == serverFinishedComplete)
if (!ssl->getSecurity().get_resuming())
neededState = serverHelloDoneComplete;
} }
if (!ssl->GetError()) if (!ssl->GetError())
ssl->useStates().UseConnect() = FIRST_REPLY_DONE; ssl->useStates().UseConnect() = FIRST_REPLY_DONE;
@ -331,6 +344,15 @@ int SSL_accept(SSL* ssl)
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ)) if (ssl->GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl->SetError(no_error); ssl->SetError(no_error);
if (ssl->GetError() == YasslError(SSL_ERROR_WANT_WRITE)) {
ssl->SetError(no_error);
ssl->SendWriteBuffered();
if (!ssl->GetError())
ssl->useStates().UseAccept() =
AcceptState(ssl->getStates().GetAccept() + 1);
}
switch (ssl->getStates().GetAccept()) { switch (ssl->getStates().GetAccept()) {
case ACCEPT_BEGIN : case ACCEPT_BEGIN :
@ -1097,7 +1119,6 @@ int EVP_BytesToKey(const EVP_CIPHER* type, const EVP_MD* md, const byte* salt,
ivLeft -= store; ivLeft -= store;
} }
} }
assert(keyOutput == (keyLen + ivLen));
return keyOutput; return keyOutput;
} }

View File

@ -69,13 +69,13 @@ void SetUpBase(Base& base, ConnectionEnd end, SOCKET_T s)
if (base.ca_) if (base.ca_)
if (SSL_CTX_load_verify_locations(base.ctx_, if (SSL_CTX_load_verify_locations(base.ctx_,
base.ca_, 0) != SSL_SUCCESS) assert(0); base.ca_, 0) != SSL_SUCCESS) throw(0);
if (base.cert_) if (base.cert_)
if (SSL_CTX_use_certificate_file(base.ctx_, if (SSL_CTX_use_certificate_file(base.ctx_,
base.cert_, SSL_FILETYPE_PEM) != SSL_SUCCESS) assert(0); base.cert_, SSL_FILETYPE_PEM) != SSL_SUCCESS) throw(0);
if (base.key_) if (base.key_)
if (SSL_CTX_use_PrivateKey_file(base.ctx_, base.key_, if (SSL_CTX_use_PrivateKey_file(base.ctx_, base.key_,
SSL_FILETYPE_PEM) != SSL_SUCCESS) assert(0); SSL_FILETYPE_PEM) != SSL_SUCCESS) throw(0);
if (end == server_end) SetDH(base); if (end == server_end) SetDH(base);

View File

@ -31,6 +31,11 @@
#pragma warning(disable: 4996) #pragma warning(disable: 4996)
#endif #endif
#ifdef _MSC_VER
// 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
#pragma warning(disable: 4996)
#endif
namespace yaSSL { namespace yaSSL {
@ -59,8 +64,9 @@ void SetErrorString(unsigned long error, char* buffer)
{ {
using namespace TaoCrypt; using namespace TaoCrypt;
const int max = MAX_ERROR_SZ; // shorthand const int max = MAX_ERROR_SZ; // shorthand
int localError = error; // errors from a few enums
switch ((int) error) { switch (localError) {
// yaSSL proper errors // yaSSL proper errors
case range_error : case range_error :
@ -148,6 +154,10 @@ void SetErrorString(unsigned long error, char* buffer)
strncpy(buffer, "the read operation would block", max); strncpy(buffer, "the read operation would block", max);
break; break;
case SSL_ERROR_WANT_WRITE :
strncpy(buffer, "the write operation would block", max);
break;
case CERTFICATE_ERROR : case CERTFICATE_ERROR :
strncpy(buffer, "Unable to verify certificate", max); strncpy(buffer, "Unable to verify certificate", max);
break; break;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2005, 2010, Oracle and/or its affiliates Copyright (c) 2005, 2012, Oracle and/or its affiliates
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -135,8 +135,7 @@ void DH_Server::build(SSL& ssl)
mySTL::auto_ptr<Auth> auth; mySTL::auto_ptr<Auth> auth;
const CertManager& cert = ssl.getCrypto().get_certManager(); const CertManager& cert = ssl.getCrypto().get_certManager();
if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) {
{
if (cert.get_keyType() != rsa_sa_algo) { if (cert.get_keyType() != rsa_sa_algo) {
ssl.SetError(privateKey_error); ssl.SetError(privateKey_error);
return; return;
@ -925,8 +924,6 @@ Data::Data(uint16 len, opaque* b)
void Data::SetData(uint16 len, const opaque* buffer) void Data::SetData(uint16 len, const opaque* buffer)
{ {
assert(write_buffer_ == 0);
length_ = len; length_ = len;
write_buffer_ = buffer; write_buffer_ = buffer;
} }
@ -992,6 +989,11 @@ void Data::Process(input_buffer& input, SSL& ssl)
int dataSz = msgSz - ivExtra - digestSz - pad - padSz; int dataSz = msgSz - ivExtra - digestSz - pad - padSz;
opaque verify[SHA_LEN]; opaque verify[SHA_LEN];
if (dataSz < 0) {
ssl.SetError(bad_input);
return;
}
const byte* rawData = input.get_buffer() + input.get_current(); const byte* rawData = input.get_buffer() + input.get_current();
// read data // read data
@ -1085,19 +1087,37 @@ void Certificate::Process(input_buffer& input, SSL& ssl)
uint32 list_sz; uint32 list_sz;
byte tmp[3]; byte tmp[3];
if (input.get_remaining() < sizeof(tmp)) {
ssl.SetError(YasslError(bad_input));
return;
}
tmp[0] = input[AUTO]; tmp[0] = input[AUTO];
tmp[1] = input[AUTO]; tmp[1] = input[AUTO];
tmp[2] = input[AUTO]; tmp[2] = input[AUTO];
c24to32(tmp, list_sz); c24to32(tmp, list_sz);
if (list_sz > (uint)MAX_RECORD_SIZE) { // sanity check
ssl.SetError(YasslError(bad_input));
return;
}
while (list_sz) { while (list_sz) {
// cert size // cert size
uint32 cert_sz; uint32 cert_sz;
if (input.get_remaining() < sizeof(tmp)) {
ssl.SetError(YasslError(bad_input));
return;
}
tmp[0] = input[AUTO]; tmp[0] = input[AUTO];
tmp[1] = input[AUTO]; tmp[1] = input[AUTO];
tmp[2] = input[AUTO]; tmp[2] = input[AUTO];
c24to32(tmp, cert_sz); c24to32(tmp, cert_sz);
if (cert_sz > (uint)MAX_RECORD_SIZE || input.get_remaining() < cert_sz){
ssl.SetError(YasslError(bad_input));
return;
}
x509* myCert; x509* myCert;
cm.AddPeerCert(myCert = NEW_YS x509(cert_sz)); cm.AddPeerCert(myCert = NEW_YS x509(cert_sz));
input.read(myCert->use_buffer(), myCert->get_length()); input.read(myCert->use_buffer(), myCert->get_length());
@ -1496,6 +1516,7 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
if (ssl.isTLS() && client_version_.minor_ < 1) { if (ssl.isTLS() && client_version_.minor_ < 1) {
// downgrade to SSLv3 // downgrade to SSLv3
ssl.useSecurity().use_connection().TurnOffTLS(); ssl.useSecurity().use_connection().TurnOffTLS();
ProtocolVersion pv = ssl.getSecurity().get_connection().version_; ProtocolVersion pv = ssl.getSecurity().get_connection().version_;
bool removeDH = ssl.getSecurity().get_parms().removeDH_; bool removeDH = ssl.getSecurity().get_parms().removeDH_;
bool removeRSA = false; bool removeRSA = false;
@ -1541,6 +1562,7 @@ void ClientHello::Process(input_buffer&, SSL& ssl)
ssl.set_session(session); ssl.set_session(session);
ssl.useSecurity().set_resuming(true); ssl.useSecurity().set_resuming(true);
ssl.matchSuite(session->GetSuite(), SUITE_LEN); ssl.matchSuite(session->GetSuite(), SUITE_LEN);
if (ssl.GetError()) return;
ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]); ssl.set_pending(ssl.getSecurity().get_parms().suite_[1]);
ssl.set_masterSecret(session->GetSecret()); ssl.set_masterSecret(session->GetSecret());

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2005, 2011, Oracle and/or its affiliates Copyright (c) 2005, 2012, Oracle and/or its affiliates
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -308,8 +308,9 @@ SSL::SSL(SSL_CTX* ctx)
SetError(YasslError(err)); SetError(YasslError(err));
return; return;
} }
else if (serverSide && !(ctx->GetCiphers().setSuites_)) { else if (serverSide && ctx->GetCiphers().setSuites_ == 0) {
// remove RSA or DSA suites depending on cert key type // remove RSA or DSA suites depending on cert key type
// but don't override user sets
ProtocolVersion pv = secure_.get_connection().version_; ProtocolVersion pv = secure_.get_connection().version_;
bool removeDH = secure_.use_parms().removeDH_; bool removeDH = secure_.use_parms().removeDH_;
@ -1128,8 +1129,28 @@ void SSL::flushBuffer()
void SSL::Send(const byte* buffer, uint sz) void SSL::Send(const byte* buffer, uint sz)
{ {
if (socket_.send(buffer, sz) != sz) unsigned int sent = 0;
if (socket_.send(buffer, sz, sent) != sz) {
if (socket_.WouldBlock()) {
buffers_.SetOutput(NEW_YS output_buffer(sz - sent, buffer + sent,
sz - sent));
SetError(YasslError(SSL_ERROR_WANT_WRITE));
}
else
SetError(send_error); SetError(send_error);
}
}
void SSL::SendWriteBuffered()
{
output_buffer* out = buffers_.TakeOutput();
if (out) {
mySTL::auto_ptr<output_buffer> tmp(out);
Send(out->get_buffer(), out->get_size());
}
} }
@ -1291,7 +1312,6 @@ void SSL::matchSuite(const opaque* peer, uint length)
if (secure_.use_parms().suites_[i] == peer[j]) { if (secure_.use_parms().suites_[i] == peer[j]) {
secure_.use_parms().suite_[0] = 0x00; secure_.use_parms().suite_[0] = 0x00;
secure_.use_parms().suite_[1] = peer[j]; secure_.use_parms().suite_[1] = peer[j];
return; return;
} }
@ -1435,7 +1455,6 @@ void SSL::addBuffer(output_buffer* b)
void SSL_SESSION::CopyX509(X509* x) void SSL_SESSION::CopyX509(X509* x)
{ {
assert(peerX509_ == 0);
if (x == 0) return; if (x == 0) return;
X509_NAME* issuer = x->GetIssuer(); X509_NAME* issuer = x->GetIssuer();
@ -2232,7 +2251,7 @@ Hashes& sslHashes::use_certVerify()
} }
Buffers::Buffers() : rawInput_(0) Buffers::Buffers() : prevSent(0), plainSz(0), rawInput_(0), output_(0)
{} {}
@ -2243,12 +2262,18 @@ Buffers::~Buffers()
STL::for_each(dataList_.begin(), dataList_.end(), STL::for_each(dataList_.begin(), dataList_.end(),
del_ptr_zero()) ; del_ptr_zero()) ;
ysDelete(rawInput_); ysDelete(rawInput_);
ysDelete(output_);
}
void Buffers::SetOutput(output_buffer* ob)
{
output_ = ob;
} }
void Buffers::SetRawInput(input_buffer* ib) void Buffers::SetRawInput(input_buffer* ib)
{ {
assert(rawInput_ == 0);
rawInput_ = ib; rawInput_ = ib;
} }
@ -2262,6 +2287,15 @@ input_buffer* Buffers::TakeRawInput()
} }
output_buffer* Buffers::TakeOutput()
{
output_buffer* ret = output_;
output_ = 0;
return ret;
}
const Buffers::inputList& Buffers::getData() const const Buffers::inputList& Buffers::getData() const
{ {
return dataList_; return dataList_;
@ -2536,14 +2570,12 @@ ASN1_STRING* StringHolder::GetString()
// these versions should never get called // these versions should never get called
int Compress(const byte* in, int sz, input_buffer& buffer) int Compress(const byte* in, int sz, input_buffer& buffer)
{ {
assert(0);
return -1; return -1;
} }
int DeCompress(input_buffer& in, int sz, input_buffer& out) int DeCompress(input_buffer& in, int sz, input_buffer& out)
{ {
assert(0);
return -1; return -1;
} }

View File

@ -21,11 +21,13 @@ ADD_DEFINITIONS(${SSL_DEFINES})
SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp SET(TAOCRYPT_SOURCES src/aes.cpp src/aestables.cpp src/algebra.cpp src/arc4.cpp src/asn.cpp src/coding.cpp
src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp src/des.cpp src/dh.cpp src/dsa.cpp src/file.cpp src/hash.cpp src/integer.cpp src/md2.cpp
src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp src/md4.cpp src/md5.cpp src/misc.cpp src/random.cpp src/ripemd.cpp src/rsa.cpp src/sha.cpp
src/rabbit.cpp src/hc128.cpp
include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp include/aes.hpp include/algebra.hpp include/arc4.hpp include/asn.hpp include/block.hpp
include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp include/coding.hpp include/des.hpp include/dh.hpp include/dsa.hpp include/dsa.hpp
include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp include/error.hpp include/file.hpp include/hash.hpp include/hmac.hpp include/integer.hpp
include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp include/md2.hpp include/md5.hpp include/misc.hpp include/modarith.hpp include/modes.hpp
include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp) include/random.hpp include/ripemd.hpp include/rsa.hpp include/sha.hpp
include/rabbit.hpp include/hc128.hpp)
IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION) IF(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION)
SET(TAOCRYPT_SOURCES ${TAOCRYPT_SOURCES} src/template_instnt.cpp) SET(TAOCRYPT_SOURCES ${TAOCRYPT_SOURCES} src/template_instnt.cpp)

View File

@ -21,7 +21,7 @@ Stream Ciphers: ARC4
Public Key Crypto: RSA, DSA, Diffie-Hellman Public Key Crypto: RSA, DSA, Diffie-Hellman
Password based key derivation: PBKDF2 from PKCS #5 Password based key derivation: PBKDF2 from PKCS #5
Pseudo Random Number Generators Pseudo Random Number Generators
Lare Integer Support Large Integer Support
Base 16/64 encoding/decoding Base 16/64 encoding/decoding
DER encoding/decoding DER encoding/decoding
X.509 processing X.509 processing

View File

@ -103,7 +103,7 @@ void bench_des()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("3DES %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("3DES %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -123,7 +123,7 @@ void bench_aes(bool show)
double persec = 1 / total * megs; double persec = 1 / total * megs;
if (show) if (show)
printf("AES %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("AES %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -142,7 +142,7 @@ void bench_twofish()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("Twofish %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("Twofish %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -162,7 +162,7 @@ void bench_blowfish()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("Blowfish %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("Blowfish %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -181,7 +181,7 @@ void bench_arc4()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("ARC4 %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("ARC4 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -203,7 +203,7 @@ void bench_md5()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("MD5 %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("MD5 %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -231,7 +231,7 @@ void bench_sha()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("SHA %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("SHA %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -253,7 +253,7 @@ void bench_ripemd()
double persec = 1 / total * megs; double persec = 1 / total * megs;
printf("RIPEMD %d megs took %5.3f seconds, %5.2f MB/s\n", megs, total, printf("RIPEMD %d megs took %5.3f seconds, %6.2f MB/s\n", megs, total,
persec); persec);
} }
@ -276,7 +276,7 @@ void bench_rsa()
byte message[] = "Everyone gets Friday off."; byte message[] = "Everyone gets Friday off.";
byte cipher[128]; // for 1024 bit byte cipher[128]; // for 1024 bit
byte plain[128]; // for 1024 bit byte plain[128]; // for 1024 bit
const int len = strlen((char*)message); const int len = (word32)strlen((char*)message);
int i; int i;
double start = current_time(); double start = current_time();

0
extra/yassl/taocrypt/benchmark/make.bat Normal file → Executable file
View File

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
30818702818100DA9A18547FF03B385CC16508C173A7EF4EB61CB40EF8FEF3B31F145051676166BCDC3FE6B799FC394D08C26385F9413F896E09117E46209D6923602683CEA100924A6EE695281775C619DAA94EA8CB3691B4275B0183F1D39639EBC92995FE645D6C1BC28D409E585549BBD2C5DCDD6C208B04EADD8B7A6D997F72CBAD88390F020102

Binary file not shown.

View File

@ -167,6 +167,7 @@ public:
void Decode(RSA_PublicKey&); void Decode(RSA_PublicKey&);
private: private:
void ReadHeader(); void ReadHeader();
void ReadHeaderOpenSSL();
}; };

View File

@ -61,10 +61,6 @@ public:
void destroy(pointer p) {p->~T();} void destroy(pointer p) {p->~T();}
size_type max_size() const {return ~size_type(0)/sizeof(T);} size_type max_size() const {return ~size_type(0)/sizeof(T);}
protected: protected:
static void CheckSize(size_t n)
{
assert(n <= ~size_t(0) / sizeof(T));
}
}; };
@ -101,7 +97,8 @@ public:
pointer allocate(size_type n, const void* = 0) pointer allocate(size_type n, const void* = 0)
{ {
this->CheckSize(n); if (n > this->max_size())
return 0;
if (n == 0) if (n == 0)
return 0; return 0;
return NEW_TC T[n]; return NEW_TC T[n];
@ -144,9 +141,8 @@ public:
return *this; return *this;
} }
T& operator[] (word32 i) { assert(i < sz_); return buffer_[i]; } T& operator[] (word32 i) { return buffer_[i]; }
const T& operator[] (word32 i) const const T& operator[] (word32 i) const { return buffer_[i]; }
{ assert(i < sz_); return buffer_[i]; }
T* operator+ (word32 i) { return buffer_ + i; } T* operator+ (word32 i) { return buffer_ + i; }
const T* operator+ (word32 i) const { return buffer_ + i; } const T* operator+ (word32 i) const { return buffer_ + i; }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2000-2007 MySQL AB Copyright (C) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -39,25 +39,32 @@ public:
explicit Source(word32 sz = 0) : buffer_(sz), current_(0) {} explicit Source(word32 sz = 0) : buffer_(sz), current_(0) {}
Source(const byte* b, word32 sz) : buffer_(b, sz), current_(0) {} Source(const byte* b, word32 sz) : buffer_(b, sz), current_(0) {}
word32 remaining() { if (GetError().What()) return 0;
else return buffer_.size() - current_; }
word32 size() const { return buffer_.size(); } word32 size() const { return buffer_.size(); }
void grow(word32 sz) { buffer_.CleanGrow(sz); } void grow(word32 sz) { buffer_.CleanGrow(sz); }
bool IsLeft(word32 sz) { if (remaining() >= sz) return true;
else { SetError(CONTENT_E); return false; } }
const byte* get_buffer() const { return buffer_.get_buffer(); } const byte* get_buffer() const { return buffer_.get_buffer(); }
const byte* get_current() const { return &buffer_[current_]; } const byte* get_current() const { return &buffer_[current_]; }
word32 get_index() const { return current_; } word32 get_index() const { return current_; }
void set_index(word32 i) { current_ = i; } void set_index(word32 i) { if (i < size()) current_ = i; }
byte operator[] (word32 i) { current_ = i; return next(); } byte operator[] (word32 i) { current_ = i; return next(); }
byte next() { return buffer_[current_++]; } byte next() { if (IsLeft(1)) return buffer_[current_++]; else return 0; }
byte prev() { return buffer_[--current_]; } byte prev() { if (current_) return buffer_[--current_]; else return 0; }
void add(const byte* data, word32 len) void add(const byte* data, word32 len)
{ {
if (IsLeft(len)) {
memcpy(buffer_.get_buffer() + current_, data, len); memcpy(buffer_.get_buffer() + current_, data, len);
current_ += len; current_ += len;
} }
}
void advance(word32 i) { current_ += i; } void advance(word32 i) { if (IsLeft(i)) current_ += i; }
void reset(ByteBlock&); void reset(ByteBlock&);
Error GetError() { return error_; } Error GetError() { return error_; }

View File

@ -0,0 +1,63 @@
/*
Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
MA 02110-1301 USA.
*/
/* hc128.hpp defines HC128
*/
#ifndef TAO_CRYPT_HC128_HPP
#define TAO_CRYPT_HC128_HPP
#include "misc.hpp"
namespace TaoCrypt {
// HC128 encryption and decryption
class HC128 {
public:
typedef HC128 Encryption;
typedef HC128 Decryption;
HC128() {}
void Process(byte*, const byte*, word32);
void SetKey(const byte*, const byte*);
private:
word32 T_[1024]; /* P[i] = T[i]; Q[i] = T[1024 + i ]; */
word32 X_[16];
word32 Y_[16];
word32 counter1024_; /* counter1024 = i mod 1024 at the ith step */
word32 key_[8];
word32 iv_[8];
void SetIV(const byte*);
void GenerateKeystream(word32*);
void SetupUpdate();
HC128(const HC128&); // hide copy
const HC128 operator=(const HC128&); // and assign
};
} // namespace
#endif // TAO_CRYPT_HC128_HPP

View File

@ -110,13 +110,6 @@ namespace TaoCrypt {
#endif #endif
// general MIN
template<typename T> inline
const T& min(const T& a, const T& b)
{
return a < b ? a : b;
}
// general MAX // general MAX
template<typename T> inline template<typename T> inline

View File

@ -30,17 +30,5 @@ extern "C" void* memcpy(void*, const void*, size_t);
extern "C" void* memset(void*, int, size_t); extern "C" void* memset(void*, int, size_t);
extern "C" void printk(char *fmt, ...); extern "C" void printk(char *fmt, ...);
#define KERN_ERR "<3>" /* error conditions */
#if defined(NDEBUG)
#define assert(p) ((void)0)
#else
#define assert(expr) \
if (!(expr)) { \
printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
#expr,__FILE__,__FUNCTION__,__LINE__); }
#endif
#endif // TAOCRYPT_KERNELC_HPP #endif // TAOCRYPT_KERNELC_HPP

View File

@ -24,7 +24,6 @@
#if !defined(DO_TAOCRYPT_KERNEL_MODE) #if !defined(DO_TAOCRYPT_KERNEL_MODE)
#include <stdlib.h> #include <stdlib.h>
#include <assert.h>
#include <string.h> #include <string.h>
#else #else
#include "kernelc.hpp" #include "kernelc.hpp"
@ -82,10 +81,10 @@ void CleanUp();
// to resolve compiler generated operator delete on base classes with // to resolve compiler generated operator delete on base classes with
// virtual destructors (when on stack), make sure doesn't get called // virtual destructors (when on stack)
class virtual_base { class virtual_base {
public: public:
static void operator delete(void*) { assert(0); } static void operator delete(void*) { }
}; };
#else // YASSL_PURE_C #else // YASSL_PURE_C
@ -366,7 +365,6 @@ inline bool IsPowerOf2(T n)
template <class T1, class T2> template <class T1, class T2>
inline T2 ModPowerOf2(T1 a, T2 b) inline T2 ModPowerOf2(T1 a, T2 b)
{ {
assert(IsPowerOf2(b));
return T2(a) & (b-1); return T2(a) & (b-1);
} }
@ -409,13 +407,11 @@ inline bool IsAligned(const void* p, T* dummy = 0) // VC60 workaround
template <class T> inline T rotlFixed(T x, unsigned int y) template <class T> inline T rotlFixed(T x, unsigned int y)
{ {
assert(y < sizeof(T)*8);
return (x<<y) | (x>>(sizeof(T)*8-y)); return (x<<y) | (x>>(sizeof(T)*8-y));
} }
template <class T> inline T rotrFixed(T x, unsigned int y) template <class T> inline T rotrFixed(T x, unsigned int y)
{ {
assert(y < sizeof(T)*8);
return (x>>y) | (x<<(sizeof(T)*8-y)); return (x>>y) | (x<<(sizeof(T)*8-y));
} }
@ -425,13 +421,11 @@ template <class T> inline T rotrFixed(T x, unsigned int y)
template<> inline word32 rotlFixed(word32 x, word32 y) template<> inline word32 rotlFixed(word32 x, word32 y)
{ {
assert(y < 32);
return y ? _lrotl(x, y) : x; return y ? _lrotl(x, y) : x;
} }
template<> inline word32 rotrFixed(word32 x, word32 y) template<> inline word32 rotrFixed(word32 x, word32 y)
{ {
assert(y < 32);
return y ? _lrotr(x, y) : x; return y ? _lrotr(x, y) : x;
} }
@ -441,7 +435,9 @@ template<> inline word32 rotrFixed(word32 x, word32 y)
#undef min #undef min
#endif #endif
inline word32 min(word32 a, word32 b)
template <class T>
inline const T& min(const T& a, const T& b)
{ {
return a < b ? a : b; return a < b ? a : b;
} }
@ -486,7 +482,6 @@ inline word64 ByteReverse(word64 value)
template <typename T> template <typename T>
inline void ByteReverse(T* out, const T* in, word32 byteCount) inline void ByteReverse(T* out, const T* in, word32 byteCount)
{ {
assert(byteCount % sizeof(T) == 0);
word32 count = byteCount/sizeof(T); word32 count = byteCount/sizeof(T);
for (word32 i=0; i<count; i++) for (word32 i=0; i<count; i++)
out[i] = ByteReverse(in[i]); out[i] = ByteReverse(in[i]);
@ -574,7 +569,6 @@ inline void GetUserKey(ByteOrder order, T* out, word32 outlen, const byte* in,
word32 inlen) word32 inlen)
{ {
const unsigned int U = sizeof(T); const unsigned int U = sizeof(T);
assert(inlen <= outlen*U);
memcpy(out, in, inlen); memcpy(out, in, inlen);
memset((byte *)out+inlen, 0, outlen*U-inlen); memset((byte *)out+inlen, 0, outlen*U-inlen);
ByteReverseIf(out, out, RoundUpToMultipleOf(inlen, U), order); ByteReverseIf(out, out, RoundUpToMultipleOf(inlen, U), order);
@ -583,7 +577,8 @@ inline void GetUserKey(ByteOrder order, T* out, word32 outlen, const byte* in,
#ifdef _MSC_VER #ifdef _MSC_VER
// disable conversion warning // disable conversion warning
#pragma warning(disable:4244) // 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy
#pragma warning(disable:4244 4996)
#endif #endif
@ -678,10 +673,7 @@ template <class T>
inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block) inline T GetWord(bool assumeAligned, ByteOrder order, const byte *block)
{ {
if (assumeAligned) if (assumeAligned)
{
assert(IsAligned<T>(block));
return ByteReverseIf(*reinterpret_cast<const T *>(block), order); return ByteReverseIf(*reinterpret_cast<const T *>(block), order);
}
else else
return UnalignedGetWord<T>(order, block); return UnalignedGetWord<T>(order, block);
} }
@ -699,7 +691,6 @@ inline void PutWord(bool assumeAligned, ByteOrder order, byte* block, T value,
{ {
if (assumeAligned) if (assumeAligned)
{ {
assert(IsAligned<T>(block));
if (xorBlock) if (xorBlock)
*reinterpret_cast<T *>(block) = ByteReverseIf(value, order) *reinterpret_cast<T *>(block) = ByteReverseIf(value, order)
^ *reinterpret_cast<const T *>(xorBlock); ^ *reinterpret_cast<const T *>(xorBlock);
@ -812,7 +803,6 @@ inline T SafeLeftShift(T value)
inline inline
word ShiftWordsLeftByBits(word* r, unsigned int n, unsigned int shiftBits) word ShiftWordsLeftByBits(word* r, unsigned int n, unsigned int shiftBits)
{ {
assert (shiftBits<WORD_BITS);
word u, carry=0; word u, carry=0;
if (shiftBits) if (shiftBits)
for (unsigned int i=0; i<n; i++) for (unsigned int i=0; i<n; i++)
@ -828,7 +818,6 @@ word ShiftWordsLeftByBits(word* r, unsigned int n, unsigned int shiftBits)
inline inline
word ShiftWordsRightByBits(word* r, unsigned int n, unsigned int shiftBits) word ShiftWordsRightByBits(word* r, unsigned int n, unsigned int shiftBits)
{ {
assert (shiftBits<WORD_BITS);
word u, carry=0; word u, carry=0;
if (shiftBits) if (shiftBits)
for (int i=n-1; i>=0; i--) for (int i=n-1; i>=0; i--)

View File

@ -61,9 +61,7 @@ public:
explicit Mode_BASE(int sz, CipherDir dir, Mode mode) explicit Mode_BASE(int sz, CipherDir dir, Mode mode)
: blockSz_(sz), reg_(reinterpret_cast<byte*>(r_)), : blockSz_(sz), reg_(reinterpret_cast<byte*>(r_)),
tmp_(reinterpret_cast<byte*>(t_)), dir_(dir), mode_(mode) tmp_(reinterpret_cast<byte*>(t_)), dir_(dir), mode_(mode)
{ {}
assert(sz <= MaxBlockSz);
}
virtual ~Mode_BASE() {} virtual ~Mode_BASE() {}
virtual void Process(byte*, const byte*, word32); virtual void Process(byte*, const byte*, word32);
@ -96,8 +94,7 @@ inline void Mode_BASE::Process(byte* out, const byte* in, word32 sz)
{ {
if (mode_ == ECB) if (mode_ == ECB)
ECB_Process(out, in, sz); ECB_Process(out, in, sz);
else if (mode_ == CBC) else if (mode_ == CBC) {
{
if (dir_ == ENCRYPTION) if (dir_ == ENCRYPTION)
CBC_Encrypt(out, in, sz); CBC_Encrypt(out, in, sz);
else else

View File

@ -48,8 +48,9 @@ word32 PBKDF2_HMAC<T>::DeriveKey(byte* derived, word32 dLen, const byte* pwd,
word32 pLen, const byte* salt, word32 sLen, word32 pLen, const byte* salt, word32 sLen,
word32 iterations) const word32 iterations) const
{ {
assert(dLen <= MaxDerivedKeyLength()); if (dLen > MaxDerivedKeyLength())
assert(iterations > 0); return 0;
ByteBlock buffer(T::DIGEST_SIZE); ByteBlock buffer(T::DIGEST_SIZE);
HMAC<T> hmac; HMAC<T> hmac;

View File

@ -0,0 +1,65 @@
/*
Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
MA 02110-1301 USA.
*/
/* rabbit.hpp defines Rabbit
*/
#ifndef TAO_CRYPT_RABBIT_HPP
#define TAO_CRYPT_RABBIT_HPP
#include "misc.hpp"
namespace TaoCrypt {
// Rabbit encryption and decryption
class Rabbit {
public:
typedef Rabbit Encryption;
typedef Rabbit Decryption;
enum RabbitCtx { Master = 0, Work = 1 };
Rabbit() {}
void Process(byte*, const byte*, word32);
void SetKey(const byte*, const byte*);
private:
struct Ctx {
word32 x[8];
word32 c[8];
word32 carry;
};
Ctx masterCtx_;
Ctx workCtx_;
void NextState(RabbitCtx);
void SetIV(const byte*);
Rabbit(const Rabbit&); // hide copy
const Rabbit operator=(const Rabbit&); // and assign
};
} // namespace
#endif // TAO_CRYPT_RABBIT_HPP

View File

@ -178,7 +178,8 @@ void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
RandomNumberGenerator& rng) RandomNumberGenerator& rng)
{ {
PK_Lengths lengths(key_.GetModulus()); PK_Lengths lengths(key_.GetModulus());
assert(sz <= lengths.FixedMaxPlaintextLength()); if (sz > lengths.FixedMaxPlaintextLength())
return;
ByteBlock paddedBlock(lengths.PaddedBlockByteLength()); ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
padding_.Pad(plain, sz, paddedBlock.get_buffer(), padding_.Pad(plain, sz, paddedBlock.get_buffer(),
@ -195,7 +196,6 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
RandomNumberGenerator& rng) RandomNumberGenerator& rng)
{ {
PK_Lengths lengths(key_.GetModulus()); PK_Lengths lengths(key_.GetModulus());
assert(sz == lengths.FixedCiphertextLength());
if (sz != lengths.FixedCiphertextLength()) if (sz != lengths.FixedCiphertextLength())
return 0; return 0;

View File

@ -31,7 +31,6 @@
#ifdef __sun #ifdef __sun
#include <assert.h>
// Handler for pure virtual functions // Handler for pure virtual functions
namespace __Crun { namespace __Crun {
@ -46,9 +45,7 @@ namespace __Crun {
#if __GNUC__ > 2 #if __GNUC__ > 2
extern "C" { extern "C" {
#if !defined(DO_TAOCRYPT_KERNEL_MODE) #if defined(DO_TAOCRYPT_KERNEL_MODE)
#include <assert.h>
#else
#include "kernelc.hpp" #include "kernelc.hpp"
#endif #endif
int __cxa_pure_virtual () __attribute__ ((weak)); int __cxa_pure_virtual () __attribute__ ((weak));

View File

@ -26,7 +26,6 @@
#include <string.h> // strncpy #include <string.h> // strncpy
#include <assert.h> // assert
#include <stdlib.h> // size_t #include <stdlib.h> // size_t
@ -41,7 +40,7 @@ public:
virtual const char* what() const { return ""; } virtual const char* what() const { return ""; }
// for compiler generated call, never used // for compiler generated call, never used
static void operator delete(void*) { assert(0); } static void operator delete(void*) { }
private: private:
// don't allow dynamic creation of exceptions // don't allow dynamic creation of exceptions
static void* operator new(size_t); static void* operator new(size_t);

View File

@ -26,7 +26,6 @@
#include "helpers.hpp" // construct, destory, fill, etc. #include "helpers.hpp" // construct, destory, fill, etc.
#include "algorithm.hpp" // swap #include "algorithm.hpp" // swap
#include <assert.h> // assert
namespace mySTL { namespace mySTL {
@ -141,7 +140,7 @@ private:
// for growing, n must be bigger than other size // for growing, n must be bigger than other size
vector(size_t n, const vector& other) : vec_(n) vector(size_t n, const vector& other) : vec_(n)
{ {
assert(n > other.size()); if (n > other.size())
vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_, vec_.finish_ = uninit_copy(other.vec_.start_, other.vec_.finish_,
vec_.start_); vec_.start_);
} }

View File

@ -87,7 +87,12 @@ void AES::Process(byte* out, const byte* in, word32 sz)
void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/) void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
{ {
assert( (keylen == 16) || (keylen == 24) || (keylen == 32) ); if (keylen <= 16)
keylen = 16;
else if (keylen >= 32)
keylen = 32;
else if (keylen != 24)
keylen = 24;
rounds_ = keylen/4 + 6; rounds_ = keylen/4 + 6;

View File

@ -33,6 +33,4 @@ const word32 AES::rcon_[] = {
}; };
} // namespace } // namespace

View File

@ -246,7 +246,6 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
for (i=0; i<expCount; i++) for (i=0; i<expCount; i++)
{ {
assert(expBegin->NotNegative());
exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0)); exponents.push_back(WindowSlider(*expBegin++, InversionIsFast(), 0));
exponents[i].FindNextWindow(); exponents[i].FindNextWindow();
buckets[i].resize(1<<(exponents[i].windowSize-1), Identity()); buckets[i].resize(1<<(exponents[i].windowSize-1), Identity());
@ -287,7 +286,7 @@ void AbstractGroup::SimultaneousMultiply(Integer *results, const Integer &base,
r = buckets[i][buckets[i].size()-1]; r = buckets[i][buckets[i].size()-1];
if (buckets[i].size() > 1) if (buckets[i].size() > 1)
{ {
for (int j= (unsigned int) (buckets[i].size()) - 2; j >= 1; j--) for (size_t j = buckets[i].size()-2; j >= 1; j--)
{ {
Accumulate(buckets[i][j], buckets[i][j+1]); Accumulate(buckets[i][j], buckets[i][j+1]);
Accumulate(r, buckets[i][j]); Accumulate(r, buckets[i][j]);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2005-2007 MySQL AB, 2009, 2010 Sun Microsystems, Inc. Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
Use is subject to license terms. Use is subject to license terms.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -111,7 +111,8 @@ bool ValidateDate(const byte* date, byte format, CertDecoder::DateType dt)
GetTime(certTime.tm_min, date, i); GetTime(certTime.tm_min, date, i);
GetTime(certTime.tm_sec, date, i); GetTime(certTime.tm_sec, date, i);
assert(date[i] == 'Z'); // only Zulu supported for this profile if (date[i] != 'Z') // only Zulu supported for this profile
return false;
time_t ltime = time(0); time_t ltime = time(0);
tm* localTime = gmtime(&ltime); tm* localTime = gmtime(&ltime);
@ -143,6 +144,8 @@ word32 GetLength(Source& source)
if (b >= LONG_LENGTH) { if (b >= LONG_LENGTH) {
word32 bytes = b & 0x7F; word32 bytes = b & 0x7F;
if (source.IsLeft(bytes) == false) return 0;
while (bytes--) { while (bytes--) {
b = source.next(); b = source.next();
length = (length << 8) | b; length = (length << 8) | b;
@ -364,12 +367,59 @@ void RSA_Public_Decoder::Decode(RSA_PublicKey& key)
ReadHeader(); ReadHeader();
if (source_.GetError().What()) return; if (source_.GetError().What()) return;
ReadHeaderOpenSSL(); // may or may not be
if (source_.GetError().What()) return;
// public key // public key
key.SetModulus(GetInteger(Integer().Ref())); key.SetModulus(GetInteger(Integer().Ref()));
key.SetPublicExponent(GetInteger(Integer().Ref())); key.SetPublicExponent(GetInteger(Integer().Ref()));
} }
// Read OpenSSL format public header
void RSA_Public_Decoder::ReadHeaderOpenSSL()
{
byte b = source_.next(); // peek
source_.prev();
if (b != INTEGER) { // have OpenSSL public format
GetSequence();
b = source_.next();
if (b != OBJECT_IDENTIFIER) {
source_.SetError(OBJECT_ID_E);
return;
}
word32 len = GetLength(source_);
source_.advance(len);
b = source_.next();
if (b == TAG_NULL) { // could have NULL tag and 0 terminator, may not
b = source_.next();
if (b != 0) {
source_.SetError(EXPECT_0_E);
return;
}
}
else
source_.prev(); // put back
b = source_.next();
if (b != BIT_STRING) {
source_.SetError(BIT_STR_E);
return;
}
len = GetLength(source_);
b = source_.next();
if (b != 0) // could have 0
source_.prev(); // put back
GetSequence();
}
}
void RSA_Public_Decoder::ReadHeader() void RSA_Public_Decoder::ReadHeader()
{ {
GetSequence(); GetSequence();
@ -530,8 +580,10 @@ void CertDecoder::StoreKey()
read = source_.get_index() - read; read = source_.get_index() - read;
length += read; length += read;
if (source_.GetError().What()) return;
while (read--) source_.prev(); while (read--) source_.prev();
if (source_.IsLeft(length) == false) return;
key_.SetSize(length); key_.SetSize(length);
key_.SetKey(source_.get_current()); key_.SetKey(source_.get_current());
source_.advance(length); source_.advance(length);
@ -563,6 +615,8 @@ void CertDecoder::AddDSA()
word32 length = GetLength(source_); word32 length = GetLength(source_);
length += source_.get_index() - idx; length += source_.get_index() - idx;
if (source_.IsLeft(length) == false) return;
key_.AddToEnd(source_.get_buffer() + idx, length); key_.AddToEnd(source_.get_buffer() + idx, length);
} }
@ -573,6 +627,8 @@ word32 CertDecoder::GetAlgoId()
if (source_.GetError().What()) return 0; if (source_.GetError().What()) return 0;
word32 length = GetSequence(); word32 length = GetSequence();
if (source_.GetError().What()) return 0;
byte b = source_.next(); byte b = source_.next();
if (b != OBJECT_IDENTIFIER) { if (b != OBJECT_IDENTIFIER) {
source_.SetError(OBJECT_ID_E); source_.SetError(OBJECT_ID_E);
@ -580,25 +636,24 @@ word32 CertDecoder::GetAlgoId()
} }
length = GetLength(source_); length = GetLength(source_);
word32 oid = 0; if (source_.IsLeft(length) == false) return 0;
word32 oid = 0;
while(length--) while(length--)
oid += source_.next(); // just sum it up for now oid += source_.next(); // just sum it up for now
if (oid != SHAwDSA && oid != DSAk) { // could have NULL tag and 0 terminator, but may not
b = source_.next(); // should have NULL tag and 0 b = source_.next();
if (b == TAG_NULL) {
if (b != TAG_NULL) {
source_.SetError(TAG_NULL_E);
return 0;
}
b = source_.next(); b = source_.next();
if (b != 0) { if (b != 0) {
source_.SetError(EXPECT_0_E); source_.SetError(EXPECT_0_E);
return 0; return 0;
} }
} }
else
// go back, didn't have it
b = source_.prev();
return oid; return oid;
} }
@ -616,6 +671,10 @@ word32 CertDecoder::GetSignature()
} }
sigLength_ = GetLength(source_); sigLength_ = GetLength(source_);
if (sigLength_ == 0 || source_.IsLeft(sigLength_) == false) {
source_.SetError(CONTENT_E);
return 0;
}
b = source_.next(); b = source_.next();
if (b != 0) { if (b != 0) {
@ -653,18 +712,20 @@ word32 CertDecoder::GetDigest()
} }
char *CertDecoder::AddTag(char *ptr, const char *buf_end, // memory length checked add tag to buffer
const char *tag_name, word32 tag_name_length, char* CertDecoder::AddTag(char* ptr, const char* buf_end, const char* tag_name,
word32 tag_value_length) word32 tag_name_length, word32 tag_value_length)
{ {
if (ptr + tag_name_length + tag_value_length > buf_end) if (ptr + tag_name_length + tag_value_length > buf_end) {
source_.SetError(CONTENT_E);
return 0; return 0;
}
memcpy(ptr, tag_name, tag_name_length); memcpy(ptr, tag_name, tag_name_length);
ptr+= tag_name_length; ptr += tag_name_length;
memcpy(ptr, source_.get_current(), tag_value_length); memcpy(ptr, source_.get_current(), tag_value_length);
ptr+= tag_value_length; ptr += tag_value_length;
return ptr; return ptr;
} }
@ -679,18 +740,20 @@ void CertDecoder::GetName(NameType nt)
word32 length = GetSequence(); // length of all distinguished names word32 length = GetSequence(); // length of all distinguished names
if (length >= ASN_NAME_MAX) if (length >= ASN_NAME_MAX)
goto err; return;
if (source_.IsLeft(length) == false) return;
length += source_.get_index(); length += source_.get_index();
char *ptr, *buf_end; char* ptr;
char* buf_end;
if (nt == ISSUER) { if (nt == ISSUER) {
ptr= issuer_; ptr = issuer_;
buf_end= ptr + sizeof(issuer_) - 1; // 1 byte for trailing 0 buf_end = ptr + sizeof(issuer_) - 1; // 1 byte for trailing 0
} }
else { else {
ptr= subject_; ptr = subject_;
buf_end= ptr + sizeof(subject_) - 1; // 1 byte for trailing 0 buf_end = ptr + sizeof(subject_) - 1; // 1 byte for trailing 0
} }
while (source_.get_index() < length) { while (source_.get_index() < length) {
@ -704,7 +767,10 @@ void CertDecoder::GetName(NameType nt)
} }
word32 oidSz = GetLength(source_); word32 oidSz = GetLength(source_);
if (source_.IsLeft(oidSz) == false) return;
byte joint[2]; byte joint[2];
if (source_.IsLeft(sizeof(joint)) == false) return;
memcpy(joint, source_.get_current(), sizeof(joint)); memcpy(joint, source_.get_current(), sizeof(joint));
// v1 name types // v1 name types
@ -714,34 +780,36 @@ void CertDecoder::GetName(NameType nt)
b = source_.next(); // strType b = source_.next(); // strType
word32 strLen = GetLength(source_); word32 strLen = GetLength(source_);
if (source_.IsLeft(strLen) == false) return;
switch (id) { switch (id) {
case COMMON_NAME: case COMMON_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/CN=", 4, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/CN=", 4, strLen)))
goto err; return;
break; break;
case SUR_NAME: case SUR_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/SN=", 4, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/SN=", 4, strLen)))
goto err; return;
break; break;
case COUNTRY_NAME: case COUNTRY_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/C=", 3, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/C=", 3, strLen)))
goto err; return;
break; break;
case LOCALITY_NAME: case LOCALITY_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/L=", 3, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/L=", 3, strLen)))
goto err; return;
break; break;
case STATE_NAME: case STATE_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/ST=", 4, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/ST=", 4, strLen)))
goto err; return;
break; break;
case ORG_NAME: case ORG_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/O=", 3, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/O=", 3, strLen)))
goto err; return;
break; break;
case ORGUNIT_NAME: case ORGUNIT_NAME:
if (!(ptr= AddTag(ptr, buf_end, "/OU=", 4, strLen))) if (!(ptr = AddTag(ptr, buf_end, "/OU=", 4, strLen)))
goto err; return;
break; break;
} }
@ -755,21 +823,25 @@ void CertDecoder::GetName(NameType nt)
source_.advance(oidSz + 1); source_.advance(oidSz + 1);
word32 length = GetLength(source_); word32 length = GetLength(source_);
if (source_.IsLeft(length) == false) return;
if (email && !(ptr= AddTag(ptr, buf_end, "/emailAddress=", 14, length))) if (email) {
goto err; if (!(ptr = AddTag(ptr, buf_end, "/emailAddress=", 14, length))) {
source_.SetError(CONTENT_E);
return;
}
}
source_.advance(length); source_.advance(length);
} }
} }
*ptr= 0;
sha.Final(nt == ISSUER ? issuerHash_ : subjectHash_); *ptr = 0;
return; if (nt == ISSUER)
sha.Final(issuerHash_);
err: else
source_.SetError(CONTENT_E); sha.Final(subjectHash_);
} }
@ -785,6 +857,8 @@ void CertDecoder::GetDate(DateType dt)
} }
word32 length = GetLength(source_); word32 length = GetLength(source_);
if (source_.IsLeft(length) == false) return;
byte date[MAX_DATE_SZ]; byte date[MAX_DATE_SZ];
if (length > MAX_DATE_SZ || length < MIN_DATE_SZ) { if (length > MAX_DATE_SZ || length < MIN_DATE_SZ) {
source_.SetError(DATE_SZ_E); source_.SetError(DATE_SZ_E);
@ -794,8 +868,7 @@ void CertDecoder::GetDate(DateType dt)
memcpy(date, source_.get_current(), length); memcpy(date, source_.get_current(), length);
source_.advance(length); source_.advance(length);
if (!ValidateDate(date, b, dt) && verify_) if (!ValidateDate(date, b, dt) && verify_) {
{
if (dt == BEFORE) if (dt == BEFORE)
source_.SetError(BEFORE_DATE_E); source_.SetError(BEFORE_DATE_E);
else else
@ -856,7 +929,8 @@ void CertDecoder::GetCompareHash(const byte* plain, word32 sz, byte* digest,
// validate signature signed by someone else // validate signature signed by someone else
bool CertDecoder::ValidateSignature(SignerList* signers) bool CertDecoder::ValidateSignature(SignerList* signers)
{ {
assert(signers); if (!signers)
return false;
SignerList::iterator first = signers->begin(); SignerList::iterator first = signers->begin();
SignerList::iterator last = signers->end(); SignerList::iterator last = signers->end();
@ -1077,8 +1151,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
return 0; return 0;
} }
word32 rLen = GetLength(source); word32 rLen = GetLength(source);
if (rLen != 20) if (rLen != 20) {
{
if (rLen == 21) { // zero at front, eat if (rLen == 21) { // zero at front, eat
source.next(); source.next();
--rLen; --rLen;
@ -1101,8 +1174,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
return 0; return 0;
} }
word32 sLen = GetLength(source); word32 sLen = GetLength(source);
if (sLen != 20) if (sLen != 20) {
{
if (sLen == 21) { if (sLen == 21) {
source.next(); // zero at front, eat source.next(); // zero at front, eat
--sLen; --sLen;
@ -1123,6 +1195,7 @@ word32 DecodeDSA_Signature(byte* decoded, const byte* encoded, word32 sz)
} }
/*
// Get Cert in PEM format from BEGIN to END // Get Cert in PEM format from BEGIN to END
int GetCert(Source& source) int GetCert(Source& source)
{ {
@ -1174,12 +1247,10 @@ void PKCS12_Decoder::Decode()
// Get MacData optional // Get MacData optional
/* // mac digestInfo like certdecoder::getdigest?
mac digestInfo like certdecoder::getdigest? // macsalt octet string
macsalt octet string // iter integer
iter integer
*/
} }
@ -1199,6 +1270,7 @@ int GetPKCS_Cert(const char* password, Source& source)
return 0; return 0;
} }
*/

View File

@ -87,7 +87,10 @@ void Blowfish::Process(byte* out, const byte* in, word32 sz)
void Blowfish::SetKey(const byte* key_string, word32 keylength, CipherDir dir) void Blowfish::SetKey(const byte* key_string, word32 keylength, CipherDir dir)
{ {
assert(keylength >= 4 && keylength <= 56); if (keylength < 4)
keylength = 4;
else if (keylength > 56)
keylength = 56;
unsigned i, j=0, k; unsigned i, j=0, k;
word32 data, dspace[2] = {0, 0}; word32 data, dspace[2] = {0, 0};
@ -166,16 +169,21 @@ void Blowfish::crypt_block(const word32 in[2], word32 out[2]) const
word32 left = in[0]; word32 left = in[0];
word32 right = in[1]; word32 right = in[1];
const word32 *const s = sbox_;
const word32* p = pbox_; const word32* p = pbox_;
word32 tmp;
left ^= p[0]; left ^= p[0];
BF_ROUNDS // roll back up and use s and p index instead of just p
for (unsigned i = 0; i < ROUNDS / 2; i++) {
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
#if ROUNDS == 20 left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
BF_EXTRA_ROUNDS ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
#endif ^ p[2*i+2];
}
right ^= p[ROUNDS + 1]; right ^= p[ROUNDS + 1];
@ -189,17 +197,23 @@ typedef BlockGetAndPut<word32, BigEndian> gpBlock;
void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out) void Blowfish::ProcessAndXorBlock(const byte* in, const byte* xOr, byte* out)
const const
{ {
word32 tmp, left, right; word32 left, right;
const word32 *const s = sbox_;
const word32* p = pbox_; const word32* p = pbox_;
gpBlock::Get(in)(left)(right); gpBlock::Get(in)(left)(right);
left ^= p[0]; left ^= p[0];
BF_ROUNDS // roll back up and use s and p index instead of just p
for (unsigned i = 0; i < ROUNDS / 2; i++) {
right ^= (((s[GETBYTE(left,3)] + s[256+GETBYTE(left,2)])
^ s[2*256+GETBYTE(left,1)]) + s[3*256+GETBYTE(left,0)])
^ p[2*i+1];
#if ROUNDS == 20 left ^= (((s[GETBYTE(right,3)] + s[256+GETBYTE(right,2)])
BF_EXTRA_ROUNDS ^ s[2*256+GETBYTE(right,1)]) + s[3*256+GETBYTE(right,0)])
#endif ^ p[2*i+2];
}
right ^= p[ROUNDS + 1]; right ^= p[ROUNDS + 1];

Some files were not shown because too many files have changed in this diff Show More