TclPKCS11

Check-in [774b9d1bc0]
Login

Check-in [774b9d1bc0]

Overview
Comment:Updated to not call Tcl_ObjPrintf() since this is not in Tcl 8.4
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 774b9d1bc0f3a320f3404c4cfd73f2a890b31444fb89dcd4cfb499cc28ca57ee
User & Date: rkeene on 2010-10-10 17:56:44
Other Links: manifest | tags
Context
2010-10-10
17:59
Fixed issue with bytearray conversion check-in: 35de72dc72 user: rkeene tags: trunk
17:56
Updated to not call Tcl_ObjPrintf() since this is not in Tcl 8.4 check-in: 774b9d1bc0 user: rkeene tags: trunk
17:38
Fixed issue with defining stubs mechanism incorrectly Updated to find shared object build flags Updated ignores Updated to cleanup after Win32 builds correctly check-in: 515139af76 user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [de19415564] to [20b4ecb072].

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16



Makefile
Makefile/*
aclocal.m4
aclocal.m4/*
autom4te.cache
autom4te.cache/*
config.log
config.log/*
config.status
config.status/*
configure
configure/*

tclpkcs11.dll.a
tclpkcs11.dll.a/*
tclpkcs11.dll.def
tclpkcs11.dll.def/*















>




>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Makefile
Makefile/*
aclocal.m4
aclocal.m4/*
autom4te.cache
autom4te.cache/*
config.log
config.log/*
config.status
config.status/*
configure
configure/*
tclpkcs11.dll
tclpkcs11.dll.a
tclpkcs11.dll.a/*
tclpkcs11.dll.def
tclpkcs11.dll.def/*
tclpkcs11.dll/*
tclpkcs11.so
tclpkcs11.so/*

Modified tclpkcs11.c from [621c9705a3] to [adf04fca8e].

236
237
238
239
240
241
242

243
244
245
246
247
248
249
250
251
252

253
254


255
256
257
258
259
260
261
			return(Tcl_NewStringObj("PKCS11_ERROR VENDOR_DEFINED", -1));
	}

	return(Tcl_NewStringObj("PKCS11_ERROR UNKNOWN", -1));
}

MODULE_SCOPE Tcl_Obj *tclpkcs11_bytearray_to_string(const unsigned char *data, unsigned long datalen) {

	unsigned long idx;
	Tcl_Obj *retval;

	retval = Tcl_NewObj();

	if (data == NULL) {
		return(retval);
	}

	for (idx = 0; idx < datalen; idx++) {

		Tcl_AppendObjToObj(retval, Tcl_ObjPrintf("%02x", data[idx]));
	}



	return(retval);
}

MODULE_SCOPE unsigned long tclpkcs11_string_to_bytearray(Tcl_Obj *data, unsigned char *outbuf, unsigned long outbuflen) {
	unsigned long outbufidx = 0;
	char tmpbuf[5];







>
|

|
<





|
>
|

>
>







236
237
238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
			return(Tcl_NewStringObj("PKCS11_ERROR VENDOR_DEFINED", -1));
	}

	return(Tcl_NewStringObj("PKCS11_ERROR UNKNOWN", -1));
}

MODULE_SCOPE Tcl_Obj *tclpkcs11_bytearray_to_string(const unsigned char *data, unsigned long datalen) {
	static char alphabet[] = "0123456789abcdef";
	unsigned long idx, bufidx;
	Tcl_Obj *retval;
	char buf[1024];


	if (data == NULL) {
		return(retval);
	}

	for (bufidx = idx = 0; (idx < datalen) && (bufidx < sizeof(buf)); idx++) {
		buf[bufidx++] = (data[idx] >> 4) & 0xf;
		buf[bufidx++] = data[idx] & 0xf;
	}

	retval = Tcl_NewByteArrayObj(buf, bufidx);

	return(retval);
}

MODULE_SCOPE unsigned long tclpkcs11_string_to_bytearray(Tcl_Obj *data, unsigned char *outbuf, unsigned long outbuflen) {
	unsigned long outbufidx = 0;
	char tmpbuf[5];
552
553
554
555
556
557
558

559
560
561
562
563
564
565
566
		Tcl_SetObjResult(interp, tclpkcs11_pkcs11_error(chk_rv));

		return(TCL_ERROR);
	}

	interpdata = (struct tclpkcs11_interpdata *) cd;


	tcl_handle = Tcl_ObjPrintf("pkcsmod%lu", interpdata->handles_idx);
	(interpdata->handles_idx)++;

	tcl_handle_entry = Tcl_CreateHashEntry(&interpdata->handles, (const char *) tcl_handle, &is_new_entry);
	if (!tcl_handle_entry) {
		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create new hash entry", -1));

		return(TCL_ERROR);







>
|







555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
		Tcl_SetObjResult(interp, tclpkcs11_pkcs11_error(chk_rv));

		return(TCL_ERROR);
	}

	interpdata = (struct tclpkcs11_interpdata *) cd;

	tcl_handle = Tcl_NewStringObj("pkcsmod", -1);
	Tcl_AppendObjToObj(tcl_handle, Tcl_NewLongObj(interpdata->handles_idx));
	(interpdata->handles_idx)++;

	tcl_handle_entry = Tcl_CreateHashEntry(&interpdata->handles, (const char *) tcl_handle, &is_new_entry);
	if (!tcl_handle_entry) {
		Tcl_SetObjResult(interp, Tcl_NewStringObj("unable to create new hash entry", -1));

		return(TCL_ERROR);