Changeset View
Changeset View
Standalone View
Standalone View
sshbuf.h
Show All 15 Lines | |||||
*/ | */ | ||||
#ifndef _SSHBUF_H | #ifndef _SSHBUF_H | ||||
#define _SSHBUF_H | #define _SSHBUF_H | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <pwd.h> | |||||
#ifdef WITH_OPENSSL | #ifdef WITH_OPENSSL | ||||
# include <openssl/bn.h> | # include <openssl/bn.h> | ||||
# ifdef OPENSSL_HAS_ECC | # ifdef OPENSSL_HAS_ECC | ||||
# include <openssl/ec.h> | # include <openssl/ec.h> | ||||
# endif /* OPENSSL_HAS_ECC */ | # endif /* OPENSSL_HAS_ECC */ | ||||
#endif /* WITH_OPENSSL */ | #endif /* WITH_OPENSSL */ | ||||
#define SSHBUF_SIZE_MAX 0x8000000 /* Hard maximum size */ | #define SSHBUF_SIZE_MAX 0x8000000 /* Hard maximum size */ | ||||
▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | |||||
int sshbuf_b64tod(struct sshbuf *buf, const char *b64); | int sshbuf_b64tod(struct sshbuf *buf, const char *b64); | ||||
/* | /* | ||||
* Duplicate the contents of a buffer to a string (caller to free). | * Duplicate the contents of a buffer to a string (caller to free). | ||||
* Returns NULL on buffer error, or if the buffer contains a premature | * Returns NULL on buffer error, or if the buffer contains a premature | ||||
* nul character. | * nul character. | ||||
*/ | */ | ||||
char *sshbuf_dup_string(struct sshbuf *buf); | char *sshbuf_dup_string(struct sshbuf *buf); | ||||
/* | |||||
* store struct pwd | |||||
*/ | |||||
int sshbuf_put_passwd(struct sshbuf *buf, const struct passwd *pwent); | |||||
/* | |||||
* extract struct pwd | |||||
*/ | |||||
struct passwd *sshbuf_get_passwd(struct sshbuf *buf); | |||||
/* | |||||
* free struct passwd obtained from sshbuf_get_passwd. | |||||
*/ | |||||
void sshbuf_free_passwd(struct passwd *pwent); | |||||
/* Macros for decoding/encoding integers */ | /* Macros for decoding/encoding integers */ | ||||
#define PEEK_U64(p) \ | #define PEEK_U64(p) \ | ||||
(((u_int64_t)(((const u_char *)(p))[0]) << 56) | \ | (((u_int64_t)(((const u_char *)(p))[0]) << 56) | \ | ||||
((u_int64_t)(((const u_char *)(p))[1]) << 48) | \ | ((u_int64_t)(((const u_char *)(p))[1]) << 48) | \ | ||||
((u_int64_t)(((const u_char *)(p))[2]) << 40) | \ | ((u_int64_t)(((const u_char *)(p))[2]) << 40) | \ | ||||
((u_int64_t)(((const u_char *)(p))[3]) << 32) | \ | ((u_int64_t)(((const u_char *)(p))[3]) << 32) | \ | ||||
((u_int64_t)(((const u_char *)(p))[4]) << 24) | \ | ((u_int64_t)(((const u_char *)(p))[4]) << 24) | \ | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |