--- /dev/null
+typedef unsigned char __u_char;
+typedef unsigned short int __u_short;
+typedef unsigned int __u_int;
+typedef unsigned long int __u_long;
+typedef signed char __int8_t;
+typedef unsigned char __uint8_t;
+typedef signed short int __int16_t;
+typedef unsigned short int __uint16_t;
+typedef signed int __int32_t;
+typedef unsigned int __uint32_t;
+__extension__ typedef signed long long int __int64_t;
+__extension__ typedef unsigned long long int __uint64_t;
+__extension__ typedef long long int __quad_t;
+__extension__ typedef unsigned long long int __u_quad_t;
+__extension__ typedef __u_quad_t __dev_t;
+__extension__ typedef unsigned int __uid_t;
+__extension__ typedef unsigned int __gid_t;
+__extension__ typedef unsigned long int __ino_t;
+__extension__ typedef __u_quad_t __ino64_t;
+__extension__ typedef unsigned int __mode_t;
+__extension__ typedef unsigned int __nlink_t;
+__extension__ typedef long int __off_t;
+__extension__ typedef __quad_t __off64_t;
+__extension__ typedef int __pid_t;
+__extension__ typedef struct { int __val[2]; } __fsid_t;
+__extension__ typedef long int __clock_t;
+__extension__ typedef unsigned long int __rlim_t;
+__extension__ typedef __u_quad_t __rlim64_t;
+__extension__ typedef unsigned int __id_t;
+__extension__ typedef long int __time_t;
+__extension__ typedef unsigned int __useconds_t;
+__extension__ typedef long int __suseconds_t;
+__extension__ typedef int __daddr_t;
+__extension__ typedef int __key_t;
+__extension__ typedef int __clockid_t;
+__extension__ typedef void * __timer_t;
+__extension__ typedef long int __blksize_t;
+__extension__ typedef long int __blkcnt_t;
+__extension__ typedef __quad_t __blkcnt64_t;
+__extension__ typedef unsigned long int __fsblkcnt_t;
+__extension__ typedef __u_quad_t __fsblkcnt64_t;
+__extension__ typedef unsigned long int __fsfilcnt_t;
+__extension__ typedef __u_quad_t __fsfilcnt64_t;
+__extension__ typedef int __fsword_t;
+__extension__ typedef int __ssize_t;
+__extension__ typedef long int __syscall_slong_t;
+__extension__ typedef unsigned long int __syscall_ulong_t;
+typedef __off64_t __loff_t;
+typedef __quad_t *__qaddr_t;
+typedef char *__caddr_t;
+__extension__ typedef int __intptr_t;
+__extension__ typedef unsigned int __socklen_t;
+typedef __u_char u_char;
+typedef __u_short u_short;
+typedef __u_int u_int;
+typedef __u_long u_long;
+typedef __quad_t quad_t;
+typedef __u_quad_t u_quad_t;
+typedef __fsid_t fsid_t;
+typedef __loff_t loff_t;
+typedef __ino64_t ino_t;
+typedef __ino64_t ino64_t;
+typedef __dev_t dev_t;
+typedef __gid_t gid_t;
+typedef __mode_t mode_t;
+typedef __nlink_t nlink_t;
+typedef __uid_t uid_t;
+typedef __off64_t off_t;
+typedef __off64_t off64_t;
+typedef __pid_t pid_t;
+typedef __id_t id_t;
+typedef __ssize_t ssize_t;
+typedef __daddr_t daddr_t;
+typedef __caddr_t caddr_t;
+typedef __key_t key_t;
+typedef __clock_t clock_t;
+typedef __time_t time_t;
+typedef __clockid_t clockid_t;
+typedef __timer_t timer_t;
+typedef __useconds_t useconds_t;
+typedef __suseconds_t suseconds_t;
+typedef unsigned int size_t;
+typedef unsigned long int ulong;
+typedef unsigned short int ushort;
+typedef unsigned int uint;
+typedef int int8_t __attribute__ ((__mode__ (__QI__)));
+typedef int int16_t __attribute__ ((__mode__ (__HI__)));
+typedef int int32_t __attribute__ ((__mode__ (__SI__)));
+typedef int int64_t __attribute__ ((__mode__ (__DI__)));
+typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
+typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
+typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));
+typedef int register_t __attribute__ ((__mode__ (__word__)));
+static __inline unsigned int
+__bswap_32 (unsigned int __bsx)
+{
+ return __builtin_bswap32 (__bsx);
+}
+static __inline __uint64_t
+__bswap_64 (__uint64_t __bsx)
+{
+ return __builtin_bswap64 (__bsx);
+}
+typedef int __sig_atomic_t;
+typedef struct
+ {
+ unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
+ } __sigset_t;
+typedef __sigset_t sigset_t;
+struct timespec
+ {
+ __time_t tv_sec;
+ __syscall_slong_t tv_nsec;
+ };
+struct timeval
+ {
+ __time_t tv_sec;
+ __suseconds_t tv_usec;
+ };
+typedef long int __fd_mask;
+typedef struct
+ {
+ __fd_mask fds_bits[1024 / (8 * (int) sizeof (__fd_mask))];
+ } fd_set;
+typedef __fd_mask fd_mask;
+extern int select (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ struct timeval *__restrict __timeout);
+extern int pselect (int __nfds, fd_set *__restrict __readfds,
+ fd_set *__restrict __writefds,
+ fd_set *__restrict __exceptfds,
+ const struct timespec *__restrict __timeout,
+ const __sigset_t *__restrict __sigmask);
+extern long int __fdelt_chk (long int __d);
+extern long int __fdelt_warn (long int __d)
+ __attribute__((__warning__ ("bit outside of fd_set selected")));
+__extension__
+extern unsigned int gnu_dev_major (unsigned long long int __dev)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+__extension__
+extern unsigned int gnu_dev_minor (unsigned long long int __dev)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+__extension__
+extern unsigned long long int gnu_dev_makedev (unsigned int __major,
+ unsigned int __minor)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+__extension__ extern __inline __attribute__ ((__const__)) unsigned int
+__attribute__ ((__nothrow__ , __leaf__)) gnu_dev_major (unsigned long long int __dev)
+{
+ return ((__dev >> 8) & 0xfff) | ((unsigned int) (__dev >> 32) & ~0xfff);
+}
+__extension__ extern __inline __attribute__ ((__const__)) unsigned int
+__attribute__ ((__nothrow__ , __leaf__)) gnu_dev_minor (unsigned long long int __dev)
+{
+ return (__dev & 0xff) | ((unsigned int) (__dev >> 12) & ~0xff);
+}
+__extension__ extern __inline __attribute__ ((__const__)) unsigned long long int
+__attribute__ ((__nothrow__ , __leaf__)) gnu_dev_makedev (unsigned int __major, unsigned int __minor)
+{
+ return ((__minor & 0xff) | ((__major & 0xfff) << 8)
+ | (((unsigned long long int) (__minor & ~0xff)) << 12)
+ | (((unsigned long long int) (__major & ~0xfff)) << 32));
+}
+typedef __blksize_t blksize_t;
+typedef __blkcnt64_t blkcnt_t;
+typedef __fsblkcnt64_t fsblkcnt_t;
+typedef __fsfilcnt64_t fsfilcnt_t;
+typedef __blkcnt64_t blkcnt64_t;
+typedef __fsblkcnt64_t fsblkcnt64_t;
+typedef __fsfilcnt64_t fsfilcnt64_t;
+typedef unsigned long int pthread_t;
+union pthread_attr_t
+{
+ char __size[36];
+ long int __align;
+};
+typedef union pthread_attr_t pthread_attr_t;
+typedef struct __pthread_internal_slist
+{
+ struct __pthread_internal_slist *__next;
+} __pthread_slist_t;
+typedef union
+{
+ struct __pthread_mutex_s
+ {
+ int __lock __attribute__ ((aligned(16)));
+ unsigned int __count;
+ int __owner;
+ int __kind;
+ int __compat_padding[4];
+ unsigned int __nusers;
+ __extension__ union
+ {
+ int __spins;
+ __pthread_slist_t __list;
+ };
+ int __reserved1;
+ int __reserved2;
+ } __data;
+ char __size[48];
+ long int __align;
+} pthread_mutex_t;
+typedef union
+{
+ char __size[4];
+ long int __align;
+} pthread_mutexattr_t;
+typedef union
+{
+ struct
+ {
+ int __lock __attribute__ ((aligned(16)));
+ int __initializer;
+ unsigned int __futex;
+ void *__mutex;
+ __extension__ unsigned long long int __total_seq;
+ __extension__ unsigned long long int __wakeup_seq;
+ __extension__ unsigned long long int __woken_seq;
+ unsigned int __nwaiters;
+ unsigned int __broadcast_seq;
+ } __data;
+ char __size[48];
+ __extension__ long long int __align;
+} pthread_cond_t;
+typedef union
+{
+ char __size[4];
+ long int __align;
+} pthread_condattr_t;
+typedef unsigned int pthread_key_t;
+typedef int pthread_once_t;
+typedef union
+{
+ struct
+ {
+ int __compat_padding[4] __attribute__ ((aligned(16)));
+ int __lock;
+ unsigned int __nr_readers;
+ unsigned int __readers_wakeup;
+ unsigned int __writer_wakeup;
+ unsigned int __nr_readers_queued;
+ unsigned int __nr_writers_queued;
+ int __writer;
+ int __reserved1;
+ unsigned char __pad2;
+ unsigned char __pad1;
+ unsigned char __shared;
+ unsigned char __flags;
+ int __reserved2;
+ int __reserved3;
+ int __reserved4;
+ } __data;
+ char __size[64];
+ long int __align;
+} pthread_rwlock_t;
+typedef union
+{
+ char __size[8];
+ long int __align;
+} pthread_rwlockattr_t;
+typedef volatile int pthread_spinlock_t;
+typedef union
+{
+ char __size[48];
+ long int __align;
+} pthread_barrier_t;
+typedef union
+{
+ char __size[4];
+ int __align;
+} pthread_barrierattr_t;
+struct iovec
+ {
+ void *iov_base;
+ size_t iov_len;
+ };
+extern ssize_t process_vm_readv (pid_t __pid, const struct iovec *__lvec,
+ unsigned long int __liovcnt,
+ const struct iovec *__rvec,
+ unsigned long int __riovcnt,
+ unsigned long int __flags)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec,
+ unsigned long int __liovcnt,
+ const struct iovec *__rvec,
+ unsigned long int __riovcnt,
+ unsigned long int __flags)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern ssize_t readv (int __fd, const struct iovec *__iovec, int __count)
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t writev (int __fd, const struct iovec *__iovec, int __count)
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t preadv (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset) __asm__ ("" "preadv64")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t pwritev (int __fd, const struct iovec *__iovec, int __count, __off64_t __offset) __asm__ ("" "pwritev64")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t preadv64 (int __fd, const struct iovec *__iovec, int __count,
+ __off64_t __offset) __attribute__ ((__warn_unused_result__));
+extern ssize_t pwritev64 (int __fd, const struct iovec *__iovec, int __count,
+ __off64_t __offset) __attribute__ ((__warn_unused_result__));
+typedef __socklen_t socklen_t;
+enum __socket_type
+{
+ SOCK_STREAM = 1,
+ SOCK_DGRAM = 2,
+ SOCK_RAW = 3,
+ SOCK_RDM = 4,
+ SOCK_SEQPACKET = 5,
+ SOCK_DCCP = 6,
+ SOCK_PACKET = 10,
+ SOCK_CLOEXEC = 010000000,
+ SOCK_NONBLOCK = 0x40000000
+};
+typedef unsigned short int sa_family_t;
+struct sockaddr
+ {
+ sa_family_t sa_family;
+ char sa_data[14];
+ };
+struct sockaddr_storage
+ {
+ sa_family_t ss_family;
+ unsigned long int __ss_align;
+ char __ss_padding[(128 - (2 * sizeof (unsigned long int)))];
+ };
+enum
+ {
+ MSG_OOB = 0x01,
+ MSG_PEEK = 0x02,
+ MSG_DONTROUTE = 0x04,
+ MSG_TRYHARD = MSG_DONTROUTE,
+ MSG_CTRUNC = 0x08,
+ MSG_PROXY = 0x10,
+ MSG_TRUNC = 0x20,
+ MSG_DONTWAIT = 0x40,
+ MSG_EOR = 0x80,
+ MSG_WAITALL = 0x100,
+ MSG_FIN = 0x200,
+ MSG_SYN = 0x400,
+ MSG_CONFIRM = 0x800,
+ MSG_RST = 0x1000,
+ MSG_ERRQUEUE = 0x2000,
+ MSG_NOSIGNAL = 0x4000,
+ MSG_MORE = 0x8000,
+ MSG_WAITFORONE = 0x10000,
+ MSG_CMSG_CLOEXEC = 0x40000000
+ };
+struct msghdr
+ {
+ void *msg_name;
+ socklen_t msg_namelen;
+ struct iovec *msg_iov;
+ size_t msg_iovlen;
+ void *msg_control;
+ size_t msg_controllen;
+ int msg_flags;
+ };
+struct cmsghdr
+ {
+ size_t cmsg_len;
+ int cmsg_level;
+ int cmsg_type;
+ __extension__ unsigned char __cmsg_data [];
+ };
+extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
+ struct cmsghdr *__cmsg) __attribute__ ((__nothrow__ , __leaf__));
+extern __inline struct cmsghdr *
+__attribute__ ((__nothrow__ , __leaf__)) __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg)
+{
+ if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
+ return (struct cmsghdr *) 0;
+ __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
+ + (((__cmsg->cmsg_len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1)));
+ if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
+ + __mhdr->msg_controllen)
+ || ((unsigned char *) __cmsg + (((__cmsg->cmsg_len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
+ > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
+ return (struct cmsghdr *) 0;
+ return __cmsg;
+}
+enum
+ {
+ SCM_RIGHTS = 0x01
+ , SCM_CREDENTIALS = 0x02
+ };
+struct ucred
+{
+ pid_t pid;
+ uid_t uid;
+ gid_t gid;
+};
+struct linger
+ {
+ int l_onoff;
+ int l_linger;
+ };
+struct osockaddr
+ {
+ unsigned short int sa_family;
+ unsigned char sa_data[14];
+ };
+enum
+{
+ SHUT_RD = 0,
+ SHUT_WR,
+ SHUT_RDWR
+};
+typedef union { struct sockaddr *__restrict __sockaddr__; struct sockaddr_at *__restrict __sockaddr_at__; struct sockaddr_ax25 *__restrict __sockaddr_ax25__; struct sockaddr_dl *__restrict __sockaddr_dl__; struct sockaddr_eon *__restrict __sockaddr_eon__; struct sockaddr_in *__restrict __sockaddr_in__; struct sockaddr_in6 *__restrict __sockaddr_in6__; struct sockaddr_inarp *__restrict __sockaddr_inarp__; struct sockaddr_ipx *__restrict __sockaddr_ipx__; struct sockaddr_iso *__restrict __sockaddr_iso__; struct sockaddr_ns *__restrict __sockaddr_ns__; struct sockaddr_un *__restrict __sockaddr_un__; struct sockaddr_x25 *__restrict __sockaddr_x25__;
+ } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
+typedef union { const struct sockaddr *__restrict __sockaddr__; const struct sockaddr_at *__restrict __sockaddr_at__; const struct sockaddr_ax25 *__restrict __sockaddr_ax25__; const struct sockaddr_dl *__restrict __sockaddr_dl__; const struct sockaddr_eon *__restrict __sockaddr_eon__; const struct sockaddr_in *__restrict __sockaddr_in__; const struct sockaddr_in6 *__restrict __sockaddr_in6__; const struct sockaddr_inarp *__restrict __sockaddr_inarp__; const struct sockaddr_ipx *__restrict __sockaddr_ipx__; const struct sockaddr_iso *__restrict __sockaddr_iso__; const struct sockaddr_ns *__restrict __sockaddr_ns__; const struct sockaddr_un *__restrict __sockaddr_un__; const struct sockaddr_x25 *__restrict __sockaddr_x25__;
+ } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
+struct mmsghdr
+ {
+ struct msghdr msg_hdr;
+ unsigned int msg_len;
+ };
+extern int socket (int __domain, int __type, int __protocol) __attribute__ ((__nothrow__ , __leaf__));
+extern int socketpair (int __domain, int __type, int __protocol,
+ int __fds[2]) __attribute__ ((__nothrow__ , __leaf__));
+extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __len) __attribute__ ((__nothrow__ , __leaf__));
+extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
+extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __len) __attribute__ ((__nothrow__ , __leaf__));
+extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags);
+extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
+extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
+ int __flags, __CONST_SOCKADDR_ARG __addr,
+ socklen_t __addr_len);
+extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
+ int __flags, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len);
+extern ssize_t sendmsg (int __fd, const struct msghdr *__message,
+ int __flags);
+extern int sendmmsg (int __fd, struct mmsghdr *__vmessages,
+ unsigned int __vlen, int __flags);
+extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
+extern int recvmmsg (int __fd, struct mmsghdr *__vmessages,
+ unsigned int __vlen, int __flags,
+ const struct timespec *__tmo);
+extern int getsockopt (int __fd, int __level, int __optname,
+ void *__restrict __optval,
+ socklen_t *__restrict __optlen) __attribute__ ((__nothrow__ , __leaf__));
+extern int setsockopt (int __fd, int __level, int __optname,
+ const void *__optval, socklen_t __optlen) __attribute__ ((__nothrow__ , __leaf__));
+extern int listen (int __fd, int __n) __attribute__ ((__nothrow__ , __leaf__));
+extern int accept (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len);
+extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len, int __flags);
+extern int shutdown (int __fd, int __how) __attribute__ ((__nothrow__ , __leaf__));
+extern int sockatmark (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern int isfdtype (int __fd, int __fdtype) __attribute__ ((__nothrow__ , __leaf__));
+extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
+ int __flags);
+extern ssize_t __recv_alias (int __fd, void *__buf, size_t __n, int __flags) __asm__ ("" "recv")
+ ;
+extern ssize_t __recv_chk_warn (int __fd, void *__buf, size_t __n, size_t __buflen, int __flags) __asm__ ("" "__recv_chk")
+ __attribute__((__warning__ ("recv called with bigger length than size of destination " "buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) ssize_t
+recv (int __fd, void *__buf, size_t __n, int __flags)
+{
+ if (__builtin_object_size (__buf, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__n))
+ return __recv_chk (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags);
+ if (__n > __builtin_object_size (__buf, 0))
+ return __recv_chk_warn (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags);
+ }
+ return __recv_alias (__fd, __buf, __n, __flags);
+}
+extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
+ size_t __buflen, int __flags,
+ __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len);
+extern ssize_t __recvfrom_alias (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) __asm__ ("" "recvfrom")
+ ;
+extern ssize_t __recvfrom_chk_warn (int __fd, void *__restrict __buf, size_t __n, size_t __buflen, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) __asm__ ("" "__recvfrom_chk")
+ __attribute__((__warning__ ("recvfrom called with bigger length than size of " "destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) ssize_t
+recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
+ __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
+{
+ if (__builtin_object_size (__buf, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__n))
+ return __recvfrom_chk (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags,
+ __addr, __addr_len);
+ if (__n > __builtin_object_size (__buf, 0))
+ return __recvfrom_chk_warn (__fd, __buf, __n, __builtin_object_size (__buf, 0), __flags,
+ __addr, __addr_len);
+ }
+ return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
+}
+struct ttyent {
+ char *ty_name;
+ char *ty_getty;
+ char *ty_type;
+ int ty_status;
+ char *ty_window;
+ char *ty_comment;
+};
+extern struct ttyent *getttyent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern struct ttyent *getttynam (const char *__tty) __attribute__ ((__nothrow__ , __leaf__));
+extern int setttyent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int endttyent (void) __attribute__ ((__nothrow__ , __leaf__));
+struct utimbuf
+ {
+ __time_t actime;
+ __time_t modtime;
+ };
+extern int utime (const char *__file,
+ const struct utimbuf *__file_times)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int bcmp (const void *__s1, const void *__s2, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__));
+extern void bcopy (const void *__src, void *__dest, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
+extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
+extern char *index (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern char *rindex (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((const));
+extern int strcasecmp (const char *__s1, const char *__s2)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__));
+extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__));
+typedef struct __locale_struct
+{
+ struct __locale_data *__locales[13];
+ const unsigned short int *__ctype_b;
+ const int *__ctype_tolower;
+ const int *__ctype_toupper;
+ const char *__names[13];
+} *__locale_t;
+typedef __locale_t locale_t;
+extern int strcasecmp_l (const char *__s1, const char *__s2, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
+extern int strncasecmp_l (const char *__s1, const char *__s2,
+ size_t __n, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4)));
+struct timezone
+ {
+ int tz_minuteswest;
+ int tz_dsttime;
+ };
+typedef struct timezone *__restrict __timezone_ptr_t;
+extern int gettimeofday (struct timeval *__restrict __tv,
+ __timezone_ptr_t __tz) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int settimeofday (const struct timeval *__tv,
+ const struct timezone *__tz)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int adjtime (const struct timeval *__delta,
+ struct timeval *__olddelta) __attribute__ ((__nothrow__ , __leaf__));
+enum __itimer_which
+ {
+ ITIMER_REAL = 0,
+ ITIMER_VIRTUAL = 1,
+ ITIMER_PROF = 2
+ };
+struct itimerval
+ {
+ struct timeval it_interval;
+ struct timeval it_value;
+ };
+typedef enum __itimer_which __itimer_which_t;
+extern int getitimer (__itimer_which_t __which,
+ struct itimerval *__value) __attribute__ ((__nothrow__ , __leaf__));
+extern int setitimer (__itimer_which_t __which,
+ const struct itimerval *__restrict __new,
+ struct itimerval *__restrict __old) __attribute__ ((__nothrow__ , __leaf__));
+extern int utimes (const char *__file, const struct timeval __tvp[2])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int lutimes (const char *__file, const struct timeval __tvp[2])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int futimes (int __fd, const struct timeval __tvp[2]) __attribute__ ((__nothrow__ , __leaf__));
+extern int futimesat (int __fd, const char *__file,
+ const struct timeval __tvp[2]) __attribute__ ((__nothrow__ , __leaf__));
+struct lastlog
+ {
+ __time_t ll_time;
+ char ll_line[32];
+ char ll_host[256];
+ };
+struct exit_status
+ {
+ short int e_termination;
+ short int e_exit;
+ };
+struct utmp
+{
+ short int ut_type;
+ pid_t ut_pid;
+ char ut_line[32];
+ char ut_id[4];
+ char ut_user[32];
+ char ut_host[256];
+ struct exit_status ut_exit;
+ long int ut_session;
+ struct timeval ut_tv;
+ int32_t ut_addr_v6[4];
+ char __unused[20];
+};
+extern int login_tty (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern void login (const struct utmp *__entry) __attribute__ ((__nothrow__ , __leaf__));
+extern int logout (const char *__ut_line) __attribute__ ((__nothrow__ , __leaf__));
+extern void logwtmp (const char *__ut_line, const char *__ut_name,
+ const char *__ut_host) __attribute__ ((__nothrow__ , __leaf__));
+extern void updwtmp (const char *__wtmp_file, const struct utmp *__utmp)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int utmpname (const char *__file) __attribute__ ((__nothrow__ , __leaf__));
+extern struct utmp *getutent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern void setutent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern void endutent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern struct utmp *getutid (const struct utmp *__id) __attribute__ ((__nothrow__ , __leaf__));
+extern struct utmp *getutline (const struct utmp *__line) __attribute__ ((__nothrow__ , __leaf__));
+extern struct utmp *pututline (const struct utmp *__utmp_ptr) __attribute__ ((__nothrow__ , __leaf__));
+extern int getutent_r (struct utmp *__buffer, struct utmp **__result) __attribute__ ((__nothrow__ , __leaf__));
+extern int getutid_r (const struct utmp *__id, struct utmp *__buffer,
+ struct utmp **__result) __attribute__ ((__nothrow__ , __leaf__));
+extern int getutline_r (const struct utmp *__line,
+ struct utmp *__buffer, struct utmp **__result) __attribute__ ((__nothrow__ , __leaf__));
+struct __exit_status
+ {
+ short int e_termination;
+ short int e_exit;
+ };
+struct utmpx
+{
+ short int ut_type;
+ __pid_t ut_pid;
+ char ut_line[32];
+ char ut_id[4];
+ char ut_user[32];
+ char ut_host[256];
+ struct __exit_status ut_exit;
+ long int ut_session;
+ struct timeval ut_tv;
+ __int32_t ut_addr_v6[4];
+ char __unused[20];
+};
+struct utmp;
+extern void setutxent (void);
+extern void endutxent (void);
+extern struct utmpx *getutxent (void);
+extern struct utmpx *getutxid (const struct utmpx *__id);
+extern struct utmpx *getutxline (const struct utmpx *__line);
+extern struct utmpx *pututxline (const struct utmpx *__utmpx);
+extern int utmpxname (const char *__file);
+extern void updwtmpx (const char *__wtmpx_file,
+ const struct utmpx *__utmpx);
+extern void getutmp (const struct utmpx *__utmpx,
+ struct utmp *__utmp);
+extern void getutmpx (const struct utmp *__utmp, struct utmpx *__utmpx);
+typedef unsigned char uint8_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+__extension__
+typedef unsigned long long int uint64_t;
+typedef signed char int_least8_t;
+typedef short int int_least16_t;
+typedef int int_least32_t;
+__extension__
+typedef long long int int_least64_t;
+typedef unsigned char uint_least8_t;
+typedef unsigned short int uint_least16_t;
+typedef unsigned int uint_least32_t;
+__extension__
+typedef unsigned long long int uint_least64_t;
+typedef signed char int_fast8_t;
+typedef int int_fast16_t;
+typedef int int_fast32_t;
+__extension__
+typedef long long int int_fast64_t;
+typedef unsigned char uint_fast8_t;
+typedef unsigned int uint_fast16_t;
+typedef unsigned int uint_fast32_t;
+__extension__
+typedef unsigned long long int uint_fast64_t;
+typedef int intptr_t;
+typedef unsigned int uintptr_t;
+__extension__
+typedef long long int intmax_t;
+__extension__
+typedef unsigned long long int uintmax_t;
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+struct termios
+ {
+ tcflag_t c_iflag;
+ tcflag_t c_oflag;
+ tcflag_t c_cflag;
+ tcflag_t c_lflag;
+ cc_t c_line;
+ cc_t c_cc[32];
+ speed_t c_ispeed;
+ speed_t c_ospeed;
+ };
+extern speed_t cfgetospeed (const struct termios *__termios_p) __attribute__ ((__nothrow__ , __leaf__));
+extern speed_t cfgetispeed (const struct termios *__termios_p) __attribute__ ((__nothrow__ , __leaf__));
+extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __attribute__ ((__nothrow__ , __leaf__));
+extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __attribute__ ((__nothrow__ , __leaf__));
+extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __attribute__ ((__nothrow__ , __leaf__));
+extern int tcgetattr (int __fd, struct termios *__termios_p) __attribute__ ((__nothrow__ , __leaf__));
+extern int tcsetattr (int __fd, int __optional_actions,
+ const struct termios *__termios_p) __attribute__ ((__nothrow__ , __leaf__));
+extern void cfmakeraw (struct termios *__termios_p) __attribute__ ((__nothrow__ , __leaf__));
+extern int tcsendbreak (int __fd, int __duration) __attribute__ ((__nothrow__ , __leaf__));
+extern int tcdrain (int __fd);
+extern int tcflush (int __fd, int __queue_selector) __attribute__ ((__nothrow__ , __leaf__));
+extern int tcflow (int __fd, int __action) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t tcgetsid (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+struct stat
+ {
+ __dev_t st_dev;
+ unsigned short int __pad1;
+ __ino_t __st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ unsigned short int __pad2;
+ __off64_t st_size;
+ __blksize_t st_blksize;
+ __blkcnt64_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ __ino64_t st_ino;
+ };
+struct stat64
+ {
+ __dev_t st_dev;
+ unsigned int __pad1;
+ __ino_t __st_ino;
+ __mode_t st_mode;
+ __nlink_t st_nlink;
+ __uid_t st_uid;
+ __gid_t st_gid;
+ __dev_t st_rdev;
+ unsigned int __pad2;
+ __off64_t st_size;
+ __blksize_t st_blksize;
+ __blkcnt64_t st_blocks;
+ struct timespec st_atim;
+ struct timespec st_mtim;
+ struct timespec st_ctim;
+ __ino64_t st_ino;
+ };
+extern int stat (const char *__restrict __file, struct stat *__restrict __buf) __asm__ ("" "stat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1, 2)));
+extern int fstat (int __fd, struct stat *__buf) __asm__ ("" "fstat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2)));
+extern int stat64 (const char *__restrict __file,
+ struct stat64 *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int fstat64 (int __fd, struct stat64 *__buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __asm__ ("" "fstatat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2, 3)));
+extern int fstatat64 (int __fd, const char *__restrict __file,
+ struct stat64 *__restrict __buf, int __flag)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
+extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __asm__ ("" "lstat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1, 2)));
+extern int lstat64 (const char *__restrict __file,
+ struct stat64 *__restrict __buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int chmod (const char *__file, __mode_t __mode)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int lchmod (const char *__file, __mode_t __mode)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int fchmod (int __fd, __mode_t __mode) __attribute__ ((__nothrow__ , __leaf__));
+extern int fchmodat (int __fd, const char *__file, __mode_t __mode,
+ int __flag)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
+extern __mode_t umask (__mode_t __mask) __attribute__ ((__nothrow__ , __leaf__));
+extern __mode_t getumask (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int mkdir (const char *__path, __mode_t __mode)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int mkdirat (int __fd, const char *__path, __mode_t __mode)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int mknodat (int __fd, const char *__path, __mode_t __mode,
+ __dev_t __dev) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int mkfifo (const char *__path, __mode_t __mode)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int utimensat (int __fd, const char *__path,
+ const struct timespec __times[2],
+ int __flags)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int futimens (int __fd, const struct timespec __times[2]) __attribute__ ((__nothrow__ , __leaf__));
+extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) __asm__ ("" "__fxstat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (3)));
+extern int __xstat (int __ver, const char *__filename, struct stat *__stat_buf) __asm__ ("" "__xstat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2, 3)));
+extern int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf) __asm__ ("" "__lxstat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2, 3)));
+extern int __fxstatat (int __ver, int __fildes, const char *__filename, struct stat *__stat_buf, int __flag) __asm__ ("" "__fxstatat64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (3, 4)));
+extern int __fxstat64 (int __ver, int __fildes, struct stat64 *__stat_buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3)));
+extern int __xstat64 (int __ver, const char *__filename,
+ struct stat64 *__stat_buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
+extern int __lxstat64 (int __ver, const char *__filename,
+ struct stat64 *__stat_buf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
+extern int __fxstatat64 (int __ver, int __fildes, const char *__filename,
+ struct stat64 *__stat_buf, int __flag)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4)));
+extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
+ __dev_t *__dev) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
+extern int __xmknodat (int __ver, int __fd, const char *__path,
+ __mode_t __mode, __dev_t *__dev)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 5)));
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) stat (const char *__path, struct stat *__statbuf)
+{
+ return __xstat (3, __path, __statbuf);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) lstat (const char *__path, struct stat *__statbuf)
+{
+ return __lxstat (3, __path, __statbuf);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) fstat (int __fd, struct stat *__statbuf)
+{
+ return __fxstat (3, __fd, __statbuf);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) fstatat (int __fd, const char *__filename, struct stat *__statbuf, int __flag)
+{
+ return __fxstatat (3, __fd, __filename, __statbuf, __flag);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) mknod (const char *__path, __mode_t __mode, __dev_t __dev)
+{
+ return __xmknod (1, __path, __mode, &__dev);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) mknodat (int __fd, const char *__path, __mode_t __mode, __dev_t __dev)
+{
+ return __xmknodat (1, __fd, __path, __mode, &__dev);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) stat64 (const char *__path, struct stat64 *__statbuf)
+{
+ return __xstat64 (3, __path, __statbuf);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) lstat64 (const char *__path, struct stat64 *__statbuf)
+{
+ return __lxstat64 (3, __path, __statbuf);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) fstat64 (int __fd, struct stat64 *__statbuf)
+{
+ return __fxstat64 (3, __fd, __statbuf);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) fstatat64 (int __fd, const char *__filename, struct stat64 *__statbuf, int __flag)
+{
+ return __fxstatat64 (3, __fd, __filename, __statbuf, __flag);
+}
+extern void * mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off64_t __offset) __asm__ ("" "mmap64") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern void *mmap64 (void *__addr, size_t __len, int __prot,
+ int __flags, int __fd, __off64_t __offset) __attribute__ ((__nothrow__ , __leaf__));
+extern int munmap (void *__addr, size_t __len) __attribute__ ((__nothrow__ , __leaf__));
+extern int mprotect (void *__addr, size_t __len, int __prot) __attribute__ ((__nothrow__ , __leaf__));
+extern int msync (void *__addr, size_t __len, int __flags);
+extern int madvise (void *__addr, size_t __len, int __advice) __attribute__ ((__nothrow__ , __leaf__));
+extern int posix_madvise (void *__addr, size_t __len, int __advice) __attribute__ ((__nothrow__ , __leaf__));
+extern int mlock (const void *__addr, size_t __len) __attribute__ ((__nothrow__ , __leaf__));
+extern int munlock (const void *__addr, size_t __len) __attribute__ ((__nothrow__ , __leaf__));
+extern int mlockall (int __flags) __attribute__ ((__nothrow__ , __leaf__));
+extern int munlockall (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int mincore (void *__start, size_t __len, unsigned char *__vec)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern void *mremap (void *__addr, size_t __old_len, size_t __new_len,
+ int __flags, ...) __attribute__ ((__nothrow__ , __leaf__));
+extern int remap_file_pages (void *__start, size_t __size, int __prot,
+ size_t __pgoff, int __flags) __attribute__ ((__nothrow__ , __leaf__));
+extern int shm_open (const char *__name, int __oflag, mode_t __mode);
+extern int shm_unlink (const char *__name);
+enum
+ {
+ IPPROTO_IP = 0,
+ IPPROTO_HOPOPTS = 0,
+ IPPROTO_ICMP = 1,
+ IPPROTO_IGMP = 2,
+ IPPROTO_IPIP = 4,
+ IPPROTO_TCP = 6,
+ IPPROTO_EGP = 8,
+ IPPROTO_PUP = 12,
+ IPPROTO_UDP = 17,
+ IPPROTO_IDP = 22,
+ IPPROTO_TP = 29,
+ IPPROTO_DCCP = 33,
+ IPPROTO_IPV6 = 41,
+ IPPROTO_ROUTING = 43,
+ IPPROTO_FRAGMENT = 44,
+ IPPROTO_RSVP = 46,
+ IPPROTO_GRE = 47,
+ IPPROTO_ESP = 50,
+ IPPROTO_AH = 51,
+ IPPROTO_ICMPV6 = 58,
+ IPPROTO_NONE = 59,
+ IPPROTO_DSTOPTS = 60,
+ IPPROTO_MTP = 92,
+ IPPROTO_ENCAP = 98,
+ IPPROTO_PIM = 103,
+ IPPROTO_COMP = 108,
+ IPPROTO_SCTP = 132,
+ IPPROTO_UDPLITE = 136,
+ IPPROTO_RAW = 255,
+ IPPROTO_MAX
+ };
+typedef uint16_t in_port_t;
+enum
+ {
+ IPPORT_ECHO = 7,
+ IPPORT_DISCARD = 9,
+ IPPORT_SYSTAT = 11,
+ IPPORT_DAYTIME = 13,
+ IPPORT_NETSTAT = 15,
+ IPPORT_FTP = 21,
+ IPPORT_TELNET = 23,
+ IPPORT_SMTP = 25,
+ IPPORT_TIMESERVER = 37,
+ IPPORT_NAMESERVER = 42,
+ IPPORT_WHOIS = 43,
+ IPPORT_MTP = 57,
+ IPPORT_TFTP = 69,
+ IPPORT_RJE = 77,
+ IPPORT_FINGER = 79,
+ IPPORT_TTYLINK = 87,
+ IPPORT_SUPDUP = 95,
+ IPPORT_EXECSERVER = 512,
+ IPPORT_LOGINSERVER = 513,
+ IPPORT_CMDSERVER = 514,
+ IPPORT_EFSSERVER = 520,
+ IPPORT_BIFFUDP = 512,
+ IPPORT_WHOSERVER = 513,
+ IPPORT_ROUTESERVER = 520,
+ IPPORT_RESERVED = 1024,
+ IPPORT_USERRESERVED = 5000
+ };
+typedef uint32_t in_addr_t;
+struct in_addr
+ {
+ in_addr_t s_addr;
+ };
+struct in6_addr
+ {
+ union
+ {
+ uint8_t __u6_addr8[16];
+ uint16_t __u6_addr16[8];
+ uint32_t __u6_addr32[4];
+ } __in6_u;
+ };
+extern const struct in6_addr in6addr_any;
+extern const struct in6_addr in6addr_loopback;
+struct sockaddr_in
+ {
+ sa_family_t sin_family;
+ in_port_t sin_port;
+ struct in_addr sin_addr;
+ unsigned char sin_zero[sizeof (struct sockaddr) -
+ (sizeof (unsigned short int)) -
+ sizeof (in_port_t) -
+ sizeof (struct in_addr)];
+ };
+struct sockaddr_in6
+ {
+ sa_family_t sin6_family;
+ in_port_t sin6_port;
+ uint32_t sin6_flowinfo;
+ struct in6_addr sin6_addr;
+ uint32_t sin6_scope_id;
+ };
+struct ip_mreq
+ {
+ struct in_addr imr_multiaddr;
+ struct in_addr imr_interface;
+ };
+struct ip_mreq_source
+ {
+ struct in_addr imr_multiaddr;
+ struct in_addr imr_interface;
+ struct in_addr imr_sourceaddr;
+ };
+struct ipv6_mreq
+ {
+ struct in6_addr ipv6mr_multiaddr;
+ unsigned int ipv6mr_interface;
+ };
+struct group_req
+ {
+ uint32_t gr_interface;
+ struct sockaddr_storage gr_group;
+ };
+struct group_source_req
+ {
+ uint32_t gsr_interface;
+ struct sockaddr_storage gsr_group;
+ struct sockaddr_storage gsr_source;
+ };
+struct ip_msfilter
+ {
+ struct in_addr imsf_multiaddr;
+ struct in_addr imsf_interface;
+ uint32_t imsf_fmode;
+ uint32_t imsf_numsrc;
+ struct in_addr imsf_slist[1];
+ };
+struct group_filter
+ {
+ uint32_t gf_interface;
+ struct sockaddr_storage gf_group;
+ uint32_t gf_fmode;
+ uint32_t gf_numsrc;
+ struct sockaddr_storage gf_slist[1];
+};
+struct ip_opts
+ {
+ struct in_addr ip_dst;
+ char ip_opts[40];
+ };
+struct ip_mreqn
+ {
+ struct in_addr imr_multiaddr;
+ struct in_addr imr_address;
+ int imr_ifindex;
+ };
+struct in_pktinfo
+ {
+ int ipi_ifindex;
+ struct in_addr ipi_spec_dst;
+ struct in_addr ipi_addr;
+ };
+extern uint32_t ntohl (uint32_t __netlong) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern uint16_t ntohs (uint16_t __netshort)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern uint32_t htonl (uint32_t __hostlong)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern uint16_t htons (uint16_t __hostshort)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) __attribute__ ((__nothrow__ , __leaf__));
+extern int bindresvport6 (int __sockfd, struct sockaddr_in6 *__sock_in)
+ __attribute__ ((__nothrow__ , __leaf__));
+struct cmsghdr;
+struct in6_pktinfo
+ {
+ struct in6_addr ipi6_addr;
+ unsigned int ipi6_ifindex;
+ };
+struct ip6_mtuinfo
+ {
+ struct sockaddr_in6 ip6m_addr;
+ uint32_t ip6m_mtu;
+ };
+extern int inet6_option_space (int __nbytes)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int inet6_option_init (void *__bp, struct cmsghdr **__cmsgp,
+ int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int inet6_option_append (struct cmsghdr *__cmsg,
+ const uint8_t *__typep, int __multx,
+ int __plusy) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern uint8_t *inet6_option_alloc (struct cmsghdr *__cmsg, int __datalen,
+ int __multx, int __plusy)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int inet6_option_next (const struct cmsghdr *__cmsg,
+ uint8_t **__tptrp)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int inet6_option_find (const struct cmsghdr *__cmsg,
+ uint8_t **__tptrp, int __type)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int inet6_opt_init (void *__extbuf, socklen_t __extlen) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_opt_append (void *__extbuf, socklen_t __extlen, int __offset,
+ uint8_t __type, socklen_t __len, uint8_t __align,
+ void **__databufp) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_opt_finish (void *__extbuf, socklen_t __extlen, int __offset)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_opt_set_val (void *__databuf, int __offset, void *__val,
+ socklen_t __vallen) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_opt_next (void *__extbuf, socklen_t __extlen, int __offset,
+ uint8_t *__typep, socklen_t *__lenp,
+ void **__databufp) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_opt_find (void *__extbuf, socklen_t __extlen, int __offset,
+ uint8_t __type, socklen_t *__lenp,
+ void **__databufp) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_opt_get_val (void *__databuf, int __offset, void *__val,
+ socklen_t __vallen) __attribute__ ((__nothrow__ , __leaf__));
+extern socklen_t inet6_rth_space (int __type, int __segments) __attribute__ ((__nothrow__ , __leaf__));
+extern void *inet6_rth_init (void *__bp, socklen_t __bp_len, int __type,
+ int __segments) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_rth_add (void *__bp, const struct in6_addr *__addr) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_rth_reverse (const void *__in, void *__out) __attribute__ ((__nothrow__ , __leaf__));
+extern int inet6_rth_segments (const void *__bp) __attribute__ ((__nothrow__ , __leaf__));
+extern struct in6_addr *inet6_rth_getaddr (const void *__bp, int __index)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int getipv4sourcefilter (int __s, struct in_addr __interface_addr,
+ struct in_addr __group, uint32_t *__fmode,
+ uint32_t *__numsrc, struct in_addr *__slist)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int setipv4sourcefilter (int __s, struct in_addr __interface_addr,
+ struct in_addr __group, uint32_t __fmode,
+ uint32_t __numsrc,
+ const struct in_addr *__slist)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int getsourcefilter (int __s, uint32_t __interface_addr,
+ const struct sockaddr *__group,
+ socklen_t __grouplen, uint32_t *__fmode,
+ uint32_t *__numsrc,
+ struct sockaddr_storage *__slist) __attribute__ ((__nothrow__ , __leaf__));
+extern int setsourcefilter (int __s, uint32_t __interface_addr,
+ const struct sockaddr *__group,
+ socklen_t __grouplen, uint32_t __fmode,
+ uint32_t __numsrc,
+ const struct sockaddr_storage *__slist) __attribute__ ((__nothrow__ , __leaf__));
+typedef u_int16_t n_short;
+typedef u_int32_t n_long;
+typedef u_int32_t n_time;
+typedef int bool_t;
+typedef int enum_t;
+typedef unsigned long rpcprog_t;
+typedef unsigned long rpcvers_t;
+typedef unsigned long rpcproc_t;
+typedef unsigned long rpcprot_t;
+typedef unsigned long rpcport_t;
+typedef long int wchar_t;
+union wait
+ {
+ int w_status;
+ struct
+ {
+ unsigned int:16;
+ unsigned int __w_retcode:8;
+ unsigned int __w_coredump:1;
+ unsigned int __w_termsig:7;
+ } __wait_terminated;
+ struct
+ {
+ unsigned int:16;
+ unsigned int __w_stopsig:8;
+ unsigned int __w_stopval:8;
+ } __wait_stopped;
+ };
+typedef union
+ {
+ union wait *__uptr;
+ int *__iptr;
+ } __WAIT_STATUS __attribute__ ((__transparent_union__));
+typedef struct
+ {
+ int quot;
+ int rem;
+ } div_t;
+typedef struct
+ {
+ long int quot;
+ long int rem;
+ } ldiv_t;
+__extension__ typedef struct
+ {
+ long long int quot;
+ long long int rem;
+ } lldiv_t;
+extern size_t __ctype_get_mb_cur_max (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern double atof (const char *__nptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int atoi (const char *__nptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern long int atol (const char *__nptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+__extension__ extern long long int atoll (const char *__nptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern double strtod (const char *__restrict __nptr,
+ char **__restrict __endptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern float strtof (const char *__restrict __nptr,
+ char **__restrict __endptr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern long double strtold (const char *__restrict __nptr,
+ char **__restrict __endptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern long int strtol (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern unsigned long int strtoul (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+__extension__
+extern long long int strtoq (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+__extension__
+extern unsigned long long int strtouq (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+__extension__
+extern long long int strtoll (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+__extension__
+extern unsigned long long int strtoull (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern long int strtol_l (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base,
+ __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4)));
+extern unsigned long int strtoul_l (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4)));
+__extension__
+extern long long int strtoll_l (const char *__restrict __nptr,
+ char **__restrict __endptr, int __base,
+ __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4)));
+__extension__
+extern unsigned long long int strtoull_l (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ int __base, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 4)));
+extern double strtod_l (const char *__restrict __nptr,
+ char **__restrict __endptr, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
+extern float strtof_l (const char *__restrict __nptr,
+ char **__restrict __endptr, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
+extern long double strtold_l (const char *__restrict __nptr,
+ char **__restrict __endptr,
+ __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3)));
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) atoi (const char *__nptr)
+{
+ return (int) strtol (__nptr, (char **) ((void *)0), 10);
+}
+extern __inline long int
+__attribute__ ((__nothrow__ , __leaf__)) atol (const char *__nptr)
+{
+ return strtol (__nptr, (char **) ((void *)0), 10);
+}
+__extension__ extern __inline long long int
+__attribute__ ((__nothrow__ , __leaf__)) atoll (const char *__nptr)
+{
+ return strtoll (__nptr, (char **) ((void *)0), 10);
+}
+extern char *l64a (long int __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern long int a64l (const char *__s)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern long int random (void) __attribute__ ((__nothrow__ , __leaf__));
+extern void srandom (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
+extern char *initstate (unsigned int __seed, char *__statebuf,
+ size_t __statelen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern char *setstate (char *__statebuf) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+struct random_data
+ {
+ int32_t *fptr;
+ int32_t *rptr;
+ int32_t *state;
+ int rand_type;
+ int rand_deg;
+ int rand_sep;
+ int32_t *end_ptr;
+ };
+extern int random_r (struct random_data *__restrict __buf,
+ int32_t *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int srandom_r (unsigned int __seed, struct random_data *__buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
+ size_t __statelen,
+ struct random_data *__restrict __buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
+extern int setstate_r (char *__restrict __statebuf,
+ struct random_data *__restrict __buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int rand (void) __attribute__ ((__nothrow__ , __leaf__));
+extern void srand (unsigned int __seed) __attribute__ ((__nothrow__ , __leaf__));
+extern int rand_r (unsigned int *__seed) __attribute__ ((__nothrow__ , __leaf__));
+extern double drand48 (void) __attribute__ ((__nothrow__ , __leaf__));
+extern double erand48 (unsigned short int __xsubi[3]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern long int lrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
+extern long int nrand48 (unsigned short int __xsubi[3])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern long int mrand48 (void) __attribute__ ((__nothrow__ , __leaf__));
+extern long int jrand48 (unsigned short int __xsubi[3])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern void srand48 (long int __seedval) __attribute__ ((__nothrow__ , __leaf__));
+extern unsigned short int *seed48 (unsigned short int __seed16v[3])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern void lcong48 (unsigned short int __param[7]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+struct drand48_data
+ {
+ unsigned short int __x[3];
+ unsigned short int __old_x[3];
+ unsigned short int __c;
+ unsigned short int __init;
+ unsigned long long int __a;
+ };
+extern int drand48_r (struct drand48_data *__restrict __buffer,
+ double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int erand48_r (unsigned short int __xsubi[3],
+ struct drand48_data *__restrict __buffer,
+ double *__restrict __result) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int lrand48_r (struct drand48_data *__restrict __buffer,
+ long int *__restrict __result)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int nrand48_r (unsigned short int __xsubi[3],
+ struct drand48_data *__restrict __buffer,
+ long int *__restrict __result)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int mrand48_r (struct drand48_data *__restrict __buffer,
+ long int *__restrict __result)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int jrand48_r (unsigned short int __xsubi[3],
+ struct drand48_data *__restrict __buffer,
+ long int *__restrict __result)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int seed48_r (unsigned short int __seed16v[3],
+ struct drand48_data *__buffer) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int lcong48_r (unsigned short int __param[7],
+ struct drand48_data *__buffer)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *malloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
+extern void *calloc (size_t __nmemb, size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
+extern void *realloc (void *__ptr, size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void free (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
+extern void cfree (void *__ptr) __attribute__ ((__nothrow__ , __leaf__));
+extern void *alloca (size_t __size) __attribute__ ((__nothrow__ , __leaf__));
+extern void *valloc (size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
+extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern void *aligned_alloc (size_t __alignment, size_t __size)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__)) __attribute__ ((__malloc__, __alloc_size__ (2)));
+extern void abort (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
+extern int atexit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int at_quick_exit (void (*__func) (void)) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern void exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
+extern void quick_exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
+extern void _Exit (int __status) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__noreturn__));
+extern char *getenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern char *secure_getenv (const char *__name)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int putenv (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int setenv (const char *__name, const char *__value, int __replace)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int unsetenv (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int clearenv (void) __attribute__ ((__nothrow__ , __leaf__));
+extern char *mktemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int mkstemp (char *__template) __asm__ ("" "mkstemp64")
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkstemp64 (char *__template) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkstemps (char *__template, int __suffixlen) __asm__ ("" "mkstemps64")
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkstemps64 (char *__template, int __suffixlen)
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern char *mkdtemp (char *__template) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkostemp (char *__template, int __flags) __asm__ ("" "mkostemp64")
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkostemp64 (char *__template, int __flags) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkostemps (char *__template, int __suffixlen, int __flags) __asm__ ("" "mkostemps64")
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int mkostemps64 (char *__template, int __suffixlen, int __flags)
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int system (const char *__command) __attribute__ ((__warn_unused_result__));
+extern char *canonicalize_file_name (const char *__name)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern char *realpath (const char *__restrict __name,
+ char *__restrict __resolved) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+typedef int (*__compar_fn_t) (const void *, const void *);
+typedef __compar_fn_t comparison_fn_t;
+typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
+extern void *bsearch (const void *__key, const void *__base,
+ size_t __nmemb, size_t __size, __compar_fn_t __compar)
+ __attribute__ ((__nonnull__ (1, 2, 5))) __attribute__ ((__warn_unused_result__));
+extern void qsort (void *__base, size_t __nmemb, size_t __size,
+ __compar_fn_t __compar) __attribute__ ((__nonnull__ (1, 4)));
+extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
+ __compar_d_fn_t __compar, void *__arg)
+ __attribute__ ((__nonnull__ (1, 4)));
+extern int abs (int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
+extern long int labs (long int __x) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
+__extension__ extern long long int llabs (long long int __x)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
+extern div_t div (int __numer, int __denom)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
+extern ldiv_t ldiv (long int __numer, long int __denom)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
+__extension__ extern lldiv_t lldiv (long long int __numer,
+ long long int __denom)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__)) __attribute__ ((__warn_unused_result__));
+extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
+extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
+extern char *gcvt (double __value, int __ndigit, char *__buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) __attribute__ ((__warn_unused_result__));
+extern char *qecvt (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
+extern char *qfcvt (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4))) __attribute__ ((__warn_unused_result__));
+extern char *qgcvt (long double __value, int __ndigit, char *__buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3))) __attribute__ ((__warn_unused_result__));
+extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign, char *__restrict __buf,
+ size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
+extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
+ int *__restrict __sign, char *__restrict __buf,
+ size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
+extern int qecvt_r (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign,
+ char *__restrict __buf, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
+extern int qfcvt_r (long double __value, int __ndigit,
+ int *__restrict __decpt, int *__restrict __sign,
+ char *__restrict __buf, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (3, 4, 5)));
+extern int mblen (const char *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int mbtowc (wchar_t *__restrict __pwc,
+ const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int wctomb (char *__s, wchar_t __wchar) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern size_t mbstowcs (wchar_t *__restrict __pwcs,
+ const char *__restrict __s, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
+extern size_t wcstombs (char *__restrict __s,
+ const wchar_t *__restrict __pwcs, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int rpmatch (const char *__response) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int getsubopt (char **__restrict __optionp,
+ char *const *__restrict __tokens,
+ char **__restrict __valuep)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3))) __attribute__ ((__warn_unused_result__));
+extern void setkey (const char *__key) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int posix_openpt (int __oflag) __attribute__ ((__warn_unused_result__));
+extern int grantpt (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern int unlockpt (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern char *ptsname (int __fd) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int ptsname_r (int __fd, char *__buf, size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int getpt (void);
+extern int getloadavg (double __loadavg[], int __nelem)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern __inline double
+__attribute__ ((__nothrow__ , __leaf__)) atof (const char *__nptr)
+{
+ return strtod (__nptr, (char **) ((void *)0));
+}
+extern char *__realpath_chk (const char *__restrict __name,
+ char *__restrict __resolved,
+ size_t __resolvedlen) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern char *__realpath_alias (const char *__restrict __name, char *__restrict __resolved) __asm__ ("" "realpath") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__));
+extern char *__realpath_chk_warn (const char *__restrict __name, char *__restrict __resolved, size_t __resolvedlen) __asm__ ("" "__realpath_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__))
+ __attribute__((__warning__ ("second argument of realpath must be either NULL or at " "least PATH_MAX bytes long buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) realpath (const char *__restrict __name, char *__restrict __resolved)
+{
+ if (__builtin_object_size (__resolved, 2 > 1) != (size_t) -1)
+ {
+ if (__builtin_object_size (__resolved, 2 > 1) < 4096)
+ return __realpath_chk_warn (__name, __resolved, __builtin_object_size (__resolved, 2 > 1));
+ return __realpath_chk (__name, __resolved, __builtin_object_size (__resolved, 2 > 1));
+ }
+ return __realpath_alias (__name, __resolved);
+}
+extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
+ size_t __nreal) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int __ptsname_r_alias (int __fd, char *__buf, size_t __buflen) __asm__ ("" "ptsname_r") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2)));
+extern int __ptsname_r_chk_warn (int __fd, char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__ptsname_r_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2))) __attribute__((__warning__ ("ptsname_r called with buflen bigger than " "size of buf")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) ptsname_r (int __fd, char *__buf, size_t __buflen)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__buflen))
+ return __ptsname_r_chk (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ if (__buflen > __builtin_object_size (__buf, 2 > 1))
+ return __ptsname_r_chk_warn (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __ptsname_r_alias (__fd, __buf, __buflen);
+}
+extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int __wctomb_alias (char *__s, wchar_t __wchar) __asm__ ("" "wctomb") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__));
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) int
+__attribute__ ((__nothrow__ , __leaf__)) wctomb (char *__s, wchar_t __wchar)
+{
+ if (__builtin_object_size (__s, 2 > 1) != (size_t) -1 && 16 > __builtin_object_size (__s, 2 > 1))
+ return __wctomb_chk (__s, __wchar, __builtin_object_size (__s, 2 > 1));
+ return __wctomb_alias (__s, __wchar);
+}
+extern size_t __mbstowcs_chk (wchar_t *__restrict __dst,
+ const char *__restrict __src,
+ size_t __len, size_t __dstlen) __attribute__ ((__nothrow__ , __leaf__));
+extern size_t __mbstowcs_alias (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len) __asm__ ("" "mbstowcs") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern size_t __mbstowcs_chk_warn (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len, size_t __dstlen) __asm__ ("" "__mbstowcs_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__((__warning__ ("mbstowcs called with dst buffer smaller than len " "* sizeof (wchar_t)")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) size_t
+__attribute__ ((__nothrow__ , __leaf__)) mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src, size_t __len)
+{
+ if (__builtin_object_size (__dst, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__len))
+ return __mbstowcs_chk (__dst, __src, __len,
+ __builtin_object_size (__dst, 2 > 1) / sizeof (wchar_t));
+ if (__len > __builtin_object_size (__dst, 2 > 1) / sizeof (wchar_t))
+ return __mbstowcs_chk_warn (__dst, __src, __len,
+ __builtin_object_size (__dst, 2 > 1) / sizeof (wchar_t));
+ }
+ return __mbstowcs_alias (__dst, __src, __len);
+}
+extern size_t __wcstombs_chk (char *__restrict __dst,
+ const wchar_t *__restrict __src,
+ size_t __len, size_t __dstlen) __attribute__ ((__nothrow__ , __leaf__));
+extern size_t __wcstombs_alias (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len) __asm__ ("" "wcstombs") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern size_t __wcstombs_chk_warn (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len, size_t __dstlen) __asm__ ("" "__wcstombs_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__((__warning__ ("wcstombs called with dst buffer smaller than len")));
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) size_t
+__attribute__ ((__nothrow__ , __leaf__)) wcstombs (char *__restrict __dst, const wchar_t *__restrict __src, size_t __len)
+{
+ if (__builtin_object_size (__dst, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__len))
+ return __wcstombs_chk (__dst, __src, __len, __builtin_object_size (__dst, 2 > 1));
+ if (__len > __builtin_object_size (__dst, 2 > 1))
+ return __wcstombs_chk_warn (__dst, __src, __len, __builtin_object_size (__dst, 2 > 1));
+ }
+ return __wcstombs_alias (__dst, __src, __len);
+}
+extern int __sigismember (const __sigset_t *, int);
+extern int __sigaddset (__sigset_t *, int);
+extern int __sigdelset (__sigset_t *, int);
+extern __inline int __sigismember (const __sigset_t *__set, int __sig) { unsigned long int __mask = (((unsigned long int) 1) << (((__sig) - 1) % (8 * sizeof (unsigned long int)))); unsigned long int __word = (((__sig) - 1) / (8 * sizeof (unsigned long int))); return (__set->__val[__word] & __mask) ? 1 : 0; }
+extern __inline int __sigaddset ( __sigset_t *__set, int __sig) { unsigned long int __mask = (((unsigned long int) 1) << (((__sig) - 1) % (8 * sizeof (unsigned long int)))); unsigned long int __word = (((__sig) - 1) / (8 * sizeof (unsigned long int))); return ((__set->__val[__word] |= __mask), 0); }
+extern __inline int __sigdelset ( __sigset_t *__set, int __sig) { unsigned long int __mask = (((unsigned long int) 1) << (((__sig) - 1) % (8 * sizeof (unsigned long int)))); unsigned long int __word = (((__sig) - 1) / (8 * sizeof (unsigned long int))); return ((__set->__val[__word] &= ~__mask), 0); }
+typedef __sig_atomic_t sig_atomic_t;
+typedef union sigval
+ {
+ int sival_int;
+ void *sival_ptr;
+ } sigval_t;
+typedef struct
+ {
+ int si_signo;
+ int si_errno;
+ int si_code;
+ union
+ {
+ int _pad[((128 / sizeof (int)) - 3)];
+ struct
+ {
+ __pid_t si_pid;
+ __uid_t si_uid;
+ } _kill;
+ struct
+ {
+ int si_tid;
+ int si_overrun;
+ sigval_t si_sigval;
+ } _timer;
+ struct
+ {
+ __pid_t si_pid;
+ __uid_t si_uid;
+ sigval_t si_sigval;
+ } _rt;
+ struct
+ {
+ __pid_t si_pid;
+ __uid_t si_uid;
+ int si_status;
+ __clock_t si_utime;
+ __clock_t si_stime;
+ } _sigchld;
+ struct
+ {
+ void *si_addr;
+ } _sigfault;
+ struct
+ {
+ long int si_band;
+ int si_fd;
+ } _sigpoll;
+ struct
+ {
+ void *_call_addr;
+ int _syscall;
+ unsigned int _arch;
+ } _sigsys;
+ } _sifields;
+ } siginfo_t;
+enum
+{
+ SI_ASYNCNL = -60,
+ SI_TKILL = -6,
+ SI_SIGIO,
+ SI_ASYNCIO,
+ SI_MESGQ,
+ SI_TIMER,
+ SI_QUEUE,
+ SI_USER,
+ SI_KERNEL = 0x80
+};
+enum
+{
+ ILL_ILLOPC = 1,
+ ILL_ILLOPN,
+ ILL_ILLADR,
+ ILL_ILLTRP,
+ ILL_PRVOPC,
+ ILL_PRVREG,
+ ILL_COPROC,
+ ILL_BADSTK
+};
+enum
+{
+ FPE_INTDIV = 1,
+ FPE_INTOVF,
+ FPE_FLTDIV,
+ FPE_FLTOVF,
+ FPE_FLTUND,
+ FPE_FLTRES,
+ FPE_FLTINV,
+ FPE_FLTSUB
+};
+enum
+{
+ SEGV_MAPERR = 1,
+ SEGV_ACCERR
+};
+enum
+{
+ BUS_ADRALN = 1,
+ BUS_ADRERR,
+ BUS_OBJERR
+};
+enum
+{
+ TRAP_BRKPT = 1,
+ TRAP_TRACE
+};
+enum
+{
+ CLD_EXITED = 1,
+ CLD_KILLED,
+ CLD_DUMPED,
+ CLD_TRAPPED,
+ CLD_STOPPED,
+ CLD_CONTINUED
+};
+enum
+{
+ POLL_IN = 1,
+ POLL_OUT,
+ POLL_MSG,
+ POLL_ERR,
+ POLL_PRI,
+ POLL_HUP
+};
+typedef struct sigevent
+ {
+ sigval_t sigev_value;
+ int sigev_signo;
+ int sigev_notify;
+ union
+ {
+ int _pad[((64 / sizeof (int)) - 3)];
+ __pid_t _tid;
+ struct
+ {
+ void (*_function) (sigval_t);
+ pthread_attr_t *_attribute;
+ } _sigev_thread;
+ } _sigev_un;
+ } sigevent_t;
+enum
+{
+ SIGEV_SIGNAL = 0,
+ SIGEV_NONE,
+ SIGEV_THREAD,
+ SIGEV_THREAD_ID = 4
+};
+typedef void (*__sighandler_t) (int);
+extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern __sighandler_t signal (int __sig, __sighandler_t __handler)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern __sighandler_t bsd_signal (int __sig, __sighandler_t __handler)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int kill (__pid_t __pid, int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern int killpg (__pid_t __pgrp, int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern int raise (int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern __sighandler_t ssignal (int __sig, __sighandler_t __handler)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int gsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern void psignal (int __sig, const char *__s);
+extern void psiginfo (const siginfo_t *__pinfo, const char *__s);
+extern int __sigpause (int __sig_or_mask, int __is_sig);
+extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
+extern int sigblock (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int sigsetmask (int __mask) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int siggetmask (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+typedef __sighandler_t sighandler_t;
+typedef __sighandler_t sig_t;
+extern int sigemptyset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigfillset (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigaddset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigdelset (sigset_t *__set, int __signo) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigismember (const sigset_t *__set, int __signo)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigisemptyset (const sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigandset (sigset_t *__set, const sigset_t *__left,
+ const sigset_t *__right) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3)));
+extern int sigorset (sigset_t *__set, const sigset_t *__left,
+ const sigset_t *__right) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2, 3)));
+struct sigaction
+ {
+ union
+ {
+ __sighandler_t sa_handler;
+ void (*sa_sigaction) (int, siginfo_t *, void *);
+ }
+ __sigaction_handler;
+ unsigned long int sa_flags;
+ __sigset_t sa_mask;
+ };
+extern int sigprocmask (int __how, const sigset_t *__restrict __set,
+ sigset_t *__restrict __oset) __attribute__ ((__nothrow__ , __leaf__));
+extern int sigsuspend (const sigset_t *__set) __attribute__ ((__nonnull__ (1)));
+extern int sigaction (int __sig, const struct sigaction *__restrict __act,
+ struct sigaction *__restrict __oact) __attribute__ ((__nothrow__ , __leaf__));
+extern int sigpending (sigset_t *__set) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
+ __attribute__ ((__nonnull__ (1, 2)));
+extern int sigwaitinfo (const sigset_t *__restrict __set,
+ siginfo_t *__restrict __info) __attribute__ ((__nonnull__ (1)));
+extern int sigtimedwait (const sigset_t *__restrict __set,
+ siginfo_t *__restrict __info,
+ const struct timespec *__restrict __timeout)
+ __attribute__ ((__nonnull__ (1)));
+extern int sigqueue (__pid_t __pid, int __sig, const union sigval __val)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern const char *const _sys_siglist[65];
+extern const char *const sys_siglist[65];
+struct sigvec
+ {
+ __sighandler_t sv_handler;
+ int sv_mask;
+ int sv_flags;
+ };
+extern int sigvec (int __sig, const struct sigvec *__vec,
+ struct sigvec *__ovec) __attribute__ ((__nothrow__ , __leaf__));
+struct sigcontext {
+ unsigned long sc_flags;
+ unsigned long sc_gr[32];
+ unsigned long long sc_fr[32];
+ unsigned long sc_iasq[2];
+ unsigned long sc_iaoq[2];
+ unsigned long sc_sar;
+};
+extern int sigreturn (struct sigcontext *__scp) __attribute__ ((__nothrow__ , __leaf__));
+extern int siginterrupt (int __sig, int __interrupt) __attribute__ ((__nothrow__ , __leaf__));
+struct sigstack
+ {
+ void *ss_sp;
+ int ss_onstack;
+ };
+enum
+{
+ SS_ONSTACK = 1,
+ SS_DISABLE
+};
+typedef struct sigaltstack
+ {
+ void *ss_sp;
+ int ss_flags;
+ size_t ss_size;
+ } stack_t;
+typedef unsigned long int greg_t;
+typedef struct gregset
+ {
+ greg_t g_regs[32];
+ greg_t sr_regs[8];
+ greg_t cr_regs[24];
+ greg_t g_pad[16];
+ } gregset_t;
+typedef struct fpregset
+ {
+ double fp_dregs[32];
+ } fpregset_t;
+typedef struct sigcontext mcontext_t;
+typedef struct ucontext
+ {
+ unsigned long int uc_flags;
+ struct ucontext *uc_link;
+ stack_t uc_stack;
+ mcontext_t uc_mcontext;
+ __sigset_t uc_sigmask;
+ } ucontext_t;
+extern int sigstack (struct sigstack *__ss, struct sigstack *__oss)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__deprecated__));
+extern int sigaltstack (const struct sigaltstack *__restrict __ss,
+ struct sigaltstack *__restrict __oss) __attribute__ ((__nothrow__ , __leaf__));
+extern int sighold (int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern int sigrelse (int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern int sigignore (int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern __sighandler_t sigset (int __sig, __sighandler_t __disp) __attribute__ ((__nothrow__ , __leaf__));
+extern int pthread_sigmask (int __how,
+ const __sigset_t *__restrict __newmask,
+ __sigset_t *__restrict __oldmask)__attribute__ ((__nothrow__ , __leaf__));
+extern int pthread_kill (pthread_t __threadid, int __signo) __attribute__ ((__nothrow__ , __leaf__));
+extern int pthread_sigqueue (pthread_t __threadid, int __signo,
+ const union sigval __value) __attribute__ ((__nothrow__ , __leaf__));
+extern int __libc_current_sigrtmin (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int __libc_current_sigrtmax (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int *__errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern char *program_invocation_name, *program_invocation_short_name;
+typedef int error_t;
+struct timestamp
+ {
+ u_int8_t len;
+ u_int8_t ptr;
+ unsigned int overflow:4;
+ unsigned int flags:4;
+ u_int32_t data[9];
+ };
+struct iphdr
+ {
+ unsigned int version:4;
+ unsigned int ihl:4;
+ u_int8_t tos;
+ u_int16_t tot_len;
+ u_int16_t id;
+ u_int16_t frag_off;
+ u_int8_t ttl;
+ u_int8_t protocol;
+ u_int16_t check;
+ u_int32_t saddr;
+ u_int32_t daddr;
+ };
+struct ip
+ {
+ unsigned int ip_v:4;
+ unsigned int ip_hl:4;
+ u_int8_t ip_tos;
+ u_short ip_len;
+ u_short ip_id;
+ u_short ip_off;
+ u_int8_t ip_ttl;
+ u_int8_t ip_p;
+ u_short ip_sum;
+ struct in_addr ip_src, ip_dst;
+ };
+struct ip_timestamp
+ {
+ u_int8_t ipt_code;
+ u_int8_t ipt_len;
+ u_int8_t ipt_ptr;
+ unsigned int ipt_oflw:4;
+ unsigned int ipt_flg:4;
+ u_int32_t data[9];
+ };
+struct passwd
+{
+ char *pw_name;
+ char *pw_passwd;
+ __uid_t pw_uid;
+ __gid_t pw_gid;
+ char *pw_gecos;
+ char *pw_dir;
+ char *pw_shell;
+};
+struct _IO_FILE;
+typedef struct _IO_FILE FILE;
+extern void setpwent (void);
+extern void endpwent (void);
+extern struct passwd *getpwent (void);
+extern struct passwd *fgetpwent (FILE *__stream);
+extern int putpwent (const struct passwd *__restrict __p,
+ FILE *__restrict __f);
+extern struct passwd *getpwuid (__uid_t __uid);
+extern struct passwd *getpwnam (const char *__name);
+extern int getpwent_r (struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+extern int getpwuid_r (__uid_t __uid,
+ struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+extern int getpwnam_r (const char *__restrict __name,
+ struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+extern int fgetpwent_r (FILE *__restrict __stream,
+ struct passwd *__restrict __resultbuf,
+ char *__restrict __buffer, size_t __buflen,
+ struct passwd **__restrict __result);
+extern int getpw (__uid_t __uid, char *__buffer);
+void platform_pre_listen(void);
+void platform_pre_fork(void);
+void platform_pre_restart(void);
+void platform_post_fork_parent(pid_t child_pid);
+void platform_post_fork_child(void);
+int platform_privileged_uidswap(void);
+void platform_setusercontext(struct passwd *);
+void platform_setusercontext_post_groups(struct passwd *);
+char *platform_get_krb5_client(const char *);
+char *platform_krb5_get_principal_name(const char *);
+int platform_sys_dir_uid(uid_t);
+int b64_ntop(u_char const *src, size_t srclength, char *target,
+ size_t targsize);
+int b64_pton(char const *src, u_char *target, size_t targsize);
+struct stat;
+typedef struct {
+ int gl_pathc;
+ int gl_matchc;
+ int gl_offs;
+ int gl_flags;
+ char **gl_pathv;
+ struct stat **gl_statv;
+ int (*gl_errfunc)(const char *, int);
+ void (*gl_closedir)(void *);
+ struct dirent *(*gl_readdir)(void *);
+ void *(*gl_opendir)(const char *);
+ int (*gl_lstat)(const char *, struct stat *);
+ int (*gl_stat)(const char *, struct stat *);
+} glob_t;
+int glob(const char *, int, int (*)(const char *, int), glob_t *);
+void globfree(glob_t *);
+char * readpassphrase(const char *, char *, size_t, int);
+char *vis(char *, int, int, int);
+int strvis(char *, const char *, int);
+int strnvis(char *, const char *, size_t, int)
+ __attribute__ (());
+int strvisx(char *, const char *, size_t, int)
+ __attribute__ (());
+int strunvis(char *, const char *);
+int unvis(char *, char, int *, int);
+ssize_t strnunvis(char *, const char *, size_t)
+ __attribute__ (());
+typedef enum __ns_sect {
+ ns_s_qd = 0,
+ ns_s_zn = 0,
+ ns_s_an = 1,
+ ns_s_pr = 1,
+ ns_s_ns = 2,
+ ns_s_ud = 2,
+ ns_s_ar = 3,
+ ns_s_max = 4
+} ns_sect;
+typedef struct __ns_msg {
+ const u_char *_msg, *_eom;
+ u_int16_t _id, _flags, _counts[ns_s_max];
+ const u_char *_sections[ns_s_max];
+ ns_sect _sect;
+ int _rrnum;
+ const u_char *_msg_ptr;
+} ns_msg;
+struct _ns_flagdata { int mask, shift; };
+extern const struct _ns_flagdata _ns_flagdata[];
+typedef struct __ns_rr {
+ char name[1025];
+ u_int16_t type;
+ u_int16_t rr_class;
+ u_int32_t ttl;
+ u_int16_t rdlength;
+ const u_char * rdata;
+} ns_rr;
+typedef enum __ns_flag {
+ ns_f_qr,
+ ns_f_opcode,
+ ns_f_aa,
+ ns_f_tc,
+ ns_f_rd,
+ ns_f_ra,
+ ns_f_z,
+ ns_f_ad,
+ ns_f_cd,
+ ns_f_rcode,
+ ns_f_max
+} ns_flag;
+typedef enum __ns_opcode {
+ ns_o_query = 0,
+ ns_o_iquery = 1,
+ ns_o_status = 2,
+ ns_o_notify = 4,
+ ns_o_update = 5,
+ ns_o_max = 6
+} ns_opcode;
+typedef enum __ns_rcode {
+ ns_r_noerror = 0,
+ ns_r_formerr = 1,
+ ns_r_servfail = 2,
+ ns_r_nxdomain = 3,
+ ns_r_notimpl = 4,
+ ns_r_refused = 5,
+ ns_r_yxdomain = 6,
+ ns_r_yxrrset = 7,
+ ns_r_nxrrset = 8,
+ ns_r_notauth = 9,
+ ns_r_notzone = 10,
+ ns_r_max = 11,
+ ns_r_badvers = 16,
+ ns_r_badsig = 16,
+ ns_r_badkey = 17,
+ ns_r_badtime = 18
+} ns_rcode;
+typedef enum __ns_update_operation {
+ ns_uop_delete = 0,
+ ns_uop_add = 1,
+ ns_uop_max = 2
+} ns_update_operation;
+struct ns_tsig_key {
+ char name[1025], alg[1025];
+ unsigned char *data;
+ int len;
+};
+typedef struct ns_tsig_key ns_tsig_key;
+struct ns_tcp_tsig_state {
+ int counter;
+ struct dst_key *key;
+ void *ctx;
+ unsigned char sig[512];
+ int siglen;
+};
+typedef struct ns_tcp_tsig_state ns_tcp_tsig_state;
+typedef enum __ns_type {
+ ns_t_invalid = 0,
+ ns_t_a = 1,
+ ns_t_ns = 2,
+ ns_t_md = 3,
+ ns_t_mf = 4,
+ ns_t_cname = 5,
+ ns_t_soa = 6,
+ ns_t_mb = 7,
+ ns_t_mg = 8,
+ ns_t_mr = 9,
+ ns_t_null = 10,
+ ns_t_wks = 11,
+ ns_t_ptr = 12,
+ ns_t_hinfo = 13,
+ ns_t_minfo = 14,
+ ns_t_mx = 15,
+ ns_t_txt = 16,
+ ns_t_rp = 17,
+ ns_t_afsdb = 18,
+ ns_t_x25 = 19,
+ ns_t_isdn = 20,
+ ns_t_rt = 21,
+ ns_t_nsap = 22,
+ ns_t_nsap_ptr = 23,
+ ns_t_sig = 24,
+ ns_t_key = 25,
+ ns_t_px = 26,
+ ns_t_gpos = 27,
+ ns_t_aaaa = 28,
+ ns_t_loc = 29,
+ ns_t_nxt = 30,
+ ns_t_eid = 31,
+ ns_t_nimloc = 32,
+ ns_t_srv = 33,
+ ns_t_atma = 34,
+ ns_t_naptr = 35,
+ ns_t_kx = 36,
+ ns_t_cert = 37,
+ ns_t_a6 = 38,
+ ns_t_dname = 39,
+ ns_t_sink = 40,
+ ns_t_opt = 41,
+ ns_t_apl = 42,
+ ns_t_tkey = 249,
+ ns_t_tsig = 250,
+ ns_t_ixfr = 251,
+ ns_t_axfr = 252,
+ ns_t_mailb = 253,
+ ns_t_maila = 254,
+ ns_t_any = 255,
+ ns_t_zxfr = 256,
+ ns_t_max = 65536
+} ns_type;
+typedef enum __ns_class {
+ ns_c_invalid = 0,
+ ns_c_in = 1,
+ ns_c_2 = 2,
+ ns_c_chaos = 3,
+ ns_c_hs = 4,
+ ns_c_none = 254,
+ ns_c_any = 255,
+ ns_c_max = 65536
+} ns_class;
+typedef enum __ns_key_types {
+ ns_kt_rsa = 1,
+ ns_kt_dh = 2,
+ ns_kt_dsa = 3,
+ ns_kt_private = 254
+} ns_key_types;
+typedef enum __ns_cert_types {
+ cert_t_pkix = 1,
+ cert_t_spki = 2,
+ cert_t_pgp = 3,
+ cert_t_url = 253,
+ cert_t_oid = 254
+} ns_cert_types;
+int ns_msg_getflag (ns_msg, int) __attribute__ ((__nothrow__ , __leaf__));
+u_int ns_get16 (const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+u_long ns_get32 (const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+void ns_put16 (u_int, u_char *) __attribute__ ((__nothrow__ , __leaf__));
+void ns_put32 (u_long, u_char *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_initparse (const u_char *, int, ns_msg *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_skiprr (const u_char *, const u_char *, ns_sect, int)
+ __attribute__ ((__nothrow__ , __leaf__));
+int ns_parserr (ns_msg *, ns_sect, int, ns_rr *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_sprintrr (const ns_msg *, const ns_rr *,
+ const char *, const char *, char *, size_t)
+ __attribute__ ((__nothrow__ , __leaf__));
+int ns_sprintrrf (const u_char *, size_t, const char *,
+ ns_class, ns_type, u_long, const u_char *,
+ size_t, const char *, const char *,
+ char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_format_ttl (u_long, char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_parse_ttl (const char *, u_long *) __attribute__ ((__nothrow__ , __leaf__));
+u_int32_t ns_datetosecs (const char *, int *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_ntol (const u_char *, u_char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_ntop (const u_char *, char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_pton (const char *, u_char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_unpack (const u_char *, const u_char *,
+ const u_char *, u_char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_pack (const u_char *, u_char *, int,
+ const u_char **, const u_char **) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_uncompress (const u_char *, const u_char *,
+ const u_char *, char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_compress (const char *, u_char *, size_t,
+ const u_char **, const u_char **) __attribute__ ((__nothrow__ , __leaf__));
+int ns_name_skip (const u_char **, const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+void ns_name_rollback (const u_char *, const u_char **,
+ const u_char **) __attribute__ ((__nothrow__ , __leaf__));
+int ns_sign (u_char *, int *, int, int, void *,
+ const u_char *, int, u_char *, int *, time_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_sign2 (u_char *, int *, int, int, void *,
+ const u_char *, int, u_char *, int *, time_t,
+ u_char **, u_char **) __attribute__ ((__nothrow__ , __leaf__));
+int ns_sign_tcp (u_char *, int *, int, int,
+ ns_tcp_tsig_state *, int) __attribute__ ((__nothrow__ , __leaf__));
+int ns_sign_tcp2 (u_char *, int *, int, int,
+ ns_tcp_tsig_state *, int,
+ u_char **, u_char **) __attribute__ ((__nothrow__ , __leaf__));
+int ns_sign_tcp_init (void *, const u_char *, int,
+ ns_tcp_tsig_state *) __attribute__ ((__nothrow__ , __leaf__));
+u_char *ns_find_tsig (u_char *, u_char *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_verify (u_char *, int *, void *, const u_char *, int,
+ u_char *, int *, time_t *, int) __attribute__ ((__nothrow__ , __leaf__));
+int ns_verify_tcp (u_char *, int *, ns_tcp_tsig_state *, int)
+ __attribute__ ((__nothrow__ , __leaf__));
+int ns_verify_tcp_init (void *, const u_char *, int,
+ ns_tcp_tsig_state *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_samedomain (const char *, const char *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_subdomain (const char *, const char *) __attribute__ ((__nothrow__ , __leaf__));
+int ns_makecanon (const char *, char *, size_t) __attribute__ ((__nothrow__ , __leaf__));
+int ns_samename (const char *, const char *) __attribute__ ((__nothrow__ , __leaf__));
+typedef struct {
+ unsigned id :16;
+ unsigned qr: 1;
+ unsigned opcode: 4;
+ unsigned aa: 1;
+ unsigned tc: 1;
+ unsigned rd: 1;
+ unsigned ra: 1;
+ unsigned unused :1;
+ unsigned ad: 1;
+ unsigned cd: 1;
+ unsigned rcode :4;
+ unsigned qdcount :16;
+ unsigned ancount :16;
+ unsigned nscount :16;
+ unsigned arcount :16;
+} HEADER;
+struct rpcent
+{
+ char *r_name;
+ char **r_aliases;
+ int r_number;
+};
+extern void setrpcent (int __stayopen) __attribute__ ((__nothrow__ , __leaf__));
+extern void endrpcent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern struct rpcent *getrpcbyname (const char *__name) __attribute__ ((__nothrow__ , __leaf__));
+extern struct rpcent *getrpcbynumber (int __number) __attribute__ ((__nothrow__ , __leaf__));
+extern struct rpcent *getrpcent (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int getrpcbyname_r (const char *__name, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result) __attribute__ ((__nothrow__ , __leaf__));
+extern int getrpcbynumber_r (int __number, struct rpcent *__result_buf,
+ char *__buffer, size_t __buflen,
+ struct rpcent **__result) __attribute__ ((__nothrow__ , __leaf__));
+extern int getrpcent_r (struct rpcent *__result_buf, char *__buffer,
+ size_t __buflen, struct rpcent **__result) __attribute__ ((__nothrow__ , __leaf__));
+struct netent
+{
+ char *n_name;
+ char **n_aliases;
+ int n_addrtype;
+ uint32_t n_net;
+};
+extern int *__h_errno_location (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern void herror (const char *__str) __attribute__ ((__nothrow__ , __leaf__));
+extern const char *hstrerror (int __err_num) __attribute__ ((__nothrow__ , __leaf__));
+struct hostent
+{
+ char *h_name;
+ char **h_aliases;
+ int h_addrtype;
+ int h_length;
+ char **h_addr_list;
+};
+extern void sethostent (int __stay_open);
+extern void endhostent (void);
+extern struct hostent *gethostent (void);
+extern struct hostent *gethostbyaddr (const void *__addr, __socklen_t __len,
+ int __type);
+extern struct hostent *gethostbyname (const char *__name);
+extern struct hostent *gethostbyname2 (const char *__name, int __af);
+extern int gethostent_r (struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
+extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
+ int __type,
+ struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
+extern int gethostbyname_r (const char *__restrict __name,
+ struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
+extern int gethostbyname2_r (const char *__restrict __name, int __af,
+ struct hostent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct hostent **__restrict __result,
+ int *__restrict __h_errnop);
+extern void setnetent (int __stay_open);
+extern void endnetent (void);
+extern struct netent *getnetent (void);
+extern struct netent *getnetbyaddr (uint32_t __net, int __type);
+extern struct netent *getnetbyname (const char *__name);
+extern int getnetent_r (struct netent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct netent **__restrict __result,
+ int *__restrict __h_errnop);
+extern int getnetbyaddr_r (uint32_t __net, int __type,
+ struct netent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct netent **__restrict __result,
+ int *__restrict __h_errnop);
+extern int getnetbyname_r (const char *__restrict __name,
+ struct netent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct netent **__restrict __result,
+ int *__restrict __h_errnop);
+struct servent
+{
+ char *s_name;
+ char **s_aliases;
+ int s_port;
+ char *s_proto;
+};
+extern void setservent (int __stay_open);
+extern void endservent (void);
+extern struct servent *getservent (void);
+extern struct servent *getservbyname (const char *__name, const char *__proto);
+extern struct servent *getservbyport (int __port, const char *__proto);
+extern int getservent_r (struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct servent **__restrict __result);
+extern int getservbyname_r (const char *__restrict __name,
+ const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct servent **__restrict __result);
+extern int getservbyport_r (int __port, const char *__restrict __proto,
+ struct servent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct servent **__restrict __result);
+struct protoent
+{
+ char *p_name;
+ char **p_aliases;
+ int p_proto;
+};
+extern void setprotoent (int __stay_open);
+extern void endprotoent (void);
+extern struct protoent *getprotoent (void);
+extern struct protoent *getprotobyname (const char *__name);
+extern struct protoent *getprotobynumber (int __proto);
+extern int getprotoent_r (struct protoent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct protoent **__restrict __result);
+extern int getprotobyname_r (const char *__restrict __name,
+ struct protoent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct protoent **__restrict __result);
+extern int getprotobynumber_r (int __proto,
+ struct protoent *__restrict __result_buf,
+ char *__restrict __buf, size_t __buflen,
+ struct protoent **__restrict __result);
+extern int setnetgrent (const char *__netgroup);
+extern void endnetgrent (void);
+extern int getnetgrent (char **__restrict __hostp,
+ char **__restrict __userp,
+ char **__restrict __domainp);
+extern int innetgr (const char *__netgroup, const char *__host,
+ const char *__user, const char *__domain);
+extern int getnetgrent_r (char **__restrict __hostp,
+ char **__restrict __userp,
+ char **__restrict __domainp,
+ char *__restrict __buffer, size_t __buflen);
+extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
+ const char *__restrict __locuser,
+ const char *__restrict __remuser,
+ const char *__restrict __cmd, int *__restrict __fd2p);
+extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
+ const char *__restrict __locuser,
+ const char *__restrict __remuser,
+ const char *__restrict __cmd, int *__restrict __fd2p,
+ sa_family_t __af);
+extern int rexec (char **__restrict __ahost, int __rport,
+ const char *__restrict __name,
+ const char *__restrict __pass,
+ const char *__restrict __cmd, int *__restrict __fd2p);
+extern int rexec_af (char **__restrict __ahost, int __rport,
+ const char *__restrict __name,
+ const char *__restrict __pass,
+ const char *__restrict __cmd, int *__restrict __fd2p,
+ sa_family_t __af);
+extern int ruserok (const char *__rhost, int __suser,
+ const char *__remuser, const char *__locuser);
+extern int ruserok_af (const char *__rhost, int __suser,
+ const char *__remuser, const char *__locuser,
+ sa_family_t __af);
+extern int iruserok (uint32_t __raddr, int __suser,
+ const char *__remuser, const char *__locuser);
+extern int iruserok_af (const void *__raddr, int __suser,
+ const char *__remuser, const char *__locuser,
+ sa_family_t __af);
+extern int rresvport (int *__alport);
+extern int rresvport_af (int *__alport, sa_family_t __af);
+struct addrinfo
+{
+ int ai_flags;
+ int ai_family;
+ int ai_socktype;
+ int ai_protocol;
+ socklen_t ai_addrlen;
+ struct sockaddr *ai_addr;
+ char *ai_canonname;
+ struct addrinfo *ai_next;
+};
+struct gaicb
+{
+ const char *ar_name;
+ const char *ar_service;
+ const struct addrinfo *ar_request;
+ struct addrinfo *ar_result;
+ int __return;
+ int __unused[5];
+};
+extern int getaddrinfo (const char *__restrict __name,
+ const char *__restrict __service,
+ const struct addrinfo *__restrict __req,
+ struct addrinfo **__restrict __pai);
+extern void freeaddrinfo (struct addrinfo *__ai) __attribute__ ((__nothrow__ , __leaf__));
+extern const char *gai_strerror (int __ecode) __attribute__ ((__nothrow__ , __leaf__));
+extern int getnameinfo (const struct sockaddr *__restrict __sa,
+ socklen_t __salen, char *__restrict __host,
+ socklen_t __hostlen, char *__restrict __serv,
+ socklen_t __servlen, int __flags);
+extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict],
+ int __ent, struct sigevent *__restrict __sig);
+extern int gai_suspend (const struct gaicb *const __list[], int __ent,
+ const struct timespec *__timeout);
+extern int gai_error (struct gaicb *__req) __attribute__ ((__nothrow__ , __leaf__));
+extern int gai_cancel (struct gaicb *__gaicbp) __attribute__ ((__nothrow__ , __leaf__));
+typedef struct _IO_FILE __FILE;
+typedef struct
+{
+ int __count;
+ union
+ {
+ unsigned int __wch;
+ char __wchb[4];
+ } __value;
+} __mbstate_t;
+typedef struct
+{
+ __off_t __pos;
+ __mbstate_t __state;
+} _G_fpos_t;
+typedef struct
+{
+ __off64_t __pos;
+ __mbstate_t __state;
+} _G_fpos64_t;
+typedef __builtin_va_list __gnuc_va_list;
+struct _IO_jump_t; struct _IO_FILE;
+typedef void _IO_lock_t;
+struct _IO_marker {
+ struct _IO_marker *_next;
+ struct _IO_FILE *_sbuf;
+ int _pos;
+};
+enum __codecvt_result
+{
+ __codecvt_ok,
+ __codecvt_partial,
+ __codecvt_error,
+ __codecvt_noconv
+};
+struct _IO_FILE {
+ int _flags;
+ char* _IO_read_ptr;
+ char* _IO_read_end;
+ char* _IO_read_base;
+ char* _IO_write_base;
+ char* _IO_write_ptr;
+ char* _IO_write_end;
+ char* _IO_buf_base;
+ char* _IO_buf_end;
+ char *_IO_save_base;
+ char *_IO_backup_base;
+ char *_IO_save_end;
+ struct _IO_marker *_markers;
+ struct _IO_FILE *_chain;
+ int _fileno;
+ int _flags2;
+ __off_t _old_offset;
+ unsigned short _cur_column;
+ signed char _vtable_offset;
+ char _shortbuf[1];
+ _IO_lock_t *_lock;
+ __off64_t _offset;
+ void *__pad1;
+ void *__pad2;
+ void *__pad3;
+ void *__pad4;
+ size_t __pad5;
+ int _mode;
+ char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
+};
+typedef struct _IO_FILE _IO_FILE;
+struct _IO_FILE_plus;
+extern struct _IO_FILE_plus _IO_2_1_stdin_;
+extern struct _IO_FILE_plus _IO_2_1_stdout_;
+extern struct _IO_FILE_plus _IO_2_1_stderr_;
+typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
+typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf,
+ size_t __n);
+typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);
+typedef int __io_close_fn (void *__cookie);
+typedef __io_read_fn cookie_read_function_t;
+typedef __io_write_fn cookie_write_function_t;
+typedef __io_seek_fn cookie_seek_function_t;
+typedef __io_close_fn cookie_close_function_t;
+typedef struct
+{
+ __io_read_fn *read;
+ __io_write_fn *write;
+ __io_seek_fn *seek;
+ __io_close_fn *close;
+} _IO_cookie_io_functions_t;
+typedef _IO_cookie_io_functions_t cookie_io_functions_t;
+struct _IO_cookie_file;
+extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
+ void *__cookie, _IO_cookie_io_functions_t __fns);
+extern int __underflow (_IO_FILE *);
+extern int __uflow (_IO_FILE *);
+extern int __overflow (_IO_FILE *, int);
+extern int _IO_getc (_IO_FILE *__fp);
+extern int _IO_putc (int __c, _IO_FILE *__fp);
+extern int _IO_feof (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
+extern int _IO_ferror (_IO_FILE *__fp) __attribute__ ((__nothrow__ , __leaf__));
+extern int _IO_peekc_locked (_IO_FILE *__fp);
+extern void _IO_flockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
+extern void _IO_funlockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
+extern int _IO_ftrylockfile (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
+extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
+ __gnuc_va_list, int *__restrict);
+extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
+ __gnuc_va_list);
+extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t);
+extern size_t _IO_sgetn (_IO_FILE *, void *, size_t);
+extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int);
+extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int);
+extern void _IO_free_backup_area (_IO_FILE *) __attribute__ ((__nothrow__ , __leaf__));
+typedef __gnuc_va_list va_list;
+typedef _G_fpos64_t fpos_t;
+typedef _G_fpos64_t fpos64_t;
+extern struct _IO_FILE *stdin;
+extern struct _IO_FILE *stdout;
+extern struct _IO_FILE *stderr;
+extern int remove (const char *__filename) __attribute__ ((__nothrow__ , __leaf__));
+extern int rename (const char *__old, const char *__new) __attribute__ ((__nothrow__ , __leaf__));
+extern int renameat (int __oldfd, const char *__old, int __newfd,
+ const char *__new) __attribute__ ((__nothrow__ , __leaf__));
+extern FILE *tmpfile (void) __asm__ ("" "tmpfile64") __attribute__ ((__warn_unused_result__));
+extern FILE *tmpfile64 (void) __attribute__ ((__warn_unused_result__));
+extern char *tmpnam (char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern char *tmpnam_r (char *__s) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern char *tempnam (const char *__dir, const char *__pfx)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__warn_unused_result__));
+extern int fclose (FILE *__stream);
+extern int fflush (FILE *__stream);
+extern int fflush_unlocked (FILE *__stream);
+extern int fcloseall (void);
+extern FILE *fopen (const char *__restrict __filename, const char *__restrict __modes) __asm__ ("" "fopen64")
+ __attribute__ ((__warn_unused_result__));
+extern FILE *freopen (const char *__restrict __filename, const char *__restrict __modes, FILE *__restrict __stream) __asm__ ("" "freopen64")
+ __attribute__ ((__warn_unused_result__));
+extern FILE *fopen64 (const char *__restrict __filename,
+ const char *__restrict __modes) __attribute__ ((__warn_unused_result__));
+extern FILE *freopen64 (const char *__restrict __filename,
+ const char *__restrict __modes,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern FILE *fdopen (int __fd, const char *__modes) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern FILE *fopencookie (void *__restrict __magic_cookie,
+ const char *__restrict __modes,
+ _IO_cookie_io_functions_t __io_funcs) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern FILE *fmemopen (void *__s, size_t __len, const char *__modes)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
+extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
+ int __modes, size_t __n) __attribute__ ((__nothrow__ , __leaf__));
+extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
+ size_t __size) __attribute__ ((__nothrow__ , __leaf__));
+extern void setlinebuf (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
+extern int fprintf (FILE *__restrict __stream,
+ const char *__restrict __format, ...);
+extern int printf (const char *__restrict __format, ...);
+extern int sprintf (char *__restrict __s,
+ const char *__restrict __format, ...) __attribute__ ((__nothrow__));
+extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
+ __gnuc_va_list __arg);
+extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
+extern int vsprintf (char *__restrict __s, const char *__restrict __format,
+ __gnuc_va_list __arg) __attribute__ ((__nothrow__));
+extern int snprintf (char *__restrict __s, size_t __maxlen,
+ const char *__restrict __format, ...)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int vsnprintf (char *__restrict __s, size_t __maxlen,
+ const char *__restrict __format, __gnuc_va_list __arg)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 3, 0)));
+extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
+ __gnuc_va_list __arg)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0))) __attribute__ ((__warn_unused_result__));
+extern int __asprintf (char **__restrict __ptr,
+ const char *__restrict __fmt, ...)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) __attribute__ ((__warn_unused_result__));
+extern int asprintf (char **__restrict __ptr,
+ const char *__restrict __fmt, ...)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3))) __attribute__ ((__warn_unused_result__));
+extern int vdprintf (int __fd, const char *__restrict __fmt,
+ __gnuc_va_list __arg)
+ __attribute__ ((__format__ (__printf__, 2, 0)));
+extern int dprintf (int __fd, const char *__restrict __fmt, ...)
+ __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int fscanf (FILE *__restrict __stream,
+ const char *__restrict __format, ...) __attribute__ ((__warn_unused_result__));
+extern int scanf (const char *__restrict __format, ...) __attribute__ ((__warn_unused_result__));
+extern int sscanf (const char *__restrict __s,
+ const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
+extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
+ __gnuc_va_list __arg)
+ __attribute__ ((__format__ (__scanf__, 2, 0))) __attribute__ ((__warn_unused_result__));
+extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
+ __attribute__ ((__format__ (__scanf__, 1, 0))) __attribute__ ((__warn_unused_result__));
+extern int vsscanf (const char *__restrict __s,
+ const char *__restrict __format, __gnuc_va_list __arg)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__scanf__, 2, 0)));
+extern int fgetc (FILE *__stream);
+extern int getc (FILE *__stream);
+extern int getchar (void);
+extern int getc_unlocked (FILE *__stream);
+extern int getchar_unlocked (void);
+extern int fgetc_unlocked (FILE *__stream);
+extern int fputc (int __c, FILE *__stream);
+extern int putc (int __c, FILE *__stream);
+extern int putchar (int __c);
+extern int fputc_unlocked (int __c, FILE *__stream);
+extern int putc_unlocked (int __c, FILE *__stream);
+extern int putchar_unlocked (int __c);
+extern int getw (FILE *__stream);
+extern int putw (int __w, FILE *__stream);
+extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+ __attribute__ ((__warn_unused_result__));
+extern char *fgets_unlocked (char *__restrict __s, int __n,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern __ssize_t __getdelim (char **__restrict __lineptr,
+ size_t *__restrict __n, int __delimiter,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern __ssize_t getdelim (char **__restrict __lineptr,
+ size_t *__restrict __n, int __delimiter,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern __ssize_t getline (char **__restrict __lineptr,
+ size_t *__restrict __n,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
+extern int puts (const char *__s);
+extern int ungetc (int __c, FILE *__stream);
+extern size_t fread (void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern size_t fwrite (const void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __s);
+extern int fputs_unlocked (const char *__restrict __s,
+ FILE *__restrict __stream);
+extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
+ size_t __n, FILE *__restrict __stream);
+extern int fseek (FILE *__stream, long int __off, int __whence);
+extern long int ftell (FILE *__stream) __attribute__ ((__warn_unused_result__));
+extern void rewind (FILE *__stream);
+extern int fseeko (FILE *__stream, __off64_t __off, int __whence) __asm__ ("" "fseeko64")
+ ;
+extern __off64_t ftello (FILE *__stream) __asm__ ("" "ftello64");
+extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos) __asm__ ("" "fgetpos64")
+ ;
+extern int fsetpos (FILE *__stream, const fpos_t *__pos) __asm__ ("" "fsetpos64")
+ ;
+extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
+extern __off64_t ftello64 (FILE *__stream) __attribute__ ((__warn_unused_result__));
+extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
+extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
+extern void clearerr (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
+extern int feof (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int ferror (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void clearerr_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
+extern int feof_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int ferror_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void perror (const char *__s);
+extern int sys_nerr;
+extern const char *const sys_errlist[];
+extern int _sys_nerr;
+extern const char *const _sys_errlist[];
+extern int fileno (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int fileno_unlocked (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern FILE *popen (const char *__command, const char *__modes) __attribute__ ((__warn_unused_result__));
+extern int pclose (FILE *__stream);
+extern char *ctermid (char *__s) __attribute__ ((__nothrow__ , __leaf__));
+extern char *cuserid (char *__s);
+struct obstack;
+extern int obstack_printf (struct obstack *__restrict __obstack,
+ const char *__restrict __format, ...)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 3)));
+extern int obstack_vprintf (struct obstack *__restrict __obstack,
+ const char *__restrict __format,
+ __gnuc_va_list __args)
+ __attribute__ ((__nothrow__)) __attribute__ ((__format__ (__printf__, 2, 0)));
+extern void flockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
+extern int ftrylockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void funlockfile (FILE *__stream) __attribute__ ((__nothrow__ , __leaf__));
+extern __inline int
+getchar (void)
+{
+ return _IO_getc (stdin);
+}
+extern __inline int
+fgetc_unlocked (FILE *__fp)
+{
+ return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
+}
+extern __inline int
+getc_unlocked (FILE *__fp)
+{
+ return (__builtin_expect (((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end), 0) ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
+}
+extern __inline int
+getchar_unlocked (void)
+{
+ return (__builtin_expect (((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end), 0) ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
+}
+extern __inline int
+putchar (int __c)
+{
+ return _IO_putc (__c, stdout);
+}
+extern __inline int
+fputc_unlocked (int __c, FILE *__stream)
+{
+ return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
+}
+extern __inline int
+putc_unlocked (int __c, FILE *__stream)
+{
+ return (__builtin_expect (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end), 0) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
+}
+extern __inline int
+putchar_unlocked (int __c)
+{
+ return (__builtin_expect (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end), 0) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
+}
+extern __inline __ssize_t
+getline (char **__lineptr, size_t *__n, FILE *__stream)
+{
+ return __getdelim (__lineptr, __n, '\n', __stream);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) feof_unlocked (FILE *__stream)
+{
+ return (((__stream)->_flags & 0x10) != 0);
+}
+extern __inline int
+__attribute__ ((__nothrow__ , __leaf__)) ferror_unlocked (FILE *__stream)
+{
+ return (((__stream)->_flags & 0x20) != 0);
+}
+extern int __sprintf_chk (char *__restrict __s, int __flag, size_t __slen,
+ const char *__restrict __format, ...) __attribute__ ((__nothrow__ , __leaf__));
+extern int __vsprintf_chk (char *__restrict __s, int __flag, size_t __slen,
+ const char *__restrict __format,
+ __gnuc_va_list __ap) __attribute__ ((__nothrow__ , __leaf__));
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) sprintf (char *__restrict __s, const char *__restrict __fmt, ...)
+{
+ return __builtin___sprintf_chk (__s, 2 - 1,
+ __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) vsprintf (char *__restrict __s, const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __builtin___vsprintf_chk (__s, 2 - 1,
+ __builtin_object_size (__s, 2 > 1), __fmt, __ap);
+}
+extern int __snprintf_chk (char *__restrict __s, size_t __n, int __flag,
+ size_t __slen, const char *__restrict __format,
+ ...) __attribute__ ((__nothrow__ , __leaf__));
+extern int __vsnprintf_chk (char *__restrict __s, size_t __n, int __flag,
+ size_t __slen, const char *__restrict __format,
+ __gnuc_va_list __ap) __attribute__ ((__nothrow__ , __leaf__));
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) snprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, ...)
+{
+ return __builtin___snprintf_chk (__s, __n, 2 - 1,
+ __builtin_object_size (__s, 2 > 1), __fmt, __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) vsnprintf (char *__restrict __s, size_t __n, const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __builtin___vsnprintf_chk (__s, __n, 2 - 1,
+ __builtin_object_size (__s, 2 > 1), __fmt, __ap);
+}
+extern int __fprintf_chk (FILE *__restrict __stream, int __flag,
+ const char *__restrict __format, ...);
+extern int __printf_chk (int __flag, const char *__restrict __format, ...);
+extern int __vfprintf_chk (FILE *__restrict __stream, int __flag,
+ const char *__restrict __format, __gnuc_va_list __ap);
+extern int __vprintf_chk (int __flag, const char *__restrict __format,
+ __gnuc_va_list __ap);
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
+{
+ return __fprintf_chk (__stream, 2 - 1, __fmt,
+ __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+printf (const char *__restrict __fmt, ...)
+{
+ return __printf_chk (2 - 1, __fmt, __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+vprintf (const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __vfprintf_chk (stdout, 2 - 1, __fmt, __ap);
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+vfprintf (FILE *__restrict __stream,
+ const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __vfprintf_chk (__stream, 2 - 1, __fmt, __ap);
+}
+extern int __dprintf_chk (int __fd, int __flag, const char *__restrict __fmt,
+ ...) __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __vdprintf_chk (int __fd, int __flag,
+ const char *__restrict __fmt, __gnuc_va_list __arg)
+ __attribute__ ((__format__ (__printf__, 3, 0)));
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+dprintf (int __fd, const char *__restrict __fmt, ...)
+{
+ return __dprintf_chk (__fd, 2 - 1, __fmt,
+ __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __vdprintf_chk (__fd, 2 - 1, __fmt, __ap);
+}
+extern int __asprintf_chk (char **__restrict __ptr, int __flag,
+ const char *__restrict __fmt, ...)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__printf__, 3, 4))) __attribute__ ((__warn_unused_result__));
+extern int __vasprintf_chk (char **__restrict __ptr, int __flag,
+ const char *__restrict __fmt, __gnuc_va_list __arg)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__printf__, 3, 0))) __attribute__ ((__warn_unused_result__));
+extern int __obstack_printf_chk (struct obstack *__restrict __obstack,
+ int __flag, const char *__restrict __format,
+ ...)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__printf__, 3, 4)));
+extern int __obstack_vprintf_chk (struct obstack *__restrict __obstack,
+ int __flag,
+ const char *__restrict __format,
+ __gnuc_va_list __args)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__format__ (__printf__, 3, 0)));
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)
+{
+ return __asprintf_chk (__ptr, 2 - 1, __fmt,
+ __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) __asprintf (char **__restrict __ptr, const char *__restrict __fmt, ...)
+{
+ return __asprintf_chk (__ptr, 2 - 1, __fmt,
+ __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) obstack_printf (struct obstack *__restrict __obstack, const char *__restrict __fmt, ...)
+{
+ return __obstack_printf_chk (__obstack, 2 - 1, __fmt,
+ __builtin_va_arg_pack ());
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) vasprintf (char **__restrict __ptr, const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __vasprintf_chk (__ptr, 2 - 1, __fmt, __ap);
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) obstack_vprintf (struct obstack *__restrict __obstack, const char *__restrict __fmt, __gnuc_va_list __ap)
+{
+ return __obstack_vprintf_chk (__obstack, 2 - 1, __fmt,
+ __ap);
+}
+extern char *__fgets_chk (char *__restrict __s, size_t __size, int __n,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern char *__fgets_alias (char *__restrict __s, int __n, FILE *__restrict __stream) __asm__ ("" "fgets")
+ __attribute__ ((__warn_unused_result__));
+extern char *__fgets_chk_warn (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __asm__ ("" "__fgets_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fgets called with bigger size than length " "of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
+fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
+{
+ if (__builtin_object_size (__s, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__n) || __n <= 0)
+ return __fgets_chk (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
+ if ((size_t) __n > __builtin_object_size (__s, 2 > 1))
+ return __fgets_chk_warn (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
+ }
+ return __fgets_alias (__s, __n, __stream);
+}
+extern size_t __fread_chk (void *__restrict __ptr, size_t __ptrlen,
+ size_t __size, size_t __n,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern size_t __fread_alias (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "fread")
+ __attribute__ ((__warn_unused_result__));
+extern size_t __fread_chk_warn (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fread called with bigger size * nmemb than length " "of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) size_t
+fread (void *__restrict __ptr, size_t __size, size_t __n,
+ FILE *__restrict __stream)
+{
+ if (__builtin_object_size (__ptr, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__size)
+ || !__builtin_constant_p (__n)
+ || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
+ return __fread_chk (__ptr, __builtin_object_size (__ptr, 0), __size, __n, __stream);
+ if (__size * __n > __builtin_object_size (__ptr, 0))
+ return __fread_chk_warn (__ptr, __builtin_object_size (__ptr, 0), __size, __n, __stream);
+ }
+ return __fread_alias (__ptr, __size, __n, __stream);
+}
+extern char *__fgets_unlocked_chk (char *__restrict __s, size_t __size,
+ int __n, FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern char *__fgets_unlocked_alias (char *__restrict __s, int __n, FILE *__restrict __stream) __asm__ ("" "fgets_unlocked")
+ __attribute__ ((__warn_unused_result__));
+extern char *__fgets_unlocked_chk_warn (char *__restrict __s, size_t __size, int __n, FILE *__restrict __stream) __asm__ ("" "__fgets_unlocked_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fgets_unlocked called with bigger size than length " "of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
+fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream)
+{
+ if (__builtin_object_size (__s, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__n) || __n <= 0)
+ return __fgets_unlocked_chk (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
+ if ((size_t) __n > __builtin_object_size (__s, 2 > 1))
+ return __fgets_unlocked_chk_warn (__s, __builtin_object_size (__s, 2 > 1), __n, __stream);
+ }
+ return __fgets_unlocked_alias (__s, __n, __stream);
+}
+extern size_t __fread_unlocked_chk (void *__restrict __ptr, size_t __ptrlen,
+ size_t __size, size_t __n,
+ FILE *__restrict __stream) __attribute__ ((__warn_unused_result__));
+extern size_t __fread_unlocked_alias (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "fread_unlocked")
+ __attribute__ ((__warn_unused_result__));
+extern size_t __fread_unlocked_chk_warn (void *__restrict __ptr, size_t __ptrlen, size_t __size, size_t __n, FILE *__restrict __stream) __asm__ ("" "__fread_unlocked_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("fread_unlocked called with bigger size * nmemb than " "length of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) size_t
+fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n,
+ FILE *__restrict __stream)
+{
+ if (__builtin_object_size (__ptr, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__size)
+ || !__builtin_constant_p (__n)
+ || (__size | __n) >= (((size_t) 1) << (8 * sizeof (size_t) / 2)))
+ return __fread_unlocked_chk (__ptr, __builtin_object_size (__ptr, 0), __size, __n,
+ __stream);
+ if (__size * __n > __builtin_object_size (__ptr, 0))
+ return __fread_unlocked_chk_warn (__ptr, __builtin_object_size (__ptr, 0), __size, __n,
+ __stream);
+ }
+ if (__builtin_constant_p (__size)
+ && __builtin_constant_p (__n)
+ && (__size | __n) < (((size_t) 1) << (8 * sizeof (size_t) / 2))
+ && __size * __n <= 8)
+ {
+ size_t __cnt = __size * __n;
+ char *__cptr = (char *) __ptr;
+ if (__cnt == 0)
+ return 0;
+ for (; __cnt > 0; --__cnt)
+ {
+ int __c = (__builtin_expect (((__stream)->_IO_read_ptr >= (__stream)->_IO_read_end), 0) ? __uflow (__stream) : *(unsigned char *) (__stream)->_IO_read_ptr++);
+ if (__c == (-1))
+ break;
+ *__cptr++ = __c;
+ }
+ return (__cptr - (char *) __ptr) / __size;
+ }
+ return __fread_unlocked_alias (__ptr, __size, __n, __stream);
+}
+typedef enum { res_goahead, res_nextns, res_modified, res_done, res_error }
+ res_sendhookact;
+typedef res_sendhookact (*res_send_qhook) (struct sockaddr_in * const *__ns,
+ const u_char **__query,
+ int *__querylen,
+ u_char *__ans,
+ int __anssiz,
+ int *__resplen);
+typedef res_sendhookact (*res_send_rhook) (const struct sockaddr_in *__ns,
+ const u_char *__query,
+ int __querylen,
+ u_char *__ans,
+ int __anssiz,
+ int *__resplen);
+struct __res_state {
+ int retrans;
+ int retry;
+ u_long options;
+ int nscount;
+ struct sockaddr_in
+ nsaddr_list[3];
+ u_short id;
+ char *dnsrch[6 +1];
+ char defdname[256];
+ u_long pfcode;
+ unsigned ndots:4;
+ unsigned nsort:4;
+ unsigned ipv6_unavail:1;
+ unsigned unused:23;
+ struct {
+ struct in_addr addr;
+ u_int32_t mask;
+ } sort_list[10];
+ res_send_qhook qhook;
+ res_send_rhook rhook;
+ int res_h_errno;
+ int _vcsock;
+ u_int _flags;
+ union {
+ char pad[52];
+ struct {
+ u_int16_t nscount;
+ u_int16_t nsmap[3];
+ int nssocks[3];
+ u_int16_t nscount6;
+ u_int16_t nsinit;
+ struct sockaddr_in6 *nsaddrs[3];
+ unsigned int _initstamp[2];
+ } _ext;
+ } _u;
+};
+typedef struct __res_state *res_state;
+struct res_sym {
+ int number;
+ char * name;
+ char * humanname;
+};
+extern struct __res_state *__res_state(void) __attribute__ ((__const__));
+void __fp_nquery (const u_char *, int, FILE *) __attribute__ ((__nothrow__ , __leaf__));
+void __fp_query (const u_char *, FILE *) __attribute__ ((__nothrow__ , __leaf__));
+const char * __hostalias (const char *) __attribute__ ((__nothrow__ , __leaf__));
+void __p_query (const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+void __res_close (void) __attribute__ ((__nothrow__ , __leaf__));
+int __res_init (void) __attribute__ ((__nothrow__ , __leaf__));
+int __res_isourserver (const struct sockaddr_in *) __attribute__ ((__nothrow__ , __leaf__));
+int __res_mkquery (int, const char *, int, int, const u_char *,
+ int, const u_char *, u_char *, int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_query (const char *, int, int, u_char *, int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_querydomain (const char *, const char *, int, int,
+ u_char *, int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_search (const char *, int, int, u_char *, int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_send (const u_char *, int, u_char *, int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_hnok (const char *) __attribute__ ((__nothrow__ , __leaf__));
+int __res_ownok (const char *) __attribute__ ((__nothrow__ , __leaf__));
+int __res_mailok (const char *) __attribute__ ((__nothrow__ , __leaf__));
+int __res_dnok (const char *) __attribute__ ((__nothrow__ , __leaf__));
+int __sym_ston (const struct res_sym *, const char *, int *) __attribute__ ((__nothrow__ , __leaf__));
+const char * __sym_ntos (const struct res_sym *, int, int *) __attribute__ ((__nothrow__ , __leaf__));
+const char * __sym_ntop (const struct res_sym *, int, int *) __attribute__ ((__nothrow__ , __leaf__));
+int __b64_ntop(u_char const *,size_t,char *,size_t) __attribute__ ((__nothrow__ , __leaf__));
+int __b64_pton(char const *,u_char *,size_t) __attribute__ ((__nothrow__ , __leaf__));
+int __loc_aton (const char *__ascii, u_char *__binary) __attribute__ ((__nothrow__ , __leaf__));
+const char * __loc_ntoa (const u_char *__binary, char *__ascii) __attribute__ ((__nothrow__ , __leaf__));
+int __dn_skipname (const u_char *, const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+void __putlong (u_int32_t, u_char *) __attribute__ ((__nothrow__ , __leaf__));
+void __putshort (u_int16_t, u_char *) __attribute__ ((__nothrow__ , __leaf__));
+const char * __p_class (int) __attribute__ ((__nothrow__ , __leaf__));
+const char * __p_time (u_int32_t) __attribute__ ((__nothrow__ , __leaf__));
+const char * __p_type (int) __attribute__ ((__nothrow__ , __leaf__));
+const char * __p_rcode (int) __attribute__ ((__nothrow__ , __leaf__));
+const u_char * __p_cdnname (const u_char *, const u_char *, int, FILE *)
+ __attribute__ ((__nothrow__ , __leaf__));
+const u_char * __p_cdname (const u_char *, const u_char *, FILE *) __attribute__ ((__nothrow__ , __leaf__));
+const u_char * __p_fqnname (const u_char *__cp, const u_char *__msg,
+ int, char *, int) __attribute__ ((__nothrow__ , __leaf__));
+const u_char * __p_fqname (const u_char *, const u_char *, FILE *) __attribute__ ((__nothrow__ , __leaf__));
+const char * __p_option (u_long __option) __attribute__ ((__nothrow__ , __leaf__));
+char * __p_secstodate (u_long) __attribute__ ((__nothrow__ , __leaf__));
+int __dn_count_labels (const char *) __attribute__ ((__nothrow__ , __leaf__));
+int __dn_comp (const char *, u_char *, int, u_char **, u_char **)
+ __attribute__ ((__nothrow__ , __leaf__));
+int __dn_expand (const u_char *, const u_char *, const u_char *,
+ char *, int) __attribute__ ((__nothrow__ , __leaf__));
+u_int __res_randomid (void) __attribute__ ((__nothrow__ , __leaf__));
+int __res_nameinquery (const char *, int, int,
+ const u_char *, const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+int __res_queriesmatch (const u_char *, const u_char *,
+ const u_char *, const u_char *) __attribute__ ((__nothrow__ , __leaf__));
+const char * __p_section (int __section, int __opcode) __attribute__ ((__nothrow__ , __leaf__));
+int __res_ninit (res_state) __attribute__ ((__nothrow__ , __leaf__));
+int __res_nisourserver (const res_state,
+ const struct sockaddr_in *) __attribute__ ((__nothrow__ , __leaf__));
+void __fp_resstat (const res_state, FILE *) __attribute__ ((__nothrow__ , __leaf__));
+void __res_npquery (const res_state, const u_char *, int, FILE *)
+ __attribute__ ((__nothrow__ , __leaf__));
+const char * __res_hostalias (const res_state, const char *, char *, size_t)
+ __attribute__ ((__nothrow__ , __leaf__));
+int __res_nquery (res_state, const char *, int, int, u_char *, int)
+ __attribute__ ((__nothrow__ , __leaf__));
+int __res_nsearch (res_state, const char *, int, int, u_char *, int)
+ __attribute__ ((__nothrow__ , __leaf__));
+int __res_nquerydomain (res_state, const char *, const char *, int,
+ int, u_char *, int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_nmkquery (res_state, int, const char *, int, int,
+ const u_char *, int, const u_char *, u_char *,
+ int) __attribute__ ((__nothrow__ , __leaf__));
+int __res_nsend (res_state, const u_char *, int, u_char *, int)
+ __attribute__ ((__nothrow__ , __leaf__));
+void __res_nclose (res_state) __attribute__ ((__nothrow__ , __leaf__));
+struct rdatainfo {
+ unsigned int rdi_length;
+ unsigned char *rdi_data;
+};
+struct rrsetinfo {
+ unsigned int rri_flags;
+ unsigned int rri_rdclass;
+ unsigned int rri_rdtype;
+ unsigned int rri_ttl;
+ unsigned int rri_nrdatas;
+ unsigned int rri_nsigs;
+ char *rri_name;
+ struct rdatainfo *rri_rdatas;
+ struct rdatainfo *rri_sigs;
+};
+int getrrsetbyname(const char *, unsigned int, unsigned int, unsigned int, struct rrsetinfo **);
+void freerrset(struct rrsetinfo *);
+typedef struct BlowfishContext {
+ u_int32_t S[4][256];
+ u_int32_t P[16 + 2];
+} blf_ctx;
+void Blowfish_encipher(blf_ctx *, u_int32_t *, u_int32_t *);
+void Blowfish_decipher(blf_ctx *, u_int32_t *, u_int32_t *);
+void Blowfish_initstate(blf_ctx *);
+void Blowfish_expand0state(blf_ctx *, const u_int8_t *, u_int16_t);
+void Blowfish_expandstate
+(blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t);
+void blf_key(blf_ctx *, const u_int8_t *, u_int16_t);
+void blf_enc(blf_ctx *, u_int32_t *, u_int16_t);
+void blf_dec(blf_ctx *, u_int32_t *, u_int16_t);
+void blf_ecb_encrypt(blf_ctx *, u_int8_t *, u_int32_t);
+void blf_ecb_decrypt(blf_ctx *, u_int8_t *, u_int32_t);
+void blf_cbc_encrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t);
+void blf_cbc_decrypt(blf_ctx *, u_int8_t *, u_int8_t *, u_int32_t);
+u_int32_t Blowfish_stream2word(const u_int8_t *, u_int16_t , u_int16_t *);
+int bindresvport_sa(int sd, struct sockaddr *sa);
+void closefrom(int);
+size_t strlcpy(char *dst, const char *src, size_t siz);
+size_t strlcat(char *dst, const char *src, size_t siz);
+void strmode(int mode, char *p);
+int mkstemps(char *path, int slen);
+int mkstemp(char *path);
+char *mkdtemp(char *path);
+int fmt_scaled(long long number, char *result);
+int scan_scaled(char *, long long *);
+void setproctitle(const char *fmt, ...);
+void compat_init_setproctitle(int argc, char *argv[]);
+int BSDgetopt(int argc, char * const *argv, const char *opts);
+struct option {
+ const char *name;
+ int has_arg;
+ int *flag;
+ int val;
+};
+int getopt_long(int, char * const *, const char *,
+ const struct option *, int *);
+int getopt_long_only(int, char * const *, const char *,
+ const struct option *, int *);
+int BSDgetopt(int, char * const *, const char *);
+int getsubopt(char **, char * const *, char **);
+extern char *BSDoptarg;
+extern int BSDopterr;
+extern int BSDoptind;
+extern int BSDoptopt;
+extern int BSDoptreset;
+extern char *suboptarg;
+char *ssh_get_progname(char *);
+int setlogin(const char *);
+typedef void (*mysig_t)(int);
+mysig_t mysignal(int sig, mysig_t act);
+int getpeereid(int , uid_t *, gid_t *);
+unsigned int arc4random(void);
+void arc4random_stir(void);
+void arc4random_buf(void *, size_t);
+u_int32_t arc4random_uniform(u_int32_t);
+long long strtonum(const char *, long long, long long, const char **);
+char *user_from_uid(uid_t, int);
+char *group_from_gid(gid_t, int);
+int timingsafe_bcmp(const void *, const void *, size_t);
+int bcrypt_pbkdf(const char *, size_t, const u_int8_t *, size_t,
+ u_int8_t *, size_t, unsigned int);
+void explicit_bzero(void *p, size_t n);
+void *xmmap(size_t size);
+char *xcrypt(const char *password, const char *salt);
+char *shadow_pw(struct passwd *pw);
+void oom_adjust_restore(void);
+void oom_adjust_setup(void);
+void solaris_contract_pre_fork(void);
+void solaris_contract_post_fork_child(void);
+void solaris_contract_post_fork_parent(pid_t pid);
+void solaris_set_default_project(struct passwd *);
+struct Channel;
+int sys_tun_open(int, int);
+int sys_tun_infilter(struct Channel *, char *, int);
+u_char *sys_tun_outfilter(struct Channel *, u_char **, u_int *);
+typedef struct {
+ u_char *buf;
+ u_int alloc;
+ u_int offset;
+ u_int end;
+} Buffer;
+void buffer_init(Buffer *);
+void buffer_clear(Buffer *);
+void buffer_free(Buffer *);
+u_int buffer_len(const Buffer *);
+void *buffer_ptr(const Buffer *);
+void buffer_append(Buffer *, const void *, u_int);
+void *buffer_append_space(Buffer *, u_int);
+int buffer_check_alloc(Buffer *, u_int);
+void buffer_get(Buffer *, void *, u_int);
+void buffer_consume(Buffer *, u_int);
+void buffer_consume_end(Buffer *, u_int);
+void buffer_dump(const Buffer *);
+int buffer_get_ret(Buffer *, void *, u_int);
+int buffer_consume_ret(Buffer *, u_int);
+int buffer_consume_end_ret(Buffer *, u_int);
+typedef struct asn1_string_st ASN1_INTEGER;
+typedef struct asn1_string_st ASN1_ENUMERATED;
+typedef struct asn1_string_st ASN1_BIT_STRING;
+typedef struct asn1_string_st ASN1_OCTET_STRING;
+typedef struct asn1_string_st ASN1_PRINTABLESTRING;
+typedef struct asn1_string_st ASN1_T61STRING;
+typedef struct asn1_string_st ASN1_IA5STRING;
+typedef struct asn1_string_st ASN1_GENERALSTRING;
+typedef struct asn1_string_st ASN1_UNIVERSALSTRING;
+typedef struct asn1_string_st ASN1_BMPSTRING;
+typedef struct asn1_string_st ASN1_UTCTIME;
+typedef struct asn1_string_st ASN1_TIME;
+typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
+typedef struct asn1_string_st ASN1_VISIBLESTRING;
+typedef struct asn1_string_st ASN1_UTF8STRING;
+typedef struct asn1_string_st ASN1_STRING;
+typedef int ASN1_BOOLEAN;
+typedef int ASN1_NULL;
+typedef struct ASN1_ITEM_st ASN1_ITEM;
+typedef struct asn1_pctx_st ASN1_PCTX;
+typedef struct bignum_st BIGNUM;
+typedef struct bignum_ctx BN_CTX;
+typedef struct bn_blinding_st BN_BLINDING;
+typedef struct bn_mont_ctx_st BN_MONT_CTX;
+typedef struct bn_recp_ctx_st BN_RECP_CTX;
+typedef struct bn_gencb_st BN_GENCB;
+typedef struct buf_mem_st BUF_MEM;
+typedef struct evp_cipher_st EVP_CIPHER;
+typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
+typedef struct env_md_st EVP_MD;
+typedef struct env_md_ctx_st EVP_MD_CTX;
+typedef struct evp_pkey_st EVP_PKEY;
+typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
+typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
+typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
+typedef struct dh_st DH;
+typedef struct dh_method DH_METHOD;
+typedef struct dsa_st DSA;
+typedef struct dsa_method DSA_METHOD;
+typedef struct rsa_st RSA;
+typedef struct rsa_meth_st RSA_METHOD;
+typedef struct rand_meth_st RAND_METHOD;
+typedef struct ecdh_method ECDH_METHOD;
+typedef struct ecdsa_method ECDSA_METHOD;
+typedef struct x509_st X509;
+typedef struct X509_algor_st X509_ALGOR;
+typedef struct X509_crl_st X509_CRL;
+typedef struct x509_crl_method_st X509_CRL_METHOD;
+typedef struct x509_revoked_st X509_REVOKED;
+typedef struct X509_name_st X509_NAME;
+typedef struct X509_pubkey_st X509_PUBKEY;
+typedef struct x509_store_st X509_STORE;
+typedef struct x509_store_ctx_st X509_STORE_CTX;
+typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;
+typedef struct v3_ext_ctx X509V3_CTX;
+typedef struct conf_st CONF;
+typedef struct store_st STORE;
+typedef struct store_method_st STORE_METHOD;
+typedef struct ui_st UI;
+typedef struct ui_method_st UI_METHOD;
+typedef struct st_ERR_FNS ERR_FNS;
+typedef struct engine_st ENGINE;
+typedef struct ssl_st SSL;
+typedef struct ssl_ctx_st SSL_CTX;
+typedef struct X509_POLICY_NODE_st X509_POLICY_NODE;
+typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;
+typedef struct X509_POLICY_TREE_st X509_POLICY_TREE;
+typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;
+typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID;
+typedef struct DIST_POINT_st DIST_POINT;
+typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT;
+typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS;
+typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
+typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
+ int idx, long argl, void *argp);
+typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
+ int idx, long argl, void *argp);
+typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
+ int idx, long argl, void *argp);
+typedef struct ocsp_req_ctx_st OCSP_REQ_CTX;
+typedef struct ocsp_response_st OCSP_RESPONSE;
+typedef struct ocsp_responder_id_st OCSP_RESPID;
+typedef struct stack_st
+ {
+ int num;
+ char **data;
+ int sorted;
+ int num_alloc;
+ int (*comp)(const void *, const void *);
+ } _STACK;
+int sk_num(const _STACK *);
+void *sk_value(const _STACK *, int);
+void *sk_set(_STACK *, int, void *);
+_STACK *sk_new(int (*cmp)(const void *, const void *));
+_STACK *sk_new_null(void);
+void sk_free(_STACK *);
+void sk_pop_free(_STACK *st, void (*func)(void *));
+int sk_insert(_STACK *sk, void *data, int where);
+void *sk_delete(_STACK *st, int loc);
+void *sk_delete_ptr(_STACK *st, void *p);
+int sk_find(_STACK *st, void *data);
+int sk_find_ex(_STACK *st, void *data);
+int sk_push(_STACK *st, void *data);
+int sk_unshift(_STACK *st, void *data);
+void *sk_shift(_STACK *st);
+void *sk_pop(_STACK *st);
+void sk_zero(_STACK *st);
+int (*sk_set_cmp_func(_STACK *sk, int (*c)(const void *, const void *)))
+ (const void *, const void *);
+_STACK *sk_dup(_STACK *st);
+void sk_sort(_STACK *st);
+int sk_is_sorted(const _STACK *st);
+typedef char *OPENSSL_STRING;
+typedef const char *OPENSSL_CSTRING;
+struct stack_st_OPENSSL_STRING { _STACK stack; };
+typedef void *OPENSSL_BLOCK;
+struct stack_st_OPENSSL_BLOCK { _STACK stack; };
+typedef struct openssl_item_st
+ {
+ int code;
+ void *value;
+ size_t value_size;
+ size_t *value_length;
+ } OPENSSL_ITEM;
+typedef struct
+ {
+ int references;
+ struct CRYPTO_dynlock_value *data;
+ } CRYPTO_dynlock;
+typedef struct bio_st BIO_dummy;
+struct crypto_ex_data_st
+ {
+ struct stack_st_void *sk;
+ int dummy;
+ };
+struct stack_st_void { _STACK stack; };
+typedef struct crypto_ex_data_func_st
+ {
+ long argl;
+ void *argp;
+ CRYPTO_EX_new *new_func;
+ CRYPTO_EX_free *free_func;
+ CRYPTO_EX_dup *dup_func;
+ } CRYPTO_EX_DATA_FUNCS;
+struct stack_st_CRYPTO_EX_DATA_FUNCS { _STACK stack; };
+int CRYPTO_mem_ctrl(int mode);
+int CRYPTO_is_mem_check_on(void);
+const char *SSLeay_version(int type);
+unsigned long SSLeay(void);
+int OPENSSL_issetugid(void);
+typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
+const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
+int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
+int CRYPTO_ex_data_new_class(void);
+int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
+ CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
+ CRYPTO_EX_free *free_func);
+int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
+int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
+ CRYPTO_EX_DATA *from);
+void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
+int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
+void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);
+void CRYPTO_cleanup_all_ex_data(void);
+int CRYPTO_get_new_lockid(char *name);
+int CRYPTO_num_locks(void);
+void CRYPTO_lock(int mode, int type,const char *file,int line);
+void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
+ const char *file,int line));
+void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
+ int line);
+void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
+ const char *file, int line));
+int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
+ const char *file,int line);
+typedef struct crypto_threadid_st
+ {
+ void *ptr;
+ unsigned long val;
+ } CRYPTO_THREADID;
+void CRYPTO_THREADID_set_numeric(CRYPTO_THREADID *id, unsigned long val);
+void CRYPTO_THREADID_set_pointer(CRYPTO_THREADID *id, void *ptr);
+int CRYPTO_THREADID_set_callback(void (*threadid_func)(CRYPTO_THREADID *));
+void (*CRYPTO_THREADID_get_callback(void))(CRYPTO_THREADID *);
+void CRYPTO_THREADID_current(CRYPTO_THREADID *id);
+int CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);
+void CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);
+unsigned long CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);
+void CRYPTO_set_id_callback(unsigned long (*func)(void));
+unsigned long (*CRYPTO_get_id_callback(void))(void);
+unsigned long CRYPTO_thread_id(void);
+const char *CRYPTO_get_lock_name(int type);
+int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
+ int line);
+int CRYPTO_get_new_dynlockid(void);
+void CRYPTO_destroy_dynlockid(int i);
+struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
+void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));
+void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));
+void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));
+struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);
+void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);
+void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);
+int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
+int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
+int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
+ void *(*r)(void *,size_t,const char *,int),
+ void (*f)(void *));
+int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
+ void (*free_func)(void *));
+int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
+ void (*r)(void *,void *,int,const char *,int,int),
+ void (*f)(void *,int),
+ void (*so)(long),
+ long (*go)(void));
+void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
+void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
+void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
+ void *(**r)(void *, size_t,const char *,int),
+ void (**f)(void *));
+void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
+ void (**f)(void *));
+void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
+ void (**r)(void *,void *,int,const char *,int,int),
+ void (**f)(void *,int),
+ void (**so)(long),
+ long (**go)(void));
+void *CRYPTO_malloc_locked(int num, const char *file, int line);
+void CRYPTO_free_locked(void *ptr);
+void *CRYPTO_malloc(int num, const char *file, int line);
+char *CRYPTO_strdup(const char *str, const char *file, int line);
+void CRYPTO_free(void *ptr);
+void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
+void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
+ int line);
+void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
+void OPENSSL_cleanse(void *ptr, size_t len);
+void CRYPTO_set_mem_debug_options(long bits);
+long CRYPTO_get_mem_debug_options(void);
+int CRYPTO_push_info_(const char *info, const char *file, int line);
+int CRYPTO_pop_info(void);
+int CRYPTO_remove_all_info(void);
+void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
+void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
+void CRYPTO_dbg_free(void *addr,int before_p);
+void CRYPTO_dbg_set_options(long bits);
+long CRYPTO_dbg_get_options(void);
+void CRYPTO_mem_leaks_fp(FILE *);
+void CRYPTO_mem_leaks(struct bio_st *bio);
+typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
+void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
+void OpenSSLDie(const char *file,int line,const char *assertion);
+unsigned long *OPENSSL_ia32cap_loc(void);
+int OPENSSL_isservice(void);
+int FIPS_mode(void);
+int FIPS_mode_set(int r);
+void OPENSSL_init(void);
+int CRYPTO_memcmp(const void *a, const void *b, size_t len);
+void ERR_load_CRYPTO_strings(void);
+struct bignum_st
+ {
+ unsigned int *d;
+ int top;
+ int dmax;
+ int neg;
+ int flags;
+ };
+struct bn_mont_ctx_st
+ {
+ int ri;
+ BIGNUM RR;
+ BIGNUM N;
+ BIGNUM Ni;
+ unsigned int n0[2];
+ int flags;
+ };
+struct bn_recp_ctx_st
+ {
+ BIGNUM N;
+ BIGNUM Nr;
+ int num_bits;
+ int shift;
+ int flags;
+ };
+struct bn_gencb_st
+ {
+ unsigned int ver;
+ void *arg;
+ union
+ {
+ void (*cb_1)(int, int, void *);
+ int (*cb_2)(int, int, BN_GENCB *);
+ } cb;
+ };
+int BN_GENCB_call(BN_GENCB *cb, int a, int b);
+const BIGNUM *BN_value_one(void);
+char * BN_options(void);
+BN_CTX *BN_CTX_new(void);
+void BN_CTX_init(BN_CTX *c);
+void BN_CTX_free(BN_CTX *c);
+void BN_CTX_start(BN_CTX *ctx);
+BIGNUM *BN_CTX_get(BN_CTX *ctx);
+void BN_CTX_end(BN_CTX *ctx);
+int BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
+int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
+int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
+int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
+int BN_num_bits(const BIGNUM *a);
+int BN_num_bits_word(unsigned int);
+BIGNUM *BN_new(void);
+void BN_init(BIGNUM *);
+void BN_clear_free(BIGNUM *a);
+BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
+void BN_swap(BIGNUM *a, BIGNUM *b);
+BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);
+int BN_bn2bin(const BIGNUM *a, unsigned char *to);
+BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);
+int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
+int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);
+void BN_set_negative(BIGNUM *b, int n);
+int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
+ BN_CTX *ctx);
+int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
+int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
+int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
+int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
+int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);
+int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
+unsigned int BN_mod_word(const BIGNUM *a, unsigned int w);
+unsigned int BN_div_word(BIGNUM *a, unsigned int w);
+int BN_mul_word(BIGNUM *a, unsigned int w);
+int BN_add_word(BIGNUM *a, unsigned int w);
+int BN_sub_word(BIGNUM *a, unsigned int w);
+int BN_set_word(BIGNUM *a, unsigned int w);
+unsigned int BN_get_word(const BIGNUM *a);
+int BN_cmp(const BIGNUM *a, const BIGNUM *b);
+void BN_free(BIGNUM *a);
+int BN_is_bit_set(const BIGNUM *a, int n);
+int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
+int BN_lshift1(BIGNUM *r, const BIGNUM *a);
+int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx);
+int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m,BN_CTX *ctx);
+int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
+int BN_mod_exp_mont_word(BIGNUM *r, unsigned int a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
+int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
+ const BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m,
+ BN_CTX *ctx,BN_MONT_CTX *m_ctx);
+int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m,BN_CTX *ctx);
+int BN_mask_bits(BIGNUM *a,int n);
+int BN_print_fp(FILE *fp, const BIGNUM *a);
+int BN_print(void *fp, const BIGNUM *a);
+int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
+int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
+int BN_rshift1(BIGNUM *r, const BIGNUM *a);
+void BN_clear(BIGNUM *a);
+BIGNUM *BN_dup(const BIGNUM *a);
+int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
+int BN_set_bit(BIGNUM *a, int n);
+int BN_clear_bit(BIGNUM *a, int n);
+char * BN_bn2hex(const BIGNUM *a);
+char * BN_bn2dec(const BIGNUM *a);
+int BN_hex2bn(BIGNUM **a, const char *str);
+int BN_dec2bn(BIGNUM **a, const char *str);
+int BN_asc2bn(BIGNUM **a, const char *str);
+int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);
+int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);
+BIGNUM *BN_mod_inverse(BIGNUM *ret,
+ const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
+BIGNUM *BN_mod_sqrt(BIGNUM *ret,
+ const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
+BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
+ const BIGNUM *add, const BIGNUM *rem,
+ void (*callback)(int,int,void *),void *cb_arg);
+int BN_is_prime(const BIGNUM *p,int nchecks,
+ void (*callback)(int,int,void *),
+ BN_CTX *ctx,void *cb_arg);
+int BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
+ void (*callback)(int,int,void *),BN_CTX *ctx,void *cb_arg,
+ int do_trial_division);
+int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,
+ const BIGNUM *rem, BN_GENCB *cb);
+int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);
+int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,
+ int do_trial_division, BN_GENCB *cb);
+int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
+int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
+ const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2,
+ const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
+int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
+ BIGNUM *Xp1, BIGNUM *Xp2,
+ const BIGNUM *Xp,
+ const BIGNUM *e, BN_CTX *ctx,
+ BN_GENCB *cb);
+BN_MONT_CTX *BN_MONT_CTX_new(void );
+void BN_MONT_CTX_init(BN_MONT_CTX *ctx);
+int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,
+ BN_MONT_CTX *mont, BN_CTX *ctx);
+int BN_from_montgomery(BIGNUM *r,const BIGNUM *a,
+ BN_MONT_CTX *mont, BN_CTX *ctx);
+void BN_MONT_CTX_free(BN_MONT_CTX *mont);
+int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);
+BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to,BN_MONT_CTX *from);
+BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
+ const BIGNUM *mod, BN_CTX *ctx);
+BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
+void BN_BLINDING_free(BN_BLINDING *b);
+int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
+int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
+int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
+int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
+int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
+unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *);
+void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long);
+CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
+unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
+void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
+BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
+ const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
+ int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
+ BN_MONT_CTX *m_ctx);
+void BN_set_params(int mul,int high,int low,int mont);
+int BN_get_params(int which);
+void BN_RECP_CTX_init(BN_RECP_CTX *recp);
+BN_RECP_CTX *BN_RECP_CTX_new(void);
+void BN_RECP_CTX_free(BN_RECP_CTX *recp);
+int BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx);
+int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
+ BN_RECP_CTX *recp,BN_CTX *ctx);
+int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx);
+int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
+ BN_RECP_CTX *recp, BN_CTX *ctx);
+int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
+int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
+int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const BIGNUM *p, BN_CTX *ctx);
+int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ BN_CTX *ctx);
+int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,
+ BN_CTX *ctx);
+int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const BIGNUM *p, BN_CTX *ctx);
+int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const BIGNUM *p, BN_CTX *ctx);
+int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ BN_CTX *ctx);
+int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ BN_CTX *ctx);
+int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
+int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const int p[], BN_CTX *ctx);
+int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
+ BN_CTX *ctx);
+int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
+ BN_CTX *ctx);
+int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const int p[], BN_CTX *ctx);
+int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
+ const int p[], BN_CTX *ctx);
+int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
+ const int p[], BN_CTX *ctx);
+int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
+ const int p[], BN_CTX *ctx);
+int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
+int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
+int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
+const BIGNUM *BN_get0_nist_prime_192(void);
+const BIGNUM *BN_get0_nist_prime_224(void);
+const BIGNUM *BN_get0_nist_prime_256(void);
+const BIGNUM *BN_get0_nist_prime_384(void);
+const BIGNUM *BN_get0_nist_prime_521(void);
+BIGNUM *bn_expand2(BIGNUM *a, int words);
+BIGNUM *bn_dup_expand(const BIGNUM *a, int words);
+unsigned int bn_mul_add_words(unsigned int *rp, const unsigned int *ap, int num, unsigned int w);
+unsigned int bn_mul_words(unsigned int *rp, const unsigned int *ap, int num, unsigned int w);
+void bn_sqr_words(unsigned int *rp, const unsigned int *ap, int num);
+unsigned int bn_div_words(unsigned int h, unsigned int l, unsigned int d);
+unsigned int bn_add_words(unsigned int *rp, const unsigned int *ap, const unsigned int *bp,int num);
+unsigned int bn_sub_words(unsigned int *rp, const unsigned int *ap, const unsigned int *bp,int num);
+BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
+BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
+BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
+int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);
+void ERR_load_BN_strings(void);
+void buffer_put_bignum(Buffer *, const BIGNUM *);
+void buffer_put_bignum2(Buffer *, const BIGNUM *);
+void buffer_get_bignum(Buffer *, BIGNUM *);
+void buffer_get_bignum2(Buffer *, BIGNUM *);
+u_short buffer_get_short(Buffer *);
+void buffer_put_short(Buffer *, u_short);
+u_int buffer_get_int(Buffer *);
+void buffer_put_int(Buffer *, u_int);
+u_int64_t buffer_get_int64(Buffer *);
+void buffer_put_int64(Buffer *, u_int64_t);
+int buffer_get_char(Buffer *);
+void buffer_put_char(Buffer *, int);
+void *buffer_get_string(Buffer *, u_int *);
+void *buffer_get_string_ptr(Buffer *, u_int *);
+void buffer_put_string(Buffer *, const void *, u_int);
+char *buffer_get_cstring(Buffer *, u_int *);
+void buffer_put_cstring(Buffer *, const char *);
+int buffer_put_bignum_ret(Buffer *, const BIGNUM *);
+int buffer_get_bignum_ret(Buffer *, BIGNUM *);
+int buffer_put_bignum2_ret(Buffer *, const BIGNUM *);
+int buffer_get_bignum2_ret(Buffer *, BIGNUM *);
+int buffer_get_short_ret(u_short *, Buffer *);
+int buffer_get_int_ret(u_int *, Buffer *);
+int buffer_get_int64_ret(u_int64_t *, Buffer *);
+void *buffer_get_string_ret(Buffer *, u_int *);
+char *buffer_get_cstring_ret(Buffer *, u_int *);
+void *buffer_get_string_ptr_ret(Buffer *, u_int *);
+int buffer_get_char_ret(u_char *, Buffer *);
+void *buffer_get_bignum2_as_string_ret(Buffer *, u_int *);
+void *buffer_get_bignum2_as_string(Buffer *, u_int *);
+void buffer_put_bignum2_from_string(Buffer *, const u_char *, u_int);
+struct timex
+{
+ unsigned int modes;
+ __syscall_slong_t offset;
+ __syscall_slong_t freq;
+ __syscall_slong_t maxerror;
+ __syscall_slong_t esterror;
+ int status;
+ __syscall_slong_t constant;
+ __syscall_slong_t precision;
+ __syscall_slong_t tolerance;
+ struct timeval time;
+ __syscall_slong_t tick;
+ __syscall_slong_t ppsfreq;
+ __syscall_slong_t jitter;
+ int shift;
+ __syscall_slong_t stabil;
+ __syscall_slong_t jitcnt;
+ __syscall_slong_t calcnt;
+ __syscall_slong_t errcnt;
+ __syscall_slong_t stbcnt;
+ int tai;
+ int :32; int :32; int :32; int :32;
+ int :32; int :32; int :32; int :32;
+ int :32; int :32; int :32;
+};
+extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __attribute__ ((__nothrow__ , __leaf__));
+struct tm
+{
+ int tm_sec;
+ int tm_min;
+ int tm_hour;
+ int tm_mday;
+ int tm_mon;
+ int tm_year;
+ int tm_wday;
+ int tm_yday;
+ int tm_isdst;
+ long int tm_gmtoff;
+ const char *tm_zone;
+};
+struct itimerspec
+ {
+ struct timespec it_interval;
+ struct timespec it_value;
+ };
+struct sigevent;
+extern clock_t clock (void) __attribute__ ((__nothrow__ , __leaf__));
+extern time_t time (time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
+extern double difftime (time_t __time1, time_t __time0)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern time_t mktime (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
+extern size_t strftime (char *__restrict __s, size_t __maxsize,
+ const char *__restrict __format,
+ const struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
+extern char *strptime (const char *__restrict __s,
+ const char *__restrict __fmt, struct tm *__tp)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern size_t strftime_l (char *__restrict __s, size_t __maxsize,
+ const char *__restrict __format,
+ const struct tm *__restrict __tp,
+ __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__));
+extern char *strptime_l (const char *__restrict __s,
+ const char *__restrict __fmt, struct tm *__tp,
+ __locale_t __loc) __attribute__ ((__nothrow__ , __leaf__));
+extern struct tm *gmtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
+extern struct tm *localtime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
+extern struct tm *gmtime_r (const time_t *__restrict __timer,
+ struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
+extern struct tm *localtime_r (const time_t *__restrict __timer,
+ struct tm *__restrict __tp) __attribute__ ((__nothrow__ , __leaf__));
+extern char *asctime (const struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
+extern char *ctime (const time_t *__timer) __attribute__ ((__nothrow__ , __leaf__));
+extern char *asctime_r (const struct tm *__restrict __tp,
+ char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
+extern char *ctime_r (const time_t *__restrict __timer,
+ char *__restrict __buf) __attribute__ ((__nothrow__ , __leaf__));
+extern char *__tzname[2];
+extern int __daylight;
+extern long int __timezone;
+extern char *tzname[2];
+extern void tzset (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int daylight;
+extern long int timezone;
+extern int stime (const time_t *__when) __attribute__ ((__nothrow__ , __leaf__));
+extern time_t timegm (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
+extern time_t timelocal (struct tm *__tp) __attribute__ ((__nothrow__ , __leaf__));
+extern int dysize (int __year) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern int nanosleep (const struct timespec *__requested_time,
+ struct timespec *__remaining);
+extern int clock_getres (clockid_t __clock_id, struct timespec *__res) __attribute__ ((__nothrow__ , __leaf__));
+extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) __attribute__ ((__nothrow__ , __leaf__));
+extern int clock_settime (clockid_t __clock_id, const struct timespec *__tp)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int clock_nanosleep (clockid_t __clock_id, int __flags,
+ const struct timespec *__req,
+ struct timespec *__rem);
+extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __attribute__ ((__nothrow__ , __leaf__));
+extern int timer_create (clockid_t __clock_id,
+ struct sigevent *__restrict __evp,
+ timer_t *__restrict __timerid) __attribute__ ((__nothrow__ , __leaf__));
+extern int timer_delete (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
+extern int timer_settime (timer_t __timerid, int __flags,
+ const struct itimerspec *__restrict __value,
+ struct itimerspec *__restrict __ovalue) __attribute__ ((__nothrow__ , __leaf__));
+extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int timer_getoverrun (timer_t __timerid) __attribute__ ((__nothrow__ , __leaf__));
+extern int timespec_get (struct timespec *__ts, int __base)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int getdate_err;
+extern struct tm *getdate (const char *__string);
+extern int getdate_r (const char *__restrict __string,
+ struct tm *__restrict __resbufp);
+typedef struct bio_st BIO;
+void BIO_set_flags(BIO *b, int flags);
+int BIO_test_flags(const BIO *b, int flags);
+void BIO_clear_flags(BIO *b, int flags);
+long (*BIO_get_callback(const BIO *b)) (struct bio_st *,int,const char *,int, long,long);
+void BIO_set_callback(BIO *b,
+ long (*callback)(struct bio_st *,int,const char *,int, long,long));
+char *BIO_get_callback_arg(const BIO *b);
+void BIO_set_callback_arg(BIO *b, char *arg);
+const char * BIO_method_name(const BIO *b);
+int BIO_method_type(const BIO *b);
+typedef void bio_info_cb(struct bio_st *, int, const char *, int, long, long);
+typedef struct bio_method_st
+ {
+ int type;
+ const char *name;
+ int (*bwrite)(BIO *, const char *, int);
+ int (*bread)(BIO *, char *, int);
+ int (*bputs)(BIO *, const char *);
+ int (*bgets)(BIO *, char *, int);
+ long (*ctrl)(BIO *, int, long, void *);
+ int (*create)(BIO *);
+ int (*destroy)(BIO *);
+ long (*callback_ctrl)(BIO *, int, bio_info_cb *);
+ } BIO_METHOD;
+struct bio_st
+ {
+ BIO_METHOD *method;
+ long (*callback)(struct bio_st *,int,const char *,int, long,long);
+ char *cb_arg;
+ int init;
+ int shutdown;
+ int flags;
+ int retry_reason;
+ int num;
+ void *ptr;
+ struct bio_st *next_bio;
+ struct bio_st *prev_bio;
+ int references;
+ unsigned long num_read;
+ unsigned long num_write;
+ CRYPTO_EX_DATA ex_data;
+ };
+struct stack_st_BIO { _STACK stack; };
+typedef struct bio_f_buffer_ctx_struct
+ {
+ int ibuf_size;
+ int obuf_size;
+ char *ibuf;
+ int ibuf_len;
+ int ibuf_off;
+ char *obuf;
+ int obuf_len;
+ int obuf_off;
+ } BIO_F_BUFFER_CTX;
+typedef int asn1_ps_func(BIO *b, unsigned char **pbuf, int *plen, void *parg);
+size_t BIO_ctrl_pending(BIO *b);
+size_t BIO_ctrl_wpending(BIO *b);
+size_t BIO_ctrl_get_write_guarantee(BIO *b);
+size_t BIO_ctrl_get_read_request(BIO *b);
+int BIO_ctrl_reset_read_request(BIO *b);
+int BIO_set_ex_data(BIO *bio,int idx,void *data);
+void *BIO_get_ex_data(BIO *bio,int idx);
+int BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+unsigned long BIO_number_read(BIO *bio);
+unsigned long BIO_number_written(BIO *bio);
+int BIO_asn1_set_prefix(BIO *b, asn1_ps_func *prefix,
+ asn1_ps_func *prefix_free);
+int BIO_asn1_get_prefix(BIO *b, asn1_ps_func **pprefix,
+ asn1_ps_func **pprefix_free);
+int BIO_asn1_set_suffix(BIO *b, asn1_ps_func *suffix,
+ asn1_ps_func *suffix_free);
+int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
+ asn1_ps_func **psuffix_free);
+BIO_METHOD *BIO_s_file(void );
+BIO *BIO_new_file(const char *filename, const char *mode);
+BIO *BIO_new_fp(FILE *stream, int close_flag);
+BIO * BIO_new(BIO_METHOD *type);
+int BIO_set(BIO *a,BIO_METHOD *type);
+int BIO_free(BIO *a);
+void BIO_vfree(BIO *a);
+int BIO_read(BIO *b, void *data, int len);
+int BIO_gets(BIO *bp,char *buf, int size);
+int BIO_write(BIO *b, const void *data, int len);
+int BIO_puts(BIO *bp,const char *buf);
+int BIO_indent(BIO *b,int indent,int max);
+long BIO_ctrl(BIO *bp,int cmd,long larg,void *parg);
+long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));
+char * BIO_ptr_ctrl(BIO *bp,int cmd,long larg);
+long BIO_int_ctrl(BIO *bp,int cmd,long larg,int iarg);
+BIO * BIO_push(BIO *b,BIO *append);
+BIO * BIO_pop(BIO *b);
+void BIO_free_all(BIO *a);
+BIO * BIO_find_type(BIO *b,int bio_type);
+BIO * BIO_next(BIO *b);
+BIO * BIO_get_retry_BIO(BIO *bio, int *reason);
+int BIO_get_retry_reason(BIO *bio);
+BIO * BIO_dup_chain(BIO *in);
+int BIO_nread0(BIO *bio, char **buf);
+int BIO_nread(BIO *bio, char **buf, int num);
+int BIO_nwrite0(BIO *bio, char **buf);
+int BIO_nwrite(BIO *bio, char **buf, int num);
+long BIO_debug_callback(BIO *bio,int cmd,const char *argp,int argi,
+ long argl,long ret);
+BIO_METHOD *BIO_s_mem(void);
+BIO *BIO_new_mem_buf(void *buf, int len);
+BIO_METHOD *BIO_s_socket(void);
+BIO_METHOD *BIO_s_connect(void);
+BIO_METHOD *BIO_s_accept(void);
+BIO_METHOD *BIO_s_fd(void);
+BIO_METHOD *BIO_s_log(void);
+BIO_METHOD *BIO_s_bio(void);
+BIO_METHOD *BIO_s_null(void);
+BIO_METHOD *BIO_f_null(void);
+BIO_METHOD *BIO_f_buffer(void);
+BIO_METHOD *BIO_f_nbio_test(void);
+BIO_METHOD *BIO_s_datagram(void);
+int BIO_sock_should_retry(int i);
+int BIO_sock_non_fatal_error(int error);
+int BIO_dgram_non_fatal_error(int error);
+int BIO_fd_should_retry(int i);
+int BIO_fd_non_fatal_error(int error);
+int BIO_dump_cb(int (*cb)(const void *data, size_t len, void *u),
+ void *u, const char *s, int len);
+int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
+ void *u, const char *s, int len, int indent);
+int BIO_dump(BIO *b,const char *bytes,int len);
+int BIO_dump_indent(BIO *b,const char *bytes,int len,int indent);
+int BIO_dump_fp(FILE *fp, const char *s, int len);
+int BIO_dump_indent_fp(FILE *fp, const char *s, int len, int indent);
+struct hostent *BIO_gethostbyname(const char *name);
+int BIO_sock_error(int sock);
+int BIO_socket_ioctl(int fd, long type, void *arg);
+int BIO_socket_nbio(int fd,int mode);
+int BIO_get_port(const char *str, unsigned short *port_ptr);
+int BIO_get_host_ip(const char *str, unsigned char *ip);
+int BIO_get_accept_socket(char *host_port,int mode);
+int BIO_accept(int sock,char **ip_port);
+int BIO_sock_init(void );
+void BIO_sock_cleanup(void);
+int BIO_set_tcp_ndelay(int sock,int turn_on);
+BIO *BIO_new_socket(int sock, int close_flag);
+BIO *BIO_new_dgram(int fd, int close_flag);
+BIO *BIO_new_fd(int fd, int close_flag);
+BIO *BIO_new_connect(char *host_port);
+BIO *BIO_new_accept(char *host_port);
+int BIO_new_bio_pair(BIO **bio1, size_t writebuf1,
+ BIO **bio2, size_t writebuf2);
+void BIO_copy_next_retry(BIO *b);
+int BIO_printf(BIO *bio, const char *format, ...)
+ __attribute__((__format__(__printf__,2,3)));
+int BIO_vprintf(BIO *bio, const char *format, va_list args)
+ __attribute__((__format__(__printf__,2,0)));
+int BIO_snprintf(char *buf, size_t n, const char *format, ...)
+ __attribute__((__format__(__printf__,3,4)));
+int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
+ __attribute__((__format__(__printf__,3,0)));
+void ERR_load_BIO_strings(void);
+struct X509_algor_st;
+struct stack_st_X509_ALGOR { _STACK stack; };
+typedef struct asn1_ctx_st
+ {
+ unsigned char *p;
+ int eos;
+ int error;
+ int inf;
+ int tag;
+ int xclass;
+ long slen;
+ unsigned char *max;
+ unsigned char *q;
+ unsigned char **pp;
+ int line;
+ } ASN1_CTX;
+typedef struct asn1_const_ctx_st
+ {
+ const unsigned char *p;
+ int eos;
+ int error;
+ int inf;
+ int tag;
+ int xclass;
+ long slen;
+ const unsigned char *max;
+ const unsigned char *q;
+ const unsigned char **pp;
+ int line;
+ } ASN1_const_CTX;
+typedef struct asn1_object_st
+ {
+ const char *sn,*ln;
+ int nid;
+ int length;
+ const unsigned char *data;
+ int flags;
+ } ASN1_OBJECT;
+struct asn1_string_st
+ {
+ int length;
+ int type;
+ unsigned char *data;
+ long flags;
+ };
+typedef struct ASN1_ENCODING_st
+ {
+ unsigned char *enc;
+ long len;
+ int modified;
+ } ASN1_ENCODING;
+typedef struct asn1_string_table_st {
+ int nid;
+ long minsize;
+ long maxsize;
+ unsigned long mask;
+ unsigned long flags;
+} ASN1_STRING_TABLE;
+struct stack_st_ASN1_STRING_TABLE { _STACK stack; };
+typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
+typedef struct ASN1_TLC_st ASN1_TLC;
+typedef struct ASN1_VALUE_st ASN1_VALUE;
+typedef void *d2i_of_void(void **,const unsigned char **,long); typedef int i2d_of_void(void *,unsigned char **);
+typedef const ASN1_ITEM ASN1_ITEM_EXP;
+struct stack_st_ASN1_INTEGER { _STACK stack; };
+struct stack_st_ASN1_GENERALSTRING { _STACK stack; };
+typedef struct asn1_type_st
+ {
+ int type;
+ union {
+ char *ptr;
+ ASN1_BOOLEAN boolean;
+ ASN1_STRING * asn1_string;
+ ASN1_OBJECT * object;
+ ASN1_INTEGER * integer;
+ ASN1_ENUMERATED * enumerated;
+ ASN1_BIT_STRING * bit_string;
+ ASN1_OCTET_STRING * octet_string;
+ ASN1_PRINTABLESTRING * printablestring;
+ ASN1_T61STRING * t61string;
+ ASN1_IA5STRING * ia5string;
+ ASN1_GENERALSTRING * generalstring;
+ ASN1_BMPSTRING * bmpstring;
+ ASN1_UNIVERSALSTRING * universalstring;
+ ASN1_UTCTIME * utctime;
+ ASN1_GENERALIZEDTIME * generalizedtime;
+ ASN1_VISIBLESTRING * visiblestring;
+ ASN1_UTF8STRING * utf8string;
+ ASN1_STRING * set;
+ ASN1_STRING * sequence;
+ ASN1_VALUE * asn1_value;
+ } value;
+ } ASN1_TYPE;
+struct stack_st_ASN1_TYPE { _STACK stack; };
+typedef struct stack_st_ASN1_TYPE ASN1_SEQUENCE_ANY;
+ASN1_SEQUENCE_ANY *d2i_ASN1_SEQUENCE_ANY(ASN1_SEQUENCE_ANY **a, const unsigned char **in, long len); int i2d_ASN1_SEQUENCE_ANY(const ASN1_SEQUENCE_ANY *a, unsigned char **out); extern const ASN1_ITEM ASN1_SEQUENCE_ANY_it;
+ASN1_SEQUENCE_ANY *d2i_ASN1_SET_ANY(ASN1_SEQUENCE_ANY **a, const unsigned char **in, long len); int i2d_ASN1_SET_ANY(const ASN1_SEQUENCE_ANY *a, unsigned char **out); extern const ASN1_ITEM ASN1_SET_ANY_it;
+typedef struct NETSCAPE_X509_st
+ {
+ ASN1_OCTET_STRING *header;
+ X509 *cert;
+ } NETSCAPE_X509;
+typedef struct BIT_STRING_BITNAME_st {
+ int bitnum;
+ const char *lname;
+ const char *sname;
+} BIT_STRING_BITNAME;
+ASN1_TYPE *ASN1_TYPE_new(void); void ASN1_TYPE_free(ASN1_TYPE *a); ASN1_TYPE *d2i_ASN1_TYPE(ASN1_TYPE **a, const unsigned char **in, long len); int i2d_ASN1_TYPE(ASN1_TYPE *a, unsigned char **out); extern const ASN1_ITEM ASN1_ANY_it;
+int ASN1_TYPE_get(ASN1_TYPE *a);
+void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
+int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
+int ASN1_TYPE_cmp(ASN1_TYPE *a, ASN1_TYPE *b);
+ASN1_OBJECT * ASN1_OBJECT_new(void );
+void ASN1_OBJECT_free(ASN1_OBJECT *a);
+int i2d_ASN1_OBJECT(ASN1_OBJECT *a,unsigned char **pp);
+ASN1_OBJECT * c2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
+ long length);
+ASN1_OBJECT * d2i_ASN1_OBJECT(ASN1_OBJECT **a,const unsigned char **pp,
+ long length);
+extern const ASN1_ITEM ASN1_OBJECT_it;
+struct stack_st_ASN1_OBJECT { _STACK stack; };
+ASN1_STRING * ASN1_STRING_new(void);
+void ASN1_STRING_free(ASN1_STRING *a);
+int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
+ASN1_STRING * ASN1_STRING_dup(const ASN1_STRING *a);
+ASN1_STRING * ASN1_STRING_type_new(int type );
+int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
+int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
+void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
+int ASN1_STRING_length(const ASN1_STRING *x);
+void ASN1_STRING_length_set(ASN1_STRING *x, int n);
+int ASN1_STRING_type(ASN1_STRING *x);
+unsigned char * ASN1_STRING_data(ASN1_STRING *x);
+ASN1_BIT_STRING *ASN1_BIT_STRING_new(void); void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a); ASN1_BIT_STRING *d2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a, const unsigned char **in, long len); int i2d_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_BIT_STRING_it;
+int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a,unsigned char **pp);
+ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,const unsigned char **pp,
+ long length);
+int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d,
+ int length );
+int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
+int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
+int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
+ unsigned char *flags, int flags_len);
+int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
+ BIT_STRING_BITNAME *tbl, int indent);
+int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
+int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
+ BIT_STRING_BITNAME *tbl);
+int i2d_ASN1_BOOLEAN(int a,unsigned char **pp);
+int d2i_ASN1_BOOLEAN(int *a,const unsigned char **pp,long length);
+ASN1_INTEGER *ASN1_INTEGER_new(void); void ASN1_INTEGER_free(ASN1_INTEGER *a); ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len); int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **out); extern const ASN1_ITEM ASN1_INTEGER_it;
+int i2c_ASN1_INTEGER(ASN1_INTEGER *a,unsigned char **pp);
+ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a,const unsigned char **pp,
+ long length);
+ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a,const unsigned char **pp,
+ long length);
+ASN1_INTEGER * ASN1_INTEGER_dup(const ASN1_INTEGER *x);
+int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
+ASN1_ENUMERATED *ASN1_ENUMERATED_new(void); void ASN1_ENUMERATED_free(ASN1_ENUMERATED *a); ASN1_ENUMERATED *d2i_ASN1_ENUMERATED(ASN1_ENUMERATED **a, const unsigned char **in, long len); int i2d_ASN1_ENUMERATED(ASN1_ENUMERATED *a, unsigned char **out); extern const ASN1_ITEM ASN1_ENUMERATED_it;
+int ASN1_UTCTIME_check(ASN1_UTCTIME *a);
+ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s,time_t t);
+ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
+ int offset_day, long offset_sec);
+int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
+int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
+int ASN1_GENERALIZEDTIME_check(ASN1_GENERALIZEDTIME *a);
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,time_t t);
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
+ time_t t, int offset_day, long offset_sec);
+int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
+ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void); void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a); ASN1_OCTET_STRING *d2i_ASN1_OCTET_STRING(ASN1_OCTET_STRING **a, const unsigned char **in, long len); int i2d_ASN1_OCTET_STRING(ASN1_OCTET_STRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_OCTET_STRING_it;
+ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
+int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a, const ASN1_OCTET_STRING *b);
+int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data, int len);
+ASN1_VISIBLESTRING *ASN1_VISIBLESTRING_new(void); void ASN1_VISIBLESTRING_free(ASN1_VISIBLESTRING *a); ASN1_VISIBLESTRING *d2i_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING **a, const unsigned char **in, long len); int i2d_ASN1_VISIBLESTRING(ASN1_VISIBLESTRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_VISIBLESTRING_it;
+ASN1_UNIVERSALSTRING *ASN1_UNIVERSALSTRING_new(void); void ASN1_UNIVERSALSTRING_free(ASN1_UNIVERSALSTRING *a); ASN1_UNIVERSALSTRING *d2i_ASN1_UNIVERSALSTRING(ASN1_UNIVERSALSTRING **a, const unsigned char **in, long len); int i2d_ASN1_UNIVERSALSTRING(ASN1_UNIVERSALSTRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_UNIVERSALSTRING_it;
+ASN1_UTF8STRING *ASN1_UTF8STRING_new(void); void ASN1_UTF8STRING_free(ASN1_UTF8STRING *a); ASN1_UTF8STRING *d2i_ASN1_UTF8STRING(ASN1_UTF8STRING **a, const unsigned char **in, long len); int i2d_ASN1_UTF8STRING(ASN1_UTF8STRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_UTF8STRING_it;
+ASN1_NULL *ASN1_NULL_new(void); void ASN1_NULL_free(ASN1_NULL *a); ASN1_NULL *d2i_ASN1_NULL(ASN1_NULL **a, const unsigned char **in, long len); int i2d_ASN1_NULL(ASN1_NULL *a, unsigned char **out); extern const ASN1_ITEM ASN1_NULL_it;
+ASN1_BMPSTRING *ASN1_BMPSTRING_new(void); void ASN1_BMPSTRING_free(ASN1_BMPSTRING *a); ASN1_BMPSTRING *d2i_ASN1_BMPSTRING(ASN1_BMPSTRING **a, const unsigned char **in, long len); int i2d_ASN1_BMPSTRING(ASN1_BMPSTRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_BMPSTRING_it;
+int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
+int UTF8_putc(unsigned char *str, int len, unsigned long value);
+ASN1_STRING *ASN1_PRINTABLE_new(void); void ASN1_PRINTABLE_free(ASN1_STRING *a); ASN1_STRING *d2i_ASN1_PRINTABLE(ASN1_STRING **a, const unsigned char **in, long len); int i2d_ASN1_PRINTABLE(ASN1_STRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_PRINTABLE_it;
+ASN1_STRING *DIRECTORYSTRING_new(void); void DIRECTORYSTRING_free(ASN1_STRING *a); ASN1_STRING *d2i_DIRECTORYSTRING(ASN1_STRING **a, const unsigned char **in, long len); int i2d_DIRECTORYSTRING(ASN1_STRING *a, unsigned char **out); extern const ASN1_ITEM DIRECTORYSTRING_it;
+ASN1_STRING *DISPLAYTEXT_new(void); void DISPLAYTEXT_free(ASN1_STRING *a); ASN1_STRING *d2i_DISPLAYTEXT(ASN1_STRING **a, const unsigned char **in, long len); int i2d_DISPLAYTEXT(ASN1_STRING *a, unsigned char **out); extern const ASN1_ITEM DISPLAYTEXT_it;
+ASN1_PRINTABLESTRING *ASN1_PRINTABLESTRING_new(void); void ASN1_PRINTABLESTRING_free(ASN1_PRINTABLESTRING *a); ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a, const unsigned char **in, long len); int i2d_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_PRINTABLESTRING_it;
+ASN1_T61STRING *ASN1_T61STRING_new(void); void ASN1_T61STRING_free(ASN1_T61STRING *a); ASN1_T61STRING *d2i_ASN1_T61STRING(ASN1_T61STRING **a, const unsigned char **in, long len); int i2d_ASN1_T61STRING(ASN1_T61STRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_T61STRING_it;
+ASN1_IA5STRING *ASN1_IA5STRING_new(void); void ASN1_IA5STRING_free(ASN1_IA5STRING *a); ASN1_IA5STRING *d2i_ASN1_IA5STRING(ASN1_IA5STRING **a, const unsigned char **in, long len); int i2d_ASN1_IA5STRING(ASN1_IA5STRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_IA5STRING_it;
+ASN1_GENERALSTRING *ASN1_GENERALSTRING_new(void); void ASN1_GENERALSTRING_free(ASN1_GENERALSTRING *a); ASN1_GENERALSTRING *d2i_ASN1_GENERALSTRING(ASN1_GENERALSTRING **a, const unsigned char **in, long len); int i2d_ASN1_GENERALSTRING(ASN1_GENERALSTRING *a, unsigned char **out); extern const ASN1_ITEM ASN1_GENERALSTRING_it;
+ASN1_UTCTIME *ASN1_UTCTIME_new(void); void ASN1_UTCTIME_free(ASN1_UTCTIME *a); ASN1_UTCTIME *d2i_ASN1_UTCTIME(ASN1_UTCTIME **a, const unsigned char **in, long len); int i2d_ASN1_UTCTIME(ASN1_UTCTIME *a, unsigned char **out); extern const ASN1_ITEM ASN1_UTCTIME_it;
+ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_new(void); void ASN1_GENERALIZEDTIME_free(ASN1_GENERALIZEDTIME *a); ASN1_GENERALIZEDTIME *d2i_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME **a, const unsigned char **in, long len); int i2d_ASN1_GENERALIZEDTIME(ASN1_GENERALIZEDTIME *a, unsigned char **out); extern const ASN1_ITEM ASN1_GENERALIZEDTIME_it;
+ASN1_TIME *ASN1_TIME_new(void); void ASN1_TIME_free(ASN1_TIME *a); ASN1_TIME *d2i_ASN1_TIME(ASN1_TIME **a, const unsigned char **in, long len); int i2d_ASN1_TIME(ASN1_TIME *a, unsigned char **out); extern const ASN1_ITEM ASN1_TIME_it;
+extern const ASN1_ITEM ASN1_OCTET_STRING_NDEF_it;
+ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s,time_t t);
+ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s,time_t t,
+ int offset_day, long offset_sec);
+int ASN1_TIME_check(ASN1_TIME *t);
+ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME **out);
+int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
+int i2d_ASN1_SET(struct stack_st_OPENSSL_BLOCK *a, unsigned char **pp,
+ i2d_of_void *i2d, int ex_tag, int ex_class,
+ int is_set);
+struct stack_st_OPENSSL_BLOCK *d2i_ASN1_SET(struct stack_st_OPENSSL_BLOCK **a,
+ const unsigned char **pp,
+ long length, d2i_of_void *d2i,
+ void (*free_func)(OPENSSL_BLOCK), int ex_tag,
+ int ex_class);
+int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
+int a2i_ASN1_INTEGER(BIO *bp,ASN1_INTEGER *bs,char *buf,int size);
+int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
+int a2i_ASN1_ENUMERATED(BIO *bp,ASN1_ENUMERATED *bs,char *buf,int size);
+int i2a_ASN1_OBJECT(BIO *bp,ASN1_OBJECT *a);
+int a2i_ASN1_STRING(BIO *bp,ASN1_STRING *bs,char *buf,int size);
+int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
+int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);
+int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
+ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
+ const char *sn, const char *ln);
+int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
+long ASN1_INTEGER_get(const ASN1_INTEGER *a);
+ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
+BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai,BIGNUM *bn);
+int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
+long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
+ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
+BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai,BIGNUM *bn);
+int ASN1_PRINTABLE_type(const unsigned char *s, int max);
+int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
+ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
+ long length, int Ptag, int Pclass);
+unsigned long ASN1_tag2bit(int tag);
+ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a,const unsigned char **pp,
+ long length,int type);
+int asn1_Finish(ASN1_CTX *c);
+int asn1_const_Finish(ASN1_const_CTX *c);
+int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
+ int *pclass, long omax);
+int ASN1_check_infinite_end(unsigned char **p,long len);
+int ASN1_const_check_infinite_end(const unsigned char **p,long len);
+void ASN1_put_object(unsigned char **pp, int constructed, int length,
+ int tag, int xclass);
+int ASN1_put_eoc(unsigned char **pp);
+int ASN1_object_size(int constructed, int length, int tag);
+void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
+void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
+void *ASN1_d2i_fp(void *(*xnew)(void), d2i_of_void *d2i, FILE *in, void **x);
+void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
+int ASN1_i2d_fp(i2d_of_void *i2d,FILE *out,void *x);
+int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
+int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
+int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
+void *ASN1_d2i_bio(void *(*xnew)(void), d2i_of_void *d2i, BIO *in, void **x);
+void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
+int ASN1_i2d_bio(i2d_of_void *i2d,BIO *out, unsigned char *x);
+int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
+int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
+int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
+int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
+int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
+int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
+int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
+ unsigned char *buf, int off);
+int ASN1_parse(BIO *bp,const unsigned char *pp,long len,int indent);
+int ASN1_parse_dump(BIO *bp,const unsigned char *pp,long len,int indent,int dump);
+const char *ASN1_tag2str(int tag);
+NETSCAPE_X509 *NETSCAPE_X509_new(void); void NETSCAPE_X509_free(NETSCAPE_X509 *a); NETSCAPE_X509 *d2i_NETSCAPE_X509(NETSCAPE_X509 **a, const unsigned char **in, long len); int i2d_NETSCAPE_X509(NETSCAPE_X509 *a, unsigned char **out); extern const ASN1_ITEM NETSCAPE_X509_it;
+int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
+int ASN1_TYPE_set_octetstring(ASN1_TYPE *a,
+ unsigned char *data, int len);
+int ASN1_TYPE_get_octetstring(ASN1_TYPE *a,
+ unsigned char *data, int max_len);
+int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
+ unsigned char *data, int len);
+int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a,long *num,
+ unsigned char *data, int max_len);
+struct stack_st_OPENSSL_BLOCK *ASN1_seq_unpack(const unsigned char *buf, int len,
+ d2i_of_void *d2i, void (*free_func)(OPENSSL_BLOCK));
+unsigned char *ASN1_seq_pack(struct stack_st_OPENSSL_BLOCK *safes, i2d_of_void *i2d,
+ unsigned char **buf, int *len );
+void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
+void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
+ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
+ ASN1_OCTET_STRING **oct);
+ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_OCTET_STRING **oct);
+void ASN1_STRING_set_default_mask(unsigned long mask);
+int ASN1_STRING_set_default_mask_asc(const char *p);
+unsigned long ASN1_STRING_get_default_mask(void);
+int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
+ int inform, unsigned long mask);
+int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
+ int inform, unsigned long mask,
+ long minsize, long maxsize);
+ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
+ const unsigned char *in, int inlen, int inform, int nid);
+ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
+int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
+void ASN1_STRING_TABLE_cleanup(void);
+ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
+void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
+ASN1_VALUE * ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in, long len, const ASN1_ITEM *it);
+int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
+int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
+void ASN1_add_oid_module(void);
+ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
+ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
+int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
+ const ASN1_ITEM *it, const ASN1_PCTX *pctx);
+ASN1_PCTX *ASN1_PCTX_new(void);
+void ASN1_PCTX_free(ASN1_PCTX *p);
+unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
+unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
+void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
+BIO_METHOD *BIO_f_asn1(void);
+BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
+int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+ const ASN1_ITEM *it);
+int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+ const char *hdr,
+ const ASN1_ITEM *it);
+int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
+ int ctype_nid, int econt_nid,
+ struct stack_st_X509_ALGOR *mdalgs,
+ const ASN1_ITEM *it);
+ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
+int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
+int SMIME_text(BIO *in, BIO *out);
+void ERR_load_ASN1_strings(void);
+typedef enum {
+ POINT_CONVERSION_COMPRESSED = 2,
+ POINT_CONVERSION_UNCOMPRESSED = 4,
+ POINT_CONVERSION_HYBRID = 6
+} point_conversion_form_t;
+typedef struct ec_method_st EC_METHOD;
+typedef struct ec_group_st
+ EC_GROUP;
+typedef struct ec_point_st EC_POINT;
+const EC_METHOD *EC_GFp_simple_method(void);
+const EC_METHOD *EC_GFp_mont_method(void);
+const EC_METHOD *EC_GFp_nist_method(void);
+const EC_METHOD *EC_GF2m_simple_method(void);
+EC_GROUP *EC_GROUP_new(const EC_METHOD *meth);
+void EC_GROUP_free(EC_GROUP *group);
+void EC_GROUP_clear_free(EC_GROUP *group);
+int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src);
+EC_GROUP *EC_GROUP_dup(const EC_GROUP *src);
+const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group);
+int EC_METHOD_get_field_type(const EC_METHOD *meth);
+int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor);
+const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group);
+int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
+int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx);
+void EC_GROUP_set_curve_name(EC_GROUP *group, int nid);
+int EC_GROUP_get_curve_name(const EC_GROUP *group);
+void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
+int EC_GROUP_get_asn1_flag(const EC_GROUP *group);
+void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form);
+point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *);
+unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x);
+size_t EC_GROUP_get_seed_len(const EC_GROUP *);
+size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len);
+int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
+int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx);
+int EC_GROUP_get_degree(const EC_GROUP *group);
+int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx);
+int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx);
+int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx);
+EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
+EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
+typedef struct {
+ int nid;
+ const char *comment;
+ } EC_builtin_curve;
+size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems);
+EC_POINT *EC_POINT_new(const EC_GROUP *group);
+void EC_POINT_free(EC_POINT *point);
+void EC_POINT_clear_free(EC_POINT *point);
+int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src);
+EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group);
+const EC_METHOD *EC_POINT_method_of(const EC_POINT *point);
+int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point);
+int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx);
+int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group,
+ const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx);
+int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
+int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
+ const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx);
+int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx);
+int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group,
+ const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx);
+int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p,
+ const BIGNUM *x, int y_bit, BN_CTX *ctx);
+size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p,
+ point_conversion_form_t form,
+ unsigned char *buf, size_t len, BN_CTX *ctx);
+int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p,
+ const unsigned char *buf, size_t len, BN_CTX *ctx);
+BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *,
+ point_conversion_form_t form, BIGNUM *, BN_CTX *);
+EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *,
+ EC_POINT *, BN_CTX *);
+char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *,
+ point_conversion_form_t form, BN_CTX *);
+EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *,
+ EC_POINT *, BN_CTX *);
+int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
+int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx);
+int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx);
+int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p);
+int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx);
+int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx);
+int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx);
+int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx);
+int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx);
+int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx);
+int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx);
+int EC_GROUP_have_precompute_mult(const EC_GROUP *group);
+int EC_GROUP_get_basis_type(const EC_GROUP *);
+int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k);
+int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1,
+ unsigned int *k2, unsigned int *k3);
+typedef struct ecpk_parameters_st ECPKPARAMETERS;
+EC_GROUP *d2i_ECPKParameters(EC_GROUP **, const unsigned char **in, long len);
+int i2d_ECPKParameters(const EC_GROUP *, unsigned char **out);
+int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
+int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
+typedef struct ec_key_st EC_KEY;
+EC_KEY *EC_KEY_new(void);
+int EC_KEY_get_flags(const EC_KEY *key);
+void EC_KEY_set_flags(EC_KEY *key, int flags);
+void EC_KEY_clear_flags(EC_KEY *key, int flags);
+EC_KEY *EC_KEY_new_by_curve_name(int nid);
+void EC_KEY_free(EC_KEY *key);
+EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src);
+EC_KEY *EC_KEY_dup(const EC_KEY *src);
+int EC_KEY_up_ref(EC_KEY *key);
+const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);
+int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
+const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key);
+int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv);
+const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
+int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
+unsigned EC_KEY_get_enc_flags(const EC_KEY *key);
+void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags);
+point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key);
+void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform);
+void *EC_KEY_get_key_method_data(EC_KEY *key,
+ void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
+void *EC_KEY_insert_key_method_data(EC_KEY *key, void *data,
+ void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *));
+void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag);
+int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx);
+int EC_KEY_generate_key(EC_KEY *key);
+int EC_KEY_check_key(const EC_KEY *key);
+int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y);
+EC_KEY *d2i_ECPrivateKey(EC_KEY **key, const unsigned char **in, long len);
+int i2d_ECPrivateKey(EC_KEY *key, unsigned char **out);
+EC_KEY *d2i_ECParameters(EC_KEY **key, const unsigned char **in, long len);
+int i2d_ECParameters(EC_KEY *key, unsigned char **out);
+EC_KEY *o2i_ECPublicKey(EC_KEY **key, const unsigned char **in, long len);
+int i2o_ECPublicKey(EC_KEY *key, unsigned char **out);
+int ECParameters_print(BIO *bp, const EC_KEY *key);
+int EC_KEY_print(BIO *bp, const EC_KEY *key, int off);
+int ECParameters_print_fp(FILE *fp, const EC_KEY *key);
+int EC_KEY_print_fp(FILE *fp, const EC_KEY *key, int off);
+void ERR_load_EC_strings(void);
+int buffer_put_ecpoint_ret(Buffer *, const EC_GROUP *, const EC_POINT *);
+void buffer_put_ecpoint(Buffer *, const EC_GROUP *, const EC_POINT *);
+int buffer_get_ecpoint_ret(Buffer *, const EC_GROUP *, EC_POINT *);
+void buffer_get_ecpoint(Buffer *, const EC_GROUP *, EC_POINT *);
+void seed_rng(void);
+void rexec_send_rng_seed(Buffer *);
+void rexec_recv_rng_seed(Buffer *);
+typedef struct obj_name_st
+ {
+ int type;
+ int alias;
+ const char *name;
+ const char *data;
+ } OBJ_NAME;
+int OBJ_NAME_init(void);
+int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
+ int (*cmp_func)(const char *, const char *),
+ void (*free_func)(const char *, int, const char *));
+const char *OBJ_NAME_get(const char *name,int type);
+int OBJ_NAME_add(const char *name,int type,const char *data);
+int OBJ_NAME_remove(const char *name,int type);
+void OBJ_NAME_cleanup(int type);
+void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),
+ void *arg);
+void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg),
+ void *arg);
+ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o);
+ASN1_OBJECT * OBJ_nid2obj(int n);
+const char * OBJ_nid2ln(int n);
+const char * OBJ_nid2sn(int n);
+int OBJ_obj2nid(const ASN1_OBJECT *o);
+ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name);
+int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
+int OBJ_txt2nid(const char *s);
+int OBJ_ln2nid(const char *s);
+int OBJ_sn2nid(const char *s);
+int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);
+const void * OBJ_bsearch_(const void *key,const void *base,int num,int size,
+ int (*cmp)(const void *, const void *));
+const void * OBJ_bsearch_ex_(const void *key,const void *base,int num,
+ int size,
+ int (*cmp)(const void *, const void *),
+ int flags);
+int OBJ_new_nid(int num);
+int OBJ_add_object(const ASN1_OBJECT *obj);
+int OBJ_create(const char *oid,const char *sn,const char *ln);
+void OBJ_cleanup(void );
+int OBJ_create_objects(BIO *in);
+int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
+int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
+int OBJ_add_sigid(int signid, int dig_id, int pkey_id);
+void OBJ_sigid_free(void);
+extern int obj_cleanup_defer;
+void check_defer(int nid);
+void ERR_load_OBJ_strings(void);
+struct evp_pkey_st
+ {
+ int type;
+ int save_type;
+ int references;
+ const EVP_PKEY_ASN1_METHOD *ameth;
+ ENGINE *engine;
+ union {
+ char *ptr;
+ struct rsa_st *rsa;
+ struct dsa_st *dsa;
+ struct dh_st *dh;
+ struct ec_key_st *ec;
+ } pkey;
+ int save_parameters;
+ struct stack_st_X509_ATTRIBUTE *attributes;
+ } ;
+struct env_md_st
+ {
+ int type;
+ int pkey_type;
+ int md_size;
+ unsigned long flags;
+ int (*init)(EVP_MD_CTX *ctx);
+ int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
+ int (*final)(EVP_MD_CTX *ctx,unsigned char *md);
+ int (*copy)(EVP_MD_CTX *to,const EVP_MD_CTX *from);
+ int (*cleanup)(EVP_MD_CTX *ctx);
+ int (*sign)(int type, const unsigned char *m, unsigned int m_length,
+ unsigned char *sigret, unsigned int *siglen, void *key);
+ int (*verify)(int type, const unsigned char *m, unsigned int m_length,
+ const unsigned char *sigbuf, unsigned int siglen,
+ void *key);
+ int required_pkey_type[5];
+ int block_size;
+ int ctx_size;
+ int (*md_ctrl)(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
+ } ;
+typedef int evp_sign_method(int type,const unsigned char *m,
+ unsigned int m_length,unsigned char *sigret,
+ unsigned int *siglen, void *key);
+typedef int evp_verify_method(int type,const unsigned char *m,
+ unsigned int m_length,const unsigned char *sigbuf,
+ unsigned int siglen, void *key);
+struct env_md_ctx_st
+ {
+ const EVP_MD *digest;
+ ENGINE *engine;
+ unsigned long flags;
+ void *md_data;
+ EVP_PKEY_CTX *pctx;
+ int (*update)(EVP_MD_CTX *ctx,const void *data,size_t count);
+ } ;
+struct evp_cipher_st
+ {
+ int nid;
+ int block_size;
+ int key_len;
+ int iv_len;
+ unsigned long flags;
+ int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
+ const unsigned char *iv, int enc);
+ int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ const unsigned char *in, size_t inl);
+ int (*cleanup)(EVP_CIPHER_CTX *);
+ int ctx_size;
+ int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *);
+ int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *);
+ int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
+ void *app_data;
+ } ;
+typedef struct evp_cipher_info_st
+ {
+ const EVP_CIPHER *cipher;
+ unsigned char iv[16];
+ } EVP_CIPHER_INFO;
+struct evp_cipher_ctx_st
+ {
+ const EVP_CIPHER *cipher;
+ ENGINE *engine;
+ int encrypt;
+ int buf_len;
+ unsigned char oiv[16];
+ unsigned char iv[16];
+ unsigned char buf[32];
+ int num;
+ void *app_data;
+ int key_len;
+ unsigned long flags;
+ void *cipher_data;
+ int final_used;
+ int block_mask;
+ unsigned char final[32];
+ } ;
+typedef struct evp_Encode_Ctx_st
+ {
+ int num;
+ int length;
+ unsigned char enc_data[80];
+ int line_num;
+ int expect_nl;
+ } EVP_ENCODE_CTX;
+typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
+ ASN1_TYPE *param, const EVP_CIPHER *cipher,
+ const EVP_MD *md, int en_de);
+int EVP_MD_type(const EVP_MD *md);
+int EVP_MD_pkey_type(const EVP_MD *md);
+int EVP_MD_size(const EVP_MD *md);
+int EVP_MD_block_size(const EVP_MD *md);
+unsigned long EVP_MD_flags(const EVP_MD *md);
+const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
+int EVP_CIPHER_nid(const EVP_CIPHER *cipher);
+int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);
+int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);
+int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);
+unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);
+const EVP_CIPHER * EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);
+int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in);
+void * EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);
+void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);
+unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);
+int EVP_Cipher(EVP_CIPHER_CTX *c,
+ unsigned char *out,
+ const unsigned char *in,
+ unsigned int inl);
+void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
+int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
+EVP_MD_CTX *EVP_MD_CTX_create(void);
+void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
+int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);
+void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
+void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
+int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx,int flags);
+int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
+int EVP_DigestUpdate(EVP_MD_CTX *ctx,const void *d,
+ size_t cnt);
+int EVP_DigestFinal_ex(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
+int EVP_Digest(const void *data, size_t count,
+ unsigned char *md, unsigned int *size, const EVP_MD *type, ENGINE *impl);
+int EVP_MD_CTX_copy(EVP_MD_CTX *out,const EVP_MD_CTX *in);
+int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
+int EVP_DigestFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s);
+int EVP_read_pw_string(char *buf,int length,const char *prompt,int verify);
+int EVP_read_pw_string_min(char *buf,int minlen,int maxlen,const char *prompt,int verify);
+void EVP_set_pw_prompt(const char *prompt);
+char * EVP_get_pw_prompt(void);
+int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
+ const unsigned char *salt, const unsigned char *data,
+ int datal, int count, unsigned char *key,unsigned char *iv);
+void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags);
+void EVP_CIPHER_CTX_clear_flags(EVP_CIPHER_CTX *ctx, int flags);
+int EVP_CIPHER_CTX_test_flags(const EVP_CIPHER_CTX *ctx,int flags);
+int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
+ const unsigned char *key, const unsigned char *iv);
+int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
+ const unsigned char *key, const unsigned char *iv);
+int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ int *outl, const unsigned char *in, int inl);
+int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
+ const unsigned char *key, const unsigned char *iv);
+int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
+ const unsigned char *key, const unsigned char *iv);
+int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ int *outl, const unsigned char *in, int inl);
+int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher,
+ const unsigned char *key,const unsigned char *iv,
+ int enc);
+int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher, ENGINE *impl,
+ const unsigned char *key,const unsigned char *iv,
+ int enc);
+int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
+ int *outl, const unsigned char *in, int inl);
+int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
+int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
+ EVP_PKEY *pkey);
+int EVP_VerifyFinal(EVP_MD_CTX *ctx,const unsigned char *sigbuf,
+ unsigned int siglen,EVP_PKEY *pkey);
+int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+int EVP_DigestSignFinal(EVP_MD_CTX *ctx,
+ unsigned char *sigret, size_t *siglen);
+int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
+ const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey);
+int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx,
+ unsigned char *sig, size_t siglen);
+int EVP_OpenInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
+ const unsigned char *ek, int ekl, const unsigned char *iv,
+ EVP_PKEY *priv);
+int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
+int EVP_SealInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
+ unsigned char **ek, int *ekl, unsigned char *iv,
+ EVP_PKEY **pubk, int npubk);
+int EVP_SealFinal(EVP_CIPHER_CTX *ctx,unsigned char *out,int *outl);
+void EVP_EncodeInit(EVP_ENCODE_CTX *ctx);
+void EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
+ const unsigned char *in,int inl);
+void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl);
+int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int n);
+void EVP_DecodeInit(EVP_ENCODE_CTX *ctx);
+int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx,unsigned char *out,int *outl,
+ const unsigned char *in, int inl);
+int EVP_DecodeFinal(EVP_ENCODE_CTX *ctx, unsigned
+ char *out, int *outl);
+int EVP_DecodeBlock(unsigned char *t, const unsigned char *f, int n);
+void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
+int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);
+EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
+void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a);
+int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);
+int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
+int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
+int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key);
+BIO_METHOD *BIO_f_md(void);
+BIO_METHOD *BIO_f_base64(void);
+BIO_METHOD *BIO_f_cipher(void);
+BIO_METHOD *BIO_f_reliable(void);
+void BIO_set_cipher(BIO *b,const EVP_CIPHER *c,const unsigned char *k,
+ const unsigned char *i, int enc);
+const EVP_MD *EVP_md_null(void);
+const EVP_MD *EVP_md4(void);
+const EVP_MD *EVP_md5(void);
+const EVP_MD *EVP_sha(void);
+const EVP_MD *EVP_sha1(void);
+const EVP_MD *EVP_dss(void);
+const EVP_MD *EVP_dss1(void);
+const EVP_MD *EVP_ecdsa(void);
+const EVP_MD *EVP_sha224(void);
+const EVP_MD *EVP_sha256(void);
+const EVP_MD *EVP_sha384(void);
+const EVP_MD *EVP_sha512(void);
+const EVP_MD *EVP_mdc2(void);
+const EVP_MD *EVP_ripemd160(void);
+const EVP_MD *EVP_whirlpool(void);
+const EVP_CIPHER *EVP_enc_null(void);
+const EVP_CIPHER *EVP_des_ecb(void);
+const EVP_CIPHER *EVP_des_ede(void);
+const EVP_CIPHER *EVP_des_ede3(void);
+const EVP_CIPHER *EVP_des_ede_ecb(void);
+const EVP_CIPHER *EVP_des_ede3_ecb(void);
+const EVP_CIPHER *EVP_des_cfb64(void);
+const EVP_CIPHER *EVP_des_cfb1(void);
+const EVP_CIPHER *EVP_des_cfb8(void);
+const EVP_CIPHER *EVP_des_ede_cfb64(void);
+const EVP_CIPHER *EVP_des_ede3_cfb64(void);
+const EVP_CIPHER *EVP_des_ede3_cfb1(void);
+const EVP_CIPHER *EVP_des_ede3_cfb8(void);
+const EVP_CIPHER *EVP_des_ofb(void);
+const EVP_CIPHER *EVP_des_ede_ofb(void);
+const EVP_CIPHER *EVP_des_ede3_ofb(void);
+const EVP_CIPHER *EVP_des_cbc(void);
+const EVP_CIPHER *EVP_des_ede_cbc(void);
+const EVP_CIPHER *EVP_des_ede3_cbc(void);
+const EVP_CIPHER *EVP_desx_cbc(void);
+const EVP_CIPHER *EVP_rc4(void);
+const EVP_CIPHER *EVP_rc4_40(void);
+const EVP_CIPHER *EVP_rc4_hmac_md5(void);
+const EVP_CIPHER *EVP_idea_ecb(void);
+const EVP_CIPHER *EVP_idea_cfb64(void);
+const EVP_CIPHER *EVP_idea_ofb(void);
+const EVP_CIPHER *EVP_idea_cbc(void);
+const EVP_CIPHER *EVP_rc2_ecb(void);
+const EVP_CIPHER *EVP_rc2_cbc(void);
+const EVP_CIPHER *EVP_rc2_40_cbc(void);
+const EVP_CIPHER *EVP_rc2_64_cbc(void);
+const EVP_CIPHER *EVP_rc2_cfb64(void);
+const EVP_CIPHER *EVP_rc2_ofb(void);
+const EVP_CIPHER *EVP_bf_ecb(void);
+const EVP_CIPHER *EVP_bf_cbc(void);
+const EVP_CIPHER *EVP_bf_cfb64(void);
+const EVP_CIPHER *EVP_bf_ofb(void);
+const EVP_CIPHER *EVP_cast5_ecb(void);
+const EVP_CIPHER *EVP_cast5_cbc(void);
+const EVP_CIPHER *EVP_cast5_cfb64(void);
+const EVP_CIPHER *EVP_cast5_ofb(void);
+const EVP_CIPHER *EVP_rc5_32_12_16_cbc(void);
+const EVP_CIPHER *EVP_rc5_32_12_16_ecb(void);
+const EVP_CIPHER *EVP_rc5_32_12_16_cfb64(void);
+const EVP_CIPHER *EVP_rc5_32_12_16_ofb(void);
+const EVP_CIPHER *EVP_aes_128_ecb(void);
+const EVP_CIPHER *EVP_aes_128_cbc(void);
+const EVP_CIPHER *EVP_aes_128_cfb1(void);
+const EVP_CIPHER *EVP_aes_128_cfb8(void);
+const EVP_CIPHER *EVP_aes_128_cfb128(void);
+const EVP_CIPHER *EVP_aes_128_ofb(void);
+const EVP_CIPHER *EVP_aes_128_ctr(void);
+const EVP_CIPHER *EVP_aes_128_ccm(void);
+const EVP_CIPHER *EVP_aes_128_gcm(void);
+const EVP_CIPHER *EVP_aes_128_xts(void);
+const EVP_CIPHER *EVP_aes_192_ecb(void);
+const EVP_CIPHER *EVP_aes_192_cbc(void);
+const EVP_CIPHER *EVP_aes_192_cfb1(void);
+const EVP_CIPHER *EVP_aes_192_cfb8(void);
+const EVP_CIPHER *EVP_aes_192_cfb128(void);
+const EVP_CIPHER *EVP_aes_192_ofb(void);
+const EVP_CIPHER *EVP_aes_192_ctr(void);
+const EVP_CIPHER *EVP_aes_192_ccm(void);
+const EVP_CIPHER *EVP_aes_192_gcm(void);
+const EVP_CIPHER *EVP_aes_256_ecb(void);
+const EVP_CIPHER *EVP_aes_256_cbc(void);
+const EVP_CIPHER *EVP_aes_256_cfb1(void);
+const EVP_CIPHER *EVP_aes_256_cfb8(void);
+const EVP_CIPHER *EVP_aes_256_cfb128(void);
+const EVP_CIPHER *EVP_aes_256_ofb(void);
+const EVP_CIPHER *EVP_aes_256_ctr(void);
+const EVP_CIPHER *EVP_aes_256_ccm(void);
+const EVP_CIPHER *EVP_aes_256_gcm(void);
+const EVP_CIPHER *EVP_aes_256_xts(void);
+const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void);
+const EVP_CIPHER *EVP_aes_256_cbc_hmac_sha1(void);
+const EVP_CIPHER *EVP_camellia_128_ecb(void);
+const EVP_CIPHER *EVP_camellia_128_cbc(void);
+const EVP_CIPHER *EVP_camellia_128_cfb1(void);
+const EVP_CIPHER *EVP_camellia_128_cfb8(void);
+const EVP_CIPHER *EVP_camellia_128_cfb128(void);
+const EVP_CIPHER *EVP_camellia_128_ofb(void);
+const EVP_CIPHER *EVP_camellia_192_ecb(void);
+const EVP_CIPHER *EVP_camellia_192_cbc(void);
+const EVP_CIPHER *EVP_camellia_192_cfb1(void);
+const EVP_CIPHER *EVP_camellia_192_cfb8(void);
+const EVP_CIPHER *EVP_camellia_192_cfb128(void);
+const EVP_CIPHER *EVP_camellia_192_ofb(void);
+const EVP_CIPHER *EVP_camellia_256_ecb(void);
+const EVP_CIPHER *EVP_camellia_256_cbc(void);
+const EVP_CIPHER *EVP_camellia_256_cfb1(void);
+const EVP_CIPHER *EVP_camellia_256_cfb8(void);
+const EVP_CIPHER *EVP_camellia_256_cfb128(void);
+const EVP_CIPHER *EVP_camellia_256_ofb(void);
+const EVP_CIPHER *EVP_seed_ecb(void);
+const EVP_CIPHER *EVP_seed_cbc(void);
+const EVP_CIPHER *EVP_seed_cfb128(void);
+const EVP_CIPHER *EVP_seed_ofb(void);
+void OPENSSL_add_all_algorithms_noconf(void);
+void OPENSSL_add_all_algorithms_conf(void);
+void OpenSSL_add_all_ciphers(void);
+void OpenSSL_add_all_digests(void);
+int EVP_add_cipher(const EVP_CIPHER *cipher);
+int EVP_add_digest(const EVP_MD *digest);
+const EVP_CIPHER *EVP_get_cipherbyname(const char *name);
+const EVP_MD *EVP_get_digestbyname(const char *name);
+void EVP_cleanup(void);
+void EVP_CIPHER_do_all(void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *x), void *arg);
+void EVP_CIPHER_do_all_sorted(void (*fn)(const EVP_CIPHER *ciph,
+ const char *from, const char *to, void *x), void *arg);
+void EVP_MD_do_all(void (*fn)(const EVP_MD *ciph,
+ const char *from, const char *to, void *x), void *arg);
+void EVP_MD_do_all_sorted(void (*fn)(const EVP_MD *ciph,
+ const char *from, const char *to, void *x), void *arg);
+int EVP_PKEY_decrypt_old(unsigned char *dec_key,
+ const unsigned char *enc_key,int enc_key_len,
+ EVP_PKEY *private_key);
+int EVP_PKEY_encrypt_old(unsigned char *enc_key,
+ const unsigned char *key,int key_len,
+ EVP_PKEY *pub_key);
+int EVP_PKEY_type(int type);
+int EVP_PKEY_id(const EVP_PKEY *pkey);
+int EVP_PKEY_base_id(const EVP_PKEY *pkey);
+int EVP_PKEY_bits(EVP_PKEY *pkey);
+int EVP_PKEY_size(EVP_PKEY *pkey);
+int EVP_PKEY_set_type(EVP_PKEY *pkey,int type);
+int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
+int EVP_PKEY_assign(EVP_PKEY *pkey,int type,void *key);
+void * EVP_PKEY_get0(EVP_PKEY *pkey);
+struct rsa_st;
+int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key);
+struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
+struct dsa_st;
+int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key);
+struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
+struct dh_st;
+int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);
+struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
+struct ec_key_st;
+int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,struct ec_key_st *key);
+struct ec_key_st *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
+EVP_PKEY * EVP_PKEY_new(void);
+void EVP_PKEY_free(EVP_PKEY *pkey);
+EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, const unsigned char **pp,
+ long length);
+int i2d_PublicKey(EVP_PKEY *a, unsigned char **pp);
+EVP_PKEY * d2i_PrivateKey(int type,EVP_PKEY **a, const unsigned char **pp,
+ long length);
+EVP_PKEY * d2i_AutoPrivateKey(EVP_PKEY **a, const unsigned char **pp,
+ long length);
+int i2d_PrivateKey(EVP_PKEY *a, unsigned char **pp);
+int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from);
+int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey);
+int EVP_PKEY_save_parameters(EVP_PKEY *pkey,int mode);
+int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b);
+int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b);
+int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx);
+int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid);
+int EVP_CIPHER_type(const EVP_CIPHER *ctx);
+int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
+int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);
+int EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);
+int EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *c,ASN1_TYPE *type);
+int PKCS5_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
+ ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
+ int en_de);
+int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,
+ const unsigned char *salt, int saltlen, int iter,
+ int keylen, unsigned char *out);
+int PKCS5_PBKDF2_HMAC(const char *pass, int passlen,
+ const unsigned char *salt, int saltlen, int iter,
+ const EVP_MD *digest,
+ int keylen, unsigned char *out);
+int PKCS5_v2_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
+ ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md,
+ int en_de);
+void PKCS5_PBE_add(void);
+int EVP_PBE_CipherInit (ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
+ ASN1_TYPE *param, EVP_CIPHER_CTX *ctx, int en_de);
+int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid, int md_nid,
+ EVP_PBE_KEYGEN *keygen);
+int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
+ EVP_PBE_KEYGEN *keygen);
+int EVP_PBE_find(int type, int pbe_nid,
+ int *pcnid, int *pmnid, EVP_PBE_KEYGEN **pkeygen);
+void EVP_PBE_cleanup(void);
+int EVP_PKEY_asn1_get_count(void);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type);
+const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,
+ const char *str, int len);
+int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth);
+int EVP_PKEY_asn1_add_alias(int to, int from);
+int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags,
+ const char **pinfo, const char **ppem_str,
+ const EVP_PKEY_ASN1_METHOD *ameth);
+const EVP_PKEY_ASN1_METHOD* EVP_PKEY_get0_asn1(EVP_PKEY *pkey);
+EVP_PKEY_ASN1_METHOD* EVP_PKEY_asn1_new(int id, int flags,
+ const char *pem_str, const char *info);
+void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst,
+ const EVP_PKEY_ASN1_METHOD *src);
+void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth);
+void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub),
+ int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk),
+ int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
+ int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx),
+ int (*pkey_size)(const EVP_PKEY *pk),
+ int (*pkey_bits)(const EVP_PKEY *pk));
+void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*priv_decode)(EVP_PKEY *pk, PKCS8_PRIV_KEY_INFO *p8inf),
+ int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk),
+ int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx));
+void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*param_decode)(EVP_PKEY *pkey,
+ const unsigned char **pder, int derlen),
+ int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder),
+ int (*param_missing)(const EVP_PKEY *pk),
+ int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from),
+ int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b),
+ int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
+ ASN1_PCTX *pctx));
+void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth,
+ void (*pkey_free)(EVP_PKEY *pkey));
+void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth,
+ int (*pkey_ctrl)(EVP_PKEY *pkey, int op,
+ long arg1, void *arg2));
+const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
+EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags);
+void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
+ const EVP_PKEY_METHOD *meth);
+void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
+void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
+int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
+EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
+EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
+EVP_PKEY_CTX *EVP_PKEY_CTX_dup(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
+ int cmd, int p1, void *p2);
+int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
+ const char *value);
+int EVP_PKEY_CTX_get_operation(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_set0_keygen_info(EVP_PKEY_CTX *ctx, int *dat, int datlen);
+EVP_PKEY *EVP_PKEY_new_mac_key(int type, ENGINE *e,
+ const unsigned char *key, int keylen);
+void EVP_PKEY_CTX_set_data(EVP_PKEY_CTX *ctx, void *data);
+void *EVP_PKEY_CTX_get_data(EVP_PKEY_CTX *ctx);
+EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx);
+EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx);
+void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data);
+void *EVP_PKEY_CTX_get_app_data(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen);
+int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
+ const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen);
+int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
+ unsigned char *rout, size_t *routlen,
+ const unsigned char *sig, size_t siglen);
+int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
+ unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen);
+int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
+int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
+typedef int EVP_PKEY_gen_cb(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_paramgen_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+int EVP_PKEY_keygen_init(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY **ppkey);
+void EVP_PKEY_CTX_set_cb(EVP_PKEY_CTX *ctx, EVP_PKEY_gen_cb *cb);
+EVP_PKEY_gen_cb *EVP_PKEY_CTX_get_cb(EVP_PKEY_CTX *ctx);
+int EVP_PKEY_CTX_get_keygen_info(EVP_PKEY_CTX *ctx, int idx);
+void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
+ int (*init)(EVP_PKEY_CTX *ctx));
+void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
+ int (*copy)(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src));
+void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
+ void (*cleanup)(EVP_PKEY_CTX *ctx));
+void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
+ int (*paramgen_init)(EVP_PKEY_CTX *ctx),
+ int (*paramgen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
+void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
+ int (*keygen_init)(EVP_PKEY_CTX *ctx),
+ int (*keygen)(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey));
+void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
+ int (*sign_init)(EVP_PKEY_CTX *ctx),
+ int (*sign)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen));
+void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
+ int (*verify_init)(EVP_PKEY_CTX *ctx),
+ int (*verify)(EVP_PKEY_CTX *ctx, const unsigned char *sig, size_t siglen,
+ const unsigned char *tbs, size_t tbslen));
+void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
+ int (*verify_recover_init)(EVP_PKEY_CTX *ctx),
+ int (*verify_recover)(EVP_PKEY_CTX *ctx,
+ unsigned char *sig, size_t *siglen,
+ const unsigned char *tbs, size_t tbslen));
+void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
+ int (*signctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
+ int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
+ EVP_MD_CTX *mctx));
+void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
+ int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx),
+ int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig,int siglen,
+ EVP_MD_CTX *mctx));
+void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
+ int (*encrypt_init)(EVP_PKEY_CTX *ctx),
+ int (*encryptfn)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen));
+void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
+ int (*decrypt_init)(EVP_PKEY_CTX *ctx),
+ int (*decrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ const unsigned char *in, size_t inlen));
+void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
+ int (*derive_init)(EVP_PKEY_CTX *ctx),
+ int (*derive)(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen));
+void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
+ int (*ctrl)(EVP_PKEY_CTX *ctx, int type, int p1, void *p2),
+ int (*ctrl_str)(EVP_PKEY_CTX *ctx,
+ const char *type, const char *value));
+void EVP_add_alg_module(void);
+void ERR_load_EVP_strings(void);
+typedef int ptrdiff_t;
+struct buf_mem_st
+ {
+ size_t length;
+ char *data;
+ size_t max;
+ };
+BUF_MEM *BUF_MEM_new(void);
+void BUF_MEM_free(BUF_MEM *a);
+int BUF_MEM_grow(BUF_MEM *str, size_t len);
+int BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
+char * BUF_strdup(const char *str);
+char * BUF_strndup(const char *str, size_t siz);
+void * BUF_memdup(const void *data, size_t siz);
+void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
+size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
+size_t BUF_strlcat(char *dst,const char *src,size_t siz);
+void ERR_load_BUF_strings(void);
+typedef struct ECDSA_SIG_st
+ {
+ BIGNUM *r;
+ BIGNUM *s;
+ } ECDSA_SIG;
+ECDSA_SIG *ECDSA_SIG_new(void);
+void ECDSA_SIG_free(ECDSA_SIG *sig);
+int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
+ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len);
+ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);
+ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
+ const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
+int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
+ const ECDSA_SIG *sig, EC_KEY* eckey);
+const ECDSA_METHOD *ECDSA_OpenSSL(void);
+void ECDSA_set_default_method(const ECDSA_METHOD *meth);
+const ECDSA_METHOD *ECDSA_get_default_method(void);
+int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
+int ECDSA_size(const EC_KEY *eckey);
+int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,
+ BIGNUM **rp);
+int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
+ unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
+int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
+ unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
+ const BIGNUM *rp, EC_KEY *eckey);
+int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,
+ const unsigned char *sig, int siglen, EC_KEY *eckey);
+int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
+ *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
+void *ECDSA_get_ex_data(EC_KEY *d, int idx);
+void ERR_load_ECDSA_strings(void);
+const ECDH_METHOD *ECDH_OpenSSL(void);
+void ECDH_set_default_method(const ECDH_METHOD *);
+const ECDH_METHOD *ECDH_get_default_method(void);
+int ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
+int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,
+ void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
+int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
+ *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
+void *ECDH_get_ex_data(EC_KEY *d, int idx);
+void ERR_load_ECDH_strings(void);
+struct rsa_meth_st
+ {
+ const char *name;
+ int (*rsa_pub_enc)(int flen,const unsigned char *from,
+ unsigned char *to,
+ RSA *rsa,int padding);
+ int (*rsa_pub_dec)(int flen,const unsigned char *from,
+ unsigned char *to,
+ RSA *rsa,int padding);
+ int (*rsa_priv_enc)(int flen,const unsigned char *from,
+ unsigned char *to,
+ RSA *rsa,int padding);
+ int (*rsa_priv_dec)(int flen,const unsigned char *from,
+ unsigned char *to,
+ RSA *rsa,int padding);
+ int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx);
+ int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx,
+ BN_MONT_CTX *m_ctx);
+ int (*init)(RSA *rsa);
+ int (*finish)(RSA *rsa);
+ int flags;
+ char *app_data;
+ int (*rsa_sign)(int type,
+ const unsigned char *m, unsigned int m_length,
+ unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
+ int (*rsa_verify)(int dtype,
+ const unsigned char *m, unsigned int m_length,
+ const unsigned char *sigbuf, unsigned int siglen,
+ const RSA *rsa);
+ int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
+ };
+struct rsa_st
+ {
+ int pad;
+ long version;
+ const RSA_METHOD *meth;
+ ENGINE *engine;
+ BIGNUM *n;
+ BIGNUM *e;
+ BIGNUM *d;
+ BIGNUM *p;
+ BIGNUM *q;
+ BIGNUM *dmp1;
+ BIGNUM *dmq1;
+ BIGNUM *iqmp;
+ CRYPTO_EX_DATA ex_data;
+ int references;
+ int flags;
+ BN_MONT_CTX *_method_mod_n;
+ BN_MONT_CTX *_method_mod_p;
+ BN_MONT_CTX *_method_mod_q;
+ char *bignum_data;
+ BN_BLINDING *blinding;
+ BN_BLINDING *mt_blinding;
+ };
+RSA * RSA_new(void);
+RSA * RSA_new_method(ENGINE *engine);
+int RSA_size(const RSA *rsa);
+RSA * RSA_generate_key(int bits, unsigned long e,void
+ (*callback)(int,int,void *),void *cb_arg);
+int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
+int RSA_check_key(const RSA *);
+int RSA_public_encrypt(int flen, const unsigned char *from,
+ unsigned char *to, RSA *rsa,int padding);
+int RSA_private_encrypt(int flen, const unsigned char *from,
+ unsigned char *to, RSA *rsa,int padding);
+int RSA_public_decrypt(int flen, const unsigned char *from,
+ unsigned char *to, RSA *rsa,int padding);
+int RSA_private_decrypt(int flen, const unsigned char *from,
+ unsigned char *to, RSA *rsa,int padding);
+void RSA_free (RSA *r);
+int RSA_up_ref(RSA *r);
+int RSA_flags(const RSA *r);
+void RSA_set_default_method(const RSA_METHOD *meth);
+const RSA_METHOD *RSA_get_default_method(void);
+const RSA_METHOD *RSA_get_method(const RSA *rsa);
+int RSA_set_method(RSA *rsa, const RSA_METHOD *meth);
+int RSA_memory_lock(RSA *r);
+const RSA_METHOD *RSA_PKCS1_SSLeay(void);
+const RSA_METHOD *RSA_null_method(void);
+RSA *d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len); int i2d_RSAPublicKey(const RSA *a, unsigned char **out); extern const ASN1_ITEM RSAPublicKey_it;
+RSA *d2i_RSAPrivateKey(RSA **a, const unsigned char **in, long len); int i2d_RSAPrivateKey(const RSA *a, unsigned char **out); extern const ASN1_ITEM RSAPrivateKey_it;
+typedef struct rsa_pss_params_st
+ {
+ X509_ALGOR *hashAlgorithm;
+ X509_ALGOR *maskGenAlgorithm;
+ ASN1_INTEGER *saltLength;
+ ASN1_INTEGER *trailerField;
+ } RSA_PSS_PARAMS;
+RSA_PSS_PARAMS *RSA_PSS_PARAMS_new(void); void RSA_PSS_PARAMS_free(RSA_PSS_PARAMS *a); RSA_PSS_PARAMS *d2i_RSA_PSS_PARAMS(RSA_PSS_PARAMS **a, const unsigned char **in, long len); int i2d_RSA_PSS_PARAMS(RSA_PSS_PARAMS *a, unsigned char **out); extern const ASN1_ITEM RSA_PSS_PARAMS_it;
+int RSA_print_fp(FILE *fp, const RSA *r,int offset);
+int RSA_print(BIO *bp, const RSA *r,int offset);
+int i2d_RSA_NET(const RSA *a, unsigned char **pp,
+ int (*cb)(char *buf, int len, const char *prompt, int verify),
+ int sgckey);
+RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
+ int (*cb)(char *buf, int len, const char *prompt, int verify),
+ int sgckey);
+int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
+ int (*cb)(char *buf, int len, const char *prompt,
+ int verify));
+RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
+ int (*cb)(char *buf, int len, const char *prompt,
+ int verify));
+int RSA_sign(int type, const unsigned char *m, unsigned int m_length,
+ unsigned char *sigret, unsigned int *siglen, RSA *rsa);
+int RSA_verify(int type, const unsigned char *m, unsigned int m_length,
+ const unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
+int RSA_sign_ASN1_OCTET_STRING(int type,
+ const unsigned char *m, unsigned int m_length,
+ unsigned char *sigret, unsigned int *siglen, RSA *rsa);
+int RSA_verify_ASN1_OCTET_STRING(int type,
+ const unsigned char *m, unsigned int m_length,
+ unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
+int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
+void RSA_blinding_off(RSA *rsa);
+BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
+int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen,
+ const unsigned char *f,int fl);
+int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,int rsa_len);
+int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,
+ const unsigned char *f,int fl);
+int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,int rsa_len);
+int PKCS1_MGF1(unsigned char *mask, long len,
+ const unsigned char *seed, long seedlen, const EVP_MD *dgst);
+int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,
+ const unsigned char *p,int pl);
+int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,int rsa_len,
+ const unsigned char *p,int pl);
+int RSA_padding_add_SSLv23(unsigned char *to,int tlen,
+ const unsigned char *f,int fl);
+int RSA_padding_check_SSLv23(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,int rsa_len);
+int RSA_padding_add_none(unsigned char *to,int tlen,
+ const unsigned char *f,int fl);
+int RSA_padding_check_none(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,int rsa_len);
+int RSA_padding_add_X931(unsigned char *to,int tlen,
+ const unsigned char *f,int fl);
+int RSA_padding_check_X931(unsigned char *to,int tlen,
+ const unsigned char *f,int fl,int rsa_len);
+int RSA_X931_hash_id(int nid);
+int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
+ const EVP_MD *Hash, const unsigned char *EM, int sLen);
+int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
+ const unsigned char *mHash,
+ const EVP_MD *Hash, int sLen);
+int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
+ const EVP_MD *Hash, const EVP_MD *mgf1Hash,
+ const unsigned char *EM, int sLen);
+int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
+ const unsigned char *mHash,
+ const EVP_MD *Hash, const EVP_MD *mgf1Hash, int sLen);
+int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int RSA_set_ex_data(RSA *r,int idx,void *arg);
+void *RSA_get_ex_data(const RSA *r, int idx);
+RSA *RSAPublicKey_dup(RSA *rsa);
+RSA *RSAPrivateKey_dup(RSA *rsa);
+void ERR_load_RSA_strings(void);
+struct dh_method
+ {
+ const char *name;
+ int (*generate_key)(DH *dh);
+ int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
+ int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
+ const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
+ BN_MONT_CTX *m_ctx);
+ int (*init)(DH *dh);
+ int (*finish)(DH *dh);
+ int flags;
+ char *app_data;
+ int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
+ };
+struct dh_st
+ {
+ int pad;
+ int version;
+ BIGNUM *p;
+ BIGNUM *g;
+ long length;
+ BIGNUM *pub_key;
+ BIGNUM *priv_key;
+ int flags;
+ BN_MONT_CTX *method_mont_p;
+ BIGNUM *q;
+ BIGNUM *j;
+ unsigned char *seed;
+ int seedlen;
+ BIGNUM *counter;
+ int references;
+ CRYPTO_EX_DATA ex_data;
+ const DH_METHOD *meth;
+ ENGINE *engine;
+ };
+DH *DHparams_dup(DH *);
+const DH_METHOD *DH_OpenSSL(void);
+void DH_set_default_method(const DH_METHOD *meth);
+const DH_METHOD *DH_get_default_method(void);
+int DH_set_method(DH *dh, const DH_METHOD *meth);
+DH *DH_new_method(ENGINE *engine);
+DH * DH_new(void);
+void DH_free(DH *dh);
+int DH_up_ref(DH *dh);
+int DH_size(const DH *dh);
+int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int DH_set_ex_data(DH *d, int idx, void *arg);
+void *DH_get_ex_data(DH *d, int idx);
+DH * DH_generate_parameters(int prime_len,int generator,
+ void (*callback)(int,int,void *),void *cb_arg);
+int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
+int DH_check(const DH *dh,int *codes);
+int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
+int DH_generate_key(DH *dh);
+int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
+DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
+int i2d_DHparams(const DH *a,unsigned char **pp);
+int DHparams_print_fp(FILE *fp, const DH *x);
+int DHparams_print(BIO *bp, const DH *x);
+void ERR_load_DH_strings(void);
+typedef struct DSA_SIG_st
+ {
+ BIGNUM *r;
+ BIGNUM *s;
+ } DSA_SIG;
+struct dsa_method
+ {
+ const char *name;
+ DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
+ int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
+ BIGNUM **rp);
+ int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
+ DSA_SIG *sig, DSA *dsa);
+ int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
+ BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
+ BN_MONT_CTX *in_mont);
+ int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
+ const BIGNUM *m, BN_CTX *ctx,
+ BN_MONT_CTX *m_ctx);
+ int (*init)(DSA *dsa);
+ int (*finish)(DSA *dsa);
+ int flags;
+ char *app_data;
+ int (*dsa_paramgen)(DSA *dsa, int bits,
+ const unsigned char *seed, int seed_len,
+ int *counter_ret, unsigned long *h_ret,
+ BN_GENCB *cb);
+ int (*dsa_keygen)(DSA *dsa);
+ };
+struct dsa_st
+ {
+ int pad;
+ long version;
+ int write_params;
+ BIGNUM *p;
+ BIGNUM *q;
+ BIGNUM *g;
+ BIGNUM *pub_key;
+ BIGNUM *priv_key;
+ BIGNUM *kinv;
+ BIGNUM *r;
+ int flags;
+ BN_MONT_CTX *method_mont_p;
+ int references;
+ CRYPTO_EX_DATA ex_data;
+ const DSA_METHOD *meth;
+ ENGINE *engine;
+ };
+DSA *DSAparams_dup(DSA *x);
+DSA_SIG * DSA_SIG_new(void);
+void DSA_SIG_free(DSA_SIG *a);
+int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
+DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
+DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
+int DSA_do_verify(const unsigned char *dgst,int dgst_len,
+ DSA_SIG *sig,DSA *dsa);
+const DSA_METHOD *DSA_OpenSSL(void);
+void DSA_set_default_method(const DSA_METHOD *);
+const DSA_METHOD *DSA_get_default_method(void);
+int DSA_set_method(DSA *dsa, const DSA_METHOD *);
+DSA * DSA_new(void);
+DSA * DSA_new_method(ENGINE *engine);
+void DSA_free (DSA *r);
+int DSA_up_ref(DSA *r);
+int DSA_size(const DSA *);
+int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
+int DSA_sign(int type,const unsigned char *dgst,int dlen,
+ unsigned char *sig, unsigned int *siglen, DSA *dsa);
+int DSA_verify(int type,const unsigned char *dgst,int dgst_len,
+ const unsigned char *sigbuf, int siglen, DSA *dsa);
+int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int DSA_set_ex_data(DSA *d, int idx, void *arg);
+void *DSA_get_ex_data(DSA *d, int idx);
+DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
+DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
+DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
+DSA * DSA_generate_parameters(int bits,
+ unsigned char *seed,int seed_len,
+ int *counter_ret, unsigned long *h_ret,void
+ (*callback)(int, int, void *),void *cb_arg);
+int DSA_generate_parameters_ex(DSA *dsa, int bits,
+ const unsigned char *seed,int seed_len,
+ int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
+int DSA_generate_key(DSA *a);
+int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
+int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
+int i2d_DSAparams(const DSA *a,unsigned char **pp);
+int DSAparams_print(BIO *bp, const DSA *x);
+int DSA_print(BIO *bp, const DSA *x, int off);
+int DSAparams_print_fp(FILE *fp, const DSA *x);
+int DSA_print_fp(FILE *bp, const DSA *x, int off);
+DH *DSA_dup_DH(const DSA *r);
+void ERR_load_DSA_strings(void);
+typedef struct SHAstate_st
+ {
+ unsigned int h0,h1,h2,h3,h4;
+ unsigned int Nl,Nh;
+ unsigned int data[16];
+ unsigned int num;
+ } SHA_CTX;
+int SHA_Init(SHA_CTX *c);
+int SHA_Update(SHA_CTX *c, const void *data, size_t len);
+int SHA_Final(unsigned char *md, SHA_CTX *c);
+unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);
+void SHA_Transform(SHA_CTX *c, const unsigned char *data);
+int SHA1_Init(SHA_CTX *c);
+int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
+int SHA1_Final(unsigned char *md, SHA_CTX *c);
+unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
+void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
+typedef struct SHA256state_st
+ {
+ unsigned int h[8];
+ unsigned int Nl,Nh;
+ unsigned int data[16];
+ unsigned int num,md_len;
+ } SHA256_CTX;
+int SHA224_Init(SHA256_CTX *c);
+int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
+int SHA224_Final(unsigned char *md, SHA256_CTX *c);
+unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md);
+int SHA256_Init(SHA256_CTX *c);
+int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
+int SHA256_Final(unsigned char *md, SHA256_CTX *c);
+unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);
+void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
+typedef struct SHA512state_st
+ {
+ unsigned long long h[8];
+ unsigned long long Nl,Nh;
+ union {
+ unsigned long long d[16];
+ unsigned char p[(16*8)];
+ } u;
+ unsigned int num,md_len;
+ } SHA512_CTX;
+int SHA384_Init(SHA512_CTX *c);
+int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
+int SHA384_Final(unsigned char *md, SHA512_CTX *c);
+unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md);
+int SHA512_Init(SHA512_CTX *c);
+int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
+int SHA512_Final(unsigned char *md, SHA512_CTX *c);
+unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);
+void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
+typedef struct X509_objects_st
+ {
+ int nid;
+ int (*a2i)(void);
+ int (*i2a)(void);
+ } X509_OBJECTS;
+struct X509_algor_st
+ {
+ ASN1_OBJECT *algorithm;
+ ASN1_TYPE *parameter;
+ } ;
+typedef struct stack_st_X509_ALGOR X509_ALGORS;
+typedef struct X509_val_st
+ {
+ ASN1_TIME *notBefore;
+ ASN1_TIME *notAfter;
+ } X509_VAL;
+struct X509_pubkey_st
+ {
+ X509_ALGOR *algor;
+ ASN1_BIT_STRING *public_key;
+ EVP_PKEY *pkey;
+ };
+typedef struct X509_sig_st
+ {
+ X509_ALGOR *algor;
+ ASN1_OCTET_STRING *digest;
+ } X509_SIG;
+typedef struct X509_name_entry_st
+ {
+ ASN1_OBJECT *object;
+ ASN1_STRING *value;
+ int set;
+ int size;
+ } X509_NAME_ENTRY;
+struct stack_st_X509_NAME_ENTRY { _STACK stack; };
+struct X509_name_st
+ {
+ struct stack_st_X509_NAME_ENTRY *entries;
+ int modified;
+ BUF_MEM *bytes;
+ unsigned char *canon_enc;
+ int canon_enclen;
+ } ;
+struct stack_st_X509_NAME { _STACK stack; };
+typedef struct X509_extension_st
+ {
+ ASN1_OBJECT *object;
+ ASN1_BOOLEAN critical;
+ ASN1_OCTET_STRING *value;
+ } X509_EXTENSION;
+typedef struct stack_st_X509_EXTENSION X509_EXTENSIONS;
+struct stack_st_X509_EXTENSION { _STACK stack; };
+typedef struct x509_attributes_st
+ {
+ ASN1_OBJECT *object;
+ int single;
+ union {
+ char *ptr;
+ struct stack_st_ASN1_TYPE *set;
+ ASN1_TYPE *single;
+ } value;
+ } X509_ATTRIBUTE;
+struct stack_st_X509_ATTRIBUTE { _STACK stack; };
+typedef struct X509_req_info_st
+ {
+ ASN1_ENCODING enc;
+ ASN1_INTEGER *version;
+ X509_NAME *subject;
+ X509_PUBKEY *pubkey;
+ struct stack_st_X509_ATTRIBUTE *attributes;
+ } X509_REQ_INFO;
+typedef struct X509_req_st
+ {
+ X509_REQ_INFO *req_info;
+ X509_ALGOR *sig_alg;
+ ASN1_BIT_STRING *signature;
+ int references;
+ } X509_REQ;
+typedef struct x509_cinf_st
+ {
+ ASN1_INTEGER *version;
+ ASN1_INTEGER *serialNumber;
+ X509_ALGOR *signature;
+ X509_NAME *issuer;
+ X509_VAL *validity;
+ X509_NAME *subject;
+ X509_PUBKEY *key;
+ ASN1_BIT_STRING *issuerUID;
+ ASN1_BIT_STRING *subjectUID;
+ struct stack_st_X509_EXTENSION *extensions;
+ ASN1_ENCODING enc;
+ } X509_CINF;
+typedef struct x509_cert_aux_st
+ {
+ struct stack_st_ASN1_OBJECT *trust;
+ struct stack_st_ASN1_OBJECT *reject;
+ ASN1_UTF8STRING *alias;
+ ASN1_OCTET_STRING *keyid;
+ struct stack_st_X509_ALGOR *other;
+ } X509_CERT_AUX;
+struct x509_st
+ {
+ X509_CINF *cert_info;
+ X509_ALGOR *sig_alg;
+ ASN1_BIT_STRING *signature;
+ int valid;
+ int references;
+ char *name;
+ CRYPTO_EX_DATA ex_data;
+ long ex_pathlen;
+ long ex_pcpathlen;
+ unsigned long ex_flags;
+ unsigned long ex_kusage;
+ unsigned long ex_xkusage;
+ unsigned long ex_nscert;
+ ASN1_OCTET_STRING *skid;
+ AUTHORITY_KEYID *akid;
+ X509_POLICY_CACHE *policy_cache;
+ struct stack_st_DIST_POINT *crldp;
+ struct stack_st_GENERAL_NAME *altname;
+ NAME_CONSTRAINTS *nc;
+ unsigned char sha1_hash[20];
+ X509_CERT_AUX *aux;
+ } ;
+struct stack_st_X509 { _STACK stack; };
+typedef struct x509_trust_st {
+ int trust;
+ int flags;
+ int (*check_trust)(struct x509_trust_st *, X509 *, int);
+ char *name;
+ int arg1;
+ void *arg2;
+} X509_TRUST;
+struct stack_st_X509_TRUST { _STACK stack; };
+typedef struct x509_cert_pair_st {
+ X509 *forward;
+ X509 *reverse;
+} X509_CERT_PAIR;
+struct x509_revoked_st
+ {
+ ASN1_INTEGER *serialNumber;
+ ASN1_TIME *revocationDate;
+ struct stack_st_X509_EXTENSION *extensions;
+ struct stack_st_GENERAL_NAME *issuer;
+ int reason;
+ int sequence;
+ };
+struct stack_st_X509_REVOKED { _STACK stack; };
+typedef struct X509_crl_info_st
+ {
+ ASN1_INTEGER *version;
+ X509_ALGOR *sig_alg;
+ X509_NAME *issuer;
+ ASN1_TIME *lastUpdate;
+ ASN1_TIME *nextUpdate;
+ struct stack_st_X509_REVOKED *revoked;
+ struct stack_st_X509_EXTENSION *extensions;
+ ASN1_ENCODING enc;
+ } X509_CRL_INFO;
+struct X509_crl_st
+ {
+ X509_CRL_INFO *crl;
+ X509_ALGOR *sig_alg;
+ ASN1_BIT_STRING *signature;
+ int references;
+ int flags;
+ AUTHORITY_KEYID *akid;
+ ISSUING_DIST_POINT *idp;
+ int idp_flags;
+ int idp_reasons;
+ ASN1_INTEGER *crl_number;
+ ASN1_INTEGER *base_crl_number;
+ unsigned char sha1_hash[20];
+ struct stack_st_GENERAL_NAMES *issuers;
+ const X509_CRL_METHOD *meth;
+ void *meth_data;
+ } ;
+struct stack_st_X509_CRL { _STACK stack; };
+typedef struct private_key_st
+ {
+ int version;
+ X509_ALGOR *enc_algor;
+ ASN1_OCTET_STRING *enc_pkey;
+ EVP_PKEY *dec_pkey;
+ int key_length;
+ char *key_data;
+ int key_free;
+ EVP_CIPHER_INFO cipher;
+ int references;
+ } X509_PKEY;
+typedef struct X509_info_st
+ {
+ X509 *x509;
+ X509_CRL *crl;
+ X509_PKEY *x_pkey;
+ EVP_CIPHER_INFO enc_cipher;
+ int enc_len;
+ char *enc_data;
+ int references;
+ } X509_INFO;
+struct stack_st_X509_INFO { _STACK stack; };
+typedef struct Netscape_spkac_st
+ {
+ X509_PUBKEY *pubkey;
+ ASN1_IA5STRING *challenge;
+ } NETSCAPE_SPKAC;
+typedef struct Netscape_spki_st
+ {
+ NETSCAPE_SPKAC *spkac;
+ X509_ALGOR *sig_algor;
+ ASN1_BIT_STRING *signature;
+ } NETSCAPE_SPKI;
+typedef struct Netscape_certificate_sequence
+ {
+ ASN1_OBJECT *type;
+ struct stack_st_X509 *certs;
+ } NETSCAPE_CERT_SEQUENCE;
+typedef struct PBEPARAM_st {
+ASN1_OCTET_STRING *salt;
+ASN1_INTEGER *iter;
+} PBEPARAM;
+typedef struct PBE2PARAM_st {
+X509_ALGOR *keyfunc;
+X509_ALGOR *encryption;
+} PBE2PARAM;
+typedef struct PBKDF2PARAM_st {
+ASN1_TYPE *salt;
+ASN1_INTEGER *iter;
+ASN1_INTEGER *keylength;
+X509_ALGOR *prf;
+} PBKDF2PARAM;
+struct pkcs8_priv_key_info_st
+ {
+ int broken;
+ ASN1_INTEGER *version;
+ X509_ALGOR *pkeyalg;
+ ASN1_TYPE *pkey;
+ struct stack_st_X509_ATTRIBUTE *attributes;
+ };
+typedef struct lhash_node_st
+ {
+ void *data;
+ struct lhash_node_st *next;
+ unsigned long hash;
+ } LHASH_NODE;
+typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
+typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
+typedef void (*LHASH_DOALL_FN_TYPE)(void *);
+typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);
+typedef struct lhash_st
+ {
+ LHASH_NODE **b;
+ LHASH_COMP_FN_TYPE comp;
+ LHASH_HASH_FN_TYPE hash;
+ unsigned int num_nodes;
+ unsigned int num_alloc_nodes;
+ unsigned int p;
+ unsigned int pmax;
+ unsigned long up_load;
+ unsigned long down_load;
+ unsigned long num_items;
+ unsigned long num_expands;
+ unsigned long num_expand_reallocs;
+ unsigned long num_contracts;
+ unsigned long num_contract_reallocs;
+ unsigned long num_hash_calls;
+ unsigned long num_comp_calls;
+ unsigned long num_insert;
+ unsigned long num_replace;
+ unsigned long num_delete;
+ unsigned long num_no_delete;
+ unsigned long num_retrieve;
+ unsigned long num_retrieve_miss;
+ unsigned long num_hash_comps;
+ int error;
+ } _LHASH;
+_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
+void lh_free(_LHASH *lh);
+void *lh_insert(_LHASH *lh, void *data);
+void *lh_delete(_LHASH *lh, const void *data);
+void *lh_retrieve(_LHASH *lh, const void *data);
+void lh_doall(_LHASH *lh, LHASH_DOALL_FN_TYPE func);
+void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);
+unsigned long lh_strhash(const char *c);
+unsigned long lh_num_items(const _LHASH *lh);
+void lh_stats(const _LHASH *lh, FILE *out);
+void lh_node_stats(const _LHASH *lh, FILE *out);
+void lh_node_usage_stats(const _LHASH *lh, FILE *out);
+void lh_stats_bio(const _LHASH *lh, BIO *out);
+void lh_node_stats_bio(const _LHASH *lh, BIO *out);
+void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
+struct lhash_st_OPENSSL_STRING { int dummy; };
+struct lhash_st_OPENSSL_CSTRING { int dummy; };
+typedef struct x509_file_st
+ {
+ int num_paths;
+ int num_alloced;
+ char **paths;
+ int *path_type;
+ } X509_CERT_FILE_CTX;
+typedef struct x509_object_st
+ {
+ int type;
+ union {
+ char *ptr;
+ X509 *x509;
+ X509_CRL *crl;
+ EVP_PKEY *pkey;
+ } data;
+ } X509_OBJECT;
+typedef struct x509_lookup_st X509_LOOKUP;
+struct stack_st_X509_LOOKUP { _STACK stack; };
+struct stack_st_X509_OBJECT { _STACK stack; };
+typedef struct x509_lookup_method_st
+ {
+ const char *name;
+ int (*new_item)(X509_LOOKUP *ctx);
+ void (*free)(X509_LOOKUP *ctx);
+ int (*init)(X509_LOOKUP *ctx);
+ int (*shutdown)(X509_LOOKUP *ctx);
+ int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,
+ char **ret);
+ int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,
+ X509_OBJECT *ret);
+ int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,
+ ASN1_INTEGER *serial,X509_OBJECT *ret);
+ int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,
+ unsigned char *bytes,int len,
+ X509_OBJECT *ret);
+ int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,
+ X509_OBJECT *ret);
+ } X509_LOOKUP_METHOD;
+typedef struct X509_VERIFY_PARAM_st
+ {
+ char *name;
+ time_t check_time;
+ unsigned long inh_flags;
+ unsigned long flags;
+ int purpose;
+ int trust;
+ int depth;
+ struct stack_st_ASN1_OBJECT *policies;
+ } X509_VERIFY_PARAM;
+struct stack_st_X509_VERIFY_PARAM { _STACK stack; };
+struct x509_store_st
+ {
+ int cache;
+ struct stack_st_X509_OBJECT *objs;
+ struct stack_st_X509_LOOKUP *get_cert_methods;
+ X509_VERIFY_PARAM *param;
+ int (*verify)(X509_STORE_CTX *ctx);
+ int (*verify_cb)(int ok,X509_STORE_CTX *ctx);
+ int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+ int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
+ int (*check_revocation)(X509_STORE_CTX *ctx);
+ int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
+ int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl);
+ int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
+ struct stack_st_X509 * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);
+ struct stack_st_X509_CRL * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);
+ int (*cleanup)(X509_STORE_CTX *ctx);
+ CRYPTO_EX_DATA ex_data;
+ int references;
+ } ;
+int X509_STORE_set_depth(X509_STORE *store, int depth);
+struct x509_lookup_st
+ {
+ int init;
+ int skip;
+ X509_LOOKUP_METHOD *method;
+ char *method_data;
+ X509_STORE *store_ctx;
+ } ;
+struct x509_store_ctx_st
+ {
+ X509_STORE *ctx;
+ int current_method;
+ X509 *cert;
+ struct stack_st_X509 *untrusted;
+ struct stack_st_X509_CRL *crls;
+ X509_VERIFY_PARAM *param;
+ void *other_ctx;
+ int (*verify)(X509_STORE_CTX *ctx);
+ int (*verify_cb)(int ok,X509_STORE_CTX *ctx);
+ int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+ int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer);
+ int (*check_revocation)(X509_STORE_CTX *ctx);
+ int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x);
+ int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl);
+ int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x);
+ int (*check_policy)(X509_STORE_CTX *ctx);
+ struct stack_st_X509 * (*lookup_certs)(X509_STORE_CTX *ctx, X509_NAME *nm);
+ struct stack_st_X509_CRL * (*lookup_crls)(X509_STORE_CTX *ctx, X509_NAME *nm);
+ int (*cleanup)(X509_STORE_CTX *ctx);
+ int valid;
+ int last_untrusted;
+ struct stack_st_X509 *chain;
+ X509_POLICY_TREE *tree;
+ int explicit_policy;
+ int error_depth;
+ int error;
+ X509 *current_cert;
+ X509 *current_issuer;
+ X509_CRL *current_crl;
+ int current_crl_score;
+ unsigned int current_reasons;
+ X509_STORE_CTX *parent;
+ CRYPTO_EX_DATA ex_data;
+ } ;
+void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
+int X509_OBJECT_idx_by_subject(struct stack_st_X509_OBJECT *h, int type,
+ X509_NAME *name);
+X509_OBJECT *X509_OBJECT_retrieve_by_subject(struct stack_st_X509_OBJECT *h,int type,X509_NAME *name);
+X509_OBJECT *X509_OBJECT_retrieve_match(struct stack_st_X509_OBJECT *h, X509_OBJECT *x);
+void X509_OBJECT_up_ref_count(X509_OBJECT *a);
+void X509_OBJECT_free_contents(X509_OBJECT *a);
+X509_STORE *X509_STORE_new(void );
+void X509_STORE_free(X509_STORE *v);
+struct stack_st_X509* X509_STORE_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);
+struct stack_st_X509_CRL* X509_STORE_get1_crls(X509_STORE_CTX *st, X509_NAME *nm);
+int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
+int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
+int X509_STORE_set_trust(X509_STORE *ctx, int trust);
+int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
+void X509_STORE_set_verify_cb(X509_STORE *ctx,
+ int (*verify_cb)(int, X509_STORE_CTX *));
+X509_STORE_CTX *X509_STORE_CTX_new(void);
+int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
+void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
+int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
+ X509 *x509, struct stack_st_X509 *chain);
+void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, struct stack_st_X509 *sk);
+void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
+X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
+X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
+X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
+int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
+int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
+int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,
+ X509_OBJECT *ret);
+int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
+ long argl, char **ret);
+int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
+int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);
+int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
+X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
+void X509_LOOKUP_free(X509_LOOKUP *ctx);
+int X509_LOOKUP_init(X509_LOOKUP *ctx);
+int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
+ X509_OBJECT *ret);
+int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
+ ASN1_INTEGER *serial, X509_OBJECT *ret);
+int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
+ unsigned char *bytes, int len, X509_OBJECT *ret);
+int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,
+ int len, X509_OBJECT *ret);
+int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
+int X509_STORE_load_locations (X509_STORE *ctx,
+ const char *file, const char *dir);
+int X509_STORE_set_default_paths(X509_STORE *ctx);
+int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);
+void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);
+int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
+void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
+int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
+X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
+X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);
+X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);
+X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx);
+struct stack_st_X509 *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
+struct stack_st_X509 *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
+void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
+void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,struct stack_st_X509 *sk);
+void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,struct stack_st_X509_CRL *sk);
+int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
+int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
+int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
+ int purpose, int trust);
+void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
+void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
+ time_t t);
+void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
+ int (*verify_cb)(int, X509_STORE_CTX *));
+X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
+int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
+X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
+void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
+int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
+X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
+void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
+int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
+ const X509_VERIFY_PARAM *from);
+int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
+ const X509_VERIFY_PARAM *from);
+int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
+int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
+int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
+ unsigned long flags);
+unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
+int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
+int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
+void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
+void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
+int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
+ ASN1_OBJECT *policy);
+int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
+ struct stack_st_ASN1_OBJECT *policies);
+int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
+int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
+const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
+void X509_VERIFY_PARAM_table_cleanup(void);
+int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
+ struct stack_st_X509 *certs,
+ struct stack_st_ASN1_OBJECT *policy_oids,
+ unsigned int flags);
+void X509_policy_tree_free(X509_POLICY_TREE *tree);
+int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
+X509_POLICY_LEVEL *
+ X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);
+struct stack_st_X509_POLICY_NODE *
+ X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);
+struct stack_st_X509_POLICY_NODE *
+ X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);
+int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
+X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);
+const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
+struct stack_st_POLICYQUALINFO *
+ X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);
+const X509_POLICY_NODE *
+ X509_policy_node_get0_parent(const X509_POLICY_NODE *node);
+typedef struct pkcs7_issuer_and_serial_st
+ {
+ X509_NAME *issuer;
+ ASN1_INTEGER *serial;
+ } PKCS7_ISSUER_AND_SERIAL;
+typedef struct pkcs7_signer_info_st
+ {
+ ASN1_INTEGER *version;
+ PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
+ X509_ALGOR *digest_alg;
+ struct stack_st_X509_ATTRIBUTE *auth_attr;
+ X509_ALGOR *digest_enc_alg;
+ ASN1_OCTET_STRING *enc_digest;
+ struct stack_st_X509_ATTRIBUTE *unauth_attr;
+ EVP_PKEY *pkey;
+ } PKCS7_SIGNER_INFO;
+struct stack_st_PKCS7_SIGNER_INFO { _STACK stack; };
+typedef struct pkcs7_recip_info_st
+ {
+ ASN1_INTEGER *version;
+ PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
+ X509_ALGOR *key_enc_algor;
+ ASN1_OCTET_STRING *enc_key;
+ X509 *cert;
+ } PKCS7_RECIP_INFO;
+struct stack_st_PKCS7_RECIP_INFO { _STACK stack; };
+typedef struct pkcs7_signed_st
+ {
+ ASN1_INTEGER *version;
+ struct stack_st_X509_ALGOR *md_algs;
+ struct stack_st_X509 *cert;
+ struct stack_st_X509_CRL *crl;
+ struct stack_st_PKCS7_SIGNER_INFO *signer_info;
+ struct pkcs7_st *contents;
+ } PKCS7_SIGNED;
+typedef struct pkcs7_enc_content_st
+ {
+ ASN1_OBJECT *content_type;
+ X509_ALGOR *algorithm;
+ ASN1_OCTET_STRING *enc_data;
+ const EVP_CIPHER *cipher;
+ } PKCS7_ENC_CONTENT;
+typedef struct pkcs7_enveloped_st
+ {
+ ASN1_INTEGER *version;
+ struct stack_st_PKCS7_RECIP_INFO *recipientinfo;
+ PKCS7_ENC_CONTENT *enc_data;
+ } PKCS7_ENVELOPE;
+typedef struct pkcs7_signedandenveloped_st
+ {
+ ASN1_INTEGER *version;
+ struct stack_st_X509_ALGOR *md_algs;
+ struct stack_st_X509 *cert;
+ struct stack_st_X509_CRL *crl;
+ struct stack_st_PKCS7_SIGNER_INFO *signer_info;
+ PKCS7_ENC_CONTENT *enc_data;
+ struct stack_st_PKCS7_RECIP_INFO *recipientinfo;
+ } PKCS7_SIGN_ENVELOPE;
+typedef struct pkcs7_digest_st
+ {
+ ASN1_INTEGER *version;
+ X509_ALGOR *md;
+ struct pkcs7_st *contents;
+ ASN1_OCTET_STRING *digest;
+ } PKCS7_DIGEST;
+typedef struct pkcs7_encrypted_st
+ {
+ ASN1_INTEGER *version;
+ PKCS7_ENC_CONTENT *enc_data;
+ } PKCS7_ENCRYPT;
+typedef struct pkcs7_st
+ {
+ unsigned char *asn1;
+ long length;
+ int state;
+ int detached;
+ ASN1_OBJECT *type;
+ union {
+ char *ptr;
+ ASN1_OCTET_STRING *data;
+ PKCS7_SIGNED *sign;
+ PKCS7_ENVELOPE *enveloped;
+ PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
+ PKCS7_DIGEST *digest;
+ PKCS7_ENCRYPT *encrypted;
+ ASN1_TYPE *other;
+ } d;
+ } PKCS7;
+struct stack_st_PKCS7 { _STACK stack; };
+PKCS7_ISSUER_AND_SERIAL *PKCS7_ISSUER_AND_SERIAL_new(void); void PKCS7_ISSUER_AND_SERIAL_free(PKCS7_ISSUER_AND_SERIAL *a); PKCS7_ISSUER_AND_SERIAL *d2i_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL **a, const unsigned char **in, long len); int i2d_PKCS7_ISSUER_AND_SERIAL(PKCS7_ISSUER_AND_SERIAL *a, unsigned char **out); extern const ASN1_ITEM PKCS7_ISSUER_AND_SERIAL_it;
+int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,
+ unsigned char *md,unsigned int *len);
+PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
+int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
+PKCS7 *PKCS7_dup(PKCS7 *p7);
+PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);
+int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);
+int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
+int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
+PKCS7_SIGNER_INFO *PKCS7_SIGNER_INFO_new(void); void PKCS7_SIGNER_INFO_free(PKCS7_SIGNER_INFO *a); PKCS7_SIGNER_INFO *d2i_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO **a, const unsigned char **in, long len); int i2d_PKCS7_SIGNER_INFO(PKCS7_SIGNER_INFO *a, unsigned char **out); extern const ASN1_ITEM PKCS7_SIGNER_INFO_it;
+PKCS7_RECIP_INFO *PKCS7_RECIP_INFO_new(void); void PKCS7_RECIP_INFO_free(PKCS7_RECIP_INFO *a); PKCS7_RECIP_INFO *d2i_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO **a, const unsigned char **in, long len); int i2d_PKCS7_RECIP_INFO(PKCS7_RECIP_INFO *a, unsigned char **out); extern const ASN1_ITEM PKCS7_RECIP_INFO_it;
+PKCS7_SIGNED *PKCS7_SIGNED_new(void); void PKCS7_SIGNED_free(PKCS7_SIGNED *a); PKCS7_SIGNED *d2i_PKCS7_SIGNED(PKCS7_SIGNED **a, const unsigned char **in, long len); int i2d_PKCS7_SIGNED(PKCS7_SIGNED *a, unsigned char **out); extern const ASN1_ITEM PKCS7_SIGNED_it;
+PKCS7_ENC_CONTENT *PKCS7_ENC_CONTENT_new(void); void PKCS7_ENC_CONTENT_free(PKCS7_ENC_CONTENT *a); PKCS7_ENC_CONTENT *d2i_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT **a, const unsigned char **in, long len); int i2d_PKCS7_ENC_CONTENT(PKCS7_ENC_CONTENT *a, unsigned char **out); extern const ASN1_ITEM PKCS7_ENC_CONTENT_it;
+PKCS7_ENVELOPE *PKCS7_ENVELOPE_new(void); void PKCS7_ENVELOPE_free(PKCS7_ENVELOPE *a); PKCS7_ENVELOPE *d2i_PKCS7_ENVELOPE(PKCS7_ENVELOPE **a, const unsigned char **in, long len); int i2d_PKCS7_ENVELOPE(PKCS7_ENVELOPE *a, unsigned char **out); extern const ASN1_ITEM PKCS7_ENVELOPE_it;
+PKCS7_SIGN_ENVELOPE *PKCS7_SIGN_ENVELOPE_new(void); void PKCS7_SIGN_ENVELOPE_free(PKCS7_SIGN_ENVELOPE *a); PKCS7_SIGN_ENVELOPE *d2i_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE **a, const unsigned char **in, long len); int i2d_PKCS7_SIGN_ENVELOPE(PKCS7_SIGN_ENVELOPE *a, unsigned char **out); extern const ASN1_ITEM PKCS7_SIGN_ENVELOPE_it;
+PKCS7_DIGEST *PKCS7_DIGEST_new(void); void PKCS7_DIGEST_free(PKCS7_DIGEST *a); PKCS7_DIGEST *d2i_PKCS7_DIGEST(PKCS7_DIGEST **a, const unsigned char **in, long len); int i2d_PKCS7_DIGEST(PKCS7_DIGEST *a, unsigned char **out); extern const ASN1_ITEM PKCS7_DIGEST_it;
+PKCS7_ENCRYPT *PKCS7_ENCRYPT_new(void); void PKCS7_ENCRYPT_free(PKCS7_ENCRYPT *a); PKCS7_ENCRYPT *d2i_PKCS7_ENCRYPT(PKCS7_ENCRYPT **a, const unsigned char **in, long len); int i2d_PKCS7_ENCRYPT(PKCS7_ENCRYPT *a, unsigned char **out); extern const ASN1_ITEM PKCS7_ENCRYPT_it;
+PKCS7 *PKCS7_new(void); void PKCS7_free(PKCS7 *a); PKCS7 *d2i_PKCS7(PKCS7 **a, const unsigned char **in, long len); int i2d_PKCS7(PKCS7 *a, unsigned char **out); extern const ASN1_ITEM PKCS7_it;
+extern const ASN1_ITEM PKCS7_ATTR_SIGN_it;
+extern const ASN1_ITEM PKCS7_ATTR_VERIFY_it;
+int i2d_PKCS7_NDEF(PKCS7 *a, unsigned char **out);
+int PKCS7_print_ctx(BIO *out, PKCS7 *x, int indent, const ASN1_PCTX *pctx);
+long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
+int PKCS7_set_type(PKCS7 *p7, int type);
+int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
+int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
+int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
+ const EVP_MD *dgst);
+int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si);
+int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
+int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
+int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
+int PKCS7_content_new(PKCS7 *p7, int nid);
+int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
+ BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
+int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
+ X509 *x509);
+BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
+int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
+BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
+PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
+ EVP_PKEY *pkey, const EVP_MD *dgst);
+X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
+int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
+struct stack_st_PKCS7_SIGNER_INFO *PKCS7_get_signer_info(PKCS7 *p7);
+PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
+void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,
+ X509_ALGOR **pdig, X509_ALGOR **psig);
+void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc);
+int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
+int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
+int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
+int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7);
+PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
+ASN1_OCTET_STRING *PKCS7_digest_from_attributes(struct stack_st_X509_ATTRIBUTE *sk);
+int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,
+ void *data);
+int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
+ void *value);
+ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
+ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
+int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
+ struct stack_st_X509_ATTRIBUTE *sk);
+int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,struct stack_st_X509_ATTRIBUTE *sk);
+PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, struct stack_st_X509 *certs,
+ BIO *data, int flags);
+PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7,
+ X509 *signcert, EVP_PKEY *pkey, const EVP_MD *md,
+ int flags);
+int PKCS7_final(PKCS7 *p7, BIO *data, int flags);
+int PKCS7_verify(PKCS7 *p7, struct stack_st_X509 *certs, X509_STORE *store,
+ BIO *indata, BIO *out, int flags);
+struct stack_st_X509 *PKCS7_get0_signers(PKCS7 *p7, struct stack_st_X509 *certs, int flags);
+PKCS7 *PKCS7_encrypt(struct stack_st_X509 *certs, BIO *in, const EVP_CIPHER *cipher,
+ int flags);
+int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
+int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
+ struct stack_st_X509_ALGOR *cap);
+struct stack_st_X509_ALGOR *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
+int PKCS7_simple_smimecap(struct stack_st_X509_ALGOR *sk, int nid, int arg);
+int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid);
+int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t);
+int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,
+ const unsigned char *md, int mdlen);
+int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
+PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
+BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);
+void ERR_load_PKCS7_strings(void);
+void X509_CRL_set_default_method(const X509_CRL_METHOD *meth);
+X509_CRL_METHOD *X509_CRL_METHOD_new(
+ int (*crl_init)(X509_CRL *crl),
+ int (*crl_free)(X509_CRL *crl),
+ int (*crl_lookup)(X509_CRL *crl, X509_REVOKED **ret,
+ ASN1_INTEGER *ser, X509_NAME *issuer),
+ int (*crl_verify)(X509_CRL *crl, EVP_PKEY *pk));
+void X509_CRL_METHOD_free(X509_CRL_METHOD *m);
+void X509_CRL_set_meth_data(X509_CRL *crl, void *dat);
+void *X509_CRL_get_meth_data(X509_CRL *crl);
+const char *X509_verify_cert_error_string(long n);
+int X509_verify(X509 *a, EVP_PKEY *r);
+int X509_REQ_verify(X509_REQ *a, EVP_PKEY *r);
+int X509_CRL_verify(X509_CRL *a, EVP_PKEY *r);
+int NETSCAPE_SPKI_verify(NETSCAPE_SPKI *a, EVP_PKEY *r);
+NETSCAPE_SPKI * NETSCAPE_SPKI_b64_decode(const char *str, int len);
+char * NETSCAPE_SPKI_b64_encode(NETSCAPE_SPKI *x);
+EVP_PKEY *NETSCAPE_SPKI_get_pubkey(NETSCAPE_SPKI *x);
+int NETSCAPE_SPKI_set_pubkey(NETSCAPE_SPKI *x, EVP_PKEY *pkey);
+int NETSCAPE_SPKI_print(BIO *out, NETSCAPE_SPKI *spki);
+int X509_signature_dump(BIO *bp,const ASN1_STRING *sig, int indent);
+int X509_signature_print(BIO *bp,X509_ALGOR *alg, ASN1_STRING *sig);
+int X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_sign_ctx(X509 *x, EVP_MD_CTX *ctx);
+int X509_REQ_sign(X509_REQ *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_REQ_sign_ctx(X509_REQ *x, EVP_MD_CTX *ctx);
+int X509_CRL_sign(X509_CRL *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_CRL_sign_ctx(X509_CRL *x, EVP_MD_CTX *ctx);
+int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md);
+int X509_pubkey_digest(const X509 *data,const EVP_MD *type,
+ unsigned char *md, unsigned int *len);
+int X509_digest(const X509 *data,const EVP_MD *type,
+ unsigned char *md, unsigned int *len);
+int X509_CRL_digest(const X509_CRL *data,const EVP_MD *type,
+ unsigned char *md, unsigned int *len);
+int X509_REQ_digest(const X509_REQ *data,const EVP_MD *type,
+ unsigned char *md, unsigned int *len);
+int X509_NAME_digest(const X509_NAME *data,const EVP_MD *type,
+ unsigned char *md, unsigned int *len);
+X509 *d2i_X509_fp(FILE *fp, X509 **x509);
+int i2d_X509_fp(FILE *fp,X509 *x509);
+X509_CRL *d2i_X509_CRL_fp(FILE *fp,X509_CRL **crl);
+int i2d_X509_CRL_fp(FILE *fp,X509_CRL *crl);
+X509_REQ *d2i_X509_REQ_fp(FILE *fp,X509_REQ **req);
+int i2d_X509_REQ_fp(FILE *fp,X509_REQ *req);
+RSA *d2i_RSAPrivateKey_fp(FILE *fp,RSA **rsa);
+int i2d_RSAPrivateKey_fp(FILE *fp,RSA *rsa);
+RSA *d2i_RSAPublicKey_fp(FILE *fp,RSA **rsa);
+int i2d_RSAPublicKey_fp(FILE *fp,RSA *rsa);
+RSA *d2i_RSA_PUBKEY_fp(FILE *fp,RSA **rsa);
+int i2d_RSA_PUBKEY_fp(FILE *fp,RSA *rsa);
+DSA *d2i_DSA_PUBKEY_fp(FILE *fp, DSA **dsa);
+int i2d_DSA_PUBKEY_fp(FILE *fp, DSA *dsa);
+DSA *d2i_DSAPrivateKey_fp(FILE *fp, DSA **dsa);
+int i2d_DSAPrivateKey_fp(FILE *fp, DSA *dsa);
+EC_KEY *d2i_EC_PUBKEY_fp(FILE *fp, EC_KEY **eckey);
+int i2d_EC_PUBKEY_fp(FILE *fp, EC_KEY *eckey);
+EC_KEY *d2i_ECPrivateKey_fp(FILE *fp, EC_KEY **eckey);
+int i2d_ECPrivateKey_fp(FILE *fp, EC_KEY *eckey);
+X509_SIG *d2i_PKCS8_fp(FILE *fp,X509_SIG **p8);
+int i2d_PKCS8_fp(FILE *fp,X509_SIG *p8);
+PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,
+ PKCS8_PRIV_KEY_INFO **p8inf);
+int i2d_PKCS8_PRIV_KEY_INFO_fp(FILE *fp,PKCS8_PRIV_KEY_INFO *p8inf);
+int i2d_PKCS8PrivateKeyInfo_fp(FILE *fp, EVP_PKEY *key);
+int i2d_PrivateKey_fp(FILE *fp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PrivateKey_fp(FILE *fp, EVP_PKEY **a);
+int i2d_PUBKEY_fp(FILE *fp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PUBKEY_fp(FILE *fp, EVP_PKEY **a);
+X509 *d2i_X509_bio(BIO *bp,X509 **x509);
+int i2d_X509_bio(BIO *bp,X509 *x509);
+X509_CRL *d2i_X509_CRL_bio(BIO *bp,X509_CRL **crl);
+int i2d_X509_CRL_bio(BIO *bp,X509_CRL *crl);
+X509_REQ *d2i_X509_REQ_bio(BIO *bp,X509_REQ **req);
+int i2d_X509_REQ_bio(BIO *bp,X509_REQ *req);
+RSA *d2i_RSAPrivateKey_bio(BIO *bp,RSA **rsa);
+int i2d_RSAPrivateKey_bio(BIO *bp,RSA *rsa);
+RSA *d2i_RSAPublicKey_bio(BIO *bp,RSA **rsa);
+int i2d_RSAPublicKey_bio(BIO *bp,RSA *rsa);
+RSA *d2i_RSA_PUBKEY_bio(BIO *bp,RSA **rsa);
+int i2d_RSA_PUBKEY_bio(BIO *bp,RSA *rsa);
+DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa);
+int i2d_DSA_PUBKEY_bio(BIO *bp, DSA *dsa);
+DSA *d2i_DSAPrivateKey_bio(BIO *bp, DSA **dsa);
+int i2d_DSAPrivateKey_bio(BIO *bp, DSA *dsa);
+EC_KEY *d2i_EC_PUBKEY_bio(BIO *bp, EC_KEY **eckey);
+int i2d_EC_PUBKEY_bio(BIO *bp, EC_KEY *eckey);
+EC_KEY *d2i_ECPrivateKey_bio(BIO *bp, EC_KEY **eckey);
+int i2d_ECPrivateKey_bio(BIO *bp, EC_KEY *eckey);
+X509_SIG *d2i_PKCS8_bio(BIO *bp,X509_SIG **p8);
+int i2d_PKCS8_bio(BIO *bp,X509_SIG *p8);
+PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,
+ PKCS8_PRIV_KEY_INFO **p8inf);
+int i2d_PKCS8_PRIV_KEY_INFO_bio(BIO *bp,PKCS8_PRIV_KEY_INFO *p8inf);
+int i2d_PKCS8PrivateKeyInfo_bio(BIO *bp, EVP_PKEY *key);
+int i2d_PrivateKey_bio(BIO *bp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PrivateKey_bio(BIO *bp, EVP_PKEY **a);
+int i2d_PUBKEY_bio(BIO *bp, EVP_PKEY *pkey);
+EVP_PKEY *d2i_PUBKEY_bio(BIO *bp, EVP_PKEY **a);
+X509 *X509_dup(X509 *x509);
+X509_ATTRIBUTE *X509_ATTRIBUTE_dup(X509_ATTRIBUTE *xa);
+X509_EXTENSION *X509_EXTENSION_dup(X509_EXTENSION *ex);
+X509_CRL *X509_CRL_dup(X509_CRL *crl);
+X509_REQ *X509_REQ_dup(X509_REQ *req);
+X509_ALGOR *X509_ALGOR_dup(X509_ALGOR *xn);
+int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval);
+void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
+ X509_ALGOR *algor);
+void X509_ALGOR_set_md(X509_ALGOR *alg, const EVP_MD *md);
+X509_NAME *X509_NAME_dup(X509_NAME *xn);
+X509_NAME_ENTRY *X509_NAME_ENTRY_dup(X509_NAME_ENTRY *ne);
+int X509_cmp_time(const ASN1_TIME *s, time_t *t);
+int X509_cmp_current_time(const ASN1_TIME *s);
+ASN1_TIME * X509_time_adj(ASN1_TIME *s, long adj, time_t *t);
+ASN1_TIME * X509_time_adj_ex(ASN1_TIME *s,
+ int offset_day, long offset_sec, time_t *t);
+ASN1_TIME * X509_gmtime_adj(ASN1_TIME *s, long adj);
+const char * X509_get_default_cert_area(void );
+const char * X509_get_default_cert_dir(void );
+const char * X509_get_default_cert_file(void );
+const char * X509_get_default_cert_dir_env(void );
+const char * X509_get_default_cert_file_env(void );
+const char * X509_get_default_private_dir(void );
+X509_REQ * X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md);
+X509 * X509_REQ_to_X509(X509_REQ *r, int days,EVP_PKEY *pkey);
+X509_ALGOR *X509_ALGOR_new(void); void X509_ALGOR_free(X509_ALGOR *a); X509_ALGOR *d2i_X509_ALGOR(X509_ALGOR **a, const unsigned char **in, long len); int i2d_X509_ALGOR(X509_ALGOR *a, unsigned char **out); extern const ASN1_ITEM X509_ALGOR_it;
+X509_ALGORS *d2i_X509_ALGORS(X509_ALGORS **a, const unsigned char **in, long len); int i2d_X509_ALGORS(X509_ALGORS *a, unsigned char **out); extern const ASN1_ITEM X509_ALGORS_it;
+X509_VAL *X509_VAL_new(void); void X509_VAL_free(X509_VAL *a); X509_VAL *d2i_X509_VAL(X509_VAL **a, const unsigned char **in, long len); int i2d_X509_VAL(X509_VAL *a, unsigned char **out); extern const ASN1_ITEM X509_VAL_it;
+X509_PUBKEY *X509_PUBKEY_new(void); void X509_PUBKEY_free(X509_PUBKEY *a); X509_PUBKEY *d2i_X509_PUBKEY(X509_PUBKEY **a, const unsigned char **in, long len); int i2d_X509_PUBKEY(X509_PUBKEY *a, unsigned char **out); extern const ASN1_ITEM X509_PUBKEY_it;
+int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey);
+EVP_PKEY * X509_PUBKEY_get(X509_PUBKEY *key);
+int X509_get_pubkey_parameters(EVP_PKEY *pkey,
+ struct stack_st_X509 *chain);
+int i2d_PUBKEY(EVP_PKEY *a,unsigned char **pp);
+EVP_PKEY * d2i_PUBKEY(EVP_PKEY **a,const unsigned char **pp,
+ long length);
+int i2d_RSA_PUBKEY(RSA *a,unsigned char **pp);
+RSA * d2i_RSA_PUBKEY(RSA **a,const unsigned char **pp,
+ long length);
+int i2d_DSA_PUBKEY(DSA *a,unsigned char **pp);
+DSA * d2i_DSA_PUBKEY(DSA **a,const unsigned char **pp,
+ long length);
+int i2d_EC_PUBKEY(EC_KEY *a, unsigned char **pp);
+EC_KEY *d2i_EC_PUBKEY(EC_KEY **a, const unsigned char **pp,
+ long length);
+X509_SIG *X509_SIG_new(void); void X509_SIG_free(X509_SIG *a); X509_SIG *d2i_X509_SIG(X509_SIG **a, const unsigned char **in, long len); int i2d_X509_SIG(X509_SIG *a, unsigned char **out); extern const ASN1_ITEM X509_SIG_it;
+X509_REQ_INFO *X509_REQ_INFO_new(void); void X509_REQ_INFO_free(X509_REQ_INFO *a); X509_REQ_INFO *d2i_X509_REQ_INFO(X509_REQ_INFO **a, const unsigned char **in, long len); int i2d_X509_REQ_INFO(X509_REQ_INFO *a, unsigned char **out); extern const ASN1_ITEM X509_REQ_INFO_it;
+X509_REQ *X509_REQ_new(void); void X509_REQ_free(X509_REQ *a); X509_REQ *d2i_X509_REQ(X509_REQ **a, const unsigned char **in, long len); int i2d_X509_REQ(X509_REQ *a, unsigned char **out); extern const ASN1_ITEM X509_REQ_it;
+X509_ATTRIBUTE *X509_ATTRIBUTE_new(void); void X509_ATTRIBUTE_free(X509_ATTRIBUTE *a); X509_ATTRIBUTE *d2i_X509_ATTRIBUTE(X509_ATTRIBUTE **a, const unsigned char **in, long len); int i2d_X509_ATTRIBUTE(X509_ATTRIBUTE *a, unsigned char **out); extern const ASN1_ITEM X509_ATTRIBUTE_it;
+X509_ATTRIBUTE *X509_ATTRIBUTE_create(int nid, int atrtype, void *value);
+X509_EXTENSION *X509_EXTENSION_new(void); void X509_EXTENSION_free(X509_EXTENSION *a); X509_EXTENSION *d2i_X509_EXTENSION(X509_EXTENSION **a, const unsigned char **in, long len); int i2d_X509_EXTENSION(X509_EXTENSION *a, unsigned char **out); extern const ASN1_ITEM X509_EXTENSION_it;
+X509_EXTENSIONS *d2i_X509_EXTENSIONS(X509_EXTENSIONS **a, const unsigned char **in, long len); int i2d_X509_EXTENSIONS(X509_EXTENSIONS *a, unsigned char **out); extern const ASN1_ITEM X509_EXTENSIONS_it;
+X509_NAME_ENTRY *X509_NAME_ENTRY_new(void); void X509_NAME_ENTRY_free(X509_NAME_ENTRY *a); X509_NAME_ENTRY *d2i_X509_NAME_ENTRY(X509_NAME_ENTRY **a, const unsigned char **in, long len); int i2d_X509_NAME_ENTRY(X509_NAME_ENTRY *a, unsigned char **out); extern const ASN1_ITEM X509_NAME_ENTRY_it;
+X509_NAME *X509_NAME_new(void); void X509_NAME_free(X509_NAME *a); X509_NAME *d2i_X509_NAME(X509_NAME **a, const unsigned char **in, long len); int i2d_X509_NAME(X509_NAME *a, unsigned char **out); extern const ASN1_ITEM X509_NAME_it;
+int X509_NAME_set(X509_NAME **xn, X509_NAME *name);
+X509_CINF *X509_CINF_new(void); void X509_CINF_free(X509_CINF *a); X509_CINF *d2i_X509_CINF(X509_CINF **a, const unsigned char **in, long len); int i2d_X509_CINF(X509_CINF *a, unsigned char **out); extern const ASN1_ITEM X509_CINF_it;
+X509 *X509_new(void); void X509_free(X509 *a); X509 *d2i_X509(X509 **a, const unsigned char **in, long len); int i2d_X509(X509 *a, unsigned char **out); extern const ASN1_ITEM X509_it;
+X509_CERT_AUX *X509_CERT_AUX_new(void); void X509_CERT_AUX_free(X509_CERT_AUX *a); X509_CERT_AUX *d2i_X509_CERT_AUX(X509_CERT_AUX **a, const unsigned char **in, long len); int i2d_X509_CERT_AUX(X509_CERT_AUX *a, unsigned char **out); extern const ASN1_ITEM X509_CERT_AUX_it;
+X509_CERT_PAIR *X509_CERT_PAIR_new(void); void X509_CERT_PAIR_free(X509_CERT_PAIR *a); X509_CERT_PAIR *d2i_X509_CERT_PAIR(X509_CERT_PAIR **a, const unsigned char **in, long len); int i2d_X509_CERT_PAIR(X509_CERT_PAIR *a, unsigned char **out); extern const ASN1_ITEM X509_CERT_PAIR_it;
+int X509_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
+ CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
+int X509_set_ex_data(X509 *r, int idx, void *arg);
+void *X509_get_ex_data(X509 *r, int idx);
+int i2d_X509_AUX(X509 *a,unsigned char **pp);
+X509 * d2i_X509_AUX(X509 **a,const unsigned char **pp,long length);
+int X509_alias_set1(X509 *x, unsigned char *name, int len);
+int X509_keyid_set1(X509 *x, unsigned char *id, int len);
+unsigned char * X509_alias_get0(X509 *x, int *len);
+unsigned char * X509_keyid_get0(X509 *x, int *len);
+int (*X509_TRUST_set_default(int (*trust)(int , X509 *, int)))(int, X509 *, int);
+int X509_TRUST_set(int *t, int trust);
+int X509_add1_trust_object(X509 *x, ASN1_OBJECT *obj);
+int X509_add1_reject_object(X509 *x, ASN1_OBJECT *obj);
+void X509_trust_clear(X509 *x);
+void X509_reject_clear(X509 *x);
+X509_REVOKED *X509_REVOKED_new(void); void X509_REVOKED_free(X509_REVOKED *a); X509_REVOKED *d2i_X509_REVOKED(X509_REVOKED **a, const unsigned char **in, long len); int i2d_X509_REVOKED(X509_REVOKED *a, unsigned char **out); extern const ASN1_ITEM X509_REVOKED_it;
+X509_CRL_INFO *X509_CRL_INFO_new(void); void X509_CRL_INFO_free(X509_CRL_INFO *a); X509_CRL_INFO *d2i_X509_CRL_INFO(X509_CRL_INFO **a, const unsigned char **in, long len); int i2d_X509_CRL_INFO(X509_CRL_INFO *a, unsigned char **out); extern const ASN1_ITEM X509_CRL_INFO_it;
+X509_CRL *X509_CRL_new(void); void X509_CRL_free(X509_CRL *a); X509_CRL *d2i_X509_CRL(X509_CRL **a, const unsigned char **in, long len); int i2d_X509_CRL(X509_CRL *a, unsigned char **out); extern const ASN1_ITEM X509_CRL_it;
+int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
+int X509_CRL_get0_by_serial(X509_CRL *crl,
+ X509_REVOKED **ret, ASN1_INTEGER *serial);
+int X509_CRL_get0_by_cert(X509_CRL *crl, X509_REVOKED **ret, X509 *x);
+X509_PKEY * X509_PKEY_new(void );
+void X509_PKEY_free(X509_PKEY *a);
+int i2d_X509_PKEY(X509_PKEY *a,unsigned char **pp);
+X509_PKEY * d2i_X509_PKEY(X509_PKEY **a,const unsigned char **pp,long length);
+NETSCAPE_SPKI *NETSCAPE_SPKI_new(void); void NETSCAPE_SPKI_free(NETSCAPE_SPKI *a); NETSCAPE_SPKI *d2i_NETSCAPE_SPKI(NETSCAPE_SPKI **a, const unsigned char **in, long len); int i2d_NETSCAPE_SPKI(NETSCAPE_SPKI *a, unsigned char **out); extern const ASN1_ITEM NETSCAPE_SPKI_it;
+NETSCAPE_SPKAC *NETSCAPE_SPKAC_new(void); void NETSCAPE_SPKAC_free(NETSCAPE_SPKAC *a); NETSCAPE_SPKAC *d2i_NETSCAPE_SPKAC(NETSCAPE_SPKAC **a, const unsigned char **in, long len); int i2d_NETSCAPE_SPKAC(NETSCAPE_SPKAC *a, unsigned char **out); extern const ASN1_ITEM NETSCAPE_SPKAC_it;
+NETSCAPE_CERT_SEQUENCE *NETSCAPE_CERT_SEQUENCE_new(void); void NETSCAPE_CERT_SEQUENCE_free(NETSCAPE_CERT_SEQUENCE *a); NETSCAPE_CERT_SEQUENCE *d2i_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE **a, const unsigned char **in, long len); int i2d_NETSCAPE_CERT_SEQUENCE(NETSCAPE_CERT_SEQUENCE *a, unsigned char **out); extern const ASN1_ITEM NETSCAPE_CERT_SEQUENCE_it;
+X509_INFO * X509_INFO_new(void);
+void X509_INFO_free(X509_INFO *a);
+char * X509_NAME_oneline(X509_NAME *a,char *buf,int size);
+int ASN1_verify(i2d_of_void *i2d, X509_ALGOR *algor1,
+ ASN1_BIT_STRING *signature,char *data,EVP_PKEY *pkey);
+int ASN1_digest(i2d_of_void *i2d,const EVP_MD *type,char *data,
+ unsigned char *md,unsigned int *len);
+int ASN1_sign(i2d_of_void *i2d, X509_ALGOR *algor1,
+ X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
+ char *data,EVP_PKEY *pkey, const EVP_MD *type);
+int ASN1_item_digest(const ASN1_ITEM *it,const EVP_MD *type,void *data,
+ unsigned char *md,unsigned int *len);
+int ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *algor1,
+ ASN1_BIT_STRING *signature,void *data,EVP_PKEY *pkey);
+int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
+ ASN1_BIT_STRING *signature,
+ void *data, EVP_PKEY *pkey, const EVP_MD *type);
+int ASN1_item_sign_ctx(const ASN1_ITEM *it,
+ X509_ALGOR *algor1, X509_ALGOR *algor2,
+ ASN1_BIT_STRING *signature, void *asn, EVP_MD_CTX *ctx);
+int X509_set_version(X509 *x,long version);
+int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial);
+ASN1_INTEGER * X509_get_serialNumber(X509 *x);
+int X509_set_issuer_name(X509 *x, X509_NAME *name);
+X509_NAME * X509_get_issuer_name(X509 *a);
+int X509_set_subject_name(X509 *x, X509_NAME *name);
+X509_NAME * X509_get_subject_name(X509 *a);
+int X509_set_notBefore(X509 *x, const ASN1_TIME *tm);
+int X509_set_notAfter(X509 *x, const ASN1_TIME *tm);
+int X509_set_pubkey(X509 *x, EVP_PKEY *pkey);
+EVP_PKEY * X509_get_pubkey(X509 *x);
+ASN1_BIT_STRING * X509_get0_pubkey_bitstr(const X509 *x);
+int X509_certificate_type(X509 *x,EVP_PKEY *pubkey );
+int X509_REQ_set_version(X509_REQ *x,long version);
+int X509_REQ_set_subject_name(X509_REQ *req,X509_NAME *name);
+int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey);
+EVP_PKEY * X509_REQ_get_pubkey(X509_REQ *req);
+int X509_REQ_extension_nid(int nid);
+int * X509_REQ_get_extension_nids(void);
+void X509_REQ_set_extension_nids(int *nids);
+struct stack_st_X509_EXTENSION *X509_REQ_get_extensions(X509_REQ *req);
+int X509_REQ_add_extensions_nid(X509_REQ *req, struct stack_st_X509_EXTENSION *exts,
+ int nid);
+int X509_REQ_add_extensions(X509_REQ *req, struct stack_st_X509_EXTENSION *exts);
+int X509_REQ_get_attr_count(const X509_REQ *req);
+int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid,
+ int lastpos);
+int X509_REQ_get_attr_by_OBJ(const X509_REQ *req, ASN1_OBJECT *obj,
+ int lastpos);
+X509_ATTRIBUTE *X509_REQ_get_attr(const X509_REQ *req, int loc);
+X509_ATTRIBUTE *X509_REQ_delete_attr(X509_REQ *req, int loc);
+int X509_REQ_add1_attr(X509_REQ *req, X509_ATTRIBUTE *attr);
+int X509_REQ_add1_attr_by_OBJ(X509_REQ *req,
+ const ASN1_OBJECT *obj, int type,
+ const unsigned char *bytes, int len);
+int X509_REQ_add1_attr_by_NID(X509_REQ *req,
+ int nid, int type,
+ const unsigned char *bytes, int len);
+int X509_REQ_add1_attr_by_txt(X509_REQ *req,
+ const char *attrname, int type,
+ const unsigned char *bytes, int len);
+int X509_CRL_set_version(X509_CRL *x, long version);
+int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
+int X509_CRL_set_lastUpdate(X509_CRL *x, const ASN1_TIME *tm);
+int X509_CRL_set_nextUpdate(X509_CRL *x, const ASN1_TIME *tm);
+int X509_CRL_sort(X509_CRL *crl);
+int X509_REVOKED_set_serialNumber(X509_REVOKED *x, ASN1_INTEGER *serial);
+int X509_REVOKED_set_revocationDate(X509_REVOKED *r, ASN1_TIME *tm);
+int X509_REQ_check_private_key(X509_REQ *x509,EVP_PKEY *pkey);
+int X509_check_private_key(X509 *x509,EVP_PKEY *pkey);
+int X509_issuer_and_serial_cmp(const X509 *a, const X509 *b);
+unsigned long X509_issuer_and_serial_hash(X509 *a);
+int X509_issuer_name_cmp(const X509 *a, const X509 *b);
+unsigned long X509_issuer_name_hash(X509 *a);
+int X509_subject_name_cmp(const X509 *a, const X509 *b);
+unsigned long X509_subject_name_hash(X509 *x);
+unsigned long X509_issuer_name_hash_old(X509 *a);
+unsigned long X509_subject_name_hash_old(X509 *x);
+int X509_cmp(const X509 *a, const X509 *b);
+int X509_NAME_cmp(const X509_NAME *a, const X509_NAME *b);
+unsigned long X509_NAME_hash(X509_NAME *x);
+unsigned long X509_NAME_hash_old(X509_NAME *x);
+int X509_CRL_cmp(const X509_CRL *a, const X509_CRL *b);
+int X509_CRL_match(const X509_CRL *a, const X509_CRL *b);
+int X509_print_ex_fp(FILE *bp,X509 *x, unsigned long nmflag, unsigned long cflag);
+int X509_print_fp(FILE *bp,X509 *x);
+int X509_CRL_print_fp(FILE *bp,X509_CRL *x);
+int X509_REQ_print_fp(FILE *bp,X509_REQ *req);
+int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags);
+int X509_NAME_print(BIO *bp, X509_NAME *name, int obase);
+int X509_NAME_print_ex(BIO *out, X509_NAME *nm, int indent, unsigned long flags);
+int X509_print_ex(BIO *bp,X509 *x, unsigned long nmflag, unsigned long cflag);
+int X509_print(BIO *bp,X509 *x);
+int X509_ocspid_print(BIO *bp,X509 *x);
+int X509_CERT_AUX_print(BIO *bp,X509_CERT_AUX *x, int indent);
+int X509_CRL_print(BIO *bp,X509_CRL *x);
+int X509_REQ_print_ex(BIO *bp, X509_REQ *x, unsigned long nmflag, unsigned long cflag);
+int X509_REQ_print(BIO *bp,X509_REQ *req);
+int X509_NAME_entry_count(X509_NAME *name);
+int X509_NAME_get_text_by_NID(X509_NAME *name, int nid,
+ char *buf,int len);
+int X509_NAME_get_text_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj,
+ char *buf,int len);
+int X509_NAME_get_index_by_NID(X509_NAME *name,int nid,int lastpos);
+int X509_NAME_get_index_by_OBJ(X509_NAME *name,ASN1_OBJECT *obj,
+ int lastpos);
+X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc);
+X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc);
+int X509_NAME_add_entry(X509_NAME *name,X509_NAME_ENTRY *ne,
+ int loc, int set);
+int X509_NAME_add_entry_by_OBJ(X509_NAME *name, ASN1_OBJECT *obj, int type,
+ unsigned char *bytes, int len, int loc, int set);
+int X509_NAME_add_entry_by_NID(X509_NAME *name, int nid, int type,
+ unsigned char *bytes, int len, int loc, int set);
+X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_txt(X509_NAME_ENTRY **ne,
+ const char *field, int type, const unsigned char *bytes, int len);
+X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_NID(X509_NAME_ENTRY **ne, int nid,
+ int type,unsigned char *bytes, int len);
+int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field, int type,
+ const unsigned char *bytes, int len, int loc, int set);
+X509_NAME_ENTRY *X509_NAME_ENTRY_create_by_OBJ(X509_NAME_ENTRY **ne,
+ ASN1_OBJECT *obj, int type,const unsigned char *bytes,
+ int len);
+int X509_NAME_ENTRY_set_object(X509_NAME_ENTRY *ne,
+ ASN1_OBJECT *obj);
+int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type,
+ const unsigned char *bytes, int len);
+ASN1_OBJECT * X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne);
+ASN1_STRING * X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne);
+int X509v3_get_ext_count(const struct stack_st_X509_EXTENSION *x);
+int X509v3_get_ext_by_NID(const struct stack_st_X509_EXTENSION *x,
+ int nid, int lastpos);
+int X509v3_get_ext_by_OBJ(const struct stack_st_X509_EXTENSION *x,
+ ASN1_OBJECT *obj,int lastpos);
+int X509v3_get_ext_by_critical(const struct stack_st_X509_EXTENSION *x,
+ int crit, int lastpos);
+X509_EXTENSION *X509v3_get_ext(const struct stack_st_X509_EXTENSION *x, int loc);
+X509_EXTENSION *X509v3_delete_ext(struct stack_st_X509_EXTENSION *x, int loc);
+struct stack_st_X509_EXTENSION *X509v3_add_ext(struct stack_st_X509_EXTENSION **x,
+ X509_EXTENSION *ex, int loc);
+int X509_get_ext_count(X509 *x);
+int X509_get_ext_by_NID(X509 *x, int nid, int lastpos);
+int X509_get_ext_by_OBJ(X509 *x,ASN1_OBJECT *obj,int lastpos);
+int X509_get_ext_by_critical(X509 *x, int crit, int lastpos);
+X509_EXTENSION *X509_get_ext(X509 *x, int loc);
+X509_EXTENSION *X509_delete_ext(X509 *x, int loc);
+int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc);
+void * X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx);
+int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
+ unsigned long flags);
+int X509_CRL_get_ext_count(X509_CRL *x);
+int X509_CRL_get_ext_by_NID(X509_CRL *x, int nid, int lastpos);
+int X509_CRL_get_ext_by_OBJ(X509_CRL *x,ASN1_OBJECT *obj,int lastpos);
+int X509_CRL_get_ext_by_critical(X509_CRL *x, int crit, int lastpos);
+X509_EXTENSION *X509_CRL_get_ext(X509_CRL *x, int loc);
+X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc);
+int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc);
+void * X509_CRL_get_ext_d2i(X509_CRL *x, int nid, int *crit, int *idx);
+int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
+ unsigned long flags);
+int X509_REVOKED_get_ext_count(X509_REVOKED *x);
+int X509_REVOKED_get_ext_by_NID(X509_REVOKED *x, int nid, int lastpos);
+int X509_REVOKED_get_ext_by_OBJ(X509_REVOKED *x,ASN1_OBJECT *obj,int lastpos);
+int X509_REVOKED_get_ext_by_critical(X509_REVOKED *x, int crit, int lastpos);
+X509_EXTENSION *X509_REVOKED_get_ext(X509_REVOKED *x, int loc);
+X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc);
+int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc);
+void * X509_REVOKED_get_ext_d2i(X509_REVOKED *x, int nid, int *crit, int *idx);
+int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
+ unsigned long flags);
+X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
+ int nid, int crit, ASN1_OCTET_STRING *data);
+X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,
+ ASN1_OBJECT *obj,int crit,ASN1_OCTET_STRING *data);
+int X509_EXTENSION_set_object(X509_EXTENSION *ex,ASN1_OBJECT *obj);
+int X509_EXTENSION_set_critical(X509_EXTENSION *ex, int crit);
+int X509_EXTENSION_set_data(X509_EXTENSION *ex,
+ ASN1_OCTET_STRING *data);
+ASN1_OBJECT * X509_EXTENSION_get_object(X509_EXTENSION *ex);
+ASN1_OCTET_STRING *X509_EXTENSION_get_data(X509_EXTENSION *ne);
+int X509_EXTENSION_get_critical(X509_EXTENSION *ex);
+int X509at_get_attr_count(const struct stack_st_X509_ATTRIBUTE *x);
+int X509at_get_attr_by_NID(const struct stack_st_X509_ATTRIBUTE *x, int nid,
+ int lastpos);
+int X509at_get_attr_by_OBJ(const struct stack_st_X509_ATTRIBUTE *sk, ASN1_OBJECT *obj,
+ int lastpos);
+X509_ATTRIBUTE *X509at_get_attr(const struct stack_st_X509_ATTRIBUTE *x, int loc);
+X509_ATTRIBUTE *X509at_delete_attr(struct stack_st_X509_ATTRIBUTE *x, int loc);
+struct stack_st_X509_ATTRIBUTE *X509at_add1_attr(struct stack_st_X509_ATTRIBUTE **x,
+ X509_ATTRIBUTE *attr);
+struct stack_st_X509_ATTRIBUTE *X509at_add1_attr_by_OBJ(struct stack_st_X509_ATTRIBUTE **x,
+ const ASN1_OBJECT *obj, int type,
+ const unsigned char *bytes, int len);
+struct stack_st_X509_ATTRIBUTE *X509at_add1_attr_by_NID(struct stack_st_X509_ATTRIBUTE **x,
+ int nid, int type,
+ const unsigned char *bytes, int len);
+struct stack_st_X509_ATTRIBUTE *X509at_add1_attr_by_txt(struct stack_st_X509_ATTRIBUTE **x,
+ const char *attrname, int type,
+ const unsigned char *bytes, int len);
+void *X509at_get0_data_by_OBJ(struct stack_st_X509_ATTRIBUTE *x,
+ ASN1_OBJECT *obj, int lastpos, int type);
+X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_NID(X509_ATTRIBUTE **attr, int nid,
+ int atrtype, const void *data, int len);
+X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_OBJ(X509_ATTRIBUTE **attr,
+ const ASN1_OBJECT *obj, int atrtype, const void *data, int len);
+X509_ATTRIBUTE *X509_ATTRIBUTE_create_by_txt(X509_ATTRIBUTE **attr,
+ const char *atrname, int type, const unsigned char *bytes, int len);
+int X509_ATTRIBUTE_set1_object(X509_ATTRIBUTE *attr, const ASN1_OBJECT *obj);
+int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len);
+void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx,
+ int atrtype, void *data);
+int X509_ATTRIBUTE_count(X509_ATTRIBUTE *attr);
+ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr);
+ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx);
+int EVP_PKEY_get_attr_count(const EVP_PKEY *key);
+int EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid,
+ int lastpos);
+int EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, ASN1_OBJECT *obj,
+ int lastpos);
+X509_ATTRIBUTE *EVP_PKEY_get_attr(const EVP_PKEY *key, int loc);
+X509_ATTRIBUTE *EVP_PKEY_delete_attr(EVP_PKEY *key, int loc);
+int EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr);
+int EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key,
+ const ASN1_OBJECT *obj, int type,
+ const unsigned char *bytes, int len);
+int EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key,
+ int nid, int type,
+ const unsigned char *bytes, int len);
+int EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key,
+ const char *attrname, int type,
+ const unsigned char *bytes, int len);
+int X509_verify_cert(X509_STORE_CTX *ctx);
+X509 *X509_find_by_issuer_and_serial(struct stack_st_X509 *sk,X509_NAME *name,
+ ASN1_INTEGER *serial);
+X509 *X509_find_by_subject(struct stack_st_X509 *sk,X509_NAME *name);
+PBEPARAM *PBEPARAM_new(void); void PBEPARAM_free(PBEPARAM *a); PBEPARAM *d2i_PBEPARAM(PBEPARAM **a, const unsigned char **in, long len); int i2d_PBEPARAM(PBEPARAM *a, unsigned char **out); extern const ASN1_ITEM PBEPARAM_it;
+PBE2PARAM *PBE2PARAM_new(void); void PBE2PARAM_free(PBE2PARAM *a); PBE2PARAM *d2i_PBE2PARAM(PBE2PARAM **a, const unsigned char **in, long len); int i2d_PBE2PARAM(PBE2PARAM *a, unsigned char **out); extern const ASN1_ITEM PBE2PARAM_it;
+PBKDF2PARAM *PBKDF2PARAM_new(void); void PBKDF2PARAM_free(PBKDF2PARAM *a); PBKDF2PARAM *d2i_PBKDF2PARAM(PBKDF2PARAM **a, const unsigned char **in, long len); int i2d_PBKDF2PARAM(PBKDF2PARAM *a, unsigned char **out); extern const ASN1_ITEM PBKDF2PARAM_it;
+int PKCS5_pbe_set0_algor(X509_ALGOR *algor, int alg, int iter,
+ const unsigned char *salt, int saltlen);
+X509_ALGOR *PKCS5_pbe_set(int alg, int iter,
+ const unsigned char *salt, int saltlen);
+X509_ALGOR *PKCS5_pbe2_set(const EVP_CIPHER *cipher, int iter,
+ unsigned char *salt, int saltlen);
+X509_ALGOR *PKCS5_pbe2_set_iv(const EVP_CIPHER *cipher, int iter,
+ unsigned char *salt, int saltlen,
+ unsigned char *aiv, int prf_nid);
+X509_ALGOR *PKCS5_pbkdf2_set(int iter, unsigned char *salt, int saltlen,
+ int prf_nid, int keylen);
+PKCS8_PRIV_KEY_INFO *PKCS8_PRIV_KEY_INFO_new(void); void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *a); PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO **a, const unsigned char **in, long len); int i2d_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *a, unsigned char **out); extern const ASN1_ITEM PKCS8_PRIV_KEY_INFO_it;
+EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *p8);
+PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8(EVP_PKEY *pkey);
+PKCS8_PRIV_KEY_INFO *EVP_PKEY2PKCS8_broken(EVP_PKEY *pkey, int broken);
+PKCS8_PRIV_KEY_INFO *PKCS8_set_broken(PKCS8_PRIV_KEY_INFO *p8, int broken);
+int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
+ int version, int ptype, void *pval,
+ unsigned char *penc, int penclen);
+int PKCS8_pkey_get0(ASN1_OBJECT **ppkalg,
+ const unsigned char **pk, int *ppklen,
+ X509_ALGOR **pa,
+ PKCS8_PRIV_KEY_INFO *p8);
+int X509_PUBKEY_set0_param(X509_PUBKEY *pub, ASN1_OBJECT *aobj,
+ int ptype, void *pval,
+ unsigned char *penc, int penclen);
+int X509_PUBKEY_get0_param(ASN1_OBJECT **ppkalg,
+ const unsigned char **pk, int *ppklen,
+ X509_ALGOR **pa,
+ X509_PUBKEY *pub);
+int X509_check_trust(X509 *x, int id, int flags);
+int X509_TRUST_get_count(void);
+X509_TRUST * X509_TRUST_get0(int idx);
+int X509_TRUST_get_by_id(int id);
+int X509_TRUST_add(int id, int flags, int (*ck)(X509_TRUST *, X509 *, int),
+ char *name, int arg1, void *arg2);
+void X509_TRUST_cleanup(void);
+int X509_TRUST_get_flags(X509_TRUST *xp);
+char *X509_TRUST_get0_name(X509_TRUST *xp);
+int X509_TRUST_get_trust(X509_TRUST *xp);
+void ERR_load_X509_strings(void);
+typedef struct PEM_Encode_Seal_st
+ {
+ EVP_ENCODE_CTX encode;
+ EVP_MD_CTX md;
+ EVP_CIPHER_CTX cipher;
+ } PEM_ENCODE_SEAL_CTX;
+typedef struct pem_recip_st
+ {
+ char *name;
+ X509_NAME *dn;
+ int cipher;
+ int key_enc;
+ } PEM_USER;
+typedef struct pem_ctx_st
+ {
+ int type;
+ struct {
+ int version;
+ int mode;
+ } proc_type;
+ char *domain;
+ struct {
+ int cipher;
+ } DEK_info;
+ PEM_USER *originator;
+ int num_recipient;
+ PEM_USER **recipient;
+ EVP_MD *md;
+ int md_enc;
+ int md_len;
+ char *md_data;
+ EVP_CIPHER *dec;
+ int key_len;
+ unsigned char *key;
+ int data_enc;
+ int data_len;
+ unsigned char *data;
+ } PEM_CTX;
+typedef int pem_password_cb(char *buf, int size, int rwflag, void *userdata);
+int PEM_get_EVP_CIPHER_INFO(char *header, EVP_CIPHER_INFO *cipher);
+int PEM_do_header (EVP_CIPHER_INFO *cipher, unsigned char *data,long *len,
+ pem_password_cb *callback,void *u);
+int PEM_read_bio(BIO *bp, char **name, char **header,
+ unsigned char **data,long *len);
+int PEM_write_bio(BIO *bp,const char *name,char *hdr,unsigned char *data,
+ long len);
+int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, const char *name, BIO *bp,
+ pem_password_cb *cb, void *u);
+void * PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp,
+ void **x, pem_password_cb *cb, void *u);
+int PEM_ASN1_write_bio(i2d_of_void *i2d,const char *name,BIO *bp, void *x,
+ const EVP_CIPHER *enc,unsigned char *kstr,int klen,
+ pem_password_cb *cb, void *u);
+struct stack_st_X509_INFO * PEM_X509_INFO_read_bio(BIO *bp, struct stack_st_X509_INFO *sk, pem_password_cb *cb, void *u);
+int PEM_X509_INFO_write_bio(BIO *bp,X509_INFO *xi, EVP_CIPHER *enc,
+ unsigned char *kstr, int klen, pem_password_cb *cd, void *u);
+int PEM_read(FILE *fp, char **name, char **header,
+ unsigned char **data,long *len);
+int PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
+void * PEM_ASN1_read(d2i_of_void *d2i, const char *name, FILE *fp, void **x,
+ pem_password_cb *cb, void *u);
+int PEM_ASN1_write(i2d_of_void *i2d,const char *name,FILE *fp,
+ void *x,const EVP_CIPHER *enc,unsigned char *kstr,
+ int klen,pem_password_cb *callback, void *u);
+struct stack_st_X509_INFO * PEM_X509_INFO_read(FILE *fp, struct stack_st_X509_INFO *sk,
+ pem_password_cb *cb, void *u);
+int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
+ EVP_MD *md_type, unsigned char **ek, int *ekl,
+ unsigned char *iv, EVP_PKEY **pubk, int npubk);
+void PEM_SealUpdate(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *out, int *outl,
+ unsigned char *in, int inl);
+int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig,int *sigl,
+ unsigned char *out, int *outl, EVP_PKEY *priv);
+void PEM_SignInit(EVP_MD_CTX *ctx, EVP_MD *type);
+void PEM_SignUpdate(EVP_MD_CTX *ctx,unsigned char *d,unsigned int cnt);
+int PEM_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
+ unsigned int *siglen, EVP_PKEY *pkey);
+int PEM_def_callback(char *buf, int num, int w, void *key);
+void PEM_proc_type(char *buf, int type);
+void PEM_dek_info(char *buf, const char *type, int len, char *str);
+X509 *PEM_read_bio_X509(BIO *bp, X509 **x, pem_password_cb *cb, void *u); X509 *PEM_read_X509(FILE *fp, X509 **x, pem_password_cb *cb, void *u); int PEM_write_bio_X509(BIO *bp, X509 *x); int PEM_write_X509(FILE *fp, X509 *x);
+X509 *PEM_read_bio_X509_AUX(BIO *bp, X509 **x, pem_password_cb *cb, void *u); X509 *PEM_read_X509_AUX(FILE *fp, X509 **x, pem_password_cb *cb, void *u); int PEM_write_bio_X509_AUX(BIO *bp, X509 *x); int PEM_write_X509_AUX(FILE *fp, X509 *x);
+X509_CERT_PAIR *PEM_read_bio_X509_CERT_PAIR(BIO *bp, X509_CERT_PAIR **x, pem_password_cb *cb, void *u); X509_CERT_PAIR *PEM_read_X509_CERT_PAIR(FILE *fp, X509_CERT_PAIR **x, pem_password_cb *cb, void *u); int PEM_write_bio_X509_CERT_PAIR(BIO *bp, X509_CERT_PAIR *x); int PEM_write_X509_CERT_PAIR(FILE *fp, X509_CERT_PAIR *x);
+X509_REQ *PEM_read_bio_X509_REQ(BIO *bp, X509_REQ **x, pem_password_cb *cb, void *u); X509_REQ *PEM_read_X509_REQ(FILE *fp, X509_REQ **x, pem_password_cb *cb, void *u); int PEM_write_bio_X509_REQ(BIO *bp, X509_REQ *x); int PEM_write_X509_REQ(FILE *fp, X509_REQ *x);
+int PEM_write_bio_X509_REQ_NEW(BIO *bp, X509_REQ *x); int PEM_write_X509_REQ_NEW(FILE *fp, X509_REQ *x);
+X509_CRL *PEM_read_bio_X509_CRL(BIO *bp, X509_CRL **x, pem_password_cb *cb, void *u); X509_CRL *PEM_read_X509_CRL(FILE *fp, X509_CRL **x, pem_password_cb *cb, void *u); int PEM_write_bio_X509_CRL(BIO *bp, X509_CRL *x); int PEM_write_X509_CRL(FILE *fp, X509_CRL *x);
+PKCS7 *PEM_read_bio_PKCS7(BIO *bp, PKCS7 **x, pem_password_cb *cb, void *u); PKCS7 *PEM_read_PKCS7(FILE *fp, PKCS7 **x, pem_password_cb *cb, void *u); int PEM_write_bio_PKCS7(BIO *bp, PKCS7 *x); int PEM_write_PKCS7(FILE *fp, PKCS7 *x);
+NETSCAPE_CERT_SEQUENCE *PEM_read_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *cb, void *u); NETSCAPE_CERT_SEQUENCE *PEM_read_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE **x, pem_password_cb *cb, void *u); int PEM_write_bio_NETSCAPE_CERT_SEQUENCE(BIO *bp, NETSCAPE_CERT_SEQUENCE *x); int PEM_write_NETSCAPE_CERT_SEQUENCE(FILE *fp, NETSCAPE_CERT_SEQUENCE *x);
+X509_SIG *PEM_read_bio_PKCS8(BIO *bp, X509_SIG **x, pem_password_cb *cb, void *u); X509_SIG *PEM_read_PKCS8(FILE *fp, X509_SIG **x, pem_password_cb *cb, void *u); int PEM_write_bio_PKCS8(BIO *bp, X509_SIG *x); int PEM_write_PKCS8(FILE *fp, X509_SIG *x);
+PKCS8_PRIV_KEY_INFO *PEM_read_bio_PKCS8_PRIV_KEY_INFO(BIO *bp, PKCS8_PRIV_KEY_INFO **x, pem_password_cb *cb, void *u); PKCS8_PRIV_KEY_INFO *PEM_read_PKCS8_PRIV_KEY_INFO(FILE *fp, PKCS8_PRIV_KEY_INFO **x, pem_password_cb *cb, void *u); int PEM_write_bio_PKCS8_PRIV_KEY_INFO(BIO *bp, PKCS8_PRIV_KEY_INFO *x); int PEM_write_PKCS8_PRIV_KEY_INFO(FILE *fp, PKCS8_PRIV_KEY_INFO *x);
+RSA *PEM_read_bio_RSAPrivateKey(BIO *bp, RSA **x, pem_password_cb *cb, void *u); RSA *PEM_read_RSAPrivateKey(FILE *fp, RSA **x, pem_password_cb *cb, void *u); int PEM_write_bio_RSAPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u); int PEM_write_RSAPrivateKey(FILE *fp, RSA *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+RSA *PEM_read_bio_RSAPublicKey(BIO *bp, RSA **x, pem_password_cb *cb, void *u); RSA *PEM_read_RSAPublicKey(FILE *fp, RSA **x, pem_password_cb *cb, void *u); int PEM_write_bio_RSAPublicKey(BIO *bp, const RSA *x); int PEM_write_RSAPublicKey(FILE *fp, const RSA *x);
+RSA *PEM_read_bio_RSA_PUBKEY(BIO *bp, RSA **x, pem_password_cb *cb, void *u); RSA *PEM_read_RSA_PUBKEY(FILE *fp, RSA **x, pem_password_cb *cb, void *u); int PEM_write_bio_RSA_PUBKEY(BIO *bp, RSA *x); int PEM_write_RSA_PUBKEY(FILE *fp, RSA *x);
+DSA *PEM_read_bio_DSAPrivateKey(BIO *bp, DSA **x, pem_password_cb *cb, void *u); DSA *PEM_read_DSAPrivateKey(FILE *fp, DSA **x, pem_password_cb *cb, void *u); int PEM_write_bio_DSAPrivateKey(BIO *bp, DSA *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u); int PEM_write_DSAPrivateKey(FILE *fp, DSA *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+DSA *PEM_read_bio_DSA_PUBKEY(BIO *bp, DSA **x, pem_password_cb *cb, void *u); DSA *PEM_read_DSA_PUBKEY(FILE *fp, DSA **x, pem_password_cb *cb, void *u); int PEM_write_bio_DSA_PUBKEY(BIO *bp, DSA *x); int PEM_write_DSA_PUBKEY(FILE *fp, DSA *x);
+DSA *PEM_read_bio_DSAparams(BIO *bp, DSA **x, pem_password_cb *cb, void *u); DSA *PEM_read_DSAparams(FILE *fp, DSA **x, pem_password_cb *cb, void *u); int PEM_write_bio_DSAparams(BIO *bp, const DSA *x); int PEM_write_DSAparams(FILE *fp, const DSA *x);
+EC_GROUP *PEM_read_bio_ECPKParameters(BIO *bp, EC_GROUP **x, pem_password_cb *cb, void *u); EC_GROUP *PEM_read_ECPKParameters(FILE *fp, EC_GROUP **x, pem_password_cb *cb, void *u); int PEM_write_bio_ECPKParameters(BIO *bp, const EC_GROUP *x); int PEM_write_ECPKParameters(FILE *fp, const EC_GROUP *x);
+EC_KEY *PEM_read_bio_ECPrivateKey(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u); EC_KEY *PEM_read_ECPrivateKey(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u); int PEM_write_bio_ECPrivateKey(BIO *bp, EC_KEY *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u); int PEM_write_ECPrivateKey(FILE *fp, EC_KEY *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+EC_KEY *PEM_read_bio_EC_PUBKEY(BIO *bp, EC_KEY **x, pem_password_cb *cb, void *u); EC_KEY *PEM_read_EC_PUBKEY(FILE *fp, EC_KEY **x, pem_password_cb *cb, void *u); int PEM_write_bio_EC_PUBKEY(BIO *bp, EC_KEY *x); int PEM_write_EC_PUBKEY(FILE *fp, EC_KEY *x);
+DH *PEM_read_bio_DHparams(BIO *bp, DH **x, pem_password_cb *cb, void *u); DH *PEM_read_DHparams(FILE *fp, DH **x, pem_password_cb *cb, void *u); int PEM_write_bio_DHparams(BIO *bp, const DH *x); int PEM_write_DHparams(FILE *fp, const DH *x);
+EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); int PEM_write_bio_PrivateKey(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u); int PEM_write_PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
+EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u); EVP_PKEY *PEM_read_PUBKEY(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u); int PEM_write_bio_PUBKEY(BIO *bp, EVP_PKEY *x); int PEM_write_PUBKEY(FILE *fp, EVP_PKEY *x);
+int PEM_write_bio_PKCS8PrivateKey_nid(BIO *bp, EVP_PKEY *x, int nid,
+ char *kstr, int klen,
+ pem_password_cb *cb, void *u);
+int PEM_write_bio_PKCS8PrivateKey(BIO *, EVP_PKEY *, const EVP_CIPHER *,
+ char *, int, pem_password_cb *, void *);
+int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
+ char *kstr, int klen,
+ pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
+ char *kstr, int klen,
+ pem_password_cb *cb, void *u);
+EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
+ char *kstr, int klen,
+ pem_password_cb *cb, void *u);
+int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
+ char *kstr, int klen,
+ pem_password_cb *cb, void *u);
+int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid,
+ char *kstr, int klen,
+ pem_password_cb *cb, void *u);
+EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
+int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
+ char *kstr,int klen, pem_password_cb *cd, void *u);
+EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
+int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
+EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length);
+EVP_PKEY *b2i_PublicKey(const unsigned char **in, long length);
+EVP_PKEY *b2i_PrivateKey_bio(BIO *in);
+EVP_PKEY *b2i_PublicKey_bio(BIO *in);
+int i2b_PrivateKey_bio(BIO *out, EVP_PKEY *pk);
+int i2b_PublicKey_bio(BIO *out, EVP_PKEY *pk);
+EVP_PKEY *b2i_PVK_bio(BIO *in, pem_password_cb *cb, void *u);
+int i2b_PVK_bio(BIO *out, EVP_PKEY *pk, int enclevel,
+ pem_password_cb *cb, void *u);
+void ERR_load_PEM_strings(void);
+int EVP_DigestFinal_ex(EVP_MD_CTX *, unsigned char *, unsigned int *);
+int EVP_MD_CTX_copy_ex(EVP_MD_CTX *, const EVP_MD_CTX *);
+int ssh_EVP_CipherInit(EVP_CIPHER_CTX *, const EVP_CIPHER *, unsigned char *,
+ unsigned char *, int);
+int ssh_EVP_Cipher(EVP_CIPHER_CTX *, char *, char *, int);
+int ssh_EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *);
+void ssh_OpenSSL_add_all_algorithms(void);
+struct flock
+ {
+ short int l_type;
+ short int l_whence;
+ __off64_t l_start;
+ __off64_t l_len;
+ __pid_t l_pid;
+ };
+struct flock64
+ {
+ short int l_type;
+ short int l_whence;
+ __off64_t l_start;
+ __off64_t l_len;
+ __pid_t l_pid;
+ };
+enum __pid_type
+ {
+ F_OWNER_TID = 0,
+ F_OWNER_PID,
+ F_OWNER_PGRP,
+ F_OWNER_GID = F_OWNER_PGRP
+ };
+struct f_owner_ex
+ {
+ enum __pid_type type;
+ __pid_t pid;
+ };
+struct file_handle
+{
+ unsigned int handle_bytes;
+ int handle_type;
+ unsigned char f_handle[0];
+};
+extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int sync_file_range (int __fd, __off64_t __offset, __off64_t __count,
+ unsigned int __flags);
+extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
+ size_t __count, unsigned int __flags);
+extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
+ __off64_t *__offout, size_t __len,
+ unsigned int __flags);
+extern ssize_t tee (int __fdin, int __fdout, size_t __len,
+ unsigned int __flags);
+extern int fallocate (int __fd, int __mode, __off64_t __offset, __off64_t __len) __asm__ ("" "fallocate64")
+ ;
+extern int fallocate64 (int __fd, int __mode, __off64_t __offset,
+ __off64_t __len);
+extern int name_to_handle_at (int __dfd, const char *__name,
+ struct file_handle *__handle, int *__mnt_id,
+ int __flags) __attribute__ ((__nothrow__ , __leaf__));
+extern int open_by_handle_at (int __mountdirfd, struct file_handle *__handle,
+ int __flags);
+extern int fcntl (int __fd, int __cmd, ...);
+extern int open (const char *__file, int __oflag, ...) __asm__ ("" "open64")
+ __attribute__ ((__nonnull__ (1)));
+extern int open64 (const char *__file, int __oflag, ...) __attribute__ ((__nonnull__ (1)));
+extern int openat (int __fd, const char *__file, int __oflag, ...) __asm__ ("" "openat64")
+ __attribute__ ((__nonnull__ (2)));
+extern int openat64 (int __fd, const char *__file, int __oflag, ...)
+ __attribute__ ((__nonnull__ (2)));
+extern int creat (const char *__file, mode_t __mode) __asm__ ("" "creat64")
+ __attribute__ ((__nonnull__ (1)));
+extern int creat64 (const char *__file, mode_t __mode) __attribute__ ((__nonnull__ (1)));
+extern int lockf (int __fd, int __cmd, __off64_t __len) __asm__ ("" "lockf64");
+extern int lockf64 (int __fd, int __cmd, off64_t __len);
+extern int posix_fadvise (int __fd, __off64_t __offset, __off64_t __len, int __advise) __asm__ ("" "posix_fadvise64") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
+ int __advise) __attribute__ ((__nothrow__ , __leaf__));
+extern int posix_fallocate (int __fd, __off64_t __offset, __off64_t __len) __asm__ ("" "posix_fallocate64")
+ ;
+extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
+extern int __open_2 (const char *__path, int __oflag) __asm__ ("" "__open64_2")
+ __attribute__ ((__nonnull__ (1)));
+extern int __open_alias (const char *__path, int __oflag, ...) __asm__ ("" "open64")
+ __attribute__ ((__nonnull__ (1)));
+extern void __open_too_many_args (void) __attribute__((__error__ ("open can be called either with 2 or 3 arguments, not more")))
+ ;
+extern void __open_missing_mode (void) __attribute__((__error__ ("open with O_CREAT in second argument needs 3 arguments")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+open (const char *__path, int __oflag, ...)
+{
+ if (__builtin_va_arg_pack_len () > 1)
+ __open_too_many_args ();
+ if (__builtin_constant_p (__oflag))
+ {
+ if ((__oflag & 00000400) != 0 && __builtin_va_arg_pack_len () < 1)
+ {
+ __open_missing_mode ();
+ return __open_2 (__path, __oflag);
+ }
+ return __open_alias (__path, __oflag, __builtin_va_arg_pack ());
+ }
+ if (__builtin_va_arg_pack_len () < 1)
+ return __open_2 (__path, __oflag);
+ return __open_alias (__path, __oflag, __builtin_va_arg_pack ());
+}
+extern int __open64_2 (const char *__path, int __oflag) __attribute__ ((__nonnull__ (1)));
+extern int __open64_alias (const char *__path, int __oflag, ...) __asm__ ("" "open64")
+ __attribute__ ((__nonnull__ (1)));
+extern void __open64_too_many_args (void) __attribute__((__error__ ("open64 can be called either with 2 or 3 arguments, not more")))
+ ;
+extern void __open64_missing_mode (void) __attribute__((__error__ ("open64 with O_CREAT in second argument needs 3 arguments")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+open64 (const char *__path, int __oflag, ...)
+{
+ if (__builtin_va_arg_pack_len () > 1)
+ __open64_too_many_args ();
+ if (__builtin_constant_p (__oflag))
+ {
+ if ((__oflag & 00000400) != 0 && __builtin_va_arg_pack_len () < 1)
+ {
+ __open64_missing_mode ();
+ return __open64_2 (__path, __oflag);
+ }
+ return __open64_alias (__path, __oflag, __builtin_va_arg_pack ());
+ }
+ if (__builtin_va_arg_pack_len () < 1)
+ return __open64_2 (__path, __oflag);
+ return __open64_alias (__path, __oflag, __builtin_va_arg_pack ());
+}
+extern int __openat_2 (int __fd, const char *__path, int __oflag) __asm__ ("" "__openat64_2")
+ __attribute__ ((__nonnull__ (2)));
+extern int __openat_alias (int __fd, const char *__path, int __oflag, ...) __asm__ ("" "openat64")
+ __attribute__ ((__nonnull__ (2)));
+extern void __openat_too_many_args (void) __attribute__((__error__ ("openat can be called either with 3 or 4 arguments, not more")))
+ ;
+extern void __openat_missing_mode (void) __attribute__((__error__ ("openat with O_CREAT in third argument needs 4 arguments")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+openat (int __fd, const char *__path, int __oflag, ...)
+{
+ if (__builtin_va_arg_pack_len () > 1)
+ __openat_too_many_args ();
+ if (__builtin_constant_p (__oflag))
+ {
+ if ((__oflag & 00000400) != 0 && __builtin_va_arg_pack_len () < 1)
+ {
+ __openat_missing_mode ();
+ return __openat_2 (__fd, __path, __oflag);
+ }
+ return __openat_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
+ }
+ if (__builtin_va_arg_pack_len () < 1)
+ return __openat_2 (__fd, __path, __oflag);
+ return __openat_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
+}
+extern int __openat64_2 (int __fd, const char *__path, int __oflag)
+ __attribute__ ((__nonnull__ (2)));
+extern int __openat64_alias (int __fd, const char *__path, int __oflag, ...) __asm__ ("" "openat64")
+ __attribute__ ((__nonnull__ (2)));
+extern void __openat64_too_many_args (void) __attribute__((__error__ ("openat64 can be called either with 3 or 4 arguments, not more")))
+ ;
+extern void __openat64_missing_mode (void) __attribute__((__error__ ("openat64 with O_CREAT in third argument needs 4 arguments")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+openat64 (int __fd, const char *__path, int __oflag, ...)
+{
+ if (__builtin_va_arg_pack_len () > 1)
+ __openat64_too_many_args ();
+ if (__builtin_constant_p (__oflag))
+ {
+ if ((__oflag & 00000400) != 0 && __builtin_va_arg_pack_len () < 1)
+ {
+ __openat64_missing_mode ();
+ return __openat64_2 (__fd, __path, __oflag);
+ }
+ return __openat64_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
+ }
+ if (__builtin_va_arg_pack_len () < 1)
+ return __openat64_2 (__fd, __path, __oflag);
+ return __openat64_alias (__fd, __path, __oflag, __builtin_va_arg_pack ());
+}
+extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
+ size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *memmove (void *__dest, const void *__src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
+ int __c, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *memset (void *__s, int __c, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int memcmp (const void *__s1, const void *__s2, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *memchr (const void *__s, int __c, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern void *rawmemchr (const void *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern void *memrchr (const void *__s, int __c, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strncpy (char *__restrict __dest,
+ const char *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strcat (char *__restrict __dest, const char *__restrict __src)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strncat (char *__restrict __dest, const char *__restrict __src,
+ size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int strcmp (const char *__s1, const char *__s2)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int strncmp (const char *__s1, const char *__s2, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int strcoll (const char *__s1, const char *__s2)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern size_t strxfrm (char *__restrict __dest,
+ const char *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int strcoll_l (const char *__s1, const char *__s2, __locale_t __l)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
+extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n,
+ __locale_t __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4)));
+extern char *strdup (const char *__s)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
+extern char *strndup (const char *__string, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__)) __attribute__ ((__nonnull__ (1)));
+extern char *strchr (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern char *strrchr (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern char *strchrnul (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern size_t strcspn (const char *__s, const char *__reject)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern size_t strspn (const char *__s, const char *__accept)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strpbrk (const char *__s, const char *__accept)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strstr (const char *__haystack, const char *__needle)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strtok (char *__restrict __s, const char *__restrict __delim)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern char *__strtok_r (char *__restrict __s,
+ const char *__restrict __delim,
+ char **__restrict __save_ptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
+extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
+ char **__restrict __save_ptr)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3)));
+extern char *strcasestr (const char *__haystack, const char *__needle)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *memmem (const void *__haystack, size_t __haystacklen,
+ const void *__needle, size_t __needlelen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 3)));
+extern void *__mempcpy (void *__restrict __dest,
+ const void *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void *mempcpy (void *__restrict __dest,
+ const void *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern size_t strlen (const char *__s)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern size_t strnlen (const char *__string, size_t __maxlen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern char *strerror (int __errnum) __attribute__ ((__nothrow__ , __leaf__));
+extern char *strerror_r (int __errnum, char *__buf, size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
+extern char *strerror_l (int __errnum, __locale_t __l) __attribute__ ((__nothrow__ , __leaf__));
+extern void __bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern void bcopy (const void *__src, void *__dest, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void bzero (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int bcmp (const void *__s1, const void *__s2, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *index (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern char *rindex (const char *__s, int __c)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1)));
+extern int ffs (int __i) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern int ffsl (long int __l) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+__extension__ extern int ffsll (long long int __ll)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern int strcasecmp (const char *__s1, const char *__s2)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int strncasecmp (const char *__s1, const char *__s2, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int strcasecmp_l (const char *__s1, const char *__s2,
+ __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 3)));
+extern int strncasecmp_l (const char *__s1, const char *__s2,
+ size_t __n, __locale_t __loc)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2, 4)));
+extern char *strsep (char **__restrict __stringp,
+ const char *__restrict __delim)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strsignal (int __sig) __attribute__ ((__nothrow__ , __leaf__));
+extern char *__stpcpy (char *__restrict __dest, const char *__restrict __src)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *__stpncpy (char *__restrict __dest,
+ const char *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *stpncpy (char *__restrict __dest,
+ const char *__restrict __src, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int strverscmp (const char *__s1, const char *__s2)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__pure__)) __attribute__ ((__nonnull__ (1, 2)));
+extern char *strfry (char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern void *memfrob (void *__s, size_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern char *basename (const char *__filename) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+typedef struct { unsigned char __arr[2]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR2;
+typedef struct { unsigned char __arr[3]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR3;
+typedef struct { unsigned char __arr[4]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR4;
+typedef struct { unsigned char __arr[5]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR5;
+typedef struct { unsigned char __arr[6]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR6;
+typedef struct { unsigned char __arr[7]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR7;
+typedef struct { unsigned char __arr[8]; } __attribute__ ((__packed__)) __STRING2_COPY_ARR8;
+extern void *__rawmemchr (const void *__s, int __c);
+extern __inline size_t __strcspn_c1 (const char *__s, int __reject);
+extern __inline size_t
+__strcspn_c1 (const char *__s, int __reject)
+{
+ register size_t __result = 0;
+ while (__s[__result] != '\0' && __s[__result] != __reject)
+ ++__result;
+ return __result;
+}
+extern __inline size_t __strcspn_c2 (const char *__s, int __reject1,
+ int __reject2);
+extern __inline size_t
+__strcspn_c2 (const char *__s, int __reject1, int __reject2)
+{
+ register size_t __result = 0;
+ while (__s[__result] != '\0' && __s[__result] != __reject1
+ && __s[__result] != __reject2)
+ ++__result;
+ return __result;
+}
+extern __inline size_t __strcspn_c3 (const char *__s, int __reject1,
+ int __reject2, int __reject3);
+extern __inline size_t
+__strcspn_c3 (const char *__s, int __reject1, int __reject2,
+ int __reject3)
+{
+ register size_t __result = 0;
+ while (__s[__result] != '\0' && __s[__result] != __reject1
+ && __s[__result] != __reject2 && __s[__result] != __reject3)
+ ++__result;
+ return __result;
+}
+extern __inline size_t __strspn_c1 (const char *__s, int __accept);
+extern __inline size_t
+__strspn_c1 (const char *__s, int __accept)
+{
+ register size_t __result = 0;
+ while (__s[__result] == __accept)
+ ++__result;
+ return __result;
+}
+extern __inline size_t __strspn_c2 (const char *__s, int __accept1,
+ int __accept2);
+extern __inline size_t
+__strspn_c2 (const char *__s, int __accept1, int __accept2)
+{
+ register size_t __result = 0;
+ while (__s[__result] == __accept1 || __s[__result] == __accept2)
+ ++__result;
+ return __result;
+}
+extern __inline size_t __strspn_c3 (const char *__s, int __accept1,
+ int __accept2, int __accept3);
+extern __inline size_t
+__strspn_c3 (const char *__s, int __accept1, int __accept2, int __accept3)
+{
+ register size_t __result = 0;
+ while (__s[__result] == __accept1 || __s[__result] == __accept2
+ || __s[__result] == __accept3)
+ ++__result;
+ return __result;
+}
+extern __inline char *__strpbrk_c2 (const char *__s, int __accept1,
+ int __accept2);
+extern __inline char *
+__strpbrk_c2 (const char *__s, int __accept1, int __accept2)
+{
+ while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
+ ++__s;
+ return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
+}
+extern __inline char *__strpbrk_c3 (const char *__s, int __accept1,
+ int __accept2, int __accept3);
+extern __inline char *
+__strpbrk_c3 (const char *__s, int __accept1, int __accept2, int __accept3)
+{
+ while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
+ && *__s != __accept3)
+ ++__s;
+ return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
+}
+extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
+extern __inline char *
+__strtok_r_1c (char *__s, char __sep, char **__nextp)
+{
+ char *__result;
+ if (__s == ((void *)0))
+ __s = *__nextp;
+ while (*__s == __sep)
+ ++__s;
+ __result = ((void *)0);
+ if (*__s != '\0')
+ {
+ __result = __s++;
+ while (*__s != '\0')
+ if (*__s++ == __sep)
+ {
+ __s[-1] = '\0';
+ break;
+ }
+ }
+ *__nextp = __s;
+ return __result;
+}
+extern char *__strsep_g (char **__stringp, const char *__delim);
+extern __inline char *__strsep_1c (char **__s, char __reject);
+extern __inline char *
+__strsep_1c (char **__s, char __reject)
+{
+ register char *__retval = *__s;
+ if (__retval != ((void *)0) && (*__s = (__extension__ (__builtin_constant_p (__reject) && !__builtin_constant_p (__retval) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : __builtin_strchr (__retval, __reject)))) != ((void *)0))
+ *(*__s)++ = '\0';
+ return __retval;
+}
+extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
+extern __inline char *
+__strsep_2c (char **__s, char __reject1, char __reject2)
+{
+ register char *__retval = *__s;
+ if (__retval != ((void *)0))
+ {
+ register char *__cp = __retval;
+ while (1)
+ {
+ if (*__cp == '\0')
+ {
+ __cp = ((void *)0);
+ break;
+ }
+ if (*__cp == __reject1 || *__cp == __reject2)
+ {
+ *__cp++ = '\0';
+ break;
+ }
+ ++__cp;
+ }
+ *__s = __cp;
+ }
+ return __retval;
+}
+extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
+ char __reject3);
+extern __inline char *
+__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
+{
+ register char *__retval = *__s;
+ if (__retval != ((void *)0))
+ {
+ register char *__cp = __retval;
+ while (1)
+ {
+ if (*__cp == '\0')
+ {
+ __cp = ((void *)0);
+ break;
+ }
+ if (*__cp == __reject1 || *__cp == __reject2 || *__cp == __reject3)
+ {
+ *__cp++ = '\0';
+ break;
+ }
+ ++__cp;
+ }
+ *__s = __cp;
+ }
+ return __retval;
+}
+extern char *__strdup (const char *__string) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__));
+extern char *__strndup (const char *__string, size_t __n)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__malloc__));
+extern void __warn_memset_zero_len (void) __attribute__((__warning__ ("memset used with constant zero length parameter; this could be due to transposed parameters")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
+__attribute__ ((__nothrow__ , __leaf__)) memcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)
+{
+ return __builtin___memcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
+__attribute__ ((__nothrow__ , __leaf__)) memmove (void *__dest, const void *__src, size_t __len)
+{
+ return __builtin___memmove_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
+__attribute__ ((__nothrow__ , __leaf__)) mempcpy (void *__restrict __dest, const void *__restrict __src, size_t __len)
+{
+ return __builtin___mempcpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void *
+__attribute__ ((__nothrow__ , __leaf__)) memset (void *__dest, int __ch, size_t __len)
+{
+ if (__builtin_constant_p (__len) && __len == 0
+ && (!__builtin_constant_p (__ch) || __ch != 0))
+ {
+ __warn_memset_zero_len ();
+ return __dest;
+ }
+ return __builtin___memset_chk (__dest, __ch, __len, __builtin_object_size (__dest, 0));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void
+__attribute__ ((__nothrow__ , __leaf__)) bcopy (const void *__src, void *__dest, size_t __len)
+{
+ (void) __builtin___memmove_chk (__dest, __src, __len, __builtin_object_size (__dest, 0));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) void
+__attribute__ ((__nothrow__ , __leaf__)) bzero (void *__dest, size_t __len)
+{
+ (void) __builtin___memset_chk (__dest, '\0', __len, __builtin_object_size (__dest, 0));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) strcpy (char *__restrict __dest, const char *__restrict __src)
+{
+ return __builtin___strcpy_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) stpcpy (char *__restrict __dest, const char *__restrict __src)
+{
+ return __builtin___stpcpy_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) strncpy (char *__restrict __dest, const char *__restrict __src, size_t __len)
+{
+ return __builtin___strncpy_chk (__dest, __src, __len, __builtin_object_size (__dest, 2 > 1));
+}
+extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n,
+ size_t __destlen) __attribute__ ((__nothrow__ , __leaf__));
+extern char *__stpncpy_alias (char *__dest, const char *__src, size_t __n) __asm__ ("" "stpncpy") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) stpncpy (char *__dest, const char *__src, size_t __n)
+{
+ if (__builtin_object_size (__dest, 2 > 1) != (size_t) -1
+ && (!__builtin_constant_p (__n) || __n <= __builtin_object_size (__dest, 2 > 1)))
+ return __stpncpy_chk (__dest, __src, __n, __builtin_object_size (__dest, 2 > 1));
+ return __stpncpy_alias (__dest, __src, __n);
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) strcat (char *__restrict __dest, const char *__restrict __src)
+{
+ return __builtin___strcat_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1));
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) strncat (char *__restrict __dest, const char *__restrict __src, size_t __len)
+{
+ return __builtin___strncat_chk (__dest, __src, __len, __builtin_object_size (__dest, 2 > 1));
+}
+extern int access (const char *__name, int __type) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int euidaccess (const char *__name, int __type)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int eaccess (const char *__name, int __type)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int faccessat (int __fd, const char *__file, int __type, int __flag)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
+extern __off64_t lseek (int __fd, __off64_t __offset, int __whence) __asm__ ("" "lseek64") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int close (int __fd);
+extern ssize_t read (int __fd, void *__buf, size_t __nbytes) __attribute__ ((__warn_unused_result__));
+extern ssize_t write (int __fd, const void *__buf, size_t __n) __attribute__ ((__warn_unused_result__));
+extern ssize_t pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __asm__ ("" "pread64")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t pwrite (int __fd, const void *__buf, size_t __nbytes, __off64_t __offset) __asm__ ("" "pwrite64")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t pread64 (int __fd, void *__buf, size_t __nbytes,
+ __off64_t __offset) __attribute__ ((__warn_unused_result__));
+extern ssize_t pwrite64 (int __fd, const void *__buf, size_t __n,
+ __off64_t __offset) __attribute__ ((__warn_unused_result__));
+extern int pipe (int __pipedes[2]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int pipe2 (int __pipedes[2], int __flags) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern unsigned int alarm (unsigned int __seconds) __attribute__ ((__nothrow__ , __leaf__));
+extern unsigned int sleep (unsigned int __seconds);
+extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int usleep (__useconds_t __useconds);
+extern int pause (void);
+extern int chown (const char *__file, __uid_t __owner, __gid_t __group)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int lchown (const char *__file, __uid_t __owner, __gid_t __group)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int fchownat (int __fd, const char *__file, __uid_t __owner,
+ __gid_t __group, int __flag)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
+extern int chdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int fchdir (int __fd) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern char *getcwd (char *__buf, size_t __size) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern char *get_current_dir_name (void) __attribute__ ((__nothrow__ , __leaf__));
+extern char *getwd (char *__buf)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) __attribute__ ((__warn_unused_result__));
+extern int dup (int __fd) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int dup2 (int __fd, int __fd2) __attribute__ ((__nothrow__ , __leaf__));
+extern int dup3 (int __fd, int __fd2, int __flags) __attribute__ ((__nothrow__ , __leaf__));
+extern char **__environ;
+extern char **environ;
+extern int execve (const char *__path, char *const __argv[],
+ char *const __envp[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int fexecve (int __fd, char *const __argv[], char *const __envp[])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int execv (const char *__path, char *const __argv[])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int execle (const char *__path, const char *__arg, ...)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int execl (const char *__path, const char *__arg, ...)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int execvp (const char *__file, char *const __argv[])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int execlp (const char *__file, const char *__arg, ...)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int execvpe (const char *__file, char *const __argv[],
+ char *const __envp[])
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern int nice (int __inc) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void _exit (int __status) __attribute__ ((__noreturn__));
+enum
+ {
+ _PC_LINK_MAX,
+ _PC_MAX_CANON,
+ _PC_MAX_INPUT,
+ _PC_NAME_MAX,
+ _PC_PATH_MAX,
+ _PC_PIPE_BUF,
+ _PC_CHOWN_RESTRICTED,
+ _PC_NO_TRUNC,
+ _PC_VDISABLE,
+ _PC_SYNC_IO,
+ _PC_ASYNC_IO,
+ _PC_PRIO_IO,
+ _PC_SOCK_MAXBUF,
+ _PC_FILESIZEBITS,
+ _PC_REC_INCR_XFER_SIZE,
+ _PC_REC_MAX_XFER_SIZE,
+ _PC_REC_MIN_XFER_SIZE,
+ _PC_REC_XFER_ALIGN,
+ _PC_ALLOC_SIZE_MIN,
+ _PC_SYMLINK_MAX,
+ _PC_2_SYMLINKS
+ };
+enum
+ {
+ _SC_ARG_MAX,
+ _SC_CHILD_MAX,
+ _SC_CLK_TCK,
+ _SC_NGROUPS_MAX,
+ _SC_OPEN_MAX,
+ _SC_STREAM_MAX,
+ _SC_TZNAME_MAX,
+ _SC_JOB_CONTROL,
+ _SC_SAVED_IDS,
+ _SC_REALTIME_SIGNALS,
+ _SC_PRIORITY_SCHEDULING,
+ _SC_TIMERS,
+ _SC_ASYNCHRONOUS_IO,
+ _SC_PRIORITIZED_IO,
+ _SC_SYNCHRONIZED_IO,
+ _SC_FSYNC,
+ _SC_MAPPED_FILES,
+ _SC_MEMLOCK,
+ _SC_MEMLOCK_RANGE,
+ _SC_MEMORY_PROTECTION,
+ _SC_MESSAGE_PASSING,
+ _SC_SEMAPHORES,
+ _SC_SHARED_MEMORY_OBJECTS,
+ _SC_AIO_LISTIO_MAX,
+ _SC_AIO_MAX,
+ _SC_AIO_PRIO_DELTA_MAX,
+ _SC_DELAYTIMER_MAX,
+ _SC_MQ_OPEN_MAX,
+ _SC_MQ_PRIO_MAX,
+ _SC_VERSION,
+ _SC_PAGESIZE,
+ _SC_RTSIG_MAX,
+ _SC_SEM_NSEMS_MAX,
+ _SC_SEM_VALUE_MAX,
+ _SC_SIGQUEUE_MAX,
+ _SC_TIMER_MAX,
+ _SC_BC_BASE_MAX,
+ _SC_BC_DIM_MAX,
+ _SC_BC_SCALE_MAX,
+ _SC_BC_STRING_MAX,
+ _SC_COLL_WEIGHTS_MAX,
+ _SC_EQUIV_CLASS_MAX,
+ _SC_EXPR_NEST_MAX,
+ _SC_LINE_MAX,
+ _SC_RE_DUP_MAX,
+ _SC_CHARCLASS_NAME_MAX,
+ _SC_2_VERSION,
+ _SC_2_C_BIND,
+ _SC_2_C_DEV,
+ _SC_2_FORT_DEV,
+ _SC_2_FORT_RUN,
+ _SC_2_SW_DEV,
+ _SC_2_LOCALEDEF,
+ _SC_PII,
+ _SC_PII_XTI,
+ _SC_PII_SOCKET,
+ _SC_PII_INTERNET,
+ _SC_PII_OSI,
+ _SC_POLL,
+ _SC_SELECT,
+ _SC_UIO_MAXIOV,
+ _SC_IOV_MAX = _SC_UIO_MAXIOV,
+ _SC_PII_INTERNET_STREAM,
+ _SC_PII_INTERNET_DGRAM,
+ _SC_PII_OSI_COTS,
+ _SC_PII_OSI_CLTS,
+ _SC_PII_OSI_M,
+ _SC_T_IOV_MAX,
+ _SC_THREADS,
+ _SC_THREAD_SAFE_FUNCTIONS,
+ _SC_GETGR_R_SIZE_MAX,
+ _SC_GETPW_R_SIZE_MAX,
+ _SC_LOGIN_NAME_MAX,
+ _SC_TTY_NAME_MAX,
+ _SC_THREAD_DESTRUCTOR_ITERATIONS,
+ _SC_THREAD_KEYS_MAX,
+ _SC_THREAD_STACK_MIN,
+ _SC_THREAD_THREADS_MAX,
+ _SC_THREAD_ATTR_STACKADDR,
+ _SC_THREAD_ATTR_STACKSIZE,
+ _SC_THREAD_PRIORITY_SCHEDULING,
+ _SC_THREAD_PRIO_INHERIT,
+ _SC_THREAD_PRIO_PROTECT,
+ _SC_THREAD_PROCESS_SHARED,
+ _SC_NPROCESSORS_CONF,
+ _SC_NPROCESSORS_ONLN,
+ _SC_PHYS_PAGES,
+ _SC_AVPHYS_PAGES,
+ _SC_ATEXIT_MAX,
+ _SC_PASS_MAX,
+ _SC_XOPEN_VERSION,
+ _SC_XOPEN_XCU_VERSION,
+ _SC_XOPEN_UNIX,
+ _SC_XOPEN_CRYPT,
+ _SC_XOPEN_ENH_I18N,
+ _SC_XOPEN_SHM,
+ _SC_2_CHAR_TERM,
+ _SC_2_C_VERSION,
+ _SC_2_UPE,
+ _SC_XOPEN_XPG2,
+ _SC_XOPEN_XPG3,
+ _SC_XOPEN_XPG4,
+ _SC_CHAR_BIT,
+ _SC_CHAR_MAX,
+ _SC_CHAR_MIN,
+ _SC_INT_MAX,
+ _SC_INT_MIN,
+ _SC_LONG_BIT,
+ _SC_WORD_BIT,
+ _SC_MB_LEN_MAX,
+ _SC_NZERO,
+ _SC_SSIZE_MAX,
+ _SC_SCHAR_MAX,
+ _SC_SCHAR_MIN,
+ _SC_SHRT_MAX,
+ _SC_SHRT_MIN,
+ _SC_UCHAR_MAX,
+ _SC_UINT_MAX,
+ _SC_ULONG_MAX,
+ _SC_USHRT_MAX,
+ _SC_NL_ARGMAX,
+ _SC_NL_LANGMAX,
+ _SC_NL_MSGMAX,
+ _SC_NL_NMAX,
+ _SC_NL_SETMAX,
+ _SC_NL_TEXTMAX,
+ _SC_XBS5_ILP32_OFF32,
+ _SC_XBS5_ILP32_OFFBIG,
+ _SC_XBS5_LP64_OFF64,
+ _SC_XBS5_LPBIG_OFFBIG,
+ _SC_XOPEN_LEGACY,
+ _SC_XOPEN_REALTIME,
+ _SC_XOPEN_REALTIME_THREADS,
+ _SC_ADVISORY_INFO,
+ _SC_BARRIERS,
+ _SC_BASE,
+ _SC_C_LANG_SUPPORT,
+ _SC_C_LANG_SUPPORT_R,
+ _SC_CLOCK_SELECTION,
+ _SC_CPUTIME,
+ _SC_THREAD_CPUTIME,
+ _SC_DEVICE_IO,
+ _SC_DEVICE_SPECIFIC,
+ _SC_DEVICE_SPECIFIC_R,
+ _SC_FD_MGMT,
+ _SC_FIFO,
+ _SC_PIPE,
+ _SC_FILE_ATTRIBUTES,
+ _SC_FILE_LOCKING,
+ _SC_FILE_SYSTEM,
+ _SC_MONOTONIC_CLOCK,
+ _SC_MULTI_PROCESS,
+ _SC_SINGLE_PROCESS,
+ _SC_NETWORKING,
+ _SC_READER_WRITER_LOCKS,
+ _SC_SPIN_LOCKS,
+ _SC_REGEXP,
+ _SC_REGEX_VERSION,
+ _SC_SHELL,
+ _SC_SIGNALS,
+ _SC_SPAWN,
+ _SC_SPORADIC_SERVER,
+ _SC_THREAD_SPORADIC_SERVER,
+ _SC_SYSTEM_DATABASE,
+ _SC_SYSTEM_DATABASE_R,
+ _SC_TIMEOUTS,
+ _SC_TYPED_MEMORY_OBJECTS,
+ _SC_USER_GROUPS,
+ _SC_USER_GROUPS_R,
+ _SC_2_PBS,
+ _SC_2_PBS_ACCOUNTING,
+ _SC_2_PBS_LOCATE,
+ _SC_2_PBS_MESSAGE,
+ _SC_2_PBS_TRACK,
+ _SC_SYMLOOP_MAX,
+ _SC_STREAMS,
+ _SC_2_PBS_CHECKPOINT,
+ _SC_V6_ILP32_OFF32,
+ _SC_V6_ILP32_OFFBIG,
+ _SC_V6_LP64_OFF64,
+ _SC_V6_LPBIG_OFFBIG,
+ _SC_HOST_NAME_MAX,
+ _SC_TRACE,
+ _SC_TRACE_EVENT_FILTER,
+ _SC_TRACE_INHERIT,
+ _SC_TRACE_LOG,
+ _SC_LEVEL1_ICACHE_SIZE,
+ _SC_LEVEL1_ICACHE_ASSOC,
+ _SC_LEVEL1_ICACHE_LINESIZE,
+ _SC_LEVEL1_DCACHE_SIZE,
+ _SC_LEVEL1_DCACHE_ASSOC,
+ _SC_LEVEL1_DCACHE_LINESIZE,
+ _SC_LEVEL2_CACHE_SIZE,
+ _SC_LEVEL2_CACHE_ASSOC,
+ _SC_LEVEL2_CACHE_LINESIZE,
+ _SC_LEVEL3_CACHE_SIZE,
+ _SC_LEVEL3_CACHE_ASSOC,
+ _SC_LEVEL3_CACHE_LINESIZE,
+ _SC_LEVEL4_CACHE_SIZE,
+ _SC_LEVEL4_CACHE_ASSOC,
+ _SC_LEVEL4_CACHE_LINESIZE,
+ _SC_IPV6 = _SC_LEVEL1_ICACHE_SIZE + 50,
+ _SC_RAW_SOCKETS,
+ _SC_V7_ILP32_OFF32,
+ _SC_V7_ILP32_OFFBIG,
+ _SC_V7_LP64_OFF64,
+ _SC_V7_LPBIG_OFFBIG,
+ _SC_SS_REPL_MAX,
+ _SC_TRACE_EVENT_NAME_MAX,
+ _SC_TRACE_NAME_MAX,
+ _SC_TRACE_SYS_MAX,
+ _SC_TRACE_USER_EVENT_MAX,
+ _SC_XOPEN_STREAMS,
+ _SC_THREAD_ROBUST_PRIO_INHERIT,
+ _SC_THREAD_ROBUST_PRIO_PROTECT
+ };
+enum
+ {
+ _CS_PATH,
+ _CS_V6_WIDTH_RESTRICTED_ENVS,
+ _CS_GNU_LIBC_VERSION,
+ _CS_GNU_LIBPTHREAD_VERSION,
+ _CS_V5_WIDTH_RESTRICTED_ENVS,
+ _CS_V7_WIDTH_RESTRICTED_ENVS,
+ _CS_LFS_CFLAGS = 1000,
+ _CS_LFS_LDFLAGS,
+ _CS_LFS_LIBS,
+ _CS_LFS_LINTFLAGS,
+ _CS_LFS64_CFLAGS,
+ _CS_LFS64_LDFLAGS,
+ _CS_LFS64_LIBS,
+ _CS_LFS64_LINTFLAGS,
+ _CS_XBS5_ILP32_OFF32_CFLAGS = 1100,
+ _CS_XBS5_ILP32_OFF32_LDFLAGS,
+ _CS_XBS5_ILP32_OFF32_LIBS,
+ _CS_XBS5_ILP32_OFF32_LINTFLAGS,
+ _CS_XBS5_ILP32_OFFBIG_CFLAGS,
+ _CS_XBS5_ILP32_OFFBIG_LDFLAGS,
+ _CS_XBS5_ILP32_OFFBIG_LIBS,
+ _CS_XBS5_ILP32_OFFBIG_LINTFLAGS,
+ _CS_XBS5_LP64_OFF64_CFLAGS,
+ _CS_XBS5_LP64_OFF64_LDFLAGS,
+ _CS_XBS5_LP64_OFF64_LIBS,
+ _CS_XBS5_LP64_OFF64_LINTFLAGS,
+ _CS_XBS5_LPBIG_OFFBIG_CFLAGS,
+ _CS_XBS5_LPBIG_OFFBIG_LDFLAGS,
+ _CS_XBS5_LPBIG_OFFBIG_LIBS,
+ _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS,
+ _CS_POSIX_V6_ILP32_OFF32_CFLAGS,
+ _CS_POSIX_V6_ILP32_OFF32_LDFLAGS,
+ _CS_POSIX_V6_ILP32_OFF32_LIBS,
+ _CS_POSIX_V6_ILP32_OFF32_LINTFLAGS,
+ _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS,
+ _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS,
+ _CS_POSIX_V6_ILP32_OFFBIG_LIBS,
+ _CS_POSIX_V6_ILP32_OFFBIG_LINTFLAGS,
+ _CS_POSIX_V6_LP64_OFF64_CFLAGS,
+ _CS_POSIX_V6_LP64_OFF64_LDFLAGS,
+ _CS_POSIX_V6_LP64_OFF64_LIBS,
+ _CS_POSIX_V6_LP64_OFF64_LINTFLAGS,
+ _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS,
+ _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS,
+ _CS_POSIX_V6_LPBIG_OFFBIG_LIBS,
+ _CS_POSIX_V6_LPBIG_OFFBIG_LINTFLAGS,
+ _CS_POSIX_V7_ILP32_OFF32_CFLAGS,
+ _CS_POSIX_V7_ILP32_OFF32_LDFLAGS,
+ _CS_POSIX_V7_ILP32_OFF32_LIBS,
+ _CS_POSIX_V7_ILP32_OFF32_LINTFLAGS,
+ _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS,
+ _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS,
+ _CS_POSIX_V7_ILP32_OFFBIG_LIBS,
+ _CS_POSIX_V7_ILP32_OFFBIG_LINTFLAGS,
+ _CS_POSIX_V7_LP64_OFF64_CFLAGS,
+ _CS_POSIX_V7_LP64_OFF64_LDFLAGS,
+ _CS_POSIX_V7_LP64_OFF64_LIBS,
+ _CS_POSIX_V7_LP64_OFF64_LINTFLAGS,
+ _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS,
+ _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS,
+ _CS_POSIX_V7_LPBIG_OFFBIG_LIBS,
+ _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS,
+ _CS_V6_ENV,
+ _CS_V7_ENV
+ };
+extern long int pathconf (const char *__path, int __name)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern long int fpathconf (int __fd, int __name) __attribute__ ((__nothrow__ , __leaf__));
+extern long int sysconf (int __name) __attribute__ ((__nothrow__ , __leaf__));
+extern size_t confstr (int __name, char *__buf, size_t __len) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t getpid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t getppid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t getpgrp (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t __getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t getpgid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
+extern int setpgid (__pid_t __pid, __pid_t __pgid) __attribute__ ((__nothrow__ , __leaf__));
+extern int setpgrp (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t setsid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __pid_t getsid (__pid_t __pid) __attribute__ ((__nothrow__ , __leaf__));
+extern __uid_t getuid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __uid_t geteuid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __gid_t getgid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern __gid_t getegid (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int getgroups (int __size, __gid_t __list[]) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int group_member (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__));
+extern int setuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int setreuid (__uid_t __ruid, __uid_t __euid) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int seteuid (__uid_t __uid) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int setgid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int setregid (__gid_t __rgid, __gid_t __egid) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int setegid (__gid_t __gid) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern __pid_t fork (void) __attribute__ ((__nothrow__));
+extern __pid_t vfork (void) __attribute__ ((__nothrow__ , __leaf__));
+extern char *ttyname (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern int ttyname_r (int __fd, char *__buf, size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2))) __attribute__ ((__warn_unused_result__));
+extern int isatty (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern int ttyslot (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int link (const char *__from, const char *__to)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
+extern int linkat (int __fromfd, const char *__from, int __tofd,
+ const char *__to, int __flags)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 4))) __attribute__ ((__warn_unused_result__));
+extern int symlink (const char *__from, const char *__to)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
+extern ssize_t readlink (const char *__restrict __path,
+ char *__restrict __buf, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
+extern int symlinkat (const char *__from, int __tofd,
+ const char *__to) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 3))) __attribute__ ((__warn_unused_result__));
+extern ssize_t readlinkat (int __fd, const char *__restrict __path,
+ char *__restrict __buf, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__));
+extern int unlink (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int unlinkat (int __fd, const char *__name, int __flag)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int rmdir (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern __pid_t tcgetpgrp (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __attribute__ ((__nothrow__ , __leaf__));
+extern char *getlogin (void);
+extern int getlogin_r (char *__name, size_t __name_len) __attribute__ ((__nonnull__ (1)));
+extern int setlogin (const char *__name) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern char *BSDoptarg;
+extern int BSDoptind;
+extern int BSDopterr;
+extern int BSDoptopt;
+extern int BSDgetopt(int ___argc, char *const *___argv, const char *__shortopts)
+ __attribute__ ((__nothrow__ , __leaf__));
+extern int gethostname (char *__name, size_t __len) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int sethostname (const char *__name, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int sethostid (long int __id) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int getdomainname (char *__name, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int setdomainname (const char *__name, size_t __len)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int vhangup (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int revoke (const char *__file) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int profil (unsigned short int *__sample_buffer, size_t __size,
+ size_t __offset, unsigned int __scale)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int acct (const char *__name) __attribute__ ((__nothrow__ , __leaf__));
+extern char *getusershell (void) __attribute__ ((__nothrow__ , __leaf__));
+extern void endusershell (void) __attribute__ ((__nothrow__ , __leaf__));
+extern void setusershell (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int daemon (int __nochdir, int __noclose) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int chroot (const char *__path) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern char *getpass (const char *__prompt) __attribute__ ((__nonnull__ (1)));
+extern int fsync (int __fd);
+extern int syncfs (int __fd) __attribute__ ((__nothrow__ , __leaf__));
+extern long int gethostid (void);
+extern void sync (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int getpagesize (void) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__const__));
+extern int getdtablesize (void) __attribute__ ((__nothrow__ , __leaf__));
+extern int truncate (const char *__file, __off64_t __length) __asm__ ("" "truncate64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int truncate64 (const char *__file, __off64_t __length)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int ftruncate (int __fd, __off64_t __length) __asm__ ("" "ftruncate64") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__));
+extern int ftruncate64 (int __fd, __off64_t __length) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int brk (void *__addr) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern void *sbrk (intptr_t __delta) __attribute__ ((__nothrow__ , __leaf__));
+extern long int syscall (long int __sysno, ...) __attribute__ ((__nothrow__ , __leaf__));
+extern int fdatasync (int __fildes);
+extern char *crypt (const char *__key, const char *__salt)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern void encrypt (char *__block, int __edflag) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern void swab (const void *__restrict __from, void *__restrict __to,
+ ssize_t __n) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2)));
+extern ssize_t __read_chk (int __fd, void *__buf, size_t __nbytes,
+ size_t __buflen) __attribute__ ((__warn_unused_result__));
+extern ssize_t __read_alias (int __fd, void *__buf, size_t __nbytes) __asm__ ("" "read")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t __read_chk_warn (int __fd, void *__buf, size_t __nbytes, size_t __buflen) __asm__ ("" "__read_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("read called with bigger length than size of " "the destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) ssize_t
+read (int __fd, void *__buf, size_t __nbytes)
+{
+ if (__builtin_object_size (__buf, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__nbytes))
+ return __read_chk (__fd, __buf, __nbytes, __builtin_object_size (__buf, 0));
+ if (__nbytes > __builtin_object_size (__buf, 0))
+ return __read_chk_warn (__fd, __buf, __nbytes, __builtin_object_size (__buf, 0));
+ }
+ return __read_alias (__fd, __buf, __nbytes);
+}
+extern ssize_t __pread_chk (int __fd, void *__buf, size_t __nbytes,
+ __off_t __offset, size_t __bufsize) __attribute__ ((__warn_unused_result__));
+extern ssize_t __pread64_chk (int __fd, void *__buf, size_t __nbytes,
+ __off64_t __offset, size_t __bufsize) __attribute__ ((__warn_unused_result__));
+extern ssize_t __pread_alias (int __fd, void *__buf, size_t __nbytes, __off_t __offset) __asm__ ("" "pread")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t __pread64_alias (int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __asm__ ("" "pread64")
+ __attribute__ ((__warn_unused_result__));
+extern ssize_t __pread_chk_warn (int __fd, void *__buf, size_t __nbytes, __off_t __offset, size_t __bufsize) __asm__ ("" "__pread_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("pread called with bigger length than size of " "the destination buffer")))
+ ;
+extern ssize_t __pread64_chk_warn (int __fd, void *__buf, size_t __nbytes, __off64_t __offset, size_t __bufsize) __asm__ ("" "__pread64_chk")
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("pread64 called with bigger length than size of " "the destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) ssize_t
+pread (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
+{
+ if (__builtin_object_size (__buf, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__nbytes))
+ return __pread64_chk (__fd, __buf, __nbytes, __offset, __builtin_object_size (__buf, 0));
+ if ( __nbytes > __builtin_object_size (__buf, 0))
+ return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
+ __builtin_object_size (__buf, 0));
+ }
+ return __pread64_alias (__fd, __buf, __nbytes, __offset);
+}
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) ssize_t
+pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset)
+{
+ if (__builtin_object_size (__buf, 0) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__nbytes))
+ return __pread64_chk (__fd, __buf, __nbytes, __offset, __builtin_object_size (__buf, 0));
+ if ( __nbytes > __builtin_object_size (__buf, 0))
+ return __pread64_chk_warn (__fd, __buf, __nbytes, __offset,
+ __builtin_object_size (__buf, 0));
+ }
+ return __pread64_alias (__fd, __buf, __nbytes, __offset);
+}
+extern ssize_t __readlink_chk (const char *__restrict __path,
+ char *__restrict __buf, size_t __len,
+ size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
+extern ssize_t __readlink_alias (const char *__restrict __path, char *__restrict __buf, size_t __len) __asm__ ("" "readlink") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__));
+extern ssize_t __readlink_chk_warn (const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __asm__ ("" "__readlink_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("readlink called with bigger length " "than size of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__nonnull__ (1, 2))) __attribute__ ((__warn_unused_result__)) ssize_t
+__attribute__ ((__nothrow__ , __leaf__)) readlink (const char *__restrict __path, char *__restrict __buf, size_t __len)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__len))
+ return __readlink_chk (__path, __buf, __len, __builtin_object_size (__buf, 2 > 1));
+ if ( __len > __builtin_object_size (__buf, 2 > 1))
+ return __readlink_chk_warn (__path, __buf, __len, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __readlink_alias (__path, __buf, __len);
+}
+extern ssize_t __readlinkat_chk (int __fd, const char *__restrict __path,
+ char *__restrict __buf, size_t __len,
+ size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__));
+extern ssize_t __readlinkat_alias (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) __asm__ ("" "readlinkat") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__));
+extern ssize_t __readlinkat_chk_warn (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len, size_t __buflen) __asm__ ("" "__readlinkat_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("readlinkat called with bigger " "length than size of destination " "buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__nonnull__ (2, 3))) __attribute__ ((__warn_unused_result__)) ssize_t
+__attribute__ ((__nothrow__ , __leaf__)) readlinkat (int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__len))
+ return __readlinkat_chk (__fd, __path, __buf, __len, __builtin_object_size (__buf, 2 > 1));
+ if (__len > __builtin_object_size (__buf, 2 > 1))
+ return __readlinkat_chk_warn (__fd, __path, __buf, __len,
+ __builtin_object_size (__buf, 2 > 1));
+ }
+ return __readlinkat_alias (__fd, __path, __buf, __len);
+}
+extern char *__getcwd_chk (char *__buf, size_t __size, size_t __buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern char *__getcwd_alias (char *__buf, size_t __size) __asm__ ("" "getcwd") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__));
+extern char *__getcwd_chk_warn (char *__buf, size_t __size, size_t __buflen) __asm__ ("" "__getcwd_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("getcwd caller with bigger length than size of " "destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__warn_unused_result__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) getcwd (char *__buf, size_t __size)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__size))
+ return __getcwd_chk (__buf, __size, __builtin_object_size (__buf, 2 > 1));
+ if (__size > __builtin_object_size (__buf, 2 > 1))
+ return __getcwd_chk_warn (__buf, __size, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __getcwd_alias (__buf, __size);
+}
+extern char *__getwd_chk (char *__buf, size_t buflen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern char *__getwd_warn (char *__buf) __asm__ ("" "getwd") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("please use getcwd instead, as getwd " "doesn't specify buffer size")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__deprecated__)) __attribute__ ((__warn_unused_result__)) char *
+__attribute__ ((__nothrow__ , __leaf__)) getwd (char *__buf)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ return __getwd_chk (__buf, __builtin_object_size (__buf, 2 > 1));
+ return __getwd_warn (__buf);
+}
+extern size_t __confstr_chk (int __name, char *__buf, size_t __len,
+ size_t __buflen) __attribute__ ((__nothrow__ , __leaf__));
+extern size_t __confstr_alias (int __name, char *__buf, size_t __len) __asm__ ("" "confstr") __attribute__ ((__nothrow__ , __leaf__))
+ ;
+extern size_t __confstr_chk_warn (int __name, char *__buf, size_t __len, size_t __buflen) __asm__ ("" "__confstr_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__((__warning__ ("confstr called with bigger length than size of destination " "buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) size_t
+__attribute__ ((__nothrow__ , __leaf__)) confstr (int __name, char *__buf, size_t __len)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__len))
+ return __confstr_chk (__name, __buf, __len, __builtin_object_size (__buf, 2 > 1));
+ if (__builtin_object_size (__buf, 2 > 1) < __len)
+ return __confstr_chk_warn (__name, __buf, __len, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __confstr_alias (__name, __buf, __len);
+}
+extern int __getgroups_chk (int __size, __gid_t __list[], size_t __listlen)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__warn_unused_result__));
+extern int __getgroups_alias (int __size, __gid_t __list[]) __asm__ ("" "getgroups") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__));
+extern int __getgroups_chk_warn (int __size, __gid_t __list[], size_t __listlen) __asm__ ("" "__getgroups_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("getgroups called with bigger group count than what " "can fit into destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) getgroups (int __size, __gid_t __list[])
+{
+ if (__builtin_object_size (__list, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__size) || __size < 0)
+ return __getgroups_chk (__size, __list, __builtin_object_size (__list, 2 > 1));
+ if (__size * sizeof (__gid_t) > __builtin_object_size (__list, 2 > 1))
+ return __getgroups_chk_warn (__size, __list, __builtin_object_size (__list, 2 > 1));
+ }
+ return __getgroups_alias (__size, __list);
+}
+extern int __ttyname_r_chk (int __fd, char *__buf, size_t __buflen,
+ size_t __nreal) __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (2)));
+extern int __ttyname_r_alias (int __fd, char *__buf, size_t __buflen) __asm__ ("" "ttyname_r") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2)));
+extern int __ttyname_r_chk_warn (int __fd, char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__ttyname_r_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (2))) __attribute__((__warning__ ("ttyname_r called with bigger buflen than " "size of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) ttyname_r (int __fd, char *__buf, size_t __buflen)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__buflen))
+ return __ttyname_r_chk (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ if (__buflen > __builtin_object_size (__buf, 2 > 1))
+ return __ttyname_r_chk_warn (__fd, __buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __ttyname_r_alias (__fd, __buf, __buflen);
+}
+extern int __getlogin_r_chk (char *__buf, size_t __buflen, size_t __nreal)
+ __attribute__ ((__nonnull__ (1)));
+extern int __getlogin_r_alias (char *__buf, size_t __buflen) __asm__ ("" "getlogin_r")
+ __attribute__ ((__nonnull__ (1)));
+extern int __getlogin_r_chk_warn (char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__getlogin_r_chk")
+ __attribute__ ((__nonnull__ (1))) __attribute__((__warning__ ("getlogin_r called with bigger buflen than " "size of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+getlogin_r (char *__buf, size_t __buflen)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__buflen))
+ return __getlogin_r_chk (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ if (__buflen > __builtin_object_size (__buf, 2 > 1))
+ return __getlogin_r_chk_warn (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __getlogin_r_alias (__buf, __buflen);
+}
+extern int __gethostname_chk (char *__buf, size_t __buflen, size_t __nreal)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1)));
+extern int __gethostname_alias (char *__buf, size_t __buflen) __asm__ ("" "gethostname") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1)));
+extern int __gethostname_chk_warn (char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__gethostname_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1))) __attribute__((__warning__ ("gethostname called with bigger buflen than " "size of destination buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) gethostname (char *__buf, size_t __buflen)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__buflen))
+ return __gethostname_chk (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ if (__buflen > __builtin_object_size (__buf, 2 > 1))
+ return __gethostname_chk_warn (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __gethostname_alias (__buf, __buflen);
+}
+extern int __getdomainname_chk (char *__buf, size_t __buflen, size_t __nreal)
+ __attribute__ ((__nothrow__ , __leaf__)) __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int __getdomainname_alias (char *__buf, size_t __buflen) __asm__ ("" "getdomainname") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__));
+extern int __getdomainname_chk_warn (char *__buf, size_t __buflen, size_t __nreal) __asm__ ("" "__getdomainname_chk") __attribute__ ((__nothrow__ , __leaf__))
+ __attribute__ ((__nonnull__ (1))) __attribute__ ((__warn_unused_result__)) __attribute__((__warning__ ("getdomainname called with bigger " "buflen than size of destination " "buffer")))
+ ;
+extern __inline __attribute__ ((__always_inline__)) __attribute__ ((__artificial__)) int
+__attribute__ ((__nothrow__ , __leaf__)) getdomainname (char *__buf, size_t __buflen)
+{
+ if (__builtin_object_size (__buf, 2 > 1) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__buflen))
+ return __getdomainname_chk (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ if (__buflen > __builtin_object_size (__buf, 2 > 1))
+ return __getdomainname_chk_warn (__buf, __buflen, __builtin_object_size (__buf, 2 > 1));
+ }
+ return __getdomainname_alias (__buf, __buflen);
+}
+void *xmalloc(size_t);
+void *xcalloc(size_t, size_t);
+void *xrealloc(void *, size_t, size_t);
+char *xstrdup(const char *);
+int xasprintf(char **, const char *, ...)
+ __attribute__((__format__ (printf, 2, 3)))
+ __attribute__((__nonnull__ (2)));
+typedef struct Key Key;
+enum types {
+ KEY_RSA1,
+ KEY_RSA,
+ KEY_DSA,
+ KEY_ECDSA,
+ KEY_ED25519,
+ KEY_RSA_CERT,
+ KEY_DSA_CERT,
+ KEY_ECDSA_CERT,
+ KEY_ED25519_CERT,
+ KEY_RSA_CERT_V00,
+ KEY_DSA_CERT_V00,
+ KEY_UNSPEC
+};
+enum fp_type {
+ SSH_FP_SHA1,
+ SSH_FP_MD5,
+ SSH_FP_SHA256
+};
+enum fp_rep {
+ SSH_FP_HEX,
+ SSH_FP_BUBBLEBABBLE,
+ SSH_FP_RANDOMART
+};
+struct KeyCert {
+ Buffer certblob;
+ u_int type;
+ u_int64_t serial;
+ char *key_id;
+ u_int nprincipals;
+ char **principals;
+ u_int64_t valid_after, valid_before;
+ Buffer critical;
+ Buffer extensions;
+ Key *signature_key;
+};
+struct Key {
+ int type;
+ int flags;
+ RSA *rsa;
+ DSA *dsa;
+ int ecdsa_nid;
+ EC_KEY *ecdsa;
+ struct KeyCert *cert;
+ u_char *ed25519_sk;
+ u_char *ed25519_pk;
+};
+Key *key_new(int);
+void key_add_private(Key *);
+Key *key_new_private(int);
+void key_free(Key *);
+Key *key_demote(const Key *);
+int key_equal_public(const Key *, const Key *);
+int key_equal(const Key *, const Key *);
+char *key_fingerprint(const Key *, enum fp_type, enum fp_rep);
+u_char *key_fingerprint_raw(const Key *, enum fp_type, u_int *);
+const char *key_type(const Key *);
+const char *key_cert_type(const Key *);
+int key_write(const Key *, FILE *);
+int key_read(Key *, char **);
+u_int key_size(const Key *);
+Key *key_generate(int, u_int);
+Key *key_from_private(const Key *);
+int key_type_from_name(char *);
+int key_is_cert(const Key *);
+int key_type_is_cert(int);
+int key_type_plain(int);
+int key_to_certified(Key *, int);
+int key_drop_cert(Key *);
+int key_certify(Key *, Key *);
+void key_cert_copy(const Key *, struct Key *);
+int key_cert_check_authority(const Key *, int, int, const char *,
+ const char **);
+int key_cert_is_legacy(const Key *);
+int key_ecdsa_nid_from_name(const char *);
+int key_curve_name_to_nid(const char *);
+const char *key_curve_nid_to_name(int);
+u_int key_curve_nid_to_bits(int);
+int key_ecdsa_bits_to_nid(int);
+int key_ecdsa_key_to_nid(EC_KEY *);
+int key_ec_nid_to_hash_alg(int nid);
+int key_ec_validate_public(const EC_GROUP *, const EC_POINT *);
+int key_ec_validate_private(const EC_KEY *);
+char *key_alg_list(int, int);
+Key *key_from_blob(const u_char *, u_int);
+int key_to_blob(const Key *, u_char **, u_int *);
+const char *key_ssh_name(const Key *);
+const char *key_ssh_name_plain(const Key *);
+int key_names_valid2(const char *);
+int key_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
+int key_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
+int ssh_dss_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
+int ssh_dss_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
+int ssh_ecdsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
+int ssh_ecdsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
+int ssh_rsa_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
+int ssh_rsa_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
+int ssh_ed25519_sign(const Key *, u_char **, u_int *, const u_char *, u_int);
+int ssh_ed25519_verify(const Key *, const u_char *, u_int, const u_char *, u_int);
+void key_private_serialize(const Key *, Buffer *);
+Key *key_private_deserialize(Buffer *);
+void rsa_public_encrypt(BIGNUM *, BIGNUM *, RSA *);
+int rsa_private_decrypt(BIGNUM *, BIGNUM *, RSA *);
+void rsa_generate_additional_parameters(RSA *);
+int key_save_private(Key *, const char *, const char *, const char *,
+ int, const char *, int);
+int key_load_file(int, const char *, Buffer *);
+Key *key_load_cert(const char *);
+Key *key_load_public(const char *, char **);
+Key *key_load_public_type(int, const char *, char **);
+Key *key_parse_private(Buffer *, const char *, const char *, char **);
+Key *key_load_private(const char *, const char *, char **);
+Key *key_load_private_cert(int, const char *, const char *, int *);
+Key *key_load_private_type(int, const char *, const char *, char **, int *);
+Key *key_load_private_pem(int, int, const char *, char **);
+int key_perm_ok(int, const char *);
+int key_in_file(Key *, const char *, int);
+int uuencode(const u_char *, u_int, char *, size_t);
+int uudecode(const char *, u_char *, size_t);
+void dump_base64(FILE *, const u_char *, u_int);
+typedef enum {
+ SYSLOG_FACILITY_DAEMON,
+ SYSLOG_FACILITY_USER,
+ SYSLOG_FACILITY_AUTH,
+ SYSLOG_FACILITY_LOCAL0,
+ SYSLOG_FACILITY_LOCAL1,
+ SYSLOG_FACILITY_LOCAL2,
+ SYSLOG_FACILITY_LOCAL3,
+ SYSLOG_FACILITY_LOCAL4,
+ SYSLOG_FACILITY_LOCAL5,
+ SYSLOG_FACILITY_LOCAL6,
+ SYSLOG_FACILITY_LOCAL7,
+ SYSLOG_FACILITY_NOT_SET = -1
+} SyslogFacility;
+typedef enum {
+ SYSLOG_LEVEL_QUIET,
+ SYSLOG_LEVEL_FATAL,
+ SYSLOG_LEVEL_ERROR,
+ SYSLOG_LEVEL_INFO,
+ SYSLOG_LEVEL_VERBOSE,
+ SYSLOG_LEVEL_DEBUG1,
+ SYSLOG_LEVEL_DEBUG2,
+ SYSLOG_LEVEL_DEBUG3,
+ SYSLOG_LEVEL_NOT_SET = -1
+} LogLevel;
+typedef void (log_handler_fn)(LogLevel, const char *, void *);
+void log_init(char *, LogLevel, SyslogFacility, int);
+void log_change_level(LogLevel);
+int log_is_on_stderr(void);
+void log_redirect_stderr_to(const char *);
+SyslogFacility log_facility_number(char *);
+const char * log_facility_name(SyslogFacility);
+LogLevel log_level_number(char *);
+const char * log_level_name(LogLevel);
+void fatal(const char *, ...) __attribute__((noreturn))
+ __attribute__((format(printf, 1, 2)));
+void error(const char *, ...) __attribute__((format(printf, 1, 2)));
+void sigdie(const char *, ...) __attribute__((noreturn))
+ __attribute__((format(printf, 1, 2)));
+void logit(const char *, ...) __attribute__((format(printf, 1, 2)));
+void verbose(const char *, ...) __attribute__((format(printf, 1, 2)));
+void debug(const char *, ...) __attribute__((format(printf, 1, 2)));
+void debug2(const char *, ...) __attribute__((format(printf, 1, 2)));
+void debug3(const char *, ...) __attribute__((format(printf, 1, 2)));
+void set_log_handler(log_handler_fn *, void *);
+void do_log2(LogLevel, const char *, ...)
+ __attribute__((format(printf, 2, 3)));
+void do_log(LogLevel, const char *, va_list);
+void cleanup_exit(int) __attribute__((noreturn));
+char *chop(char *);
+char *strdelim(char **);
+int set_nonblock(int);
+int unset_nonblock(int);
+void set_nodelay(int);
+int a2port(const char *);
+int a2tun(const char *, int *);
+char *put_host_port(const char *, u_short);
+char *hpdelim(char **);
+char *cleanhostname(char *);
+char *colon(char *);
+long convtime(const char *);
+char *tilde_expand_filename(const char *, uid_t);
+char *percent_expand(const char *, ...) __attribute__(());
+char *tohex(const void *, size_t);
+void sanitise_stdfd(void);
+void ms_subtract_diff(struct timeval *, int *);
+void ms_to_timeval(struct timeval *, int);
+time_t monotime(void);
+void lowercase(char *s);
+void sock_set_v6only(int);
+struct passwd *pwcopy(struct passwd *);
+const char *ssh_gai_strerror(int);
+typedef struct arglist arglist;
+struct arglist {
+ char **list;
+ u_int num;
+ u_int nalloc;
+};
+void addargs(arglist *, char *, ...)
+ __attribute__((format(printf, 2, 3)));
+void replacearg(arglist *, u_int, char *, ...)
+ __attribute__((format(printf, 3, 4)));
+void freeargs(arglist *);
+int tun_open(int, int);
+u_int64_t get_u64(const void *)
+ __attribute__(());
+u_int32_t get_u32(const void *)
+ __attribute__(());
+u_int16_t get_u16(const void *)
+ __attribute__(());
+void put_u64(void *, u_int64_t)
+ __attribute__(());
+void put_u32(void *, u_int32_t)
+ __attribute__(());
+void put_u16(void *, u_int16_t)
+ __attribute__(());
+struct bwlimit {
+ size_t buflen;
+ u_int64_t rate, thresh, lamt;
+ struct timeval bwstart, bwend;
+};
+void bandwidth_limit_init(struct bwlimit *, u_int64_t, size_t);
+void bandwidth_limit(struct bwlimit *, size_t);
+int parse_ipqos(const char *);
+const char *iptos2str(int);
+void mktemp_proto(char *, size_t);
+char *read_passphrase(const char *, int);
+int ask_permission(const char *, ...) __attribute__((format(printf, 1, 2)));
+int read_keyfile_line(FILE *, const char *, char *, size_t, u_long *);
+int match_pattern(const char *, const char *);
+int match_pattern_list(const char *, const char *, u_int, int);
+int match_hostname(const char *, const char *, u_int);
+int match_host_and_ip(const char *, const char *, const char *);
+int match_user(const char *, const char *, const char *, const char *);
+char *match_list(const char *, const char *, u_int *);
+int addr_match_list(const char *, const char *);
+int addr_match_cidr_list(const char *, const char *);
+typedef enum {
+ HOST_OK, HOST_NEW, HOST_CHANGED, HOST_REVOKED, HOST_FOUND
+} HostStatus;
+typedef enum {
+ MRK_ERROR, MRK_NONE, MRK_REVOKE, MRK_CA
+} HostkeyMarker;
+struct hostkey_entry {
+ char *host;
+ char *file;
+ u_long line;
+ Key *key;
+ HostkeyMarker marker;
+};
+struct hostkeys;
+struct hostkeys *init_hostkeys(void);
+void load_hostkeys(struct hostkeys *, const char *, const char *);
+void free_hostkeys(struct hostkeys *);
+HostStatus check_key_in_hostkeys(struct hostkeys *, Key *,
+ const struct hostkey_entry **);
+int lookup_key_in_hostkeys_by_type(struct hostkeys *, int,
+ const struct hostkey_entry **);
+int hostfile_read_key(char **, int *, Key *);
+int add_host_to_hostfile(const char *, const char *, const Key *, int);
+char *host_hash(const char *, const char *, u_int);
+enum sshfp_types {
+ SSHFP_KEY_RESERVED = 0,
+ SSHFP_KEY_RSA = 1,
+ SSHFP_KEY_DSA = 2,
+ SSHFP_KEY_ECDSA = 3
+};
+enum sshfp_hashes {
+ SSHFP_HASH_RESERVED = 0,
+ SSHFP_HASH_SHA1 = 1,
+ SSHFP_HASH_SHA256 = 2,
+ SSHFP_HASH_MAX = 3
+};
+int verify_host_key_dns(const char *, struct sockaddr *, Key *, int *);
+int export_dns_rr(const char *, Key *, FILE *, int);
+int pkcs11_init(int);
+void pkcs11_terminate(void);
+int pkcs11_add_provider(char *, char *, Key ***);
+int pkcs11_del_provider(char *);
+size_t
+atomicio6(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n,
+ int (*cb)(void *, size_t), void *);
+size_t atomicio(ssize_t (*)(int, void *, size_t), int, void *, size_t);
+size_t
+atomiciov6(ssize_t (*f) (int, const struct iovec *, int), int fd,
+ const struct iovec *_iov, int iovcnt, int (*cb)(void *, size_t), void *);
+size_t atomiciov(ssize_t (*)(int, const struct iovec *, int),
+ int, const struct iovec *, int);
+struct ssh_krl;
+struct ssh_krl *ssh_krl_init(void);
+void ssh_krl_free(struct ssh_krl *krl);
+void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version);
+void ssh_krl_set_sign_key(struct ssh_krl *krl, const Key *sign_key);
+void ssh_krl_set_comment(struct ssh_krl *krl, const char *comment);
+int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const Key *ca_key,
+ u_int64_t serial);
+int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const Key *ca_key,
+ u_int64_t lo, u_int64_t hi);
+int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key,
+ const char *key_id);
+int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const Key *key);
+int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const Key *key);
+int ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key);
+int ssh_krl_to_blob(struct ssh_krl *krl, Buffer *buf, const Key **sign_keys,
+ u_int nsign_keys);
+int ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp,
+ const Key **sign_ca_keys, u_int nsign_ca_keys);
+int ssh_krl_check_key(struct ssh_krl *krl, const Key *key);
+int ssh_krl_file_contains_key(const char *path, const Key *key);
+u_int32_t bits = 0;
+int change_passphrase = 0;
+int change_comment = 0;
+int quiet = 0;
+int log_level = SYSLOG_LEVEL_INFO;
+int hash_hosts = 0;
+int find_host = 0;
+int delete_host = 0;
+int show_cert = 0;
+int print_fingerprint = 0;
+int print_bubblebabble = 0;
+char identity_file[1024];
+int have_identity = 0;
+char *identity_passphrase = ((void *)0);
+char *identity_new_passphrase = ((void *)0);
+char *identity_comment = ((void *)0);
+char *ca_key_path = ((void *)0);
+unsigned long long cert_serial = 0;
+u_int cert_key_type = 1;
+char *cert_key_id = ((void *)0);
+char *cert_principals = ((void *)0);
+u_int64_t cert_valid_from = 0;
+u_int64_t cert_valid_to = ~0ULL;
+u_int32_t certflags_flags = ((1)|(1<<1)| (1<<2)|(1<<3)|(1<<4));
+char *certflags_command = ((void *)0);
+char *certflags_src_addr = ((void *)0);
+int convert_to = 0;
+int convert_from = 0;
+enum {
+ FMT_RFC4716,
+ FMT_PKCS8,
+ FMT_PEM
+} convert_format = FMT_RFC4716;
+int print_public = 0;
+int print_generic = 0;
+char *key_type_name = ((void *)0);
+char *pkcs11provider = ((void *)0);
+int use_new_format = 0;
+char *new_format_cipher = ((void *)0);
+int rounds = 0;
+extern char *__progname;
+char hostname[64];
+int gen_candidates(FILE *, u_int32_t, u_int32_t, BIGNUM *);
+int prime_test(FILE *, FILE *, u_int32_t, u_int32_t, char *, unsigned long,
+ unsigned long);
+static void
+type_bits_valid(int type, u_int32_t *bitsp)
+{
+ u_int maxbits;
+ if (type == KEY_UNSPEC) {
+ fprintf(stderr, "unknown key type %s\n", key_type_name);
+ exit(1);
+ }
+ if (*bitsp == 0) {
+ if (type == KEY_DSA)
+ *bitsp = 1024;
+ else if (type == KEY_ECDSA)
+ *bitsp = 256;
+ else
+ *bitsp = 2048;
+ }
+ maxbits = (type == KEY_DSA) ?
+ 10000 : 16384;
+ if (*bitsp > maxbits) {
+ fprintf(stderr, "key bits exceeds maximum %d\n", maxbits);
+ exit(1);
+ }
+ if (type == KEY_DSA && *bitsp != 1024)
+ fatal("DSA keys must be 1024 bits");
+ else if (type != KEY_ECDSA && type != KEY_ED25519 && *bitsp < 768)
+ fatal("Key must at least be 768 bits");
+ else if (type == KEY_ECDSA && key_ecdsa_bits_to_nid(*bitsp) == -1)
+ fatal("Invalid ECDSA key length - valid lengths are "
+ "256, 384 or 521 bits");
+}
+static void
+ask_filename(struct passwd *pw, const char *prompt)
+{
+ char buf[1024];
+ char *name = ((void *)0);
+ if (key_type_name == ((void *)0))
+ name = ".ssh" "/id_rsa";
+ else {
+ switch (key_type_from_name(key_type_name)) {
+ case KEY_RSA1:
+ name = ".ssh" "/identity";
+ break;
+ case KEY_DSA_CERT:
+ case KEY_DSA_CERT_V00:
+ case KEY_DSA:
+ name = ".ssh" "/id_dsa";
+ break;
+ case KEY_ECDSA_CERT:
+ case KEY_ECDSA:
+ name = ".ssh" "/id_ecdsa";
+ break;
+ case KEY_RSA_CERT:
+ case KEY_RSA_CERT_V00:
+ case KEY_RSA:
+ name = ".ssh" "/id_rsa";
+ break;
+ case KEY_ED25519:
+ case KEY_ED25519_CERT:
+ name = ".ssh" "/id_ed25519";
+ break;
+ default:
+ fprintf(stderr, "bad key type\n");
+ exit(1);
+ break;
+ }
+ }
+ snprintf(identity_file, sizeof(identity_file), "%s/%s", pw->pw_dir, name);
+ fprintf(stderr, "%s (%s): ", prompt, identity_file);
+ if (fgets(buf, sizeof(buf), stdin) == ((void *)0))
+ exit(1);
+ buf[__extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p ("\n") && ((size_t)(const void *)(("\n") + 1) - (size_t)(const void *)("\n") == 1) ? ((__builtin_constant_p (buf) && ((size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf) == 1)) ? __builtin_strcspn (buf, "\n") : ((__r0 = ((const char *) ("\n"))[0], __r0 == '\0') ? strlen (buf) : ((__r1 = ((const char *) ("\n"))[1], __r1 == '\0') ? __strcspn_c1 (buf, __r0) : ((__r2 = ((const char *) ("\n"))[2], __r2 == '\0') ? __strcspn_c2 (buf, __r0, __r1) : (((const char *) ("\n"))[3] == '\0' ? __strcspn_c3 (buf, __r0, __r1, __r2) : __builtin_strcspn (buf, "\n")))))) : __builtin_strcspn (buf, "\n")); })] = '\0';
+ if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (buf) && __builtin_constant_p ("") && (__s1_len = strlen (buf), __s2_len = strlen (""), (!((size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("") + 1) - (size_t)(const void *)("") == 1) || __s2_len >= 4)) ? __builtin_strcmp (buf, "") : (__builtin_constant_p (buf) && ((size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf) == 1) && (__s1_len = strlen (buf), __s1_len < 4) ? (__builtin_constant_p ("") && ((size_t)(const void *)(("") + 1) - (size_t)(const void *)("") == 1) ? __builtin_strcmp (buf, "") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (""); register int __result = (((const unsigned char *) (const char *) (buf))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (buf))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (buf))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (buf))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("") && ((size_t)(const void *)(("") + 1) - (size_t)(const void *)("") == 1) && (__s2_len = strlen (""), __s2_len < 4) ? (__builtin_constant_p (buf) && ((size_t)(const void *)((buf) + 1) - (size_t)(const void *)(buf) == 1) ? __builtin_strcmp (buf, "") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (buf); register int __result = __s1[0] - ((const unsigned char *) (const char *) (""))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) (""))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) (""))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) (""))[3]); } } __result; }))) : __builtin_strcmp (buf, "")))); }) != 0)
+ strlcpy(identity_file, buf, sizeof(identity_file));
+ have_identity = 1;
+}
+static Key *
+load_identity(char *filename)
+{
+ char *pass;
+ Key *prv;
+ prv = key_load_private(filename, "", ((void *)0));
+ if (prv == ((void *)0)) {
+ if (identity_passphrase)
+ pass = xstrdup(identity_passphrase);
+ else
+ pass = read_passphrase("Enter passphrase: ",
+ 0x0002);
+ prv = key_load_private(filename, pass, ((void *)0));
+ explicit_bzero(pass, strlen(pass));
+ free(pass);
+ }
+ return prv;
+}
+static void
+do_convert_to_ssh2(struct passwd *pw, Key *k)
+{
+ u_int len;
+ u_char *blob;
+ char comment[61];
+ if (k->type == KEY_RSA1) {
+ fprintf(stderr, "version 1 keys are not supported\n");
+ exit(1);
+ }
+ if (key_to_blob(k, &blob, &len) <= 0) {
+ fprintf(stderr, "key_to_blob failed\n");
+ exit(1);
+ }
+ snprintf(comment, sizeof(comment),
+ "%u-bit %s, converted by %s@%s from OpenSSH",
+ key_size(k), key_type(k),
+ pw->pw_name, hostname);
+ fprintf(stdout, "%s\n", "---- BEGIN SSH2 PUBLIC KEY ----");
+ fprintf(stdout, "Comment: \"%s\"\n", comment);
+ dump_base64(stdout, blob, len);
+ fprintf(stdout, "%s\n", "---- END SSH2 PUBLIC KEY ----");
+ key_free(k);
+ free(blob);
+ exit(0);
+}
+static void
+do_convert_to_pkcs8(Key *k)
+{
+ switch (key_type_plain(k->type)) {
+ case KEY_RSA1:
+ case KEY_RSA:
+ if (!PEM_write_RSA_PUBKEY(stdout, k->rsa))
+ fatal("PEM_write_RSA_PUBKEY failed");
+ break;
+ case KEY_DSA:
+ if (!PEM_write_DSA_PUBKEY(stdout, k->dsa))
+ fatal("PEM_write_DSA_PUBKEY failed");
+ break;
+ case KEY_ECDSA:
+ if (!PEM_write_EC_PUBKEY(stdout, k->ecdsa))
+ fatal("PEM_write_EC_PUBKEY failed");
+ break;
+ default:
+ fatal("%s: unsupported key type %s", __func__, key_type(k));
+ }
+ exit(0);
+}
+static void
+do_convert_to_pem(Key *k)
+{
+ switch (key_type_plain(k->type)) {
+ case KEY_RSA1:
+ case KEY_RSA:
+ if (!PEM_write_RSAPublicKey(stdout, k->rsa))
+ fatal("PEM_write_RSAPublicKey failed");
+ break;
+ default:
+ fatal("%s: unsupported key type %s", __func__, key_type(k));
+ }
+ exit(0);
+}
+static void
+do_convert_to(struct passwd *pw)
+{
+ Key *k;
+ struct stat st;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0)
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ if ((k = key_load_public(identity_file, ((void *)0))) == ((void *)0)) {
+ if ((k = load_identity(identity_file)) == ((void *)0)) {
+ fprintf(stderr, "load failed\n");
+ exit(1);
+ }
+ }
+ switch (convert_format) {
+ case FMT_RFC4716:
+ do_convert_to_ssh2(pw, k);
+ break;
+ case FMT_PKCS8:
+ do_convert_to_pkcs8(k);
+ break;
+ case FMT_PEM:
+ do_convert_to_pem(k);
+ break;
+ default:
+ fatal("%s: unknown key format %d", __func__, convert_format);
+ }
+ exit(0);
+}
+static void
+buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
+{
+ u_int bignum_bits = buffer_get_int(b);
+ u_int bytes = (bignum_bits + 7) / 8;
+ if (buffer_len(b) < bytes)
+ fatal("buffer_get_bignum_bits: input buffer too small: "
+ "need %d have %d", bytes, buffer_len(b));
+ if (BN_bin2bn(buffer_ptr(b), bytes, value) == ((void *)0))
+ fatal("buffer_get_bignum_bits: BN_bin2bn failed");
+ buffer_consume(b, bytes);
+}
+static Key *
+do_convert_private_ssh2_from_blob(u_char *blob, u_int blen)
+{
+ Buffer b;
+ Key *key = ((void *)0);
+ char *type, *cipher;
+ u_char *sig, data[] = "abcde12345";
+ int magic, rlen, ktype, i1, i2, i3, i4;
+ u_int slen;
+ u_long e;
+ buffer_init(&b);
+ buffer_append(&b, blob, blen);
+ magic = buffer_get_int(&b);
+ if (magic != 0x3f6ff9eb) {
+ error("bad magic 0x%x != 0x%x", magic, 0x3f6ff9eb);
+ buffer_free(&b);
+ return ((void *)0);
+ }
+ i1 = buffer_get_int(&b);
+ type = buffer_get_string(&b, ((void *)0));
+ cipher = buffer_get_string(&b, ((void *)0));
+ i2 = buffer_get_int(&b);
+ i3 = buffer_get_int(&b);
+ i4 = buffer_get_int(&b);
+ debug("ignore (%d %d %d %d)", i1, i2, i3, i4);
+ if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (cipher) && __builtin_constant_p ("none") && (__s1_len = strlen (cipher), __s2_len = strlen ("none"), (!((size_t)(const void *)((cipher) + 1) - (size_t)(const void *)(cipher) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("none") + 1) - (size_t)(const void *)("none") == 1) || __s2_len >= 4)) ? __builtin_strcmp (cipher, "none") : (__builtin_constant_p (cipher) && ((size_t)(const void *)((cipher) + 1) - (size_t)(const void *)(cipher) == 1) && (__s1_len = strlen (cipher), __s1_len < 4) ? (__builtin_constant_p ("none") && ((size_t)(const void *)(("none") + 1) - (size_t)(const void *)("none") == 1) ? __builtin_strcmp (cipher, "none") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("none"); register int __result = (((const unsigned char *) (const char *) (cipher))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (cipher))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (cipher))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (cipher))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("none") && ((size_t)(const void *)(("none") + 1) - (size_t)(const void *)("none") == 1) && (__s2_len = strlen ("none"), __s2_len < 4) ? (__builtin_constant_p (cipher) && ((size_t)(const void *)((cipher) + 1) - (size_t)(const void *)(cipher) == 1) ? __builtin_strcmp (cipher, "none") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (cipher); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("none"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("none"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("none"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("none"))[3]); } } __result; }))) : __builtin_strcmp (cipher, "none")))); }) != 0) {
+ error("unsupported cipher %s", cipher);
+ free(cipher);
+ buffer_free(&b);
+ free(type);
+ return ((void *)0);
+ }
+ free(cipher);
+ if (strstr(type, "dsa")) {
+ ktype = KEY_DSA;
+ } else if (strstr(type, "rsa")) {
+ ktype = KEY_RSA;
+ } else {
+ buffer_free(&b);
+ free(type);
+ return ((void *)0);
+ }
+ key = key_new_private(ktype);
+ free(type);
+ switch (key->type) {
+ case KEY_DSA:
+ buffer_get_bignum_bits(&b, key->dsa->p);
+ buffer_get_bignum_bits(&b, key->dsa->g);
+ buffer_get_bignum_bits(&b, key->dsa->q);
+ buffer_get_bignum_bits(&b, key->dsa->pub_key);
+ buffer_get_bignum_bits(&b, key->dsa->priv_key);
+ break;
+ case KEY_RSA:
+ e = buffer_get_char(&b);
+ debug("e %lx", e);
+ if (e < 30) {
+ e <<= 8;
+ e += buffer_get_char(&b);
+ debug("e %lx", e);
+ e <<= 8;
+ e += buffer_get_char(&b);
+ debug("e %lx", e);
+ }
+ if (!BN_set_word(key->rsa->e, e)) {
+ buffer_free(&b);
+ key_free(key);
+ return ((void *)0);
+ }
+ buffer_get_bignum_bits(&b, key->rsa->d);
+ buffer_get_bignum_bits(&b, key->rsa->n);
+ buffer_get_bignum_bits(&b, key->rsa->iqmp);
+ buffer_get_bignum_bits(&b, key->rsa->q);
+ buffer_get_bignum_bits(&b, key->rsa->p);
+ rsa_generate_additional_parameters(key->rsa);
+ break;
+ }
+ rlen = buffer_len(&b);
+ if (rlen != 0)
+ error("do_convert_private_ssh2_from_blob: "
+ "remaining bytes in key blob %d", rlen);
+ buffer_free(&b);
+ key_sign(key, &sig, &slen, data, sizeof(data));
+ key_verify(key, sig, slen, data, sizeof(data));
+ free(sig);
+ return key;
+}
+static int
+get_line(FILE *fp, char *line, size_t len)
+{
+ int c;
+ size_t pos = 0;
+ line[0] = '\0';
+ while ((c = fgetc(fp)) != (-1)) {
+ if (pos >= len - 1) {
+ fprintf(stderr, "input line too long.\n");
+ exit(1);
+ }
+ switch (c) {
+ case '\r':
+ c = fgetc(fp);
+ if (c != (-1) && c != '\n' && ungetc(c, fp) == (-1)) {
+ fprintf(stderr, "unget: %s\n", strerror((*__errno_location ())));
+ exit(1);
+ }
+ return pos;
+ case '\n':
+ return pos;
+ }
+ line[pos++] = c;
+ line[pos] = '\0';
+ }
+ return -1;
+}
+static void
+do_convert_from_ssh2(struct passwd *pw, Key **k, int *private)
+{
+ int blen;
+ u_int len;
+ char line[1024];
+ u_char blob[8096];
+ char encoded[8096];
+ int escaped = 0;
+ FILE *fp;
+ if ((fp = fopen(identity_file, "r")) == ((void *)0))
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ encoded[0] = '\0';
+ while ((blen = get_line(fp, line, sizeof(line))) != -1) {
+ if (blen > 0 && line[blen - 1] == '\\')
+ escaped++;
+ if ((__extension__ (__builtin_constant_p (4) && ((__builtin_constant_p (line) && strlen (line) < ((size_t) (4))) || (__builtin_constant_p ("----") && strlen ("----") < ((size_t) (4)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (line) && __builtin_constant_p ("----") && (__s1_len = strlen (line), __s2_len = strlen ("----"), (!((size_t)(const void *)((line) + 1) - (size_t)(const void *)(line) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("----") + 1) - (size_t)(const void *)("----") == 1) || __s2_len >= 4)) ? __builtin_strcmp (line, "----") : (__builtin_constant_p (line) && ((size_t)(const void *)((line) + 1) - (size_t)(const void *)(line) == 1) && (__s1_len = strlen (line), __s1_len < 4) ? (__builtin_constant_p ("----") && ((size_t)(const void *)(("----") + 1) - (size_t)(const void *)("----") == 1) ? __builtin_strcmp (line, "----") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("----"); register int __result = (((const unsigned char *) (const char *) (line))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (line))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (line))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (line))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("----") && ((size_t)(const void *)(("----") + 1) - (size_t)(const void *)("----") == 1) && (__s2_len = strlen ("----"), __s2_len < 4) ? (__builtin_constant_p (line) && ((size_t)(const void *)((line) + 1) - (size_t)(const void *)(line) == 1) ? __builtin_strcmp (line, "----") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (line); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("----"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("----"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("----"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("----"))[3]); } } __result; }))) : __builtin_strcmp (line, "----")))); }) : strncmp (line, "----", 4))) == 0 ||
+ strstr(line, ": ") != ((void *)0)) {
+ if (strstr(line, "---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----") != ((void *)0))
+ *private = 1;
+ if (strstr(line, " END ") != ((void *)0)) {
+ break;
+ }
+ continue;
+ }
+ if (escaped) {
+ escaped--;
+ continue;
+ }
+ strlcat(encoded, line, sizeof(encoded));
+ }
+ len = strlen(encoded);
+ if (((len % 4) == 3) &&
+ (encoded[len-1] == '=') &&
+ (encoded[len-2] == '=') &&
+ (encoded[len-3] == '='))
+ encoded[len-3] = '\0';
+ blen = uudecode(encoded, blob, sizeof(blob));
+ if (blen < 0) {
+ fprintf(stderr, "uudecode failed.\n");
+ exit(1);
+ }
+ *k = *private ?
+ do_convert_private_ssh2_from_blob(blob, blen) :
+ key_from_blob(blob, blen);
+ if (*k == ((void *)0)) {
+ fprintf(stderr, "decode blob failed.\n");
+ exit(1);
+ }
+ fclose(fp);
+}
+static void
+do_convert_from_pkcs8(Key **k, int *private)
+{
+ EVP_PKEY *pubkey;
+ FILE *fp;
+ if ((fp = fopen(identity_file, "r")) == ((void *)0))
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ if ((pubkey = PEM_read_PUBKEY(fp, ((void *)0), ((void *)0), ((void *)0))) == ((void *)0)) {
+ fatal("%s: %s is not a recognised public key format", __func__,
+ identity_file);
+ }
+ fclose(fp);
+ switch (EVP_PKEY_type(pubkey->type)) {
+ case 6:
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_RSA;
+ (*k)->rsa = EVP_PKEY_get1_RSA(pubkey);
+ break;
+ case 116:
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_DSA;
+ (*k)->dsa = EVP_PKEY_get1_DSA(pubkey);
+ break;
+ case 408:
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_ECDSA;
+ (*k)->ecdsa = EVP_PKEY_get1_EC_KEY(pubkey);
+ (*k)->ecdsa_nid = key_ecdsa_key_to_nid((*k)->ecdsa);
+ break;
+ default:
+ fatal("%s: unsupported pubkey type %d", __func__,
+ EVP_PKEY_type(pubkey->type));
+ }
+ EVP_PKEY_free(pubkey);
+ return;
+}
+static void
+do_convert_from_pem(Key **k, int *private)
+{
+ FILE *fp;
+ RSA *rsa;
+ if ((fp = fopen(identity_file, "r")) == ((void *)0))
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ if ((rsa = PEM_read_RSAPublicKey(fp, ((void *)0), ((void *)0), ((void *)0))) != ((void *)0)) {
+ *k = key_new(KEY_UNSPEC);
+ (*k)->type = KEY_RSA;
+ (*k)->rsa = rsa;
+ fclose(fp);
+ return;
+ }
+ fatal("%s: unrecognised raw private key format", __func__);
+}
+static void
+do_convert_from(struct passwd *pw)
+{
+ Key *k = ((void *)0);
+ int private = 0, ok = 0;
+ struct stat st;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0)
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ switch (convert_format) {
+ case FMT_RFC4716:
+ do_convert_from_ssh2(pw, &k, &private);
+ break;
+ case FMT_PKCS8:
+ do_convert_from_pkcs8(&k, &private);
+ break;
+ case FMT_PEM:
+ do_convert_from_pem(&k, &private);
+ break;
+ default:
+ fatal("%s: unknown key format %d", __func__, convert_format);
+ }
+ if (!private)
+ ok = key_write(k, stdout);
+ if (ok)
+ fprintf(stdout, "\n");
+ else {
+ switch (k->type) {
+ case KEY_DSA:
+ ok = PEM_write_DSAPrivateKey(stdout, k->dsa, ((void *)0),
+ ((void *)0), 0, ((void *)0), ((void *)0));
+ break;
+ case KEY_ECDSA:
+ ok = PEM_write_ECPrivateKey(stdout, k->ecdsa, ((void *)0),
+ ((void *)0), 0, ((void *)0), ((void *)0));
+ break;
+ case KEY_RSA:
+ ok = PEM_write_RSAPrivateKey(stdout, k->rsa, ((void *)0),
+ ((void *)0), 0, ((void *)0), ((void *)0));
+ break;
+ default:
+ fatal("%s: unsupported key type %s", __func__,
+ key_type(k));
+ }
+ }
+ if (!ok) {
+ fprintf(stderr, "key write failed\n");
+ exit(1);
+ }
+ key_free(k);
+ exit(0);
+}
+static void
+do_print_public(struct passwd *pw)
+{
+ Key *prv;
+ struct stat st;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0) {
+ perror(identity_file);
+ exit(1);
+ }
+ prv = load_identity(identity_file);
+ if (prv == ((void *)0)) {
+ fprintf(stderr, "load failed\n");
+ exit(1);
+ }
+ if (!key_write(prv, stdout))
+ fprintf(stderr, "key_write failed");
+ key_free(prv);
+ fprintf(stdout, "\n");
+ exit(0);
+}
+static void
+do_download(struct passwd *pw)
+{
+ Key **keys = ((void *)0);
+ int i, nkeys;
+ enum fp_rep rep;
+ enum fp_type fptype;
+ char *fp, *ra;
+ fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
+ rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
+ pkcs11_init(0);
+ nkeys = pkcs11_add_provider(pkcs11provider, ((void *)0), &keys);
+ if (nkeys <= 0)
+ fatal("cannot read public key from pkcs11");
+ for (i = 0; i < nkeys; i++) {
+ if (print_fingerprint) {
+ fp = key_fingerprint(keys[i], fptype, rep);
+ ra = key_fingerprint(keys[i], SSH_FP_MD5,
+ SSH_FP_RANDOMART);
+ printf("%u %s %s (PKCS11 key)\n", key_size(keys[i]),
+ fp, key_type(keys[i]));
+ if (log_level >= SYSLOG_LEVEL_VERBOSE)
+ printf("%s\n", ra);
+ free(ra);
+ free(fp);
+ } else {
+ key_write(keys[i], stdout);
+ fprintf(stdout, "\n");
+ }
+ key_free(keys[i]);
+ }
+ free(keys);
+ pkcs11_terminate();
+ exit(0);
+}
+static void
+do_fingerprint(struct passwd *pw)
+{
+ FILE *f;
+ Key *public;
+ char *comment = ((void *)0), *cp, *ep, line[16*1024], *fp, *ra;
+ int i, skip = 0, num = 0, invalid = 1;
+ enum fp_rep rep;
+ enum fp_type fptype;
+ struct stat st;
+ fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
+ rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0) {
+ perror(identity_file);
+ exit(1);
+ }
+ public = key_load_public(identity_file, &comment);
+ if (public != ((void *)0)) {
+ fp = key_fingerprint(public, fptype, rep);
+ ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART);
+ printf("%u %s %s (%s)\n", key_size(public), fp, comment,
+ key_type(public));
+ if (log_level >= SYSLOG_LEVEL_VERBOSE)
+ printf("%s\n", ra);
+ key_free(public);
+ free(comment);
+ free(ra);
+ free(fp);
+ exit(0);
+ }
+ if (comment) {
+ free(comment);
+ comment = ((void *)0);
+ }
+ if ((f = fopen(identity_file, "r")) == ((void *)0))
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ while (fgets(line, sizeof(line), f)) {
+ if ((cp = (__extension__ (__builtin_constant_p ('\n') && !__builtin_constant_p (line) && ('\n') == '\0' ? (char *) __rawmemchr (line, '\n') : __builtin_strchr (line, '\n')))) == ((void *)0)) {
+ error("line %d too long: %.40s...",
+ num + 1, line);
+ skip = 1;
+ continue;
+ }
+ num++;
+ if (skip) {
+ skip = 0;
+ continue;
+ }
+ *cp = '\0';
+ for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
+ ;
+ if (!*cp || *cp == '\n' || *cp == '#')
+ continue;
+ i = strtol(cp, &ep, 10);
+ if (i == 0 || ep == ((void *)0) || (*ep != ' ' && *ep != '\t')) {
+ int quoted = 0;
+ comment = cp;
+ for (; *cp && (quoted || (*cp != ' ' &&
+ *cp != '\t')); cp++) {
+ if (*cp == '\\' && cp[1] == '"')
+ cp++;
+ else if (*cp == '"')
+ quoted = !quoted;
+ }
+ if (!*cp)
+ continue;
+ *cp++ = '\0';
+ }
+ ep = cp;
+ public = key_new(KEY_RSA1);
+ if (key_read(public, &cp) != 1) {
+ cp = ep;
+ key_free(public);
+ public = key_new(KEY_UNSPEC);
+ if (key_read(public, &cp) != 1) {
+ key_free(public);
+ continue;
+ }
+ }
+ comment = *cp ? cp : comment;
+ fp = key_fingerprint(public, fptype, rep);
+ ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART);
+ printf("%u %s %s (%s)\n", key_size(public), fp,
+ comment ? comment : "no comment", key_type(public));
+ if (log_level >= SYSLOG_LEVEL_VERBOSE)
+ printf("%s\n", ra);
+ free(ra);
+ free(fp);
+ key_free(public);
+ invalid = 0;
+ }
+ fclose(f);
+ if (invalid) {
+ printf("%s is not a public key file.\n", identity_file);
+ exit(1);
+ }
+ exit(0);
+}
+static void
+do_gen_all_hostkeys(struct passwd *pw)
+{
+ struct {
+ char *key_type;
+ char *key_type_display;
+ char *path;
+ } key_types[] = {
+ { "rsa1", "RSA1", "/etc/ssh" "/ssh_host_key" },
+ { "rsa", "RSA" ,"/etc/ssh" "/ssh_host_rsa_key" },
+ { "dsa", "DSA", "/etc/ssh" "/ssh_host_dsa_key" },
+ { "ecdsa", "ECDSA","/etc/ssh" "/ssh_host_ecdsa_key" },
+ { "ed25519", "ED25519","/etc/ssh" "/ssh_host_ed25519_key" },
+ { ((void *)0), ((void *)0), ((void *)0) }
+ };
+ int first = 0;
+ struct stat st;
+ Key *private, *public;
+ char comment[1024];
+ int i, type, fd;
+ FILE *f;
+ for (i = 0; key_types[i].key_type; i++) {
+ if (stat(key_types[i].path, &st) == 0)
+ continue;
+ if ((*__errno_location ()) != 2) {
+ printf("Could not stat %s: %s", key_types[i].path,
+ strerror((*__errno_location ())));
+ first = 0;
+ continue;
+ }
+ if (first == 0) {
+ first = 1;
+ printf("%s: generating new host keys: ", __progname);
+ }
+ printf("%s ", key_types[i].key_type_display);
+ fflush(stdout);
+ type = key_type_from_name(key_types[i].key_type);
+ strlcpy(identity_file, key_types[i].path, sizeof(identity_file));
+ bits = 0;
+ type_bits_valid(type, &bits);
+ private = key_generate(type, bits);
+ if (private == ((void *)0)) {
+ fprintf(stderr, "key_generate failed\n");
+ first = 0;
+ continue;
+ }
+ public = key_from_private(private);
+ snprintf(comment, sizeof comment, "%s@%s", pw->pw_name,
+ hostname);
+ if (!key_save_private(private, identity_file, "", comment,
+ use_new_format, new_format_cipher, rounds)) {
+ printf("Saving the key failed: %s.\n", identity_file);
+ key_free(private);
+ key_free(public);
+ first = 0;
+ continue;
+ }
+ key_free(private);
+ strlcat(identity_file, ".pub", sizeof(identity_file));
+ fd = open(identity_file, 01 | 00000400 | 01000, 0644);
+ if (fd == -1) {
+ printf("Could not save your public key in %s\n",
+ identity_file);
+ key_free(public);
+ first = 0;
+ continue;
+ }
+ f = fdopen(fd, "w");
+ if (f == ((void *)0)) {
+ printf("fdopen %s failed\n", identity_file);
+ key_free(public);
+ first = 0;
+ continue;
+ }
+ if (!key_write(public, f)) {
+ fprintf(stderr, "write key failed\n");
+ key_free(public);
+ first = 0;
+ continue;
+ }
+ fprintf(f, " %s\n", comment);
+ fclose(f);
+ key_free(public);
+ }
+ if (first != 0)
+ printf("\n");
+}
+static void
+printhost(FILE *f, const char *name, Key *public, int ca, int hash)
+{
+ if (print_fingerprint) {
+ enum fp_rep rep;
+ enum fp_type fptype;
+ char *fp, *ra;
+ fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
+ rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
+ fp = key_fingerprint(public, fptype, rep);
+ ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART);
+ printf("%u %s %s (%s)\n", key_size(public), fp, name,
+ key_type(public));
+ if (log_level >= SYSLOG_LEVEL_VERBOSE)
+ printf("%s\n", ra);
+ free(ra);
+ free(fp);
+ } else {
+ if (hash && (name = host_hash(name, ((void *)0), 0)) == ((void *)0))
+ fatal("hash_host failed");
+ fprintf(f, "%s%s%s ", ca ? "@cert-authority" : "", ca ? " " : "", name);
+ if (!key_write(public, f))
+ fatal("key_write failed");
+ fprintf(f, "\n");
+ }
+}
+static void
+do_known_hosts(struct passwd *pw, const char *name)
+{
+ FILE *in, *out = stdout;
+ Key *pub;
+ char *cp, *cp2, *kp, *kp2;
+ char line[16*1024], tmp[4096], old[4096];
+ int c, skip = 0, inplace = 0, num = 0, invalid = 0, has_unhashed = 0;
+ int ca;
+ int found_key = 0;
+ if (!have_identity) {
+ cp = tilde_expand_filename("~/" ".ssh" "/known_hosts", pw->pw_uid);
+ if (strlcpy(identity_file, cp, sizeof(identity_file)) >=
+ sizeof(identity_file))
+ fatal("Specified known hosts path too long");
+ free(cp);
+ have_identity = 1;
+ }
+ if ((in = fopen(identity_file, "r")) == ((void *)0))
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ if (!find_host && (hash_hosts || delete_host)) {
+ if (strlcpy(tmp, identity_file, sizeof(tmp)) >= sizeof(tmp) ||
+ strlcat(tmp, ".XXXXXXXXXX", sizeof(tmp)) >= sizeof(tmp) ||
+ strlcpy(old, identity_file, sizeof(old)) >= sizeof(old) ||
+ strlcat(old, ".old", sizeof(old)) >= sizeof(old))
+ fatal("known_hosts path too long");
+ umask(077);
+ if ((c = mkstemp(tmp)) == -1)
+ fatal("mkstemp: %s", strerror((*__errno_location ())));
+ if ((out = fdopen(c, "w")) == ((void *)0)) {
+ c = (*__errno_location ());
+ unlink(tmp);
+ fatal("fdopen: %s", strerror(c));
+ }
+ inplace = 1;
+ }
+ while (fgets(line, sizeof(line), in)) {
+ if ((cp = (__extension__ (__builtin_constant_p ('\n') && !__builtin_constant_p (line) && ('\n') == '\0' ? (char *) __rawmemchr (line, '\n') : __builtin_strchr (line, '\n')))) == ((void *)0)) {
+ error("line %d too long: %.40s...", num + 1, line);
+ skip = 1;
+ invalid = 1;
+ continue;
+ }
+ num++;
+ if (skip) {
+ skip = 0;
+ continue;
+ }
+ *cp = '\0';
+ for (cp = line; *cp == ' ' || *cp == '\t'; cp++)
+ ;
+ if (!*cp || *cp == '\n' || *cp == '#') {
+ if (inplace)
+ fprintf(out, "%s\n", cp);
+ continue;
+ }
+ if (strncasecmp(cp, "@cert-authority", sizeof("@cert-authority") - 1) == 0 &&
+ (cp[sizeof("@cert-authority") - 1] == ' ' ||
+ cp[sizeof("@cert-authority") - 1] == '\t')) {
+ ca = 1;
+ cp += sizeof("@cert-authority");
+ } else
+ ca = 0;
+ for (kp = cp; *kp && *kp != ' ' && *kp != '\t'; kp++)
+ ;
+ if (*kp == '\0' || *(kp + 1) == '\0') {
+ error("line %d missing key: %.40s...",
+ num, line);
+ invalid = 1;
+ continue;
+ }
+ *kp++ = '\0';
+ kp2 = kp;
+ pub = key_new(KEY_RSA1);
+ if (key_read(pub, &kp) != 1) {
+ kp = kp2;
+ key_free(pub);
+ pub = key_new(KEY_UNSPEC);
+ if (key_read(pub, &kp) != 1) {
+ error("line %d invalid key: %.40s...",
+ num, line);
+ key_free(pub);
+ invalid = 1;
+ continue;
+ }
+ }
+ if (*cp == '|') {
+ if (find_host || delete_host) {
+ cp2 = host_hash(name, cp, strlen(cp));
+ if (cp2 == ((void *)0)) {
+ error("line %d: invalid hashed "
+ "name: %.64s...", num, line);
+ invalid = 1;
+ continue;
+ }
+ c = (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (cp2) && __builtin_constant_p (cp) && (__s1_len = strlen (cp2), __s2_len = strlen (cp), (!((size_t)(const void *)((cp2) + 1) - (size_t)(const void *)(cp2) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1) || __s2_len >= 4)) ? __builtin_strcmp (cp2, cp) : (__builtin_constant_p (cp2) && ((size_t)(const void *)((cp2) + 1) - (size_t)(const void *)(cp2) == 1) && (__s1_len = strlen (cp2), __s1_len < 4) ? (__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1) ? __builtin_strcmp (cp2, cp) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (cp); register int __result = (((const unsigned char *) (const char *) (cp2))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (cp2))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (cp2))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (cp2))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1) && (__s2_len = strlen (cp), __s2_len < 4) ? (__builtin_constant_p (cp2) && ((size_t)(const void *)((cp2) + 1) - (size_t)(const void *)(cp2) == 1) ? __builtin_strcmp (cp2, cp) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (cp2); register int __result = __s1[0] - ((const unsigned char *) (const char *) (cp))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) (cp))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) (cp))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) (cp))[3]); } } __result; }))) : __builtin_strcmp (cp2, cp)))); }) == 0);
+ if (find_host && c) {
+ if (!quiet)
+ printf("# Host %s found: "
+ "line %d type %s%s\n", name,
+ num, key_type(pub),
+ ca ? " (CA key)" : "");
+ printhost(out, cp, pub, ca, 0);
+ found_key = 1;
+ }
+ if (delete_host) {
+ if (!c && !ca)
+ printhost(out, cp, pub, ca, 0);
+ else
+ printf("# Host %s found: "
+ "line %d type %s\n", name,
+ num, key_type(pub));
+ }
+ } else if (hash_hosts)
+ printhost(out, cp, pub, ca, 0);
+ } else {
+ if (find_host || delete_host) {
+ c = (match_hostname(name, cp,
+ strlen(cp)) == 1);
+ if (find_host && c) {
+ if (!quiet)
+ printf("# Host %s found: "
+ "line %d type %s%s\n", name,
+ num, key_type(pub),
+ ca ? " (CA key)" : "");
+ printhost(out, name, pub,
+ ca, hash_hosts && !ca);
+ found_key = 1;
+ }
+ if (delete_host) {
+ if (!c && !ca)
+ printhost(out, cp, pub, ca, 0);
+ else
+ printf("# Host %s found: "
+ "line %d type %s\n", name,
+ num, key_type(pub));
+ }
+ } else if (hash_hosts) {
+ for (cp2 = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) && (__r0 = ((const char *) (","))[0], ((const char *) (","))[0] != '\0') ? ((__r1 = ((const char *) (","))[1], ((const char *) (","))[1] == '\0') ? __strsep_1c (&cp, __r0) : ((__r2 = ((const char *) (","))[2], __r2 == '\0') ? __strsep_2c (&cp, __r0, __r1) : (((const char *) (","))[3] == '\0' ? __strsep_3c (&cp, __r0, __r1, __r2) : __strsep_g (&cp, ",")))) : __strsep_g (&cp, ",")); });
+ cp2 != ((void *)0) && *cp2 != '\0';
+ cp2 = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) && (__r0 = ((const char *) (","))[0], ((const char *) (","))[0] != '\0') ? ((__r1 = ((const char *) (","))[1], ((const char *) (","))[1] == '\0') ? __strsep_1c (&cp, __r0) : ((__r2 = ((const char *) (","))[2], __r2 == '\0') ? __strsep_2c (&cp, __r0, __r1) : (((const char *) (","))[3] == '\0' ? __strsep_3c (&cp, __r0, __r1, __r2) : __strsep_g (&cp, ",")))) : __strsep_g (&cp, ",")); })) {
+ if (ca) {
+ fprintf(stderr, "Warning: "
+ "ignoring CA key for host: "
+ "%.64s\n", cp2);
+ printhost(out, cp2, pub, ca, 0);
+ } else if (__extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p ("*?!") && ((size_t)(const void *)(("*?!") + 1) - (size_t)(const void *)("*?!") == 1) ? ((__builtin_constant_p (cp2) && ((size_t)(const void *)((cp2) + 1) - (size_t)(const void *)(cp2) == 1)) ? __builtin_strcspn (cp2, "*?!") : ((__r0 = ((const char *) ("*?!"))[0], __r0 == '\0') ? strlen (cp2) : ((__r1 = ((const char *) ("*?!"))[1], __r1 == '\0') ? __strcspn_c1 (cp2, __r0) : ((__r2 = ((const char *) ("*?!"))[2], __r2 == '\0') ? __strcspn_c2 (cp2, __r0, __r1) : (((const char *) ("*?!"))[3] == '\0' ? __strcspn_c3 (cp2, __r0, __r1, __r2) : __builtin_strcspn (cp2, "*?!")))))) : __builtin_strcspn (cp2, "*?!")); }) !=
+ strlen(cp2)) {
+ fprintf(stderr, "Warning: "
+ "ignoring host name with "
+ "metacharacters: %.64s\n",
+ cp2);
+ printhost(out, cp2, pub, ca, 0);
+ } else
+ printhost(out, cp2, pub, ca, 1);
+ }
+ has_unhashed = 1;
+ }
+ }
+ key_free(pub);
+ }
+ fclose(in);
+ if (invalid) {
+ fprintf(stderr, "%s is not a valid known_hosts file.\n",
+ identity_file);
+ if (inplace) {
+ fprintf(stderr, "Not replacing existing known_hosts "
+ "file because of errors\n");
+ fclose(out);
+ unlink(tmp);
+ }
+ exit(1);
+ }
+ if (inplace) {
+ fclose(out);
+ if (unlink(old) == -1 && (*__errno_location ()) != 2)
+ fatal("unlink %.100s: %s", old, strerror((*__errno_location ())));
+ if (link(identity_file, old) == -1)
+ fatal("link %.100s to %.100s: %s", identity_file, old,
+ strerror((*__errno_location ())));
+ if (rename(tmp, identity_file) == -1) {
+ error("rename\"%s\" to \"%s\": %s", tmp, identity_file,
+ strerror((*__errno_location ())));
+ unlink(tmp);
+ unlink(old);
+ exit(1);
+ }
+ fprintf(stderr, "%s updated.\n", identity_file);
+ fprintf(stderr, "Original contents retained as %s\n", old);
+ if (has_unhashed) {
+ fprintf(stderr, "WARNING: %s contains unhashed "
+ "entries\n", old);
+ fprintf(stderr, "Delete this file to ensure privacy "
+ "of hostnames\n");
+ }
+ }
+ exit (find_host && !found_key);
+}
+static void
+do_change_passphrase(struct passwd *pw)
+{
+ char *comment;
+ char *old_passphrase, *passphrase1, *passphrase2;
+ struct stat st;
+ Key *private;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0) {
+ perror(identity_file);
+ exit(1);
+ }
+ private = key_load_private(identity_file, "", &comment);
+ if (private == ((void *)0)) {
+ if (identity_passphrase)
+ old_passphrase = xstrdup(identity_passphrase);
+ else
+ old_passphrase =
+ read_passphrase("Enter old passphrase: ",
+ 0x0002);
+ private = key_load_private(identity_file, old_passphrase,
+ &comment);
+ explicit_bzero(old_passphrase, strlen(old_passphrase));
+ free(old_passphrase);
+ if (private == ((void *)0)) {
+ printf("Bad passphrase.\n");
+ exit(1);
+ }
+ }
+ printf("Key has comment '%s'\n", comment);
+ if (identity_new_passphrase) {
+ passphrase1 = xstrdup(identity_new_passphrase);
+ passphrase2 = ((void *)0);
+ } else {
+ passphrase1 =
+ read_passphrase("Enter new passphrase (empty for no "
+ "passphrase): ", 0x0002);
+ passphrase2 = read_passphrase("Enter same passphrase again: ",
+ 0x0002);
+ if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (passphrase1) && __builtin_constant_p (passphrase2) && (__s1_len = strlen (passphrase1), __s2_len = strlen (passphrase2), (!((size_t)(const void *)((passphrase1) + 1) - (size_t)(const void *)(passphrase1) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((passphrase2) + 1) - (size_t)(const void *)(passphrase2) == 1) || __s2_len >= 4)) ? __builtin_strcmp (passphrase1, passphrase2) : (__builtin_constant_p (passphrase1) && ((size_t)(const void *)((passphrase1) + 1) - (size_t)(const void *)(passphrase1) == 1) && (__s1_len = strlen (passphrase1), __s1_len < 4) ? (__builtin_constant_p (passphrase2) && ((size_t)(const void *)((passphrase2) + 1) - (size_t)(const void *)(passphrase2) == 1) ? __builtin_strcmp (passphrase1, passphrase2) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (passphrase2); register int __result = (((const unsigned char *) (const char *) (passphrase1))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (passphrase1))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (passphrase1))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (passphrase1))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (passphrase2) && ((size_t)(const void *)((passphrase2) + 1) - (size_t)(const void *)(passphrase2) == 1) && (__s2_len = strlen (passphrase2), __s2_len < 4) ? (__builtin_constant_p (passphrase1) && ((size_t)(const void *)((passphrase1) + 1) - (size_t)(const void *)(passphrase1) == 1) ? __builtin_strcmp (passphrase1, passphrase2) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (passphrase1); register int __result = __s1[0] - ((const unsigned char *) (const char *) (passphrase2))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) (passphrase2))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) (passphrase2))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) (passphrase2))[3]); } } __result; }))) : __builtin_strcmp (passphrase1, passphrase2)))); }) != 0) {
+ explicit_bzero(passphrase1, strlen(passphrase1));
+ explicit_bzero(passphrase2, strlen(passphrase2));
+ free(passphrase1);
+ free(passphrase2);
+ printf("Pass phrases do not match. Try again.\n");
+ exit(1);
+ }
+ explicit_bzero(passphrase2, strlen(passphrase2));
+ free(passphrase2);
+ }
+ if (!key_save_private(private, identity_file, passphrase1, comment,
+ use_new_format, new_format_cipher, rounds)) {
+ printf("Saving the key failed: %s.\n", identity_file);
+ explicit_bzero(passphrase1, strlen(passphrase1));
+ free(passphrase1);
+ key_free(private);
+ free(comment);
+ exit(1);
+ }
+ explicit_bzero(passphrase1, strlen(passphrase1));
+ free(passphrase1);
+ key_free(private);
+ free(comment);
+ printf("Your identification has been saved with the new passphrase.\n");
+ exit(0);
+}
+static int
+do_print_resource_record(struct passwd *pw, char *fname, char *hname)
+{
+ Key *public;
+ char *comment = ((void *)0);
+ struct stat st;
+ if (fname == ((void *)0))
+ fatal("%s: no filename", __func__);
+ if (stat(fname, &st) < 0) {
+ if ((*__errno_location ()) == 2)
+ return 0;
+ perror(fname);
+ exit(1);
+ }
+ public = key_load_public(fname, &comment);
+ if (public != ((void *)0)) {
+ export_dns_rr(hname, public, stdout, print_generic);
+ key_free(public);
+ free(comment);
+ return 1;
+ }
+ if (comment)
+ free(comment);
+ printf("failed to read v2 public key from %s.\n", fname);
+ exit(1);
+}
+static void
+do_change_comment(struct passwd *pw)
+{
+ char new_comment[1024], *comment, *passphrase;
+ Key *private;
+ Key *public;
+ struct stat st;
+ FILE *f;
+ int fd;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0) {
+ perror(identity_file);
+ exit(1);
+ }
+ private = key_load_private(identity_file, "", &comment);
+ if (private == ((void *)0)) {
+ if (identity_passphrase)
+ passphrase = xstrdup(identity_passphrase);
+ else if (identity_new_passphrase)
+ passphrase = xstrdup(identity_new_passphrase);
+ else
+ passphrase = read_passphrase("Enter passphrase: ",
+ 0x0002);
+ private = key_load_private(identity_file, passphrase, &comment);
+ if (private == ((void *)0)) {
+ explicit_bzero(passphrase, strlen(passphrase));
+ free(passphrase);
+ printf("Bad passphrase.\n");
+ exit(1);
+ }
+ } else {
+ passphrase = xstrdup("");
+ }
+ if (private->type != KEY_RSA1) {
+ fprintf(stderr, "Comments are only supported for RSA1 keys.\n");
+ key_free(private);
+ exit(1);
+ }
+ printf("Key now has comment '%s'\n", comment);
+ if (identity_comment) {
+ strlcpy(new_comment, identity_comment, sizeof(new_comment));
+ } else {
+ printf("Enter new comment: ");
+ fflush(stdout);
+ if (!fgets(new_comment, sizeof(new_comment), stdin)) {
+ explicit_bzero(passphrase, strlen(passphrase));
+ key_free(private);
+ exit(1);
+ }
+ new_comment[__extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p ("\n") && ((size_t)(const void *)(("\n") + 1) - (size_t)(const void *)("\n") == 1) ? ((__builtin_constant_p (new_comment) && ((size_t)(const void *)((new_comment) + 1) - (size_t)(const void *)(new_comment) == 1)) ? __builtin_strcspn (new_comment, "\n") : ((__r0 = ((const char *) ("\n"))[0], __r0 == '\0') ? strlen (new_comment) : ((__r1 = ((const char *) ("\n"))[1], __r1 == '\0') ? __strcspn_c1 (new_comment, __r0) : ((__r2 = ((const char *) ("\n"))[2], __r2 == '\0') ? __strcspn_c2 (new_comment, __r0, __r1) : (((const char *) ("\n"))[3] == '\0' ? __strcspn_c3 (new_comment, __r0, __r1, __r2) : __builtin_strcspn (new_comment, "\n")))))) : __builtin_strcspn (new_comment, "\n")); })] = '\0';
+ }
+ if (!key_save_private(private, identity_file, passphrase, new_comment,
+ use_new_format, new_format_cipher, rounds)) {
+ printf("Saving the key failed: %s.\n", identity_file);
+ explicit_bzero(passphrase, strlen(passphrase));
+ free(passphrase);
+ key_free(private);
+ free(comment);
+ exit(1);
+ }
+ explicit_bzero(passphrase, strlen(passphrase));
+ free(passphrase);
+ public = key_from_private(private);
+ key_free(private);
+ strlcat(identity_file, ".pub", sizeof(identity_file));
+ fd = open(identity_file, 01 | 00000400 | 01000, 0644);
+ if (fd == -1) {
+ printf("Could not save your public key in %s\n", identity_file);
+ exit(1);
+ }
+ f = fdopen(fd, "w");
+ if (f == ((void *)0)) {
+ printf("fdopen %s failed\n", identity_file);
+ exit(1);
+ }
+ if (!key_write(public, f))
+ fprintf(stderr, "write key failed\n");
+ key_free(public);
+ fprintf(f, " %s\n", new_comment);
+ fclose(f);
+ free(comment);
+ printf("The comment in your key file has been changed.\n");
+ exit(0);
+}
+static const char *
+fmt_validity(u_int64_t valid_from, u_int64_t valid_to)
+{
+ char from[32], to[32];
+ static char ret[64];
+ time_t tt;
+ struct tm *tm;
+ *from = *to = '\0';
+ if (valid_from == 0 && valid_to == 0xffffffffffffffffULL)
+ return "forever";
+ if (valid_from != 0) {
+ tt = valid_from > 2147483647 ? 2147483647 : valid_from;
+ tm = localtime(&tt);
+ strftime(from, sizeof(from), "%Y-%m-%dT%H:%M:%S", tm);
+ }
+ if (valid_to != 0xffffffffffffffffULL) {
+ tt = valid_to > 2147483647 ? 2147483647 : valid_to;
+ tm = localtime(&tt);
+ strftime(to, sizeof(to), "%Y-%m-%dT%H:%M:%S", tm);
+ }
+ if (valid_from == 0) {
+ snprintf(ret, sizeof(ret), "before %s", to);
+ return ret;
+ }
+ if (valid_to == 0xffffffffffffffffULL) {
+ snprintf(ret, sizeof(ret), "after %s", from);
+ return ret;
+ }
+ snprintf(ret, sizeof(ret), "from %s to %s", from, to);
+ return ret;
+}
+static void
+add_flag_option(Buffer *c, const char *name)
+{
+ debug3("%s: %s", __func__, name);
+ buffer_put_cstring(c, name);
+ buffer_put_string(c, ((void *)0), 0);
+}
+static void
+add_string_option(Buffer *c, const char *name, const char *value)
+{
+ Buffer b;
+ debug3("%s: %s=%s", __func__, name, value);
+ buffer_init(&b);
+ buffer_put_cstring(&b, value);
+ buffer_put_cstring(c, name);
+ buffer_put_string(c, buffer_ptr(&b), buffer_len(&b));
+ buffer_free(&b);
+}
+static void
+prepare_options_buf(Buffer *c, int which)
+{
+ buffer_clear(c);
+ if ((which & 1) != 0 &&
+ certflags_command != ((void *)0))
+ add_string_option(c, "force-command", certflags_command);
+ if ((which & 2) != 0 &&
+ (certflags_flags & (1)) != 0)
+ add_flag_option(c, "permit-X11-forwarding");
+ if ((which & 2) != 0 &&
+ (certflags_flags & (1<<1)) != 0)
+ add_flag_option(c, "permit-agent-forwarding");
+ if ((which & 2) != 0 &&
+ (certflags_flags & (1<<2)) != 0)
+ add_flag_option(c, "permit-port-forwarding");
+ if ((which & 2) != 0 &&
+ (certflags_flags & (1<<3)) != 0)
+ add_flag_option(c, "permit-pty");
+ if ((which & 2) != 0 &&
+ (certflags_flags & (1<<4)) != 0)
+ add_flag_option(c, "permit-user-rc");
+ if ((which & 1) != 0 &&
+ certflags_src_addr != ((void *)0))
+ add_string_option(c, "source-address", certflags_src_addr);
+}
+static Key *
+load_pkcs11_key(char *path)
+{
+ Key **keys = ((void *)0), *public, *private = ((void *)0);
+ int i, nkeys;
+ if ((public = key_load_public(path, ((void *)0))) == ((void *)0))
+ fatal("Couldn't load CA public key \"%s\"", path);
+ nkeys = pkcs11_add_provider(pkcs11provider, identity_passphrase, &keys);
+ debug3("%s: %d keys", __func__, nkeys);
+ if (nkeys <= 0)
+ fatal("cannot read public key from pkcs11");
+ for (i = 0; i < nkeys; i++) {
+ if (key_equal_public(public, keys[i])) {
+ private = keys[i];
+ continue;
+ }
+ key_free(keys[i]);
+ }
+ free(keys);
+ key_free(public);
+ return private;
+}
+static void
+do_ca_sign(struct passwd *pw, int argc, char **argv)
+{
+ int i, fd;
+ u_int n;
+ Key *ca, *public;
+ char *otmp, *tmp, *cp, *out, *comment, **plist = ((void *)0);
+ FILE *f;
+ int v00 = 0;
+ if (key_type_name != ((void *)0)) {
+ switch (key_type_from_name(key_type_name)) {
+ case KEY_RSA_CERT_V00:
+ case KEY_DSA_CERT_V00:
+ v00 = 1;
+ break;
+ case KEY_UNSPEC:
+ if (strcasecmp(key_type_name, "v00") == 0) {
+ v00 = 1;
+ break;
+ } else if (strcasecmp(key_type_name, "v01") == 0)
+ break;
+ default:
+ fprintf(stderr, "unknown key type %s\n", key_type_name);
+ exit(1);
+ }
+ }
+ pkcs11_init(1);
+ tmp = tilde_expand_filename(ca_key_path, pw->pw_uid);
+ if (pkcs11provider != ((void *)0)) {
+ if ((ca = load_pkcs11_key(tmp)) == ((void *)0))
+ fatal("No PKCS#11 key matching %s found", ca_key_path);
+ } else if ((ca = load_identity(tmp)) == ((void *)0))
+ fatal("Couldn't load CA key \"%s\"", tmp);
+ free(tmp);
+ for (i = 0; i < argc; i++) {
+ n = 0;
+ if (cert_principals != ((void *)0)) {
+ otmp = tmp = xstrdup(cert_principals);
+ plist = ((void *)0);
+ for (; (cp = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) && (__r0 = ((const char *) (","))[0], ((const char *) (","))[0] != '\0') ? ((__r1 = ((const char *) (","))[1], ((const char *) (","))[1] == '\0') ? __strsep_1c (&tmp, __r0) : ((__r2 = ((const char *) (","))[2], __r2 == '\0') ? __strsep_2c (&tmp, __r0, __r1) : (((const char *) (","))[3] == '\0' ? __strsep_3c (&tmp, __r0, __r1, __r2) : __strsep_g (&tmp, ",")))) : __strsep_g (&tmp, ",")); })) != ((void *)0); n++) {
+ plist = xrealloc(plist, n + 1, sizeof(*plist));
+ if (*(plist[n] = xstrdup(cp)) == '\0')
+ fatal("Empty principal name");
+ }
+ free(otmp);
+ }
+ tmp = tilde_expand_filename(argv[i], pw->pw_uid);
+ if ((public = key_load_public(tmp, &comment)) == ((void *)0))
+ fatal("%s: unable to open \"%s\"", __func__, tmp);
+ if (public->type != KEY_RSA && public->type != KEY_DSA &&
+ public->type != KEY_ECDSA && public->type != KEY_ED25519)
+ fatal("%s: key \"%s\" type %s cannot be certified",
+ __func__, tmp, key_type(public));
+ if (key_to_certified(public, v00) != 0)
+ fatal("Could not upgrade key %s to certificate", tmp);
+ public->cert->type = cert_key_type;
+ public->cert->serial = (u_int64_t)cert_serial;
+ public->cert->key_id = xstrdup(cert_key_id);
+ public->cert->nprincipals = n;
+ public->cert->principals = plist;
+ public->cert->valid_after = cert_valid_from;
+ public->cert->valid_before = cert_valid_to;
+ if (v00) {
+ prepare_options_buf(&public->cert->critical,
+ 1|2);
+ } else {
+ prepare_options_buf(&public->cert->critical,
+ 1);
+ prepare_options_buf(&public->cert->extensions,
+ 2);
+ }
+ public->cert->signature_key = key_from_private(ca);
+ if (key_certify(public, ca) != 0)
+ fatal("Couldn't not certify key %s", tmp);
+ if ((cp = strrchr(tmp, '.')) != ((void *)0) && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (cp) && __builtin_constant_p (".pub") && (__s1_len = strlen (cp), __s2_len = strlen (".pub"), (!((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((".pub") + 1) - (size_t)(const void *)(".pub") == 1) || __s2_len >= 4)) ? __builtin_strcmp (cp, ".pub") : (__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1) && (__s1_len = strlen (cp), __s1_len < 4) ? (__builtin_constant_p (".pub") && ((size_t)(const void *)((".pub") + 1) - (size_t)(const void *)(".pub") == 1) ? __builtin_strcmp (cp, ".pub") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (".pub"); register int __result = (((const unsigned char *) (const char *) (cp))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (cp))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (cp))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (cp))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (".pub") && ((size_t)(const void *)((".pub") + 1) - (size_t)(const void *)(".pub") == 1) && (__s2_len = strlen (".pub"), __s2_len < 4) ? (__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1) ? __builtin_strcmp (cp, ".pub") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (cp); register int __result = __s1[0] - ((const unsigned char *) (const char *) (".pub"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) (".pub"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) (".pub"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) (".pub"))[3]); } } __result; }))) : __builtin_strcmp (cp, ".pub")))); }) == 0)
+ *cp = '\0';
+ xasprintf(&out, "%s-cert.pub", tmp);
+ free(tmp);
+ if ((fd = open(out, 01|00000400|01000, 0644)) == -1)
+ fatal("Could not open \"%s\" for writing: %s", out,
+ strerror((*__errno_location ())));
+ if ((f = fdopen(fd, "w")) == ((void *)0))
+ fatal("%s: fdopen: %s", __func__, strerror((*__errno_location ())));
+ if (!key_write(public, f))
+ fatal("Could not write certified key to %s", out);
+ fprintf(f, " %s\n", comment);
+ fclose(f);
+ if (!quiet) {
+ logit("Signed %s key %s: id \"%s\" serial %llu%s%s "
+ "valid %s", key_cert_type(public),
+ out, public->cert->key_id,
+ (unsigned long long)public->cert->serial,
+ cert_principals != ((void *)0) ? " for " : "",
+ cert_principals != ((void *)0) ? cert_principals : "",
+ fmt_validity(cert_valid_from, cert_valid_to));
+ }
+ key_free(public);
+ free(out);
+ }
+ pkcs11_terminate();
+ exit(0);
+}
+static u_int64_t
+parse_relative_time(const char *s, time_t now)
+{
+ int64_t mul, secs;
+ mul = *s == '-' ? -1 : 1;
+ if ((secs = convtime(s + 1)) == -1)
+ fatal("Invalid relative certificate time %s", s);
+ if (mul == -1 && secs > now)
+ fatal("Certificate time %s cannot be represented", s);
+ return now + (u_int64_t)(secs * mul);
+}
+static u_int64_t
+parse_absolute_time(const char *s)
+{
+ struct tm tm;
+ time_t tt;
+ char buf[32], *fmt;
+ switch (strlen(s)) {
+ case 8:
+ fmt = "%Y-%m-%d";
+ snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2s", s, s + 4, s + 6);
+ break;
+ case 14:
+ fmt = "%Y-%m-%dT%H:%M:%S";
+ snprintf(buf, sizeof(buf), "%.4s-%.2s-%.2sT%.2s:%.2s:%.2s",
+ s, s + 4, s + 6, s + 8, s + 10, s + 12);
+ break;
+ default:
+ fatal("Invalid certificate time format %s", s);
+ }
+ memset(&tm, 0, sizeof(tm));
+ if (strptime(buf, fmt, &tm) == ((void *)0))
+ fatal("Invalid certificate time %s", s);
+ if ((tt = mktime(&tm)) < 0)
+ fatal("Certificate time %s cannot be represented", s);
+ return (u_int64_t)tt;
+}
+static void
+parse_cert_times(char *timespec)
+{
+ char *from, *to;
+ time_t now = time(((void *)0));
+ int64_t secs;
+ if (*timespec == '+' && (__extension__ (__builtin_constant_p (':') && !__builtin_constant_p (timespec) && (':') == '\0' ? (char *) __rawmemchr (timespec, ':') : __builtin_strchr (timespec, ':'))) == ((void *)0)) {
+ if ((secs = convtime(timespec + 1)) == -1)
+ fatal("Invalid relative certificate life %s", timespec);
+ cert_valid_to = now + secs;
+ cert_valid_from = ((now - 59)/ 60) * 60;
+ return;
+ }
+ from = xstrdup(timespec);
+ to = (__extension__ (__builtin_constant_p (':') && !__builtin_constant_p (from) && (':') == '\0' ? (char *) __rawmemchr (from, ':') : __builtin_strchr (from, ':')));
+ if (to == ((void *)0) || from == to || *(to + 1) == '\0')
+ fatal("Invalid certificate life specification %s", timespec);
+ *to++ = '\0';
+ if (*from == '-' || *from == '+')
+ cert_valid_from = parse_relative_time(from, now);
+ else
+ cert_valid_from = parse_absolute_time(from);
+ if (*to == '-' || *to == '+')
+ cert_valid_to = parse_relative_time(to, now);
+ else
+ cert_valid_to = parse_absolute_time(to);
+ if (cert_valid_to <= cert_valid_from)
+ fatal("Empty certificate validity interval");
+ free(from);
+}
+static void
+add_cert_option(char *opt)
+{
+ char *val;
+ if (strcasecmp(opt, "clear") == 0)
+ certflags_flags = 0;
+ else if (strcasecmp(opt, "no-x11-forwarding") == 0)
+ certflags_flags &= ~(1);
+ else if (strcasecmp(opt, "permit-x11-forwarding") == 0)
+ certflags_flags |= (1);
+ else if (strcasecmp(opt, "no-agent-forwarding") == 0)
+ certflags_flags &= ~(1<<1);
+ else if (strcasecmp(opt, "permit-agent-forwarding") == 0)
+ certflags_flags |= (1<<1);
+ else if (strcasecmp(opt, "no-port-forwarding") == 0)
+ certflags_flags &= ~(1<<2);
+ else if (strcasecmp(opt, "permit-port-forwarding") == 0)
+ certflags_flags |= (1<<2);
+ else if (strcasecmp(opt, "no-pty") == 0)
+ certflags_flags &= ~(1<<3);
+ else if (strcasecmp(opt, "permit-pty") == 0)
+ certflags_flags |= (1<<3);
+ else if (strcasecmp(opt, "no-user-rc") == 0)
+ certflags_flags &= ~(1<<4);
+ else if (strcasecmp(opt, "permit-user-rc") == 0)
+ certflags_flags |= (1<<4);
+ else if (strncasecmp(opt, "force-command=", 14) == 0) {
+ val = opt + 14;
+ if (*val == '\0')
+ fatal("Empty force-command option");
+ if (certflags_command != ((void *)0))
+ fatal("force-command already specified");
+ certflags_command = xstrdup(val);
+ } else if (strncasecmp(opt, "source-address=", 15) == 0) {
+ val = opt + 15;
+ if (*val == '\0')
+ fatal("Empty source-address option");
+ if (certflags_src_addr != ((void *)0))
+ fatal("source-address already specified");
+ if (addr_match_cidr_list(((void *)0), val) != 0)
+ fatal("Invalid source-address list");
+ certflags_src_addr = xstrdup(val);
+ } else
+ fatal("Unsupported certificate option \"%s\"", opt);
+}
+static void
+show_options(const Buffer *optbuf, int v00, int in_critical)
+{
+ char *name;
+ u_char *data;
+ u_int dlen;
+ Buffer options, option;
+ buffer_init(&options);
+ buffer_append(&options, buffer_ptr(optbuf), buffer_len(optbuf));
+ buffer_init(&option);
+ while (buffer_len(&options) != 0) {
+ name = buffer_get_string(&options, ((void *)0));
+ data = buffer_get_string_ptr(&options, &dlen);
+ buffer_append(&option, data, dlen);
+ printf(" %s", name);
+ if ((v00 || !in_critical) &&
+ (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("permit-X11-forwarding") && (__s1_len = strlen (name), __s2_len = strlen ("permit-X11-forwarding"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("permit-X11-forwarding") + 1) - (size_t)(const void *)("permit-X11-forwarding") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "permit-X11-forwarding") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("permit-X11-forwarding") && ((size_t)(const void *)(("permit-X11-forwarding") + 1) - (size_t)(const void *)("permit-X11-forwarding") == 1) ? __builtin_strcmp (name, "permit-X11-forwarding") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("permit-X11-forwarding"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("permit-X11-forwarding") && ((size_t)(const void *)(("permit-X11-forwarding") + 1) - (size_t)(const void *)("permit-X11-forwarding") == 1) && (__s2_len = strlen ("permit-X11-forwarding"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "permit-X11-forwarding") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("permit-X11-forwarding"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("permit-X11-forwarding"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("permit-X11-forwarding"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("permit-X11-forwarding"))[3]); } } __result; }))) : __builtin_strcmp (name, "permit-X11-forwarding")))); }) == 0 ||
+ __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("permit-agent-forwarding") && (__s1_len = strlen (name), __s2_len = strlen ("permit-agent-forwarding"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("permit-agent-forwarding") + 1) - (size_t)(const void *)("permit-agent-forwarding") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "permit-agent-forwarding") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("permit-agent-forwarding") && ((size_t)(const void *)(("permit-agent-forwarding") + 1) - (size_t)(const void *)("permit-agent-forwarding") == 1) ? __builtin_strcmp (name, "permit-agent-forwarding") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("permit-agent-forwarding"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("permit-agent-forwarding") && ((size_t)(const void *)(("permit-agent-forwarding") + 1) - (size_t)(const void *)("permit-agent-forwarding") == 1) && (__s2_len = strlen ("permit-agent-forwarding"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "permit-agent-forwarding") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("permit-agent-forwarding"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("permit-agent-forwarding"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("permit-agent-forwarding"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("permit-agent-forwarding"))[3]); } } __result; }))) : __builtin_strcmp (name, "permit-agent-forwarding")))); }) == 0 ||
+ __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("permit-port-forwarding") && (__s1_len = strlen (name), __s2_len = strlen ("permit-port-forwarding"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("permit-port-forwarding") + 1) - (size_t)(const void *)("permit-port-forwarding") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "permit-port-forwarding") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("permit-port-forwarding") && ((size_t)(const void *)(("permit-port-forwarding") + 1) - (size_t)(const void *)("permit-port-forwarding") == 1) ? __builtin_strcmp (name, "permit-port-forwarding") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("permit-port-forwarding"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("permit-port-forwarding") && ((size_t)(const void *)(("permit-port-forwarding") + 1) - (size_t)(const void *)("permit-port-forwarding") == 1) && (__s2_len = strlen ("permit-port-forwarding"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "permit-port-forwarding") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("permit-port-forwarding"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("permit-port-forwarding"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("permit-port-forwarding"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("permit-port-forwarding"))[3]); } } __result; }))) : __builtin_strcmp (name, "permit-port-forwarding")))); }) == 0 ||
+ __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("permit-pty") && (__s1_len = strlen (name), __s2_len = strlen ("permit-pty"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("permit-pty") + 1) - (size_t)(const void *)("permit-pty") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "permit-pty") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("permit-pty") && ((size_t)(const void *)(("permit-pty") + 1) - (size_t)(const void *)("permit-pty") == 1) ? __builtin_strcmp (name, "permit-pty") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("permit-pty"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("permit-pty") && ((size_t)(const void *)(("permit-pty") + 1) - (size_t)(const void *)("permit-pty") == 1) && (__s2_len = strlen ("permit-pty"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "permit-pty") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("permit-pty"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("permit-pty"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("permit-pty"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("permit-pty"))[3]); } } __result; }))) : __builtin_strcmp (name, "permit-pty")))); }) == 0 ||
+ __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("permit-user-rc") && (__s1_len = strlen (name), __s2_len = strlen ("permit-user-rc"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("permit-user-rc") + 1) - (size_t)(const void *)("permit-user-rc") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "permit-user-rc") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("permit-user-rc") && ((size_t)(const void *)(("permit-user-rc") + 1) - (size_t)(const void *)("permit-user-rc") == 1) ? __builtin_strcmp (name, "permit-user-rc") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("permit-user-rc"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("permit-user-rc") && ((size_t)(const void *)(("permit-user-rc") + 1) - (size_t)(const void *)("permit-user-rc") == 1) && (__s2_len = strlen ("permit-user-rc"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "permit-user-rc") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("permit-user-rc"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("permit-user-rc"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("permit-user-rc"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("permit-user-rc"))[3]); } } __result; }))) : __builtin_strcmp (name, "permit-user-rc")))); }) == 0))
+ printf("\n");
+ else if ((v00 || in_critical) &&
+ (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("force-command") && (__s1_len = strlen (name), __s2_len = strlen ("force-command"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("force-command") + 1) - (size_t)(const void *)("force-command") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "force-command") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("force-command") && ((size_t)(const void *)(("force-command") + 1) - (size_t)(const void *)("force-command") == 1) ? __builtin_strcmp (name, "force-command") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("force-command"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("force-command") && ((size_t)(const void *)(("force-command") + 1) - (size_t)(const void *)("force-command") == 1) && (__s2_len = strlen ("force-command"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "force-command") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("force-command"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("force-command"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("force-command"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("force-command"))[3]); } } __result; }))) : __builtin_strcmp (name, "force-command")))); }) == 0 ||
+ __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p ("source-address") && (__s1_len = strlen (name), __s2_len = strlen ("source-address"), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("source-address") + 1) - (size_t)(const void *)("source-address") == 1) || __s2_len >= 4)) ? __builtin_strcmp (name, "source-address") : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p ("source-address") && ((size_t)(const void *)(("source-address") + 1) - (size_t)(const void *)("source-address") == 1) ? __builtin_strcmp (name, "source-address") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("source-address"); register int __result = (((const unsigned char *) (const char *) (name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("source-address") && ((size_t)(const void *)(("source-address") + 1) - (size_t)(const void *)("source-address") == 1) && (__s2_len = strlen ("source-address"), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? __builtin_strcmp (name, "source-address") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (name); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("source-address"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("source-address"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("source-address"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("source-address"))[3]); } } __result; }))) : __builtin_strcmp (name, "source-address")))); }) == 0)) {
+ data = buffer_get_string(&option, ((void *)0));
+ printf(" %s\n", data);
+ free(data);
+ } else {
+ printf(" UNKNOWN OPTION (len %u)\n",
+ buffer_len(&option));
+ buffer_clear(&option);
+ }
+ free(name);
+ if (buffer_len(&option) != 0)
+ fatal("Option corrupt: extra data at end");
+ }
+ buffer_free(&option);
+ buffer_free(&options);
+}
+static void
+do_show_cert(struct passwd *pw)
+{
+ Key *key;
+ struct stat st;
+ char *key_fp, *ca_fp;
+ u_int i, v00;
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which the key is");
+ if (stat(identity_file, &st) < 0)
+ fatal("%s: %s: %s", __progname, identity_file, strerror((*__errno_location ())));
+ if ((key = key_load_public(identity_file, ((void *)0))) == ((void *)0))
+ fatal("%s is not a public key", identity_file);
+ if (!key_is_cert(key))
+ fatal("%s is not a certificate", identity_file);
+ v00 = key->type == KEY_RSA_CERT_V00 || key->type == KEY_DSA_CERT_V00;
+ key_fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX);
+ ca_fp = key_fingerprint(key->cert->signature_key,
+ SSH_FP_MD5, SSH_FP_HEX);
+ printf("%s:\n", identity_file);
+ printf(" Type: %s %s certificate\n", key_ssh_name(key),
+ key_cert_type(key));
+ printf(" Public key: %s %s\n", key_type(key), key_fp);
+ printf(" Signing CA: %s %s\n",
+ key_type(key->cert->signature_key), ca_fp);
+ printf(" Key ID: \"%s\"\n", key->cert->key_id);
+ if (!v00) {
+ printf(" Serial: %llu\n",
+ (unsigned long long)key->cert->serial);
+ }
+ printf(" Valid: %s\n",
+ fmt_validity(key->cert->valid_after, key->cert->valid_before));
+ printf(" Principals: ");
+ if (key->cert->nprincipals == 0)
+ printf("(none)\n");
+ else {
+ for (i = 0; i < key->cert->nprincipals; i++)
+ printf("\n %s",
+ key->cert->principals[i]);
+ printf("\n");
+ }
+ printf(" Critical Options: ");
+ if (buffer_len(&key->cert->critical) == 0)
+ printf("(none)\n");
+ else {
+ printf("\n");
+ show_options(&key->cert->critical, v00, 1);
+ }
+ if (!v00) {
+ printf(" Extensions: ");
+ if (buffer_len(&key->cert->extensions) == 0)
+ printf("(none)\n");
+ else {
+ printf("\n");
+ show_options(&key->cert->extensions, v00, 0);
+ }
+ }
+ exit(0);
+}
+static void
+load_krl(const char *path, struct ssh_krl **krlp)
+{
+ Buffer krlbuf;
+ int fd;
+ buffer_init(&krlbuf);
+ if ((fd = open(path, 00)) == -1)
+ fatal("open %s: %s", path, strerror((*__errno_location ())));
+ if (!key_load_file(fd, path, &krlbuf))
+ fatal("Unable to load KRL");
+ close(fd);
+ if (ssh_krl_from_blob(&krlbuf, krlp, ((void *)0), 0) != 0 ||
+ *krlp == ((void *)0))
+ fatal("Invalid KRL file");
+ buffer_free(&krlbuf);
+}
+static void
+update_krl_from_file(struct passwd *pw, const char *file, const Key *ca,
+ struct ssh_krl *krl)
+{
+ Key *key = ((void *)0);
+ u_long lnum = 0;
+ char *path, *cp, *ep, line[8192];
+ unsigned long long serial, serial2;
+ int i, was_explicit_key, was_sha1, r;
+ FILE *krl_spec;
+ path = tilde_expand_filename(file, pw->pw_uid);
+ if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (path) && __builtin_constant_p ("-") && (__s1_len = strlen (path), __s2_len = strlen ("-"), (!((size_t)(const void *)((path) + 1) - (size_t)(const void *)(path) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) || __s2_len >= 4)) ? __builtin_strcmp (path, "-") : (__builtin_constant_p (path) && ((size_t)(const void *)((path) + 1) - (size_t)(const void *)(path) == 1) && (__s1_len = strlen (path), __s1_len < 4) ? (__builtin_constant_p ("-") && ((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) ? __builtin_strcmp (path, "-") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-"); register int __result = (((const unsigned char *) (const char *) (path))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (path))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (path))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (path))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-") && ((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) && (__s2_len = strlen ("-"), __s2_len < 4) ? (__builtin_constant_p (path) && ((size_t)(const void *)((path) + 1) - (size_t)(const void *)(path) == 1) ? __builtin_strcmp (path, "-") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (path); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("-"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("-"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("-"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("-"))[3]); } } __result; }))) : __builtin_strcmp (path, "-")))); }) == 0) {
+ krl_spec = stdin;
+ free(path);
+ path = xstrdup("(standard input)");
+ } else if ((krl_spec = fopen(path, "r")) == ((void *)0))
+ fatal("fopen %s: %s", path, strerror((*__errno_location ())));
+ if (!quiet)
+ printf("Revoking from %s\n", path);
+ while (read_keyfile_line(krl_spec, path, line, sizeof(line),
+ &lnum) == 0) {
+ was_explicit_key = was_sha1 = 0;
+ cp = line + __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p (" \t") && ((size_t)(const void *)((" \t") + 1) - (size_t)(const void *)(" \t") == 1) ? ((__builtin_constant_p (line) && ((size_t)(const void *)((line) + 1) - (size_t)(const void *)(line) == 1)) ? __builtin_strspn (line, " \t") : ((__a0 = ((const char *) (" \t"))[0], __a0 == '\0') ? ((void) (line), (size_t) 0) : ((__a1 = ((const char *) (" \t"))[1], __a1 == '\0') ? __strspn_c1 (line, __a0) : ((__a2 = ((const char *) (" \t"))[2], __a2 == '\0') ? __strspn_c2 (line, __a0, __a1) : (((const char *) (" \t"))[3] == '\0' ? __strspn_c3 (line, __a0, __a1, __a2) : __builtin_strspn (line, " \t")))))) : __builtin_strspn (line, " \t")); });
+ for (i = 0, r = -1; cp[i] != '\0'; i++) {
+ if (cp[i] == '#' || cp[i] == '\n') {
+ cp[i] = '\0';
+ break;
+ }
+ if (cp[i] == ' ' || cp[i] == '\t') {
+ if (r == -1)
+ r = i;
+ } else
+ r = -1;
+ }
+ if (r != -1)
+ cp[r] = '\0';
+ if (*cp == '\0')
+ continue;
+ if (strncasecmp(cp, "serial:", 7) == 0) {
+ if (ca == ((void *)0)) {
+ fatal("revoking certificates by serial number "
+ "requires specification of a CA key");
+ }
+ cp += 7;
+ cp = cp + __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p (" \t") && ((size_t)(const void *)((" \t") + 1) - (size_t)(const void *)(" \t") == 1) ? ((__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1)) ? __builtin_strspn (cp, " \t") : ((__a0 = ((const char *) (" \t"))[0], __a0 == '\0') ? ((void) (cp), (size_t) 0) : ((__a1 = ((const char *) (" \t"))[1], __a1 == '\0') ? __strspn_c1 (cp, __a0) : ((__a2 = ((const char *) (" \t"))[2], __a2 == '\0') ? __strspn_c2 (cp, __a0, __a1) : (((const char *) (" \t"))[3] == '\0' ? __strspn_c3 (cp, __a0, __a1, __a2) : __builtin_strspn (cp, " \t")))))) : __builtin_strspn (cp, " \t")); });
+ (*__errno_location ()) = 0;
+ serial = strtoull(cp, &ep, 0);
+ if (*cp == '\0' || (*ep != '\0' && *ep != '-'))
+ fatal("%s:%lu: invalid serial \"%s\"",
+ path, lnum, cp);
+ if ((*__errno_location ()) == 34 && serial == (9223372036854775807LL * 2ULL + 1))
+ fatal("%s:%lu: serial out of range",
+ path, lnum);
+ serial2 = serial;
+ if (*ep == '-') {
+ cp = ep + 1;
+ (*__errno_location ()) = 0;
+ serial2 = strtoull(cp, &ep, 0);
+ if (*cp == '\0' || *ep != '\0')
+ fatal("%s:%lu: invalid serial \"%s\"",
+ path, lnum, cp);
+ if ((*__errno_location ()) == 34 && serial2 == (9223372036854775807LL * 2ULL + 1))
+ fatal("%s:%lu: serial out of range",
+ path, lnum);
+ if (serial2 <= serial)
+ fatal("%s:%lu: invalid serial range "
+ "%llu:%llu", path, lnum,
+ (unsigned long long)serial,
+ (unsigned long long)serial2);
+ }
+ if (ssh_krl_revoke_cert_by_serial_range(krl,
+ ca, serial, serial2) != 0) {
+ fatal("%s: revoke serial failed",
+ __func__);
+ }
+ } else if (strncasecmp(cp, "id:", 3) == 0) {
+ if (ca == ((void *)0)) {
+ fatal("revoking certificates by key ID "
+ "requires specification of a CA key");
+ }
+ cp += 3;
+ cp = cp + __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p (" \t") && ((size_t)(const void *)((" \t") + 1) - (size_t)(const void *)(" \t") == 1) ? ((__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1)) ? __builtin_strspn (cp, " \t") : ((__a0 = ((const char *) (" \t"))[0], __a0 == '\0') ? ((void) (cp), (size_t) 0) : ((__a1 = ((const char *) (" \t"))[1], __a1 == '\0') ? __strspn_c1 (cp, __a0) : ((__a2 = ((const char *) (" \t"))[2], __a2 == '\0') ? __strspn_c2 (cp, __a0, __a1) : (((const char *) (" \t"))[3] == '\0' ? __strspn_c3 (cp, __a0, __a1, __a2) : __builtin_strspn (cp, " \t")))))) : __builtin_strspn (cp, " \t")); });
+ if (ssh_krl_revoke_cert_by_key_id(krl, ca, cp) != 0)
+ fatal("%s: revoke key ID failed", __func__);
+ } else {
+ if (strncasecmp(cp, "key:", 4) == 0) {
+ cp += 4;
+ cp = cp + __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p (" \t") && ((size_t)(const void *)((" \t") + 1) - (size_t)(const void *)(" \t") == 1) ? ((__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1)) ? __builtin_strspn (cp, " \t") : ((__a0 = ((const char *) (" \t"))[0], __a0 == '\0') ? ((void) (cp), (size_t) 0) : ((__a1 = ((const char *) (" \t"))[1], __a1 == '\0') ? __strspn_c1 (cp, __a0) : ((__a2 = ((const char *) (" \t"))[2], __a2 == '\0') ? __strspn_c2 (cp, __a0, __a1) : (((const char *) (" \t"))[3] == '\0' ? __strspn_c3 (cp, __a0, __a1, __a2) : __builtin_strspn (cp, " \t")))))) : __builtin_strspn (cp, " \t")); });
+ was_explicit_key = 1;
+ } else if (strncasecmp(cp, "sha1:", 5) == 0) {
+ cp += 5;
+ cp = cp + __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p (" \t") && ((size_t)(const void *)((" \t") + 1) - (size_t)(const void *)(" \t") == 1) ? ((__builtin_constant_p (cp) && ((size_t)(const void *)((cp) + 1) - (size_t)(const void *)(cp) == 1)) ? __builtin_strspn (cp, " \t") : ((__a0 = ((const char *) (" \t"))[0], __a0 == '\0') ? ((void) (cp), (size_t) 0) : ((__a1 = ((const char *) (" \t"))[1], __a1 == '\0') ? __strspn_c1 (cp, __a0) : ((__a2 = ((const char *) (" \t"))[2], __a2 == '\0') ? __strspn_c2 (cp, __a0, __a1) : (((const char *) (" \t"))[3] == '\0' ? __strspn_c3 (cp, __a0, __a1, __a2) : __builtin_strspn (cp, " \t")))))) : __builtin_strspn (cp, " \t")); });
+ was_sha1 = 1;
+ } else {
+ }
+ if ((key = key_new(KEY_UNSPEC)) == ((void *)0))
+ fatal("key_new");
+ if (key_read(key, &cp) != 1)
+ fatal("%s:%lu: invalid key", path, lnum);
+ if (was_explicit_key)
+ r = ssh_krl_revoke_key_explicit(krl, key);
+ else if (was_sha1)
+ r = ssh_krl_revoke_key_sha1(krl, key);
+ else
+ r = ssh_krl_revoke_key(krl, key);
+ if (r != 0)
+ fatal("%s: revoke key failed", __func__);
+ key_free(key);
+ }
+ }
+ if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (path) && __builtin_constant_p ("-") && (__s1_len = strlen (path), __s2_len = strlen ("-"), (!((size_t)(const void *)((path) + 1) - (size_t)(const void *)(path) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) || __s2_len >= 4)) ? __builtin_strcmp (path, "-") : (__builtin_constant_p (path) && ((size_t)(const void *)((path) + 1) - (size_t)(const void *)(path) == 1) && (__s1_len = strlen (path), __s1_len < 4) ? (__builtin_constant_p ("-") && ((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) ? __builtin_strcmp (path, "-") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-"); register int __result = (((const unsigned char *) (const char *) (path))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (path))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (path))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (path))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-") && ((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) && (__s2_len = strlen ("-"), __s2_len < 4) ? (__builtin_constant_p (path) && ((size_t)(const void *)((path) + 1) - (size_t)(const void *)(path) == 1) ? __builtin_strcmp (path, "-") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (path); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("-"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("-"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("-"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("-"))[3]); } } __result; }))) : __builtin_strcmp (path, "-")))); }) != 0)
+ fclose(krl_spec);
+ free(path);
+}
+static void
+do_gen_krl(struct passwd *pw, int updating, int argc, char **argv)
+{
+ struct ssh_krl *krl;
+ struct stat sb;
+ Key *ca = ((void *)0);
+ int fd, i;
+ char *tmp;
+ Buffer kbuf;
+ if (*identity_file == '\0')
+ fatal("KRL generation requires an output file");
+ if (stat(identity_file, &sb) == -1) {
+ if ((*__errno_location ()) != 2)
+ fatal("Cannot access KRL \"%s\": %s",
+ identity_file, strerror((*__errno_location ())));
+ if (updating)
+ fatal("KRL \"%s\" does not exist", identity_file);
+ }
+ if (ca_key_path != ((void *)0)) {
+ tmp = tilde_expand_filename(ca_key_path, pw->pw_uid);
+ if ((ca = key_load_public(tmp, ((void *)0))) == ((void *)0))
+ fatal("Cannot load CA public key %s", tmp);
+ free(tmp);
+ }
+ if (updating)
+ load_krl(identity_file, &krl);
+ else if ((krl = ssh_krl_init()) == ((void *)0))
+ fatal("couldn't create KRL");
+ if (cert_serial != 0)
+ ssh_krl_set_version(krl, cert_serial);
+ if (identity_comment != ((void *)0))
+ ssh_krl_set_comment(krl, identity_comment);
+ for (i = 0; i < argc; i++)
+ update_krl_from_file(pw, argv[i], ca, krl);
+ buffer_init(&kbuf);
+ if (ssh_krl_to_blob(krl, &kbuf, ((void *)0), 0) != 0)
+ fatal("Couldn't generate KRL");
+ if ((fd = open(identity_file, 01|00000400|01000, 0644)) == -1)
+ fatal("open %s: %s", identity_file, strerror((*__errno_location ())));
+ if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, buffer_ptr(&kbuf), buffer_len(&kbuf)) !=
+ buffer_len(&kbuf))
+ fatal("write %s: %s", identity_file, strerror((*__errno_location ())));
+ close(fd);
+ buffer_free(&kbuf);
+ ssh_krl_free(krl);
+ if (ca != ((void *)0))
+ key_free(ca);
+}
+static void
+do_check_krl(struct passwd *pw, int argc, char **argv)
+{
+ int i, r, ret = 0;
+ char *comment;
+ struct ssh_krl *krl;
+ Key *k;
+ if (*identity_file == '\0')
+ fatal("KRL checking requires an input file");
+ load_krl(identity_file, &krl);
+ for (i = 0; i < argc; i++) {
+ if ((k = key_load_public(argv[i], &comment)) == ((void *)0))
+ fatal("Cannot load public key %s", argv[i]);
+ r = ssh_krl_check_key(krl, k);
+ printf("%s%s%s%s: %s\n", argv[i],
+ *comment ? " (" : "", comment, *comment ? ")" : "",
+ r == 0 ? "ok" : "REVOKED");
+ if (r != 0)
+ ret = 1;
+ key_free(k);
+ free(comment);
+ }
+ ssh_krl_free(krl);
+ exit(ret);
+}
+static void
+usage(void)
+{
+ fprintf(stderr, "usage: %s [options]\n", __progname);
+ fprintf(stderr, "Options:\n");
+ fprintf(stderr, " -A Generate non-existent host keys for all key types.\n");
+ fprintf(stderr, " -a number Number of KDF rounds for new key format or moduli primality tests.\n");
+ fprintf(stderr, " -B Show bubblebabble digest of key file.\n");
+ fprintf(stderr, " -b bits Number of bits in the key to create.\n");
+ fprintf(stderr, " -C comment Provide new comment.\n");
+ fprintf(stderr, " -c Change comment in private and public key files.\n");
+ fprintf(stderr, " -D pkcs11 Download public key from pkcs11 token.\n");
+ fprintf(stderr, " -e Export OpenSSH to foreign format key file.\n");
+ fprintf(stderr, " -F hostname Find hostname in known hosts file.\n");
+ fprintf(stderr, " -f filename Filename of the key file.\n");
+ fprintf(stderr, " -G file Generate candidates for DH-GEX moduli.\n");
+ fprintf(stderr, " -g Use generic DNS resource record format.\n");
+ fprintf(stderr, " -H Hash names in known_hosts file.\n");
+ fprintf(stderr, " -h Generate host certificate instead of a user certificate.\n");
+ fprintf(stderr, " -I key_id Key identifier to include in certificate.\n");
+ fprintf(stderr, " -i Import foreign format to OpenSSH key file.\n");
+ fprintf(stderr, " -J number Screen this number of moduli lines.\n");
+ fprintf(stderr, " -j number Start screening moduli at specified line.\n");
+ fprintf(stderr, " -K checkpt Write checkpoints to this file.\n");
+ fprintf(stderr, " -k Generate a KRL file.\n");
+ fprintf(stderr, " -L Print the contents of a certificate.\n");
+ fprintf(stderr, " -l Show fingerprint of key file.\n");
+ fprintf(stderr, " -M memory Amount of memory (MB) to use for generating DH-GEX moduli.\n");
+ fprintf(stderr, " -m key_fmt Conversion format for -e/-i (PEM|PKCS8|RFC4716).\n");
+ fprintf(stderr, " -N phrase Provide new passphrase.\n");
+ fprintf(stderr, " -n name,... User/host principal names to include in certificate\n");
+ fprintf(stderr, " -O option Specify a certificate option.\n");
+ fprintf(stderr, " -o Enforce new private key format.\n");
+ fprintf(stderr, " -P phrase Provide old passphrase.\n");
+ fprintf(stderr, " -p Change passphrase of private key file.\n");
+ fprintf(stderr, " -Q Test whether key(s) are revoked in KRL.\n");
+ fprintf(stderr, " -q Quiet.\n");
+ fprintf(stderr, " -R hostname Remove host from known_hosts file.\n");
+ fprintf(stderr, " -r hostname Print DNS resource record.\n");
+ fprintf(stderr, " -S start Start point (hex) for generating DH-GEX moduli.\n");
+ fprintf(stderr, " -s ca_key Certify keys with CA key.\n");
+ fprintf(stderr, " -T file Screen candidates for DH-GEX moduli.\n");
+ fprintf(stderr, " -t type Specify type of key to create.\n");
+ fprintf(stderr, " -u Update KRL rather than creating a new one.\n");
+ fprintf(stderr, " -V from:to Specify certificate validity interval.\n");
+ fprintf(stderr, " -v Verbose.\n");
+ fprintf(stderr, " -W gen Generator to use for generating DH-GEX moduli.\n");
+ fprintf(stderr, " -y Read private key file and print public key.\n");
+ fprintf(stderr, " -Z cipher Specify a cipher for new private key format.\n");
+ fprintf(stderr, " -z serial Specify a serial number.\n");
+ exit(1);
+}
+int
+main(int argc, char **argv)
+{
+ char dotsshdir[4096], comment[1024], *passphrase1, *passphrase2;
+ char *checkpoint = ((void *)0);
+ char out_file[4096], *ep, *rr_hostname = ((void *)0);
+ Key *private, *public;
+ struct passwd *pw;
+ struct stat st;
+ int opt, type, fd;
+ u_int32_t memory = 0, generator_wanted = 0;
+ int do_gen_candidates = 0, do_screen_candidates = 0;
+ int gen_all_hostkeys = 0, gen_krl = 0, update_krl = 0, check_krl = 0;
+ unsigned long start_lineno = 0, lines_to_process = 0;
+ BIGNUM *start = ((void *)0);
+ FILE *f;
+ const char *errstr;
+ extern int BSDoptind;
+ extern char *BSDoptarg;
+ sanitise_stdfd();
+ __progname = ssh_get_progname(argv[0]);
+ ssh_OpenSSL_add_all_algorithms();
+ log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1);
+ seed_rng();
+ pw = getpwuid(getuid());
+ if (!pw) {
+ printf("No user exists for uid %lu\n", (u_long)getuid());
+ exit(1);
+ }
+ if (gethostname(hostname, sizeof(hostname)) < 0) {
+ perror("gethostname");
+ exit(1);
+ }
+ while ((opt = BSDgetopt(argc, argv, "ABHLQXceghiklopquvxy" "C:D:F:G:I:J:K:M:N:O:P:R:S:T:V:W:Z:a:b:f:g:j:m:n:r:s:t:z:")
+ ) != -1) {
+ switch (opt) {
+ case 'A':
+ gen_all_hostkeys = 1;
+ break;
+ case 'b':
+ bits = (u_int32_t)strtonum(BSDoptarg, 256, 32768, &errstr);
+ if (errstr)
+ fatal("Bits has bad value %s (%s)",
+ BSDoptarg, errstr);
+ break;
+ case 'F':
+ find_host = 1;
+ rr_hostname = BSDoptarg;
+ break;
+ case 'H':
+ hash_hosts = 1;
+ break;
+ case 'I':
+ cert_key_id = BSDoptarg;
+ break;
+ case 'J':
+ lines_to_process = strtoul(BSDoptarg, ((void *)0), 10);
+ break;
+ case 'j':
+ start_lineno = strtoul(BSDoptarg, ((void *)0), 10);
+ break;
+ case 'R':
+ delete_host = 1;
+ rr_hostname = BSDoptarg;
+ break;
+ case 'L':
+ show_cert = 1;
+ break;
+ case 'l':
+ print_fingerprint = 1;
+ break;
+ case 'B':
+ print_bubblebabble = 1;
+ break;
+ case 'm':
+ if (strcasecmp(BSDoptarg, "RFC4716") == 0 ||
+ strcasecmp(BSDoptarg, "ssh2") == 0) {
+ convert_format = FMT_RFC4716;
+ break;
+ }
+ if (strcasecmp(BSDoptarg, "PKCS8") == 0) {
+ convert_format = FMT_PKCS8;
+ break;
+ }
+ if (strcasecmp(BSDoptarg, "PEM") == 0) {
+ convert_format = FMT_PEM;
+ break;
+ }
+ fatal("Unsupported conversion format \"%s\"", BSDoptarg);
+ case 'n':
+ cert_principals = BSDoptarg;
+ break;
+ case 'o':
+ use_new_format = 1;
+ break;
+ case 'p':
+ change_passphrase = 1;
+ break;
+ case 'c':
+ change_comment = 1;
+ break;
+ case 'f':
+ if (strlcpy(identity_file, BSDoptarg, sizeof(identity_file)) >=
+ sizeof(identity_file))
+ fatal("Identity filename too long");
+ have_identity = 1;
+ break;
+ case 'g':
+ print_generic = 1;
+ break;
+ case 'P':
+ identity_passphrase = BSDoptarg;
+ break;
+ case 'N':
+ identity_new_passphrase = BSDoptarg;
+ break;
+ case 'Q':
+ check_krl = 1;
+ break;
+ case 'O':
+ add_cert_option(BSDoptarg);
+ break;
+ case 'Z':
+ new_format_cipher = BSDoptarg;
+ break;
+ case 'C':
+ identity_comment = BSDoptarg;
+ break;
+ case 'q':
+ quiet = 1;
+ break;
+ case 'e':
+ case 'x':
+ convert_to = 1;
+ break;
+ case 'h':
+ cert_key_type = 2;
+ certflags_flags = 0;
+ break;
+ case 'k':
+ gen_krl = 1;
+ break;
+ case 'i':
+ case 'X':
+ convert_from = 1;
+ break;
+ case 'y':
+ print_public = 1;
+ break;
+ case 's':
+ ca_key_path = BSDoptarg;
+ break;
+ case 't':
+ key_type_name = BSDoptarg;
+ break;
+ case 'D':
+ pkcs11provider = BSDoptarg;
+ break;
+ case 'u':
+ update_krl = 1;
+ break;
+ case 'v':
+ if (log_level == SYSLOG_LEVEL_INFO)
+ log_level = SYSLOG_LEVEL_DEBUG1;
+ else {
+ if (log_level >= SYSLOG_LEVEL_DEBUG1 &&
+ log_level < SYSLOG_LEVEL_DEBUG3)
+ log_level++;
+ }
+ break;
+ case 'r':
+ rr_hostname = BSDoptarg;
+ break;
+ case 'W':
+ generator_wanted = (u_int32_t)strtonum(BSDoptarg, 1,
+ (2147483647 * 2U + 1U), &errstr);
+ if (errstr)
+ fatal("Desired generator has bad value: %s (%s)",
+ BSDoptarg, errstr);
+ break;
+ case 'a':
+ rounds = (int)strtonum(BSDoptarg, 1, 2147483647, &errstr);
+ if (errstr)
+ fatal("Invalid number: %s (%s)",
+ BSDoptarg, errstr);
+ break;
+ case 'M':
+ memory = (u_int32_t)strtonum(BSDoptarg, 1, (2147483647 * 2U + 1U), &errstr);
+ if (errstr)
+ fatal("Memory limit is %s: %s", errstr, BSDoptarg);
+ break;
+ case 'G':
+ do_gen_candidates = 1;
+ if (strlcpy(out_file, BSDoptarg, sizeof(out_file)) >=
+ sizeof(out_file))
+ fatal("Output filename too long");
+ break;
+ case 'T':
+ do_screen_candidates = 1;
+ if (strlcpy(out_file, BSDoptarg, sizeof(out_file)) >=
+ sizeof(out_file))
+ fatal("Output filename too long");
+ break;
+ case 'K':
+ if (strlen(BSDoptarg) >= 4096)
+ fatal("Checkpoint filename too long");
+ checkpoint = xstrdup(BSDoptarg);
+ break;
+ case 'S':
+ if (BN_hex2bn(&start, BSDoptarg) == 0)
+ fatal("Invalid start point.");
+ break;
+ case 'V':
+ parse_cert_times(BSDoptarg);
+ break;
+ case 'z':
+ (*__errno_location ()) = 0;
+ cert_serial = strtoull(BSDoptarg, &ep, 10);
+ if (*BSDoptarg < '0' || *BSDoptarg > '9' || *ep != '\0' ||
+ ((*__errno_location ()) == 34 && cert_serial == (9223372036854775807LL * 2ULL + 1)))
+ fatal("Invalid serial number \"%s\"", BSDoptarg);
+ break;
+ case '?':
+ default:
+ usage();
+ }
+ }
+ log_init(argv[0], log_level, SYSLOG_FACILITY_USER, 1);
+ argv += BSDoptind;
+ argc -= BSDoptind;
+ if (ca_key_path != ((void *)0)) {
+ if (argc < 1 && !gen_krl) {
+ printf("Too few arguments.\n");
+ usage();
+ }
+ } else if (argc > 0 && !gen_krl && !check_krl) {
+ printf("Too many arguments.\n");
+ usage();
+ }
+ if (change_passphrase && change_comment) {
+ printf("Can only have one of -p and -c.\n");
+ usage();
+ }
+ if (print_fingerprint && (delete_host || hash_hosts)) {
+ printf("Cannot use -l with -H or -R.\n");
+ usage();
+ }
+ if (gen_krl) {
+ do_gen_krl(pw, update_krl, argc, argv);
+ return (0);
+ }
+ if (check_krl) {
+ do_check_krl(pw, argc, argv);
+ return (0);
+ }
+ if (ca_key_path != ((void *)0)) {
+ if (cert_key_id == ((void *)0))
+ fatal("Must specify key id (-I) when certifying");
+ do_ca_sign(pw, argc, argv);
+ }
+ if (show_cert)
+ do_show_cert(pw);
+ if (delete_host || hash_hosts || find_host)
+ do_known_hosts(pw, rr_hostname);
+ if (pkcs11provider != ((void *)0))
+ do_download(pw);
+ if (print_fingerprint || print_bubblebabble)
+ do_fingerprint(pw);
+ if (change_passphrase)
+ do_change_passphrase(pw);
+ if (change_comment)
+ do_change_comment(pw);
+ if (convert_to)
+ do_convert_to(pw);
+ if (convert_from)
+ do_convert_from(pw);
+ if (print_public)
+ do_print_public(pw);
+ if (rr_hostname != ((void *)0)) {
+ unsigned int n = 0;
+ if (have_identity) {
+ n = do_print_resource_record(pw,
+ identity_file, rr_hostname);
+ if (n == 0) {
+ perror(identity_file);
+ exit(1);
+ }
+ exit(0);
+ } else {
+ n += do_print_resource_record(pw,
+ "/etc/ssh" "/ssh_host_rsa_key", rr_hostname);
+ n += do_print_resource_record(pw,
+ "/etc/ssh" "/ssh_host_dsa_key", rr_hostname);
+ n += do_print_resource_record(pw,
+ "/etc/ssh" "/ssh_host_ecdsa_key", rr_hostname);
+ if (n == 0)
+ fatal("no keys found.");
+ exit(0);
+ }
+ }
+ if (do_gen_candidates) {
+ FILE *out = fopen(out_file, "w");
+ if (out == ((void *)0)) {
+ error("Couldn't open modulus candidate file \"%s\": %s",
+ out_file, strerror((*__errno_location ())));
+ return (1);
+ }
+ if (bits == 0)
+ bits = 2048;
+ if (gen_candidates(out, memory, bits, start) != 0)
+ fatal("modulus candidate generation failed");
+ return (0);
+ }
+ if (do_screen_candidates) {
+ FILE *in;
+ FILE *out = fopen(out_file, "a");
+ if (have_identity && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (identity_file) && __builtin_constant_p ("-") && (__s1_len = strlen (identity_file), __s2_len = strlen ("-"), (!((size_t)(const void *)((identity_file) + 1) - (size_t)(const void *)(identity_file) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) || __s2_len >= 4)) ? __builtin_strcmp (identity_file, "-") : (__builtin_constant_p (identity_file) && ((size_t)(const void *)((identity_file) + 1) - (size_t)(const void *)(identity_file) == 1) && (__s1_len = strlen (identity_file), __s1_len < 4) ? (__builtin_constant_p ("-") && ((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) ? __builtin_strcmp (identity_file, "-") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-"); register int __result = (((const unsigned char *) (const char *) (identity_file))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (identity_file))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (identity_file))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (identity_file))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-") && ((size_t)(const void *)(("-") + 1) - (size_t)(const void *)("-") == 1) && (__s2_len = strlen ("-"), __s2_len < 4) ? (__builtin_constant_p (identity_file) && ((size_t)(const void *)((identity_file) + 1) - (size_t)(const void *)(identity_file) == 1) ? __builtin_strcmp (identity_file, "-") : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (identity_file); register int __result = __s1[0] - ((const unsigned char *) (const char *) ("-"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) ("-"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) ("-"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) ("-"))[3]); } } __result; }))) : __builtin_strcmp (identity_file, "-")))); }) != 0) {
+ if ((in = fopen(identity_file, "r")) == ((void *)0)) {
+ fatal("Couldn't open modulus candidate "
+ "file \"%s\": %s", identity_file,
+ strerror((*__errno_location ())));
+ }
+ } else
+ in = stdin;
+ if (out == ((void *)0)) {
+ fatal("Couldn't open moduli file \"%s\": %s",
+ out_file, strerror((*__errno_location ())));
+ }
+ if (prime_test(in, out, rounds == 0 ? 100 : rounds,
+ generator_wanted, checkpoint,
+ start_lineno, lines_to_process) != 0)
+ fatal("modulus screening failed");
+ return (0);
+ }
+ if (gen_all_hostkeys) {
+ do_gen_all_hostkeys(pw);
+ return (0);
+ }
+ if (key_type_name == ((void *)0))
+ key_type_name = "rsa";
+ type = key_type_from_name(key_type_name);
+ type_bits_valid(type, &bits);
+ if (!quiet)
+ printf("Generating public/private %s key pair.\n", key_type_name);
+ private = key_generate(type, bits);
+ if (private == ((void *)0)) {
+ fprintf(stderr, "key_generate failed\n");
+ exit(1);
+ }
+ public = key_from_private(private);
+ if (!have_identity)
+ ask_filename(pw, "Enter file in which to save the key");
+ snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",
+ pw->pw_dir, ".ssh");
+ if (strstr(identity_file, dotsshdir) != ((void *)0)) {
+ if (stat(dotsshdir, &st) < 0) {
+ if ((*__errno_location ()) != 2) {
+ error("Could not stat %s: %s", dotsshdir,
+ strerror((*__errno_location ())));
+ } else if (mkdir(dotsshdir, 0700) < 0) {
+ error("Could not create directory '%s': %s",
+ dotsshdir, strerror((*__errno_location ())));
+ } else if (!quiet)
+ printf("Created directory '%s'.\n", dotsshdir);
+ }
+ }
+ if (stat(identity_file, &st) >= 0) {
+ char yesno[3];
+ printf("%s already exists.\n", identity_file);
+ printf("Overwrite (y/n)? ");
+ fflush(stdout);
+ if (fgets(yesno, sizeof(yesno), stdin) == ((void *)0))
+ exit(1);
+ if (yesno[0] != 'y' && yesno[0] != 'Y')
+ exit(1);
+ }
+ if (identity_passphrase)
+ passphrase1 = xstrdup(identity_passphrase);
+ else if (identity_new_passphrase)
+ passphrase1 = xstrdup(identity_new_passphrase);
+ else {
+passphrase_again:
+ passphrase1 =
+ read_passphrase("Enter passphrase (empty for no "
+ "passphrase): ", 0x0002);
+ passphrase2 = read_passphrase("Enter same passphrase again: ",
+ 0x0002);
+ if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (passphrase1) && __builtin_constant_p (passphrase2) && (__s1_len = strlen (passphrase1), __s2_len = strlen (passphrase2), (!((size_t)(const void *)((passphrase1) + 1) - (size_t)(const void *)(passphrase1) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((passphrase2) + 1) - (size_t)(const void *)(passphrase2) == 1) || __s2_len >= 4)) ? __builtin_strcmp (passphrase1, passphrase2) : (__builtin_constant_p (passphrase1) && ((size_t)(const void *)((passphrase1) + 1) - (size_t)(const void *)(passphrase1) == 1) && (__s1_len = strlen (passphrase1), __s1_len < 4) ? (__builtin_constant_p (passphrase2) && ((size_t)(const void *)((passphrase2) + 1) - (size_t)(const void *)(passphrase2) == 1) ? __builtin_strcmp (passphrase1, passphrase2) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (passphrase2); register int __result = (((const unsigned char *) (const char *) (passphrase1))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (passphrase1))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (passphrase1))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (passphrase1))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (passphrase2) && ((size_t)(const void *)((passphrase2) + 1) - (size_t)(const void *)(passphrase2) == 1) && (__s2_len = strlen (passphrase2), __s2_len < 4) ? (__builtin_constant_p (passphrase1) && ((size_t)(const void *)((passphrase1) + 1) - (size_t)(const void *)(passphrase1) == 1) ? __builtin_strcmp (passphrase1, passphrase2) : (__extension__ ({ const unsigned char *__s1 = (const unsigned char *) (const char *) (passphrase1); register int __result = __s1[0] - ((const unsigned char *) (const char *) (passphrase2))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((const unsigned char *) (const char *) (passphrase2))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((const unsigned char *) (const char *) (passphrase2))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((const unsigned char *) (const char *) (passphrase2))[3]); } } __result; }))) : __builtin_strcmp (passphrase1, passphrase2)))); }) != 0) {
+ explicit_bzero(passphrase1, strlen(passphrase1));
+ explicit_bzero(passphrase2, strlen(passphrase2));
+ free(passphrase1);
+ free(passphrase2);
+ printf("Passphrases do not match. Try again.\n");
+ goto passphrase_again;
+ }
+ explicit_bzero(passphrase2, strlen(passphrase2));
+ free(passphrase2);
+ }
+ if (identity_comment) {
+ strlcpy(comment, identity_comment, sizeof(comment));
+ } else {
+ snprintf(comment, sizeof comment, "%s@%s", pw->pw_name, hostname);
+ }
+ if (!key_save_private(private, identity_file, passphrase1, comment,
+ use_new_format, new_format_cipher, rounds)) {
+ printf("Saving the key failed: %s.\n", identity_file);
+ explicit_bzero(passphrase1, strlen(passphrase1));
+ free(passphrase1);
+ exit(1);
+ }
+ explicit_bzero(passphrase1, strlen(passphrase1));
+ free(passphrase1);
+ key_free(private);
+ if (!quiet)
+ printf("Your identification has been saved in %s.\n", identity_file);
+ strlcat(identity_file, ".pub", sizeof(identity_file));
+ fd = open(identity_file, 01 | 00000400 | 01000, 0644);
+ if (fd == -1) {
+ printf("Could not save your public key in %s\n", identity_file);
+ exit(1);
+ }
+ f = fdopen(fd, "w");
+ if (f == ((void *)0)) {
+ printf("fdopen %s failed\n", identity_file);
+ exit(1);
+ }
+ if (!key_write(public, f))
+ fprintf(stderr, "write key failed\n");
+ fprintf(f, " %s\n", comment);
+ fclose(f);
+ if (!quiet) {
+ char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX);
+ char *ra = key_fingerprint(public, SSH_FP_MD5,
+ SSH_FP_RANDOMART);
+ printf("Your public key has been saved in %s.\n",
+ identity_file);
+ printf("The key fingerprint is:\n");
+ printf("%s %s\n", fp, comment);
+ printf("The key's randomart image is:\n");
+ printf("%s\n", ra);
+ free(ra);
+ free(fp);
+ }
+ key_free(public);
+ exit(0);
+}