]> andersk Git - openssh.git/blob - authfile.c
- stevesk@cvs.openbsd.org 2006/07/26 02:35:17
[openssh.git] / authfile.c
1 /* $OpenBSD: authfile.c,v 1.72 2006/07/26 02:35:17 stevesk Exp $ */
2 /*
3  * Author: Tatu Ylonen <ylo@cs.hut.fi>
4  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5  *                    All rights reserved
6  * This file contains functions for reading and writing identity files, and
7  * for reading the passphrase from the user.
8  *
9  * As far as I am concerned, the code I have written for this software
10  * can be used freely for any purpose.  Any derived versions of this
11  * software must be clearly marked as such, and if the derived work is
12  * incompatible with the protocol description in the RFC file, it must be
13  * called by a name other than "ssh" or "Secure Shell".
14  *
15  *
16  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions
20  * are met:
21  * 1. Redistributions of source code must retain the above copyright
22  *    notice, this list of conditions and the following disclaimer.
23  * 2. Redistributions in binary form must reproduce the above copyright
24  *    notice, this list of conditions and the following disclaimer in the
25  *    documentation and/or other materials provided with the distribution.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38
39 #include "includes.h"
40
41 #include <sys/types.h>
42 #include <sys/stat.h>
43 #include <sys/param.h>
44
45 #include <openssl/err.h>
46 #include <openssl/evp.h>
47 #include <openssl/pem.h>
48
49 #include <errno.h>
50 #include <fcntl.h>
51 #include <string.h>
52 #include <unistd.h>
53
54 #include "cipher.h"
55 #include "xmalloc.h"
56 #include "buffer.h"
57 #include "bufaux.h"
58 #include "key.h"
59 #include "ssh.h"
60 #include "log.h"
61 #include "authfile.h"
62 #include "rsa.h"
63 #include "misc.h"
64 #include "atomicio.h"
65
66 /* Version identification string for SSH v1 identity files. */
67 static const char authfile_id_string[] =
68     "SSH PRIVATE KEY FILE FORMAT 1.1\n";
69
70 /*
71  * Saves the authentication (private) key in a file, encrypting it with
72  * passphrase.  The identification of the file (lowest 64 bits of n) will
73  * precede the key to provide identification of the key without needing a
74  * passphrase.
75  */
76
77 static int
78 key_save_private_rsa1(Key *key, const char *filename, const char *passphrase,
79     const char *comment)
80 {
81         Buffer buffer, encrypted;
82         u_char buf[100], *cp;
83         int fd, i, cipher_num;
84         CipherContext ciphercontext;
85         Cipher *cipher;
86         u_int32_t rnd;
87
88         /*
89          * If the passphrase is empty, use SSH_CIPHER_NONE to ease converting
90          * to another cipher; otherwise use SSH_AUTHFILE_CIPHER.
91          */
92         cipher_num = (strcmp(passphrase, "") == 0) ?
93             SSH_CIPHER_NONE : SSH_AUTHFILE_CIPHER;
94         if ((cipher = cipher_by_number(cipher_num)) == NULL)
95                 fatal("save_private_key_rsa: bad cipher");
96
97         /* This buffer is used to built the secret part of the private key. */
98         buffer_init(&buffer);
99
100         /* Put checkbytes for checking passphrase validity. */
101         rnd = arc4random();
102         buf[0] = rnd & 0xff;
103         buf[1] = (rnd >> 8) & 0xff;
104         buf[2] = buf[0];
105         buf[3] = buf[1];
106         buffer_append(&buffer, buf, 4);
107
108         /*
109          * Store the private key (n and e will not be stored because they
110          * will be stored in plain text, and storing them also in encrypted
111          * format would just give known plaintext).
112          */
113         buffer_put_bignum(&buffer, key->rsa->d);
114         buffer_put_bignum(&buffer, key->rsa->iqmp);
115         buffer_put_bignum(&buffer, key->rsa->q);        /* reverse from SSL p */
116         buffer_put_bignum(&buffer, key->rsa->p);        /* reverse from SSL q */
117
118         /* Pad the part to be encrypted until its size is a multiple of 8. */
119         while (buffer_len(&buffer) % 8 != 0)
120                 buffer_put_char(&buffer, 0);
121
122         /* This buffer will be used to contain the data in the file. */
123         buffer_init(&encrypted);
124
125         /* First store keyfile id string. */
126         for (i = 0; authfile_id_string[i]; i++)
127                 buffer_put_char(&encrypted, authfile_id_string[i]);
128         buffer_put_char(&encrypted, 0);
129
130         /* Store cipher type. */
131         buffer_put_char(&encrypted, cipher_num);
132         buffer_put_int(&encrypted, 0);  /* For future extension */
133
134         /* Store public key.  This will be in plain text. */
135         buffer_put_int(&encrypted, BN_num_bits(key->rsa->n));
136         buffer_put_bignum(&encrypted, key->rsa->n);
137         buffer_put_bignum(&encrypted, key->rsa->e);
138         buffer_put_cstring(&encrypted, comment);
139
140         /* Allocate space for the private part of the key in the buffer. */
141         cp = buffer_append_space(&encrypted, buffer_len(&buffer));
142
143         cipher_set_key_string(&ciphercontext, cipher, passphrase,
144             CIPHER_ENCRYPT);
145         cipher_crypt(&ciphercontext, cp,
146             buffer_ptr(&buffer), buffer_len(&buffer));
147         cipher_cleanup(&ciphercontext);
148         memset(&ciphercontext, 0, sizeof(ciphercontext));
149
150         /* Destroy temporary data. */
151         memset(buf, 0, sizeof(buf));
152         buffer_free(&buffer);
153
154         fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
155         if (fd < 0) {
156                 error("open %s failed: %s.", filename, strerror(errno));
157                 buffer_free(&encrypted);
158                 return 0;
159         }
160         if (atomicio(vwrite, fd, buffer_ptr(&encrypted),
161             buffer_len(&encrypted)) != buffer_len(&encrypted)) {
162                 error("write to key file %s failed: %s", filename,
163                     strerror(errno));
164                 buffer_free(&encrypted);
165                 close(fd);
166                 unlink(filename);
167                 return 0;
168         }
169         close(fd);
170         buffer_free(&encrypted);
171         return 1;
172 }
173
174 /* save SSH v2 key in OpenSSL PEM format */
175 static int
176 key_save_private_pem(Key *key, const char *filename, const char *_passphrase,
177     const char *comment)
178 {
179         FILE *fp;
180         int fd;
181         int success = 0;
182         int len = strlen(_passphrase);
183         u_char *passphrase = (len > 0) ? (u_char *)_passphrase : NULL;
184         const EVP_CIPHER *cipher = (len > 0) ? EVP_des_ede3_cbc() : NULL;
185
186         if (len > 0 && len <= 4) {
187                 error("passphrase too short: have %d bytes, need > 4", len);
188                 return 0;
189         }
190         fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600);
191         if (fd < 0) {
192                 error("open %s failed: %s.", filename, strerror(errno));
193                 return 0;
194         }
195         fp = fdopen(fd, "w");
196         if (fp == NULL ) {
197                 error("fdopen %s failed: %s.", filename, strerror(errno));
198                 close(fd);
199                 return 0;
200         }
201         switch (key->type) {
202         case KEY_DSA:
203                 success = PEM_write_DSAPrivateKey(fp, key->dsa,
204                     cipher, passphrase, len, NULL, NULL);
205                 break;
206         case KEY_RSA:
207                 success = PEM_write_RSAPrivateKey(fp, key->rsa,
208                     cipher, passphrase, len, NULL, NULL);
209                 break;
210         }
211         fclose(fp);
212         return success;
213 }
214
215 int
216 key_save_private(Key *key, const char *filename, const char *passphrase,
217     const char *comment)
218 {
219         switch (key->type) {
220         case KEY_RSA1:
221                 return key_save_private_rsa1(key, filename, passphrase,
222                     comment);
223         case KEY_DSA:
224         case KEY_RSA:
225                 return key_save_private_pem(key, filename, passphrase,
226                     comment);
227         default:
228                 break;
229         }
230         error("key_save_private: cannot save key type %d", key->type);
231         return 0;
232 }
233
234 /*
235  * Loads the public part of the ssh v1 key file.  Returns NULL if an error was
236  * encountered (the file does not exist or is not readable), and the key
237  * otherwise.
238  */
239
240 static Key *
241 key_load_public_rsa1(int fd, const char *filename, char **commentp)
242 {
243         Buffer buffer;
244         Key *pub;
245         struct stat st;
246         char *cp;
247         u_int i;
248         size_t len;
249
250         if (fstat(fd, &st) < 0) {
251                 error("fstat for key file %.200s failed: %.100s",
252                     filename, strerror(errno));
253                 return NULL;
254         }
255         if (st.st_size > 1*1024*1024) {
256                 error("key file %.200s too large", filename);
257                 return NULL;
258         }
259         len = (size_t)st.st_size;               /* truncated */
260
261         buffer_init(&buffer);
262         cp = buffer_append_space(&buffer, len);
263
264         if (atomicio(read, fd, cp, len) != len) {
265                 debug("Read from key file %.200s failed: %.100s", filename,
266                     strerror(errno));
267                 buffer_free(&buffer);
268                 return NULL;
269         }
270
271         /* Check that it is at least big enough to contain the ID string. */
272         if (len < sizeof(authfile_id_string)) {
273                 debug3("Not a RSA1 key file %.200s.", filename);
274                 buffer_free(&buffer);
275                 return NULL;
276         }
277         /*
278          * Make sure it begins with the id string.  Consume the id string
279          * from the buffer.
280          */
281         for (i = 0; i < sizeof(authfile_id_string); i++)
282                 if (buffer_get_char(&buffer) != authfile_id_string[i]) {
283                         debug3("Not a RSA1 key file %.200s.", filename);
284                         buffer_free(&buffer);
285                         return NULL;
286                 }
287         /* Skip cipher type and reserved data. */
288         (void) buffer_get_char(&buffer);        /* cipher type */
289         (void) buffer_get_int(&buffer);         /* reserved */
290
291         /* Read the public key from the buffer. */
292         (void) buffer_get_int(&buffer);
293         pub = key_new(KEY_RSA1);
294         buffer_get_bignum(&buffer, pub->rsa->n);
295         buffer_get_bignum(&buffer, pub->rsa->e);
296         if (commentp)
297                 *commentp = buffer_get_string(&buffer, NULL);
298         /* The encrypted private part is not parsed by this function. */
299
300         buffer_free(&buffer);
301         return pub;
302 }
303
304 /* load public key from private-key file, works only for SSH v1 */
305 Key *
306 key_load_public_type(int type, const char *filename, char **commentp)
307 {
308         Key *pub;
309         int fd;
310
311         if (type == KEY_RSA1) {
312                 fd = open(filename, O_RDONLY);
313                 if (fd < 0)
314                         return NULL;
315                 pub = key_load_public_rsa1(fd, filename, commentp);
316                 close(fd);
317                 return pub;
318         }
319         return NULL;
320 }
321
322 /*
323  * Loads the private key from the file.  Returns 0 if an error is encountered
324  * (file does not exist or is not readable, or passphrase is bad). This
325  * initializes the private key.
326  * Assumes we are called under uid of the owner of the file.
327  */
328
329 static Key *
330 key_load_private_rsa1(int fd, const char *filename, const char *passphrase,
331     char **commentp)
332 {
333         u_int i;
334         int check1, check2, cipher_type;
335         size_t len;
336         Buffer buffer, decrypted;
337         u_char *cp;
338         CipherContext ciphercontext;
339         Cipher *cipher;
340         Key *prv = NULL;
341         struct stat st;
342
343         if (fstat(fd, &st) < 0) {
344                 error("fstat for key file %.200s failed: %.100s",
345                     filename, strerror(errno));
346                 close(fd);
347                 return NULL;
348         }
349         if (st.st_size > 1*1024*1024) {
350                 error("key file %.200s too large", filename);
351                 close(fd);
352                 return (NULL);
353         }
354         len = (size_t)st.st_size;               /* truncated */
355
356         buffer_init(&buffer);
357         cp = buffer_append_space(&buffer, len);
358
359         if (atomicio(read, fd, cp, len) != len) {
360                 debug("Read from key file %.200s failed: %.100s", filename,
361                     strerror(errno));
362                 buffer_free(&buffer);
363                 close(fd);
364                 return NULL;
365         }
366
367         /* Check that it is at least big enough to contain the ID string. */
368         if (len < sizeof(authfile_id_string)) {
369                 debug3("Not a RSA1 key file %.200s.", filename);
370                 buffer_free(&buffer);
371                 close(fd);
372                 return NULL;
373         }
374         /*
375          * Make sure it begins with the id string.  Consume the id string
376          * from the buffer.
377          */
378         for (i = 0; i < sizeof(authfile_id_string); i++)
379                 if (buffer_get_char(&buffer) != authfile_id_string[i]) {
380                         debug3("Not a RSA1 key file %.200s.", filename);
381                         buffer_free(&buffer);
382                         close(fd);
383                         return NULL;
384                 }
385
386         /* Read cipher type. */
387         cipher_type = buffer_get_char(&buffer);
388         (void) buffer_get_int(&buffer); /* Reserved data. */
389
390         /* Read the public key from the buffer. */
391         (void) buffer_get_int(&buffer);
392         prv = key_new_private(KEY_RSA1);
393
394         buffer_get_bignum(&buffer, prv->rsa->n);
395         buffer_get_bignum(&buffer, prv->rsa->e);
396         if (commentp)
397                 *commentp = buffer_get_string(&buffer, NULL);
398         else
399                 xfree(buffer_get_string(&buffer, NULL));
400
401         /* Check that it is a supported cipher. */
402         cipher = cipher_by_number(cipher_type);
403         if (cipher == NULL) {
404                 debug("Unsupported cipher %d used in key file %.200s.",
405                     cipher_type, filename);
406                 buffer_free(&buffer);
407                 goto fail;
408         }
409         /* Initialize space for decrypted data. */
410         buffer_init(&decrypted);
411         cp = buffer_append_space(&decrypted, buffer_len(&buffer));
412
413         /* Rest of the buffer is encrypted.  Decrypt it using the passphrase. */
414         cipher_set_key_string(&ciphercontext, cipher, passphrase,
415             CIPHER_DECRYPT);
416         cipher_crypt(&ciphercontext, cp,
417             buffer_ptr(&buffer), buffer_len(&buffer));
418         cipher_cleanup(&ciphercontext);
419         memset(&ciphercontext, 0, sizeof(ciphercontext));
420         buffer_free(&buffer);
421
422         check1 = buffer_get_char(&decrypted);
423         check2 = buffer_get_char(&decrypted);
424         if (check1 != buffer_get_char(&decrypted) ||
425             check2 != buffer_get_char(&decrypted)) {
426                 if (strcmp(passphrase, "") != 0)
427                         debug("Bad passphrase supplied for key file %.200s.",
428                             filename);
429                 /* Bad passphrase. */
430                 buffer_free(&decrypted);
431                 goto fail;
432         }
433         /* Read the rest of the private key. */
434         buffer_get_bignum(&decrypted, prv->rsa->d);
435         buffer_get_bignum(&decrypted, prv->rsa->iqmp);          /* u */
436         /* in SSL and SSH v1 p and q are exchanged */
437         buffer_get_bignum(&decrypted, prv->rsa->q);             /* p */
438         buffer_get_bignum(&decrypted, prv->rsa->p);             /* q */
439
440         /* calculate p-1 and q-1 */
441         rsa_generate_additional_parameters(prv->rsa);
442
443         buffer_free(&decrypted);
444
445         /* enable blinding */
446         if (RSA_blinding_on(prv->rsa, NULL) != 1) {
447                 error("key_load_private_rsa1: RSA_blinding_on failed");
448                 goto fail;
449         }
450         close(fd);
451         return prv;
452
453 fail:
454         if (commentp)
455                 xfree(*commentp);
456         close(fd);
457         key_free(prv);
458         return NULL;
459 }
460
461 Key *
462 key_load_private_pem(int fd, int type, const char *passphrase,
463     char **commentp)
464 {
465         FILE *fp;
466         EVP_PKEY *pk = NULL;
467         Key *prv = NULL;
468         char *name = "<no key>";
469
470         fp = fdopen(fd, "r");
471         if (fp == NULL) {
472                 error("fdopen failed: %s", strerror(errno));
473                 close(fd);
474                 return NULL;
475         }
476         pk = PEM_read_PrivateKey(fp, NULL, NULL, (char *)passphrase);
477         if (pk == NULL) {
478                 debug("PEM_read_PrivateKey failed");
479                 (void)ERR_get_error();
480         } else if (pk->type == EVP_PKEY_RSA &&
481             (type == KEY_UNSPEC||type==KEY_RSA)) {
482                 prv = key_new(KEY_UNSPEC);
483                 prv->rsa = EVP_PKEY_get1_RSA(pk);
484                 prv->type = KEY_RSA;
485                 name = "rsa w/o comment";
486 #ifdef DEBUG_PK
487                 RSA_print_fp(stderr, prv->rsa, 8);
488 #endif
489                 if (RSA_blinding_on(prv->rsa, NULL) != 1) {
490                         error("key_load_private_pem: RSA_blinding_on failed");
491                         key_free(prv);
492                         prv = NULL;
493                 }
494         } else if (pk->type == EVP_PKEY_DSA &&
495             (type == KEY_UNSPEC||type==KEY_DSA)) {
496                 prv = key_new(KEY_UNSPEC);
497                 prv->dsa = EVP_PKEY_get1_DSA(pk);
498                 prv->type = KEY_DSA;
499                 name = "dsa w/o comment";
500 #ifdef DEBUG_PK
501                 DSA_print_fp(stderr, prv->dsa, 8);
502 #endif
503         } else {
504                 error("PEM_read_PrivateKey: mismatch or "
505                     "unknown EVP_PKEY save_type %d", pk->save_type);
506         }
507         fclose(fp);
508         if (pk != NULL)
509                 EVP_PKEY_free(pk);
510         if (prv != NULL && commentp)
511                 *commentp = xstrdup(name);
512         debug("read PEM private key done: type %s",
513             prv ? key_type(prv) : "<unknown>");
514         return prv;
515 }
516
517 int
518 key_perm_ok(int fd, const char *filename)
519 {
520         struct stat st;
521
522         if (fstat(fd, &st) < 0)
523                 return 0;
524         /*
525          * if a key owned by the user is accessed, then we check the
526          * permissions of the file. if the key owned by a different user,
527          * then we don't care.
528          */
529 #ifdef HAVE_CYGWIN
530         if (check_ntsec(filename))
531 #endif
532         if ((st.st_uid == getuid()) && (st.st_mode & 077) != 0) {
533                 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
534                 error("@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @");
535                 error("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
536                 error("Permissions 0%3.3o for '%s' are too open.",
537                     (u_int)st.st_mode & 0777, filename);
538                 error("It is recommended that your private key files are NOT accessible by others.");
539                 error("This private key will be ignored.");
540                 return 0;
541         }
542         return 1;
543 }
544
545 Key *
546 key_load_private_type(int type, const char *filename, const char *passphrase,
547     char **commentp, int *perm_ok)
548 {
549         int fd;
550
551         fd = open(filename, O_RDONLY);
552         if (fd < 0)
553                 return NULL;
554         if (!key_perm_ok(fd, filename)) {
555                 if (perm_ok != NULL)
556                         *perm_ok = 0;
557                 error("bad permissions: ignore key: %s", filename);
558                 close(fd);
559                 return NULL;
560         }
561         if (perm_ok != NULL)
562                 *perm_ok = 1;
563         switch (type) {
564         case KEY_RSA1:
565                 return key_load_private_rsa1(fd, filename, passphrase,
566                     commentp);
567                 /* closes fd */
568         case KEY_DSA:
569         case KEY_RSA:
570         case KEY_UNSPEC:
571                 return key_load_private_pem(fd, type, passphrase, commentp);
572                 /* closes fd */
573         default:
574                 close(fd);
575                 break;
576         }
577         return NULL;
578 }
579
580 Key *
581 key_load_private(const char *filename, const char *passphrase,
582     char **commentp)
583 {
584         Key *pub, *prv;
585         int fd;
586
587         fd = open(filename, O_RDONLY);
588         if (fd < 0)
589                 return NULL;
590         if (!key_perm_ok(fd, filename)) {
591                 error("bad permissions: ignore key: %s", filename);
592                 close(fd);
593                 return NULL;
594         }
595         pub = key_load_public_rsa1(fd, filename, commentp);
596         lseek(fd, (off_t) 0, SEEK_SET);         /* rewind */
597         if (pub == NULL) {
598                 /* closes fd */
599                 prv = key_load_private_pem(fd, KEY_UNSPEC, passphrase, NULL);
600                 /* use the filename as a comment for PEM */
601                 if (commentp && prv)
602                         *commentp = xstrdup(filename);
603         } else {
604                 /* it's a SSH v1 key if the public key part is readable */
605                 key_free(pub);
606                 /* closes fd */
607                 prv = key_load_private_rsa1(fd, filename, passphrase, NULL);
608         }
609         return prv;
610 }
611
612 static int
613 key_try_load_public(Key *k, const char *filename, char **commentp)
614 {
615         FILE *f;
616         char line[SSH_MAX_PUBKEY_BYTES];
617         char *cp;
618         u_long linenum = 0;
619
620         f = fopen(filename, "r");
621         if (f != NULL) {
622                 while (read_keyfile_line(f, filename, line, sizeof(line),
623                             &linenum) != -1) {
624                         cp = line;
625                         switch (*cp) {
626                         case '#':
627                         case '\n':
628                         case '\0':
629                                 continue;
630                         }
631                         /* Skip leading whitespace. */
632                         for (; *cp && (*cp == ' ' || *cp == '\t'); cp++)
633                                 ;
634                         if (*cp) {
635                                 if (key_read(k, &cp) == 1) {
636                                         if (commentp)
637                                                 *commentp=xstrdup(filename);
638                                         fclose(f);
639                                         return 1;
640                                 }
641                         }
642                 }
643                 fclose(f);
644         }
645         return 0;
646 }
647
648 /* load public key from ssh v1 private or any pubkey file */
649 Key *
650 key_load_public(const char *filename, char **commentp)
651 {
652         Key *pub;
653         char file[MAXPATHLEN];
654
655         /* try rsa1 private key */
656         pub = key_load_public_type(KEY_RSA1, filename, commentp);
657         if (pub != NULL)
658                 return pub;
659
660         /* try rsa1 public key */
661         pub = key_new(KEY_RSA1);
662         if (key_try_load_public(pub, filename, commentp) == 1)
663                 return pub;
664         key_free(pub);
665
666         /* try ssh2 public key */
667         pub = key_new(KEY_UNSPEC);
668         if (key_try_load_public(pub, filename, commentp) == 1)
669                 return pub;
670         if ((strlcpy(file, filename, sizeof file) < sizeof(file)) &&
671             (strlcat(file, ".pub", sizeof file) < sizeof(file)) &&
672             (key_try_load_public(pub, file, commentp) == 1))
673                 return pub;
674         key_free(pub);
675         return NULL;
676 }
This page took 0.247799 seconds and 5 git commands to generate.