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

Diff for /src/usr.bin/ssh/ssh-dss.c between version 1.35 and 1.36

version 1.35, 2016/04/21 06:08:02 version 1.36, 2018/01/23 05:27:21
Line 80 
Line 80 
         BN_bn2bin(sig->r, sigblob + SIGBLOB_LEN - INTBLOB_LEN - rlen);          BN_bn2bin(sig->r, sigblob + SIGBLOB_LEN - INTBLOB_LEN - rlen);
         BN_bn2bin(sig->s, sigblob + SIGBLOB_LEN - slen);          BN_bn2bin(sig->s, sigblob + SIGBLOB_LEN - slen);
   
         if (compat & SSH_BUG_SIGBLOB) {          if ((b = sshbuf_new()) == NULL) {
                 if (sigp != NULL) {                  ret = SSH_ERR_ALLOC_FAIL;
                         if ((*sigp = malloc(SIGBLOB_LEN)) == NULL) {                  goto out;
                                 ret = SSH_ERR_ALLOC_FAIL;          }
                                 goto out;          if ((ret = sshbuf_put_cstring(b, "ssh-dss")) != 0 ||
                         }              (ret = sshbuf_put_string(b, sigblob, SIGBLOB_LEN)) != 0)
                         memcpy(*sigp, sigblob, SIGBLOB_LEN);                  goto out;
                 }  
                 if (lenp != NULL)          len = sshbuf_len(b);
                         *lenp = SIGBLOB_LEN;          if (sigp != NULL) {
                 ret = 0;                  if ((*sigp = malloc(len)) == NULL) {
         } else {  
                 /* ietf-drafts */  
                 if ((b = sshbuf_new()) == NULL) {  
                         ret = SSH_ERR_ALLOC_FAIL;                          ret = SSH_ERR_ALLOC_FAIL;
                         goto out;                          goto out;
                 }                  }
                 if ((ret = sshbuf_put_cstring(b, "ssh-dss")) != 0 ||                  memcpy(*sigp, sshbuf_ptr(b), len);
                     (ret = sshbuf_put_string(b, sigblob, SIGBLOB_LEN)) != 0)  
                         goto out;  
                 len = sshbuf_len(b);  
                 if (sigp != NULL) {  
                         if ((*sigp = malloc(len)) == NULL) {  
                                 ret = SSH_ERR_ALLOC_FAIL;  
                                 goto out;  
                         }  
                         memcpy(*sigp, sshbuf_ptr(b), len);  
                 }  
                 if (lenp != NULL)  
                         *lenp = len;  
                 ret = 0;  
         }          }
           if (lenp != NULL)
                   *lenp = len;
           ret = 0;
  out:   out:
         explicit_bzero(digest, sizeof(digest));          explicit_bzero(digest, sizeof(digest));
         if (sig != NULL)          if (sig != NULL)
Line 140 
Line 127 
                 return SSH_ERR_INTERNAL_ERROR;                  return SSH_ERR_INTERNAL_ERROR;
   
         /* fetch signature */          /* fetch signature */
         if (compat & SSH_BUG_SIGBLOB) {          if ((b = sshbuf_from(signature, signaturelen)) == NULL)
                 if ((sigblob = malloc(signaturelen)) == NULL)                  return SSH_ERR_ALLOC_FAIL;
                         return SSH_ERR_ALLOC_FAIL;          if (sshbuf_get_cstring(b, &ktype, NULL) != 0 ||
                 memcpy(sigblob, signature, signaturelen);              sshbuf_get_string(b, &sigblob, &len) != 0) {
                 len = signaturelen;                  ret = SSH_ERR_INVALID_FORMAT;
         } else {                  goto out;
                 /* ietf-drafts */          }
                 if ((b = sshbuf_from(signature, signaturelen)) == NULL)          if (strcmp("ssh-dss", ktype) != 0) {
                         return SSH_ERR_ALLOC_FAIL;                  ret = SSH_ERR_KEY_TYPE_MISMATCH;
                 if (sshbuf_get_cstring(b, &ktype, NULL) != 0 ||                  goto out;
                     sshbuf_get_string(b, &sigblob, &len) != 0) {          }
                         ret = SSH_ERR_INVALID_FORMAT;          if (sshbuf_len(b) != 0) {
                         goto out;                  ret = SSH_ERR_UNEXPECTED_TRAILING_DATA;
                 }                  goto out;
                 if (strcmp("ssh-dss", ktype) != 0) {  
                         ret = SSH_ERR_KEY_TYPE_MISMATCH;  
                         goto out;  
                 }  
                 if (sshbuf_len(b) != 0) {  
                         ret = SSH_ERR_UNEXPECTED_TRAILING_DATA;  
                         goto out;  
                 }  
         }          }
   
         if (len != SIGBLOB_LEN) {          if (len != SIGBLOB_LEN) {

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.36