[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.2

version 1.7, 2000/05/08 17:42:24 version 1.7.2.2, 2000/11/08 21:30:46
Line 9 
Line 9 
  * 2. Redistributions in binary form must reproduce the above copyright   * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the   *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.   *    documentation and/or other materials provided with the distribution.
  * 3. All advertising materials mentioning features or use of this software  
  *    must display the following acknowledgement:  
  *      This product includes software developed by Markus Friedl.  
  * 4. The name of the author may not be used to endorse or promote products  
  *    derived from this software without specific prior written permission.  
  *   *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR   * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES   * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
Line 28 
Line 23 
  */   */
   
 #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 48 
 #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 60 
         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 79 
         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 192 
         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 221 
                 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.2