ssh-dss.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
#pragma ident "%Z%%M% %I% %E% SMI"
#include "xmalloc.h"
#include "buffer.h"
#include "bufaux.h"
#include "compat.h"
#include "log.h"
#include "key.h"
#include "ssh-dss.h"
#define INTBLOB_LEN 20
int
{
Buffer b;
error("ssh_dss_sign: no DSA key");
return -1;
}
error("ssh_dss_sign: sign failed");
return -1;
}
return -1;
}
if (datafellows & SSH_BUG_SIGBLOB) {
*lenp = SIGBLOB_LEN;
}
} else {
/* ietf-drafts */
buffer_init(&b);
buffer_put_cstring(&b, "ssh-dss");
len = buffer_len(&b);
}
buffer_free(&b);
}
return 0;
}
int
{
Buffer b;
error("ssh_dss_verify: no DSA key");
return -1;
}
/* fetch signature */
if (datafellows & SSH_BUG_SIGBLOB) {
len = signaturelen;
} else {
/* ietf-drafts */
char *ktype;
buffer_init(&b);
buffer_free(&b);
return -1;
}
rlen = buffer_len(&b);
buffer_free(&b);
if (rlen != 0) {
error("ssh_dss_verify: "
"remaining bytes in signature %d", rlen);
return -1;
}
}
if (len != SIGBLOB_LEN) {
}
/* parse signature */
fatal("ssh_dss_verify: DSA_SIG_new failed");
fatal("ssh_dss_verify: BN_new failed");
fatal("ssh_dss_verify: BN_new failed");
if (!(datafellows & SSH_BUG_SIGBLOB)) {
}
/* sha1 the data */
debug("ssh_dss_verify: signature %s",
return ret;
}