-/***************************************************************************
- *
- * Part II Project, "A secure, private IP network"
- * Stephen Early <sde1000@cam.ac.uk>
- *
- *
- * $RCSfile: rsa.c,v $
- *
- * Description: RSA signature making and checking functions
- *
- * Copyright: (C) Stephen Early 1995
- *
- * $Revision: 1.1 $
- *
- * $Date: 1996/05/16 18:40:14 $
- *
- * $State: Exp $
- *
- ***************************************************************************/
-
-/* $Log: rsa.c,v $
- * Revision 1.1 1996/05/16 18:40:14 sde1000
- * Initial revision
- *
- */
-
#include <stdio.h>
#include <gmp.h>
#include "secnet.h"
msize=mpz_sizeinbase(&st->n, 16);
+ if (datalen*2+4>=msize) {
+ fatal("rsa_sign: message too big\n");
+ }
+
strcpy(buff,"0001");
for (i=0; i<datalen; i++) {
buff[5+i*2]=hexchars[data[i]&0xf];
}
buff[4+datalen*2]=0;
-
+
for (i=datalen*2+4; i<msize; i++)
buff[i]='f';