[BACK]Return to dsa.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/Attic/dsa.c between version 1.7 and 1.7.2.1

version 1.7, 2000/05/08 17:42:24 version 1.7.2.1, 2000/09/01 18:23:19
Line 28 
Line 28 
  */   */
   
 #include "includes.h"  #include "includes.h"
 RCSID("$Id$");  RCSID("$OpenBSD$");
   
 #include "ssh.h"  #include "ssh.h"
 #include "xmalloc.h"  #include "xmalloc.h"
Line 53 
Line 53 
 #define SIGBLOB_LEN     (2*INTBLOB_LEN)  #define SIGBLOB_LEN     (2*INTBLOB_LEN)
   
 Key *  Key *
 dsa_key_from_blob(  dsa_key_from_blob(char *blob, int blen)
     char *blob, int blen)  
 {  {
         Buffer b;          Buffer b;
         char *ktype;          char *ktype;
Line 66 
Line 65 
         dump_base64(stderr, blob, blen);          dump_base64(stderr, blob, blen);
 #endif  #endif
         /* fetch & parse DSA/DSS pubkey */          /* fetch & parse DSA/DSS pubkey */
         key = key_new(KEY_DSA);  
         dsa = key->dsa;  
         buffer_init(&b);          buffer_init(&b);
         buffer_append(&b, blob, blen);          buffer_append(&b, blob, blen);
         ktype = buffer_get_string(&b, NULL);          ktype = buffer_get_string(&b, NULL);
         if (strcmp(KEX_DSS, ktype) != 0) {          if (strcmp(KEX_DSS, ktype) != 0) {
                 error("dsa_key_from_blob: cannot handle type  %s", ktype);                  error("dsa_key_from_blob: cannot handle type %s", ktype);
                 key_free(key);                  buffer_free(&b);
                   xfree(ktype);
                 return NULL;                  return NULL;
         }          }
           key = key_new(KEY_DSA);
           dsa = key->dsa;
         buffer_get_bignum2(&b, dsa->p);          buffer_get_bignum2(&b, dsa->p);
         buffer_get_bignum2(&b, dsa->q);          buffer_get_bignum2(&b, dsa->q);
         buffer_get_bignum2(&b, dsa->g);          buffer_get_bignum2(&b, dsa->g);
Line 84 
Line 84 
         if(rlen != 0)          if(rlen != 0)
                 error("dsa_key_from_blob: remaining bytes in key blob %d", rlen);                  error("dsa_key_from_blob: remaining bytes in key blob %d", rlen);
         buffer_free(&b);          buffer_free(&b);
           xfree(ktype);
   
         debug("keytype %s", ktype);  
 #ifdef DEBUG_DSS  #ifdef DEBUG_DSS
         DSA_print_fp(stderr, dsa, 8);          DSA_print_fp(stderr, dsa, 8);
 #endif  #endif
Line 197 
Line 197 
         DSA_SIG *sig;          DSA_SIG *sig;
         EVP_MD *evp_md = EVP_sha1();          EVP_MD *evp_md = EVP_sha1();
         EVP_MD_CTX md;          EVP_MD_CTX md;
         char *ktype;  
         unsigned char *sigblob;          unsigned char *sigblob;
         char *txt;          char *txt;
         unsigned int len;          unsigned int len;
Line 227 
Line 226 
                 len = signaturelen;                  len = signaturelen;
         } else {          } else {
                 /* ietf-drafts */                  /* ietf-drafts */
                   char *ktype;
                 buffer_init(&b);                  buffer_init(&b);
                 buffer_append(&b, (char *) signature, signaturelen);                  buffer_append(&b, (char *) signature, signaturelen);
                 ktype = buffer_get_string(&b, NULL);                  ktype = buffer_get_string(&b, NULL);
                   if (strcmp(KEX_DSS, ktype) != 0) {
                           error("dsa_verify: cannot handle type %s", ktype);
                           buffer_free(&b);
                           return -1;
                   }
                 sigblob = (unsigned char *)buffer_get_string(&b, &len);                  sigblob = (unsigned char *)buffer_get_string(&b, &len);
                 rlen = buffer_len(&b);                  rlen = buffer_len(&b);
                 if(rlen != 0)                  if(rlen != 0) {
                         error("remaining bytes in signature %d", rlen);                          error("remaining bytes in signature %d", rlen);
                           buffer_free(&b);
                           return -1;
                   }
                 buffer_free(&b);                  buffer_free(&b);
                   xfree(ktype);
         }          }
   
         if (len != SIGBLOB_LEN) {          if (len != SIGBLOB_LEN) {

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.7.2.1