1
2
3
4
5
6
7
8
9
10
11
12
|
#include <tcl.h>
#include <stdint.h>
#include <limits.h>
#include <string.h>
#include "tweetnacl.h"
#if 0
#include <sys/random.h>
void randombytes(uint8_t *buffer, uint64_t length) {
ssize_t gr_ret;
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#include <tcl.h>
#include <stdint.h>
#include <limits.h>
#include <string.h>
#include "tweetnacl.h"
#include "blake2-supercop.h"
#if 0
#include <sys/random.h>
void randombytes(uint8_t *buffer, uint64_t length) {
ssize_t gr_ret;
|
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
|
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
return(TCL_OK);
/* NOTREACH */
clientData = clientData;
}
int Nano_Init(Tcl_Interp *interp) {
#ifdef USE_TCL_STUBS
const char *tclInitStubs_ret;
/* Initialize Stubs */
tclInitStubs_ret = Tcl_InitStubs(interp, TCL_PATCH_LEVEL, 0);
if (!tclInitStubs_ret) {
return(TCL_ERROR);
}
#endif
Tcl_CreateObjCommand(interp, "::nano::internal::signDetached", nano_tcl_sign_detached, NULL, NULL);
Tcl_CreateObjCommand(interp, "::nano::internal::publicKey", nano_tcl_secret_key_to_public_key, NULL, NULL);
Tcl_CreateObjCommand(interp, "::nano::internal::verifyDetached", nano_tcl_verify_detached, NULL, NULL);
return(TCL_OK);
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
Tcl_SetObjResult(interp, Tcl_NewBooleanObj(result));
return(TCL_OK);
/* NOTREACH */
clientData = clientData;
}
static int nano_tcl_hash_data(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
unsigned char *data, result[crypto_sign_BYTES];
int data_length, result_length;
if (objc != 2) {
Tcl_WrongNumArgs(interp, 1, objv, "data");
return(TCL_ERROR);
}
data = Tcl_GetByteArrayFromObj(objv[1], &data_length);
crypto_hash(result, data, data_length);
result_length = sizeof(result);
Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(result, result_length));
return(TCL_OK);
/* NOTREACH */
clientData = clientData;
}
int Nano_Init(Tcl_Interp *interp) {
#ifdef USE_TCL_STUBS
const char *tclInitStubs_ret;
/* Initialize Stubs */
tclInitStubs_ret = Tcl_InitStubs(interp, TCL_PATCH_LEVEL, 0);
if (!tclInitStubs_ret) {
return(TCL_ERROR);
}
#endif
Tcl_CreateObjCommand(interp, "::nano::internal::signDetached", nano_tcl_sign_detached, NULL, NULL);
Tcl_CreateObjCommand(interp, "::nano::internal::publicKey", nano_tcl_secret_key_to_public_key, NULL, NULL);
Tcl_CreateObjCommand(interp, "::nano::internal::verifyDetached", nano_tcl_verify_detached, NULL, NULL);
Tcl_CreateObjCommand(interp, "::nano::internal::hashData", nano_tcl_hash_data, NULL, NULL);
return(TCL_OK);
}
|