* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*/
+/* ====================================================================
+ * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
+ * ECC cipher suite support in OpenSSL originally developed by
+ * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
+ */
#include <stdio.h>
ret->dh_tmp_cb = cert->dh_tmp_cb;
#endif
+#ifndef OPENSSL_NO_ECDH
+ if (cert->ecdh_tmp)
+ {
+ EC_KEY_up_ref(cert->ecdh_tmp);
+ ret->ecdh_tmp = cert->ecdh_tmp;
+ }
+ ret->ecdh_tmp_cb = cert->ecdh_tmp_cb;
+#endif
+
for (i = 0; i < SSL_PKEY_NUM; i++)
{
if (cert->pkeys[i].x509 != NULL)
case SSL_PKEY_DH_DSA:
/* We have a DH key. */
break;
-
+
+ case SSL_PKEY_ECC:
+ /* We have an ECC key */
+ break;
+
default:
/* Can't happen. */
SSLerr(SSL_F_SSL_CERT_DUP, SSL_R_LIBRARY_BUG);
if (ret->dh_tmp != NULL)
DH_free(ret->dh_tmp);
#endif
+#ifndef OPENSSL_NO_ECDH
+ if (ret->ecdh_tmp != NULL)
+ EC_KEY_free(ret->ecdh_tmp);
+#endif
for (i = 0; i < SSL_PKEY_NUM; i++)
{
#ifndef OPENSSL_NO_DH
if (c->dh_tmp) DH_free(c->dh_tmp);
#endif
+#ifndef OPENSSL_NO_ECDH
+ if (c->ecdh_tmp) EC_KEY_free(c->ecdh_tmp);
+#endif
for (i=0; i<SSL_PKEY_NUM; i++)
{
if (sc->peer_dh_tmp != NULL)
DH_free(sc->peer_dh_tmp);
#endif
+#ifndef OPENSSL_NO_ECDH
+ if (sc->peer_ecdh_tmp != NULL)
+ EC_KEY_free(sc->peer_ecdh_tmp);
+#endif
OPENSSL_free(sc);
}
X509_STORE_CTX_set_verify_cb(&ctx, s->verify_callback);
if (s->ctx->app_verify_callback != NULL)
+#if 1 /* new with OpenSSL 0.9.7 */
+ i=s->ctx->app_verify_callback(&ctx, s->ctx->app_verify_arg);
+#else
i=s->ctx->app_verify_callback(&ctx); /* should pass app_verify_arg */
+#endif
else
{
#ifndef OPENSSL_NO_X509_VERIFY
ret = 1;
err:
+ if (d) closedir(d);
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret;
}
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
int ret = 0;
+#ifdef OPENSSL_SYS_WINCE
+ WCHAR* wdir = NULL;
+#endif
CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
+#ifdef OPENSSL_SYS_WINCE
+ /* convert strings to UNICODE */
+ {
+ BOOL result = FALSE;
+ int i;
+ wdir = malloc((strlen(dir)+1)*2);
+ if (wdir == NULL)
+ goto err_noclose;
+ for (i=0; i<(int)strlen(dir)+1; i++)
+ wdir[i] = (short)dir[i];
+ }
+#endif
+
+#ifdef OPENSSL_SYS_WINCE
+ hFind = FindFirstFile(wdir, &FindFileData);
+#else
hFind = FindFirstFile(dir, &FindFileData);
+#endif
/* Note that a side effect is that the CAs will be sorted by name */
if(hFind == INVALID_HANDLE_VALUE)
{
SYSerr(SYS_F_OPENDIR, get_last_sys_error());
ERR_add_error_data(3, "opendir('", dir, "')");
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
- goto err;
+ goto err_noclose;
}
do
char buf[1024];
int r;
+#ifdef OPENSSL_SYS_WINCE
+ if(strlen(dir)+_tcslen(FindFileData.cFileName)+2 > sizeof buf)
+#else
if(strlen(dir)+strlen(FindFileData.cFileName)+2 > sizeof buf)
+#endif
{
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
goto err;
goto err;
}
while (FindNextFile(hFind, &FindFileData) != FALSE);
- FindClose(hFind);
ret = 1;
-err:
+err:
+ FindClose(hFind);
+err_noclose:
+#ifdef OPENSSL_SYS_WINCE
+ if (wdir != NULL)
+ free(wdir);
+#endif
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret;
}