1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <stdint.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <tcl.h>
#include "tweetnacl.h"
#include "blake2-supercop.h"
#define NANO_SECRET_KEY_LENGTH (crypto_sign_SECRETKEYBYTES - crypto_sign_PUBLICKEYBYTES)
#define NANO_PUBLIC_KEY_LENGTH (crypto_sign_PUBLICKEYBYTES)
#define TclNano_AttemptAlloc(x) ((void *) Tcl_Alloc(x))
#define TclNano_Free(x) Tcl_Free((char *) x)
#if defined(HAVE_GETRANDOM)
# ifdef HAVE_SYS_RANDOM_H
# include <sys/random.h>
# endif
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <stdint.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <tcl.h>
#include "tweetnacl.h"
#include "blake2-supercop.h"
#define NANO_SECRET_KEY_LENGTH (crypto_sign_SECRETKEYBYTES - crypto_sign_PUBLICKEYBYTES)
#define NANO_PUBLIC_KEY_LENGTH (crypto_sign_PUBLICKEYBYTES)
#define TclNano_AttemptAlloc(x) ((void *) Tcl_AttemptAlloc(x))
#define TclNano_Free(x) Tcl_Free((char *) x)
#if defined(HAVE_GETRANDOM)
# ifdef HAVE_SYS_RANDOM_H
# include <sys/random.h>
# endif
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
Tcl_SetResult(interp, "Internal error", NULL);
return(TCL_ERROR);
}
verify_data_length_nacl = verify_data_length;
printf("cso sdl = %i, dl=%i, sl=%i\n", signed_data_length, data_length, signature_length);
cso_ret = crypto_sign_open(verify_data, &verify_data_length_nacl, signed_data, signed_data_length, public_key);
result = 0;
if (cso_ret == 0) {
result = 1;
}
TclNano_Free(signed_data);
|
<
|
279
280
281
282
283
284
285
286
287
288
289
290
291
292
|
Tcl_SetResult(interp, "Internal error", NULL);
return(TCL_ERROR);
}
verify_data_length_nacl = verify_data_length;
cso_ret = crypto_sign_open(verify_data, &verify_data_length_nacl, signed_data, signed_data_length, public_key);
result = 0;
if (cso_ret == 0) {
result = 1;
}
TclNano_Free(signed_data);
|