mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-05 22:03:50 +03:00
commit
0ee959b9e7
@ -1,3 +1,4 @@
|
|||||||
|
dist: xenial
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- 4
|
- 4
|
||||||
@ -32,6 +33,8 @@ addons:
|
|||||||
packages:
|
packages:
|
||||||
- python3
|
- python3
|
||||||
- python3-pip
|
- python3-pip
|
||||||
|
- python3-setuptools
|
||||||
|
- python3-wheel
|
||||||
- libgmp3-dev
|
- libgmp3-dev
|
||||||
- libsigsegv-dev
|
- libsigsegv-dev
|
||||||
- openssl
|
- openssl
|
||||||
|
@ -55,6 +55,11 @@
|
|||||||
int
|
int
|
||||||
c3_cooked();
|
c3_cooked();
|
||||||
|
|
||||||
|
/* Fill 16 words (64 bytes) with high-quality entropy.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
c3_rand(c3_w* rad_w);
|
||||||
|
|
||||||
/* Short integers.
|
/* Short integers.
|
||||||
*/
|
*/
|
||||||
# define c3_s1(a) ( (a) )
|
# define c3_s1(a) ( (a) )
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
**
|
**
|
||||||
** This file is in the public domain.
|
** This file is in the public domain.
|
||||||
*/
|
*/
|
||||||
/** Must be compiled on gcc with C99 support.
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@ -33,6 +31,7 @@
|
|||||||
# include <setjmp.h>
|
# include <setjmp.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <signal.h>
|
# include <signal.h>
|
||||||
|
# include <sys/syscall.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
@ -50,6 +49,7 @@
|
|||||||
# include <machine/endian.h>
|
# include <machine/endian.h>
|
||||||
# include <machine/byte_order.h>
|
# include <machine/byte_order.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
# include <sys/random.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <sys/resource.h>
|
# include <sys/resource.h>
|
||||||
# include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
@ -140,7 +140,6 @@
|
|||||||
# define c3_bswap_16(x) bswap_16(x)
|
# define c3_bswap_16(x) bswap_16(x)
|
||||||
# define c3_bswap_32(x) bswap_32(x)
|
# define c3_bswap_32(x) bswap_32(x)
|
||||||
# define c3_bswap_64(x) bswap_64(x)
|
# define c3_bswap_64(x) bswap_64(x)
|
||||||
|
|
||||||
# elif defined(U3_OS_osx)
|
# elif defined(U3_OS_osx)
|
||||||
# define c3_bswap_16(x) NXSwapShort(x)
|
# define c3_bswap_16(x) NXSwapShort(x)
|
||||||
# define c3_bswap_32(x) NXSwapInt(x)
|
# define c3_bswap_32(x) NXSwapInt(x)
|
||||||
@ -149,7 +148,7 @@
|
|||||||
# error "port: byte swap"
|
# error "port: byte swap"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Sync
|
/* Sync.
|
||||||
*/
|
*/
|
||||||
# if defined(U3_OS_linux)
|
# if defined(U3_OS_linux)
|
||||||
# define c3_sync(fd) (fdatasync(fd))
|
# define c3_sync(fd) (fdatasync(fd))
|
||||||
@ -161,7 +160,7 @@
|
|||||||
# error "port: sync"
|
# error "port: sync"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Purge
|
/* Purge.
|
||||||
*/
|
*/
|
||||||
# if defined(U3_OS_linux)
|
# if defined(U3_OS_linux)
|
||||||
# include <stdio_ext.h>
|
# include <stdio_ext.h>
|
||||||
@ -172,7 +171,7 @@
|
|||||||
# error "port: fpurge"
|
# error "port: fpurge"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Stat struct
|
/* Stat.
|
||||||
*/
|
*/
|
||||||
# if defined(U3_OS_linux)
|
# if defined(U3_OS_linux)
|
||||||
# define c3_stat_mtime(dp) (u3_time_t_in_ts((dp)->st_mtime))
|
# define c3_stat_mtime(dp) (u3_time_t_in_ts((dp)->st_mtime))
|
||||||
@ -186,13 +185,20 @@
|
|||||||
# error "port: timeconvert"
|
# error "port: timeconvert"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* Entropy
|
/* Entropy.
|
||||||
*/
|
*/
|
||||||
#define c3_rand u3_sist_rand
|
# if defined(U3_OS_linux)
|
||||||
|
# define c3_getentropy(B, L) \
|
||||||
|
((L) == syscall(SYS_getrandom, B, L, 0) ? 0 : -1)
|
||||||
|
# elif defined(U3_OS_bsd) || defined(U3_OS_osx)
|
||||||
|
# define c3_getentropy getentropy
|
||||||
|
# else
|
||||||
|
# error "port: getentropy"
|
||||||
|
# endif
|
||||||
|
|
||||||
/* Static assertion
|
/* Static assertion.
|
||||||
*/
|
*/
|
||||||
#define ASSERT_CONCAT_(a, b) a##b
|
# define ASSERT_CONCAT_(a, b) a##b
|
||||||
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
|
# define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
|
||||||
#define STATIC_ASSERT(e,m) \
|
# define STATIC_ASSERT(e,m) \
|
||||||
;enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) }
|
;enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1/(int)(!!(e)) }
|
||||||
|
@ -1182,11 +1182,6 @@
|
|||||||
void
|
void
|
||||||
u3_sist_get(const c3_c* key_c, c3_y* val_y);
|
u3_sist_get(const c3_c* key_c, c3_y* val_y);
|
||||||
|
|
||||||
/* u3_sist_rand(): fill 8 words (32 bytes) with high-quality entropy.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
u3_sist_rand(c3_w* rad_w);
|
|
||||||
|
|
||||||
/** HTTP client.
|
/** HTTP client.
|
||||||
**/
|
**/
|
||||||
/* u3_cttp_ef_thus(): send %thus effect to cttp.
|
/* u3_cttp_ef_thus(): send %thus effect to cttp.
|
||||||
|
24
vere/sist.c
24
vere/sist.c
@ -12,12 +12,6 @@
|
|||||||
#include "all.h"
|
#include "all.h"
|
||||||
#include "vere/vere.h"
|
#include "vere/vere.h"
|
||||||
|
|
||||||
#if defined(U3_OS_linux)
|
|
||||||
#define DEVRANDOM "/dev/urandom"
|
|
||||||
#else
|
|
||||||
#define DEVRANDOM "/dev/random"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* u3_sist_pack(): write a blob to disk, transferring.
|
/* u3_sist_pack(): write a blob to disk, transferring.
|
||||||
*/
|
*/
|
||||||
c3_d
|
c3_d
|
||||||
@ -411,23 +405,15 @@ _sist_bask(c3_c* pop_c, u3_noun may)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* u3_sist_rand(): fill a 512-bit (16-word) buffer.
|
/* c3_rand(): fill a 512-bit (16-word) buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
u3_sist_rand(c3_w* rad_w)
|
c3_rand(c3_w* rad_w)
|
||||||
{
|
{
|
||||||
#if defined(U3_OS_bsd) && defined(__OpenBSD__)
|
if ( 0 != c3_getentropy(rad_w, 64) ) {
|
||||||
if (-1 == getentropy(rad_w, 64)) {
|
uL(fprintf(uH, "c3_rand getentropy: %s\n", strerror(errno)));
|
||||||
c3_assert(!"lo_rand");
|
u3_lo_bail();
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
c3_i fid_i = open(DEVRANDOM, O_RDONLY);
|
|
||||||
|
|
||||||
if ( 64 != read(fid_i, (c3_y*) rad_w, 64) ) {
|
|
||||||
c3_assert(!"lo_rand");
|
|
||||||
}
|
|
||||||
close(fid_i);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _sist_fast(): offer to save passcode by mug in home directory.
|
/* _sist_fast(): offer to save passcode by mug in home directory.
|
||||||
|
Loading…
Reference in New Issue
Block a user