} if (key->modulus.data[0] == 0) {  if (info->in.data[0] >= key->modulus.data[1]) return SECFailure; } else { if (info->in.data[0] >= key->modulus.data[0]) return SECFailure; } modLen = key->modulus.len - !key->modulus.data[0]; if (info->in.len % modLen != 0) { fprintf(stderr, "Input buffer must be a multiple of modulus length!\n"); return SECFailure;
rsa_test(blapitestInfo *info){	RSAPrivateKey *key;	SECItem expitem;	SECStatus rv;	PRIntervalTime time1, time2;	int i, j, numiter;	numiter = info->repetitions;	fillitem(&info->in, info->bufsize, "tmp.pt");	info->in.data[0] = 0x00;	if (info->key.len > 0) {		key = rsakey_from_filedata(&info->key);	} else {		expitem.len = 4;		expitem.data = (unsigned char *)PORT_ZAlloc(4);		expitem.data[0] = (info->rsapubexp >> 24) & 0xff;		expitem.data[1] = (info->rsapubexp >> 16) & 0xff;		expitem.data[2] = (info->rsapubexp >>  8) & 0xff;		expitem.data[3] = (info->rsapubexp & 0xff);		key = RSA_NewKey(info->keysize*8, &expitem);		rsakey_to_file(key, "tmp.key");	}	info->out.len = info->in.len; 	info->out.data = (unsigned char *)PORT_ZAlloc(info->out.len);	if (info->encrypt) {		RSAPublicKey pubkey;		SECITEM_CopyItem(key->arena, &pubkey.modulus, &key->modulus);		SECITEM_CopyItem(key->arena, &pubkey.publicExponent, 		                             &key->publicExponent);		TIMESTART();		for (i=0; i<numiter; i++) {			for (j=0; j<info->in.len; j+=pubkey.modulus.len) {				rv = RSA_PublicKeyOp(&pubkey, &info->out.data[j], 				                              &info->in.data[j]);			}		}		TIMEFINISH("RSA ENCRYPT", info->in.len);		CHECKERROR(rv, __LINE__);	} else {		TIMESTART();		for (i=info->repetitions; i>0; i--) {			for (j=0; j<info->in.len; j+=key->modulus.len) {				rv = RSA_PrivateKeyOp(key, &info->out.data[j], 				                           &info->in.data[j]);			}		}		TIMEFINISH("RSA DECRYPT", info->in.len);		CHECKERROR(rv, __LINE__);	}	PORT_FreeArena(key->arena, PR_TRUE);	return SECSuccess;}