int fd, i; off_t len; Buffer buffer; char *cp;  fd = open(filename, O_RDONLY); if (fd < 0) return 0; len = lseek(fd, (off_t) 0, SEEK_END); lseek(fd, (off_t) 0, SEEK_SET);  buffer_init(&buffer); buffer_append_space(&buffer, &cp, len);  if (read(fd, cp, (size_t) len) != (size_t) len) { debug("Read from key file %.200s failed: %.100s", filename, strerror(errno)); buffer_free(&buffer); close(fd); return 0;
switch (key->type) { case KEY_RSA: return load_public_key_rsa(filename, key->rsa, comment_return); break; case KEY_DSA: default: break;
load_public_key(const char *filename, RSA * pub,		char **comment_return){	int fd, i;	off_t len;	Buffer buffer;	char *cp;	fd = open(filename, O_RDONLY);	if (fd < 0)		return 0;	len = lseek(fd, (off_t) 0, SEEK_END);	lseek(fd, (off_t) 0, SEEK_SET);	buffer_init(&buffer);	buffer_append_space(&buffer, &cp, len);	if (read(fd, cp, (size_t) len) != (size_t) len) {		debug("Read from key file %.200s failed: %.100s", filename,		      strerror(errno));		buffer_free(&buffer);		close(fd);		return 0;	}	close(fd);	/* Check that it is at least big enought to contain the ID string. */	if (len < strlen(AUTHFILE_ID_STRING) + 1) {		debug("Bad key file %.200s.", filename);		buffer_free(&buffer);		return 0;	}	/*	 * Make sure it begins with the id string.  Consume the id string	 * from the buffer.	 */	for (i = 0; i < (unsigned int) strlen(AUTHFILE_ID_STRING) + 1; i++)		if (buffer_get_char(&buffer) != (u_char) AUTHFILE_ID_STRING[i]) {			debug("Bad key file %.200s.", filename);			buffer_free(&buffer);			return 0;		}	/* Skip cipher type and reserved data. */	(void) buffer_get_char(&buffer);	/* cipher type */	(void) buffer_get_int(&buffer);		/* reserved */	/* Read the public key from the buffer. */	buffer_get_int(&buffer);	pub->n = BN_new();	buffer_get_bignum(&buffer, pub->n);	pub->e = BN_new();	buffer_get_bignum(&buffer, pub->e);	if (comment_return)		*comment_return = buffer_get_string(&buffer, NULL);	/* The encrypted private part is not parsed by this function. */	buffer_free(&buffer);	return 1;}