diff options
| author | 2003-05-12 02:18:34 +0000 | |
|---|---|---|
| committer | 2003-05-12 02:18:34 +0000 | |
| commit | 767fe2ff93c41790f9195ca310f4dfd4596a3448 (patch) | |
| tree | 1a41fed2bee42d987049c11dfe3193ec916bd858 /lib/libssl/src/ssl/ssl_cert.c | |
| parent | Adaptive timeout value scaling. Allows to reduce timeout values as the (diff) | |
| download | wireguard-openbsd-767fe2ff93c41790f9195ca310f4dfd4596a3448.tar.xz wireguard-openbsd-767fe2ff93c41790f9195ca310f4dfd4596a3448.zip | |
merge 0.9.7b with local changes; crank majors for libssl/libcrypto
Diffstat (limited to 'lib/libssl/src/ssl/ssl_cert.c')
| -rw-r--r-- | lib/libssl/src/ssl/ssl_cert.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/libssl/src/ssl/ssl_cert.c b/lib/libssl/src/ssl/ssl_cert.c index 3d31bbf05f0..da90078a378 100644 --- a/lib/libssl/src/ssl/ssl_cert.c +++ b/lib/libssl/src/ssl/ssl_cert.c @@ -781,7 +781,7 @@ err: #endif #endif -#else +#else /* OPENSSL_SYS_WIN32 */ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) @@ -789,10 +789,30 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 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) { @@ -807,7 +827,11 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 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; @@ -825,6 +849,10 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, err: FindClose(hFind); err_noclose: +#ifdef OPENSSL_SYS_WINCE + if (wdir != NULL) + free(wdir); +#endif CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); return ret; } |
