if (e_len > key_len) {
silc_mp_clear(&key->e);
silc_mp_clear(&key->n);
- return FALSE;
+ return 0;
}
silc_mp_bin2mp(key_data + 4, e_len, &key->e);
if (e_len + n_len > key_len) {
silc_mp_clear(&key->e);
silc_mp_clear(&key->n);
- return FALSE;
+ return 0;
}
silc_mp_bin2mp(key_data + 4 + e_len + 4, n_len, &key->n);
key->bits = n_len * 8;
- return TRUE;
+ return key->bits;
}
/* Set private key. This derives the public key from the private
return sizeof(RsaKey);
}
-SILC_PKCS_API_DATA_CONTEXT_LEN(rsa)
-{
- return sizeof(RsaDataContext);
-}
-
-SILC_PKCS_API_SET_ARG(rsa)
-{
- RsaDataContext *data_ctx = (RsaDataContext *)data_context;
-
- switch(argnum) {
- case 1:
- data_ctx->src = val;
- return TRUE;
- break;
- case 2:
- data_ctx->dst = val;
- return TRUE;
- break;
- case 3:
- data_ctx->exp = val;
- return TRUE;
- break;
- case 4:
- data_ctx->mod = val;
- return TRUE;
- break;
- default:
- return FALSE;
- break;
- }
-
- return FALSE;
-}
-
SILC_PKCS_API_ENCRYPT(rsa)
{
RsaKey *key = (RsaKey *)context;