unsigned int modLen;
unsigned int modLen, expLen;
RSA_PublicKeyOp(RSAPublicKey  *key,                 unsigned char *output,                 const unsigned char *input){    unsigned int modLen;    mp_int n, e, m, c;    mp_err err   = MP_OKAY;    SECStatus rv = SECSuccess;    if (!key || !output || !input) {	PORT_SetError(SEC_ERROR_INVALID_ARGS);	return SECFailure;    }    MP_DIGITS(&n) = 0;    MP_DIGITS(&e) = 0;    MP_DIGITS(&m) = 0;    MP_DIGITS(&c) = 0;    CHECK_MPI_OK( mp_init(&n) );    CHECK_MPI_OK( mp_init(&e) );    CHECK_MPI_OK( mp_init(&m) );    CHECK_MPI_OK( mp_init(&c) );    modLen = rsa_modulusLen(&key->modulus);    /* 1.  Obtain public key (n, e) */    if (rsa_modulusLen(&key->publicExponent) > modLen) {	/* exponent should not be greater than modulus */    	PORT_SetError(SEC_ERROR_INVALID_KEY);	rv = SECFailure;	goto cleanup;    }    SECITEM_TO_MPINT(key->modulus, &n);    SECITEM_TO_MPINT(key->publicExponent, &e);    if (e.used > n.used) {	/* exponent should not be greater than modulus */    	PORT_SetError(SEC_ERROR_INVALID_KEY);	rv = SECFailure;	goto cleanup;    }    /* 2.  Represent message as integer in range [0..n-1] */    CHECK_MPI_OK( mp_read_unsigned_octets(&m, input, modLen) );    /* 3.  Compute c = m**e mod n */#ifdef USE_MPI_EXPT_D    /* XXX see which is faster */    if (MP_USED(&e) == 1) {	CHECK_MPI_OK( mp_exptmod_d(&m, MP_DIGIT(&e, 0), &n, &c) );    } else#endif    CHECK_MPI_OK( mp_exptmod(&m, &e, &n, &c) );    /* 4.  result c is ciphertext */    err = mp_to_fixlen_octets(&c, output, modLen);    if (err >= 0) err = MP_OKAY;cleanup:    mp_clear(&n);    mp_clear(&e);    mp_clear(&m);    mp_clear(&c);    if (err) {	MP_TO_SEC_ERROR(err);	rv = SECFailure;    }    return rv;}