TclPKCS11

Check-in [87f454af73]
Login

Check-in [87f454af73]

Overview
Comment:Improved Tcl 8.6 module loading support
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 87f454af73fb1879dd033cdf32e0d2679f294e8c27f4c641c6b9ef5c61c65f4e
User & Date: rkeene on 2010-10-10 05:33:34
Other Links: manifest | tags
Context
2010-10-10
05:36
Updated test driver to not give false errors if a non-PIN related decryption error occurs check-in: be76ba4355 user: rkeene tags: trunk
05:33
Improved Tcl 8.6 module loading support check-in: 87f454af73 user: rkeene tags: trunk
05:25
Updated to support Tcl 8.6 file loading (untested) check-in: 295f01867c user: rkeene tags: trunk
Changes

Modified tclpkcs11.c from [0e48a30252] to [05f498a3e1].

386
387
388
389
390
391
392


393
394
395
396
397
398
399
400
401
402
403
404
405




406


407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
 * Platform Specific Functions 
 */
static void *tclpkcs11_int_load_module(const char *pathname) {
#ifdef TCL_INCLUDES_LOADFILE
	int tcl_rv;
	Tcl_LoadHandle *new_handle;



	tcl_rv = Tcl_LoadFile(NULL, pathname, NULL, 0, NULL, &new_handle);
	if (tcl_rv != TCL_OK) {
		return(NULL);
	}

	return(new_handle);
#else
	/* XXX: TODO: Replace this with Tcl_Load() in 8.6 or otherwise a system-specific loading mechanism */
	return(dlopen(pathname, RTLD_LAZY | RTLD_LOCAL));
#endif
}
static void tclpkcs11_int_unload_module(void *handle) {
#ifdef TCL_INCLUDES_LOADFILE




	Tcl_FSUnloadFile(NULL, handle);


#else
	/* XXX: TODO: Replace this with Tcl_Unload() in 8.6 or otherwise a system-specific unloading mechanism */
	dlclose(handle);
#endif
	return;
}
static void *tclpkcs11_int_lookup_sym(void *handle, const char *sym) {
#ifdef TCL_INCLUDES_LOADFILE
	Tcl_LoadHandle *tcl_handle;
	void *retval;

	tcl_handle = handle;

	retval = Tcl_FindSymbol(NULL, *tcl_handle, sym);o

	return(retval);
#else
	/* XXX: TODO: Replace this with ... ? in 8.6 or otherwise a system-specific symbol lookup mechanism */
	return(dlsym(handle, sym));
#endif
}







>
>
|












>
>
>
>
|
>
>













|







386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
 * Platform Specific Functions 
 */
static void *tclpkcs11_int_load_module(const char *pathname) {
#ifdef TCL_INCLUDES_LOADFILE
	int tcl_rv;
	Tcl_LoadHandle *new_handle;

	new_handle = (Tcl_LoadHandle *) ckalloc(sizeof(*new_handle));

	tcl_rv = Tcl_LoadFile(NULL, Tcl_NewStringObj(pathname, -1), NULL, 0, NULL, new_handle);
	if (tcl_rv != TCL_OK) {
		return(NULL);
	}

	return(new_handle);
#else
	/* XXX: TODO: Replace this with Tcl_Load() in 8.6 or otherwise a system-specific loading mechanism */
	return(dlopen(pathname, RTLD_LAZY | RTLD_LOCAL));
#endif
}
static void tclpkcs11_int_unload_module(void *handle) {
#ifdef TCL_INCLUDES_LOADFILE
	Tcl_LoadHandle *tcl_handle;

	tcl_handle = handle;

	Tcl_FSUnloadFile(NULL, *tcl_handle);

	ckfree(handle);
#else
	/* XXX: TODO: Replace this with Tcl_Unload() in 8.6 or otherwise a system-specific unloading mechanism */
	dlclose(handle);
#endif
	return;
}
static void *tclpkcs11_int_lookup_sym(void *handle, const char *sym) {
#ifdef TCL_INCLUDES_LOADFILE
	Tcl_LoadHandle *tcl_handle;
	void *retval;

	tcl_handle = handle;

	retval = Tcl_FindSymbol(NULL, *tcl_handle, sym);

	return(retval);
#else
	/* XXX: TODO: Replace this with ... ? in 8.6 or otherwise a system-specific symbol lookup mechanism */
	return(dlsym(handle, sym));
#endif
}