key.c (162856) | key.c (164149) |
---|---|
1/* $OpenBSD: key.c,v 1.67 2006/08/03 03:34:42 deraadt Exp $ */ | 1/* $OpenBSD: key.c,v 1.68 2006/11/06 21:25:28 markus Exp $ */ |
2/* 3 * read_bignum(): 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * 6 * As far as I am concerned, the code I have written for this software 7 * can be used freely for any purpose. Any derived versions of this 8 * software must be clearly marked as such, and if the derived work is 9 * incompatible with the protocol description in the RFC file, it must be --- 602 unchanged lines hidden (view full) --- 612 613Key * 614key_from_private(const Key *k) 615{ 616 Key *n = NULL; 617 switch (k->type) { 618 case KEY_DSA: 619 n = key_new(k->type); | 2/* 3 * read_bignum(): 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 5 * 6 * As far as I am concerned, the code I have written for this software 7 * can be used freely for any purpose. Any derived versions of this 8 * software must be clearly marked as such, and if the derived work is 9 * incompatible with the protocol description in the RFC file, it must be --- 602 unchanged lines hidden (view full) --- 612 613Key * 614key_from_private(const Key *k) 615{ 616 Key *n = NULL; 617 switch (k->type) { 618 case KEY_DSA: 619 n = key_new(k->type); |
620 BN_copy(n->dsa->p, k->dsa->p); 621 BN_copy(n->dsa->q, k->dsa->q); 622 BN_copy(n->dsa->g, k->dsa->g); 623 BN_copy(n->dsa->pub_key, k->dsa->pub_key); | 620 if ((BN_copy(n->dsa->p, k->dsa->p) == NULL) || 621 (BN_copy(n->dsa->q, k->dsa->q) == NULL) || 622 (BN_copy(n->dsa->g, k->dsa->g) == NULL) || 623 (BN_copy(n->dsa->pub_key, k->dsa->pub_key) == NULL)) 624 fatal("key_from_private: BN_copy failed"); |
624 break; 625 case KEY_RSA: 626 case KEY_RSA1: 627 n = key_new(k->type); | 625 break; 626 case KEY_RSA: 627 case KEY_RSA1: 628 n = key_new(k->type); |
628 BN_copy(n->rsa->n, k->rsa->n); 629 BN_copy(n->rsa->e, k->rsa->e); | 629 if ((BN_copy(n->rsa->n, k->rsa->n) == NULL) || 630 (BN_copy(n->rsa->e, k->rsa->e) == NULL)) 631 fatal("key_from_private: BN_copy failed"); |
630 break; 631 default: 632 fatal("key_from_private: unknown type %d", k->type); 633 break; 634 } 635 return n; 636} 637 --- 229 unchanged lines hidden --- | 632 break; 633 default: 634 fatal("key_from_private: unknown type %d", k->type); 635 break; 636 } 637 return n; 638} 639 --- 229 unchanged lines hidden --- |