Changes between 0.9.7c and 0.9.8 [xx XXX xxxx]
+ *) The tmdiff.h API was so ugly and minimal that our own timing utility
+ (speed) prefers to use its own implementation. The two implementations
+ haven't been consolidated as yet (volunteers?) but the tmdiff API has had
+ its object type properly exposed (MS_TM) instead of casting to/from "char
+ *". This may still change yet if someone realises MS_TM and "ms_time_***"
+ aren't necessarily the greatest nomenclatures - but this is what was used
+ internally to the implementation so I've used that for now.
+ [Geoff Thorpe]
+
*) Ensure that deprecated functions do not get compiled when
OPENSSL_NO_DEPRECATED is defined. Some "openssl" subcommands and a few of
the self-tests were still using deprecated key-generation functions so
#include <openssl/ecdh.h>
#endif
+/*
+ * The following "HZ" timing stuff should be sync'd up with the code in
+ * crypto/tmdiff.[ch]. That appears to try to do the same job, though I think
+ * this code is more up to date than libcrypto's so there may be features to
+ * migrate over first. This is used in two places further down AFAICS.
+ * The point is that nothing in openssl actually *uses* that tmdiff stuff, so
+ * either speed.c should be using it or it should go because it's obviously not
+ * useful enough. Anyone want to do a janitorial job on this?
+ */
+
/* The following if from times(3) man page. It may need to be changed */
#ifndef HZ
# if defined(_SC_CLK_TCK) \
&& (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
-# define HZ ((double)sysconf(_SC_CLK_TCK))
+# define HZ sysconf(_SC_CLK_TCK)
# else
# ifndef CLK_TCK
# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
#ifdef USE_TOD
if(usertime)
- {
+ {
static struct rusage tstart,tend;
getrusage_used = 1;
else
{
times(&tend);
- ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ;
+ ret = HZ;
+ ret=(double)(tend.tms_utime-tstart.tms_utime) / ret;
return((ret < 1e-3)?1e-3:ret);
}
}
#endif
#ifdef HZ
#define as_string(s) (#s)
- printf("HZ=%g", (double)HZ);
+ {
+ double dbl = HZ;
+ printf("HZ=%g", dbl);
+ }
# ifdef _SC_CLK_TCK
printf(" [sysconf value]");
# endif
#ifndef HZ
# if defined(_SC_CLK_TCK) \
&& (!defined(OPENSSL_SYS_VMS) || __CTRL_VER >= 70000000)
-# define HZ ((double)sysconf(_SC_CLK_TCK))
+/* # define HZ ((double)sysconf(_SC_CLK_TCK)) */
+# define HZ sysconf(_SC_CLK_TCK)
# else
# ifndef CLK_TCK
# ifndef _BSD_CLK_TCK_ /* FreeBSD hack */
# endif
#endif
-typedef struct ms_tm
+struct ms_tm
{
#ifdef TIMES
struct tms ms_tms;
# endif
# endif
#endif
- } MS_TM;
+ };
-char *ms_time_new(void)
+MS_TM *ms_time_new(void)
{
MS_TM *ret;
#ifdef OPENSSL_SYS_WIN32
ret->thread_id=GetCurrentThread();
#endif
- return((char *)ret);
+ return ret;
}
-void ms_time_free(char *a)
+void ms_time_free(MS_TM *a)
{
if (a != NULL)
OPENSSL_free(a);
}
-void ms_time_get(char *a)
+void ms_time_get(MS_TM *tm)
{
- MS_TM *tm=(MS_TM *)a;
#ifdef OPENSSL_SYS_WIN32
FILETIME tmpa,tmpb,tmpc;
#endif
#endif
}
-double ms_time_diff(char *ap, char *bp)
+double ms_time_diff(MS_TM *a, MS_TM *b)
{
- MS_TM *a=(MS_TM *)ap;
- MS_TM *b=(MS_TM *)bp;
double ret;
#ifdef TIMES
- ret=(b->ms_tms.tms_utime-a->ms_tms.tms_utime)/HZ;
+ ret = HZ;
+ ret = (b->ms_tms.tms_utime-a->ms_tms.tms_utime) / ret;
#else
# ifdef OPENSSL_SYS_WIN32
{
return((ret < 0.0000001)?0.0000001:ret);
}
-int ms_time_cmp(char *ap, char *bp)
+int ms_time_cmp(const MS_TM *a, const MS_TM *b)
{
- MS_TM *a=(MS_TM *)ap,*b=(MS_TM *)bp;
double d;
int ret;
#ifdef TIMES
- d=(b->ms_tms.tms_utime-a->ms_tms.tms_utime)/HZ;
+ d = HZ;
+ d = (b->ms_tms.tms_utime-a->ms_tms.tms_utime) / d;
#else
# ifdef OPENSSL_SYS_WIN32
d =(b->ms_win32.dwHighDateTime&0x000fffff)*10+b->ms_win32.dwLowDateTime/1e7;
/* Header for dynamic hash table routines
* Author - Eric Young
*/
+/* ... erm yeah, "dynamic hash tables" you say?
+ *
+ * And what would dynamic hash tables have to do with any of this code *now*?
+ * AFAICS, this code is only referenced by crypto/bn/exp.c which is an unused
+ * file that I doubt compiles any more. speed.c is the only thing that could
+ * use this (and it has nothing to do with hash tables), yet it instead has its
+ * own duplication of all this stuff and looks, if anything, more complete. See
+ * the corresponding note in apps/speed.c.
+ * The Bemused - Geoff
+ */
#ifndef HEADER_TMDIFF_H
#define HEADER_TMDIFF_H
extern "C" {
#endif
-char *ms_time_new(void );
-void ms_time_free(char *a);
-void ms_time_get(char *a);
-double ms_time_diff(char *start,char *end);
-int ms_time_cmp(char *ap,char *bp);
+typedef struct ms_tm MS_TM;
+
+MS_TM *ms_time_new(void );
+void ms_time_free(MS_TM *a);
+void ms_time_get(MS_TM *a);
+double ms_time_diff(MS_TM *start, MS_TM *end);
+int ms_time_cmp(const MS_TM *ap, const MS_TM *bp);
#ifdef __cplusplus
}