Overview
Comment: | Expose random buffer generation mechanism to the script level |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
40140fc849f544c6e2c0fa88b54cff2b |
User & Date: | rkeene on 2018-08-17 13:49:39 |
Other Links: | manifest | tags |
Context
2018-08-17
| ||
16:21 | Added script which can be used to generate blocks for a stress test check-in: 94a2cee313 user: rkeene tags: trunk | |
13:49 | Expose random buffer generation mechanism to the script level check-in: 40140fc849 user: rkeene tags: trunk | |
13:48 | Use a newer version of mandoc for creating the wiki-fied man page check-in: 53ee952ef1 user: rkeene tags: trunk | |
Changes
Modified nano.c from [5ea860caff] to [ac5d19ee67].
︙ | |||
524 525 526 527 528 529 530 531 532 533 534 535 536 537 | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(work, sizeof(work))); return(TCL_OK); /* NOTREACH */ clientData = clientData; } static int nano_tcl_random_bytes(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { unsigned char *buffer; int number_of_bytes; int tgifo_ret; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "numberOfBytes"); return(TCL_ERROR); } tgifo_ret = Tcl_GetIntFromObj(interp, objv[1], &number_of_bytes); if (tgifo_ret != TCL_OK) { return(tgifo_ret); } if (number_of_bytes > 128) { Tcl_SetResult(interp, "May only request 128 bytes of random data at once", NULL); return(TCL_ERROR); } buffer = TclNano_AttemptAlloc(number_of_bytes); if (!buffer) { Tcl_SetResult(interp, "memory allocation failure", NULL); return(TCL_ERROR); } randombytes(buffer, number_of_bytes); Tcl_SetObjResult(interp, Tcl_NewByteArrayObj(buffer, number_of_bytes)); TclNano_Free(buffer); return(TCL_OK); /* NOTREACH */ clientData = clientData; } static int nano_tcl_self_test(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { if (objc != 1) { Tcl_WrongNumArgs(interp, 1, objv, ""); return(TCL_ERROR); } |
︙ | |||
581 582 583 584 585 586 587 588 589 590 591 592 593 594 | 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | + | TclNano_CreateObjCommand(interp, "::nano::internal::generateSeed", nano_tcl_generate_seed); TclNano_CreateObjCommand(interp, "::nano::internal::publicKey", nano_tcl_secret_key_to_public_key); TclNano_CreateObjCommand(interp, "::nano::internal::signDetached", nano_tcl_sign_detached); TclNano_CreateObjCommand(interp, "::nano::internal::verifyDetached", nano_tcl_verify_detached); TclNano_CreateObjCommand(interp, "::nano::internal::hashData", nano_tcl_hash_data); TclNano_CreateObjCommand(interp, "::nano::internal::validateWork", nano_tcl_validate_work); TclNano_CreateObjCommand(interp, "::nano::internal::generateWork", nano_tcl_generate_work); TclNano_CreateObjCommand(interp, "::nano::internal::randomBytes", nano_tcl_random_bytes); TclNano_Eval(interp, nanoInitScript); TclNano_PkgProvide(interp, "nano", PACKAGE_VERSION); return(TCL_OK); } |