aboutsummaryrefslogtreecommitdiff
path: root/crypto/rsa
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>1999-04-19 21:31:43 +0000
committerUlf Möller <ulf@openssl.org>1999-04-19 21:31:43 +0000
commit6b691a5c85ddc4e407e32781841fee5c029506cd (patch)
tree436f1127406e1cacfe83dfcbfff824d89c47d834 /crypto/rsa
parent3edd7ed15de229230f74c79c3d71e7c9c674cf4f (diff)
downloadopenssl-6b691a5c85ddc4e407e32781841fee5c029506cd.zip
openssl-6b691a5c85ddc4e407e32781841fee5c029506cd.tar.gz
openssl-6b691a5c85ddc4e407e32781841fee5c029506cd.tar.bz2
Change functions to ANSI C.
Diffstat (limited to 'crypto/rsa')
-rw-r--r--crypto/rsa/rsa_eay.c45
-rw-r--r--crypto/rsa/rsa_err.c2
-rw-r--r--crypto/rsa/rsa_gen.c7
-rw-r--r--crypto/rsa/rsa_lib.c76
-rw-r--r--crypto/rsa/rsa_none.c15
-rw-r--r--crypto/rsa/rsa_oaep.c20
-rw-r--r--crypto/rsa/rsa_oaep_test.c2
-rw-r--r--crypto/rsa/rsa_pk1.c30
-rw-r--r--crypto/rsa/rsa_saos.c19
-rw-r--r--crypto/rsa/rsa_sign.c18
-rw-r--r--crypto/rsa/rsa_ssl.c15
11 files changed, 67 insertions, 182 deletions
diff --git a/crypto/rsa/rsa_eay.c b/crypto/rsa/rsa_eay.c
index 609ec04..c882738 100644
--- a/crypto/rsa/rsa_eay.c
+++ b/crypto/rsa/rsa_eay.c
@@ -98,17 +98,13 @@ static RSA_METHOD rsa_pkcs1_eay_meth={
NULL,
};
-RSA_METHOD *RSA_PKCS1_SSLeay()
+RSA_METHOD *RSA_PKCS1_SSLeay(void)
{
return(&rsa_pkcs1_eay_meth);
}
-static int RSA_eay_public_encrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+static int RSA_eay_public_encrypt(int flen, unsigned char *from,
+ unsigned char *to, RSA *rsa, int padding)
{
BIGNUM f,ret;
int i,j,k,num=0,r= -1;
@@ -177,12 +173,8 @@ err:
return(r);
}
-static int RSA_eay_private_encrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+static int RSA_eay_private_encrypt(int flen, unsigned char *from,
+ unsigned char *to, RSA *rsa, int padding)
{
BIGNUM f,ret;
int i,j,k,num=0,r= -1;
@@ -256,12 +248,8 @@ err:
return(r);
}
-static int RSA_eay_private_decrypt(flen, from, to, rsa,padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+static int RSA_eay_private_decrypt(int flen, unsigned char *from,
+ unsigned char *to, RSA *rsa, int padding)
{
BIGNUM f,ret;
int j,num=0,r= -1;
@@ -350,12 +338,8 @@ err:
return(r);
}
-static int RSA_eay_public_decrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+static int RSA_eay_public_decrypt(int flen, unsigned char *from,
+ unsigned char *to, RSA *rsa, int padding)
{
BIGNUM f,ret;
int i,num=0,r= -1;
@@ -426,10 +410,7 @@ err:
return(r);
}
-static int RSA_eay_mod_exp(r0, I, rsa)
-BIGNUM *r0;
-BIGNUM *I;
-RSA *rsa;
+static int RSA_eay_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
{
BIGNUM r1,m1;
int ret=0;
@@ -493,15 +474,13 @@ err:
return(ret);
}
-static int RSA_eay_init(rsa)
-RSA *rsa;
+static int RSA_eay_init(RSA *rsa)
{
rsa->flags|=RSA_FLAG_CACHE_PUBLIC|RSA_FLAG_CACHE_PRIVATE;
return(1);
}
-static int RSA_eay_finish(rsa)
-RSA *rsa;
+static int RSA_eay_finish(RSA *rsa)
{
if (rsa->_method_mod_n != NULL)
BN_MONT_CTX_free(rsa->_method_mod_n);
diff --git a/crypto/rsa/rsa_err.c b/crypto/rsa/rsa_err.c
index cdb8a33..0d7e656 100644
--- a/crypto/rsa/rsa_err.c
+++ b/crypto/rsa/rsa_err.c
@@ -118,7 +118,7 @@ static ERR_STRING_DATA RSA_str_reasons[]=
#endif
-void ERR_load_RSA_strings()
+void ERR_load_RSA_strings(void)
{
static int init=1;
diff --git a/crypto/rsa/rsa_gen.c b/crypto/rsa/rsa_gen.c
index 936db49..b2569e5 100644
--- a/crypto/rsa/rsa_gen.c
+++ b/crypto/rsa/rsa_gen.c
@@ -62,11 +62,8 @@
#include "bn.h"
#include "rsa.h"
-RSA *RSA_generate_key(bits, e_value, callback,cb_arg)
-int bits;
-unsigned long e_value;
-void (*callback)(P_I_I_P);
-char *cb_arg;
+RSA *RSA_generate_key(int bits, unsigned long e_value,
+ void (*callback)(P_I_I_P), char *cb_arg)
{
RSA *rsa=NULL;
BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index 951d181..6732e98 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.c
@@ -69,19 +69,17 @@ static RSA_METHOD *default_RSA_meth=NULL;
static int rsa_meth_num=0;
static STACK *rsa_meth=NULL;
-RSA *RSA_new()
+RSA *RSA_new(void)
{
return(RSA_new_method(NULL));
}
-void RSA_set_default_method(meth)
-RSA_METHOD *meth;
+void RSA_set_default_method(RSA_METHOD *meth)
{
default_RSA_meth=meth;
}
-RSA *RSA_new_method(meth)
-RSA_METHOD *meth;
+RSA *RSA_new_method(RSA_METHOD *meth)
{
RSA *ret;
@@ -132,8 +130,7 @@ RSA_METHOD *meth;
return(ret);
}
-void RSA_free(r)
-RSA *r;
+void RSA_free(RSA *r)
{
int i;
@@ -170,87 +167,59 @@ RSA *r;
Free(r);
}
-int RSA_get_ex_new_index(argl,argp,new_func,dup_func,free_func)
-long argl;
-char *argp;
-int (*new_func)();
-int (*dup_func)();
-void (*free_func)();
+int RSA_get_ex_new_index(long argl, char *argp, int (*new_func)(),
+ int (*dup_func)(), void (*free_func)())
{
rsa_meth_num++;
return(CRYPTO_get_ex_new_index(rsa_meth_num-1,
&rsa_meth,argl,argp,new_func,dup_func,free_func));
}
-int RSA_set_ex_data(r,idx,arg)
-RSA *r;
-int idx;
-char *arg;
+int RSA_set_ex_data(RSA *r, int idx, char *arg)
{
return(CRYPTO_set_ex_data(&r->ex_data,idx,arg));
}
-char *RSA_get_ex_data(r,idx)
-RSA *r;
-int idx;
+char *RSA_get_ex_data(RSA *r, int idx)
{
return(CRYPTO_get_ex_data(&r->ex_data,idx));
}
-int RSA_size(r)
-RSA *r;
+int RSA_size(RSA *r)
{
return(BN_num_bytes(r->n));
}
-int RSA_public_encrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+int RSA_public_encrypt(int flen, unsigned char *from, unsigned char *to,
+ RSA *rsa, int padding)
{
return(rsa->meth->rsa_pub_enc(flen, from, to, rsa, padding));
}
-int RSA_private_encrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+int RSA_private_encrypt(int flen, unsigned char *from, unsigned char *to,
+ RSA *rsa, int padding)
{
return(rsa->meth->rsa_priv_enc(flen, from, to, rsa, padding));
}
-int RSA_private_decrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+int RSA_private_decrypt(int flen, unsigned char *from, unsigned char *to,
+ RSA *rsa, int padding)
{
return(rsa->meth->rsa_priv_dec(flen, from, to, rsa, padding));
}
-int RSA_public_decrypt(flen, from, to, rsa, padding)
-int flen;
-unsigned char *from;
-unsigned char *to;
-RSA *rsa;
-int padding;
+int RSA_public_decrypt(int flen, unsigned char *from, unsigned char *to,
+ RSA *rsa, int padding)
{
return(rsa->meth->rsa_pub_dec(flen, from, to, rsa, padding));
}
-int RSA_flags(r)
-RSA *r;
+int RSA_flags(RSA *r)
{
return((r == NULL)?0:r->meth->flags);
}
-void RSA_blinding_off(rsa)
-RSA *rsa;
+void RSA_blinding_off(RSA *rsa)
{
if (rsa->blinding != NULL)
{
@@ -260,9 +229,7 @@ RSA *rsa;
rsa->flags&= ~RSA_FLAG_BLINDING;
}
-int RSA_blinding_on(rsa,p_ctx)
-RSA *rsa;
-BN_CTX *p_ctx;
+int RSA_blinding_on(RSA *rsa, BN_CTX *p_ctx)
{
BIGNUM *A,*Ai;
BN_CTX *ctx;
@@ -295,8 +262,7 @@ err:
return(ret);
}
-int RSA_memory_lock(r)
-RSA *r;
+int RSA_memory_lock(RSA *r)
{
int i,j,k,off;
char *p;
diff --git a/crypto/rsa/rsa_none.c b/crypto/rsa/rsa_none.c
index e944f84..6d43677 100644
--- a/crypto/rsa/rsa_none.c
+++ b/crypto/rsa/rsa_none.c
@@ -62,11 +62,8 @@
#include "rsa.h"
#include "rand.h"
-int RSA_padding_add_none(to,tlen,from,flen)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
+int RSA_padding_add_none(unsigned char *to, int tlen, unsigned char *from,
+ int flen)
{
if (flen > tlen)
{
@@ -84,12 +81,8 @@ int flen;
return(1);
}
-int RSA_padding_check_none(to,tlen,from,flen,num)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
-int num;
+int RSA_padding_check_none(unsigned char *to, int tlen, unsigned char *from,
+ int flen, int num)
{
if (flen > tlen)
diff --git a/crypto/rsa/rsa_oaep.c b/crypto/rsa/rsa_oaep.c
index 6907ba9..4473246 100644
--- a/crypto/rsa/rsa_oaep.c
+++ b/crypto/rsa/rsa_oaep.c
@@ -13,13 +13,8 @@
int MGF1(unsigned char *mask, long len, unsigned char *seed, long seedlen);
-int RSA_padding_add_PKCS1_OAEP(to, tlen, from, flen, param, plen)
- unsigned char *to;
- int tlen;
- unsigned char *from;
- int flen;
- unsigned char *param;
- int plen;
+int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
+ unsigned char *from, int flen, unsigned char *param, int plen)
{
int i, emlen = tlen - 1;
unsigned char *db, *seed;
@@ -73,14 +68,9 @@ int RSA_padding_add_PKCS1_OAEP(to, tlen, from, flen, param, plen)
return (1);
}
-int RSA_padding_check_PKCS1_OAEP(to, tlen, from, flen, num, param, plen)
- unsigned char *to;
- int tlen;
- unsigned char *from;
- int flen;
- int num;
- unsigned char *param;
- int plen;
+int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
+ unsigned char *from, int flen, int num, unsigned char *param,
+ int plen)
{
int i, dblen, mlen = -1;
unsigned char *maskeddb;
diff --git a/crypto/rsa/rsa_oaep_test.c b/crypto/rsa/rsa_oaep_test.c
index c18fd98..c4b454a 100644
--- a/crypto/rsa/rsa_oaep_test.c
+++ b/crypto/rsa/rsa_oaep_test.c
@@ -184,7 +184,7 @@ int key3(RSA *key, unsigned char *c)
SetKey;
}
-int pad_unknown()
+int pad_unknown(void)
{
unsigned long l;
while ((l = ERR_get_error()) != 0)
diff --git a/crypto/rsa/rsa_pk1.c b/crypto/rsa/rsa_pk1.c
index 4638187..7648b76 100644
--- a/crypto/rsa/rsa_pk1.c
+++ b/crypto/rsa/rsa_pk1.c
@@ -74,11 +74,8 @@ int RSA_padding_check_none();
#endif
-int RSA_padding_add_PKCS1_type_1(to,tlen,from,flen)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
+int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
+ unsigned char *from, int flen)
{
int j;
unsigned char *p;
@@ -103,12 +100,8 @@ int flen;
return(1);
}
-int RSA_padding_check_PKCS1_type_1(to,tlen,from,flen,num)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
-int num;
+int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
+ unsigned char *from, int flen, int num)
{
int i,j;
unsigned char *p;
@@ -154,11 +147,8 @@ int num;
return(j);
}
-int RSA_padding_add_PKCS1_type_2(to,tlen,from,flen)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
+int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
+ unsigned char *from, int flen)
{
int i,j;
unsigned char *p;
@@ -193,12 +183,8 @@ int flen;
return(1);
}
-int RSA_padding_check_PKCS1_type_2(to,tlen,from,flen,num)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
-int num;
+int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
+ unsigned char *from, int flen, int num)
{
int i,j;
unsigned char *p;
diff --git a/crypto/rsa/rsa_saos.c b/crypto/rsa/rsa_saos.c
index fb0fae5..d73beb0 100644
--- a/crypto/rsa/rsa_saos.c
+++ b/crypto/rsa/rsa_saos.c
@@ -63,13 +63,8 @@
#include "objects.h"
#include "x509.h"
-int RSA_sign_ASN1_OCTET_STRING(type,m,m_len,sigret,siglen,rsa)
-int type;
-unsigned char *m;
-unsigned int m_len;
-unsigned char *sigret;
-unsigned int *siglen;
-RSA *rsa;
+int RSA_sign_ASN1_OCTET_STRING(int type, unsigned char *m, unsigned int m_len,
+ unsigned char *sigret, unsigned int *siglen, RSA *rsa)
{
ASN1_OCTET_STRING sig;
int i,j,ret=1;
@@ -105,13 +100,9 @@ RSA *rsa;
return(ret);
}
-int RSA_verify_ASN1_OCTET_STRING(dtype, m, m_len, sigbuf, siglen, rsa)
-int dtype;
-unsigned char *m;
-unsigned int m_len;
-unsigned char *sigbuf;
-unsigned int siglen;
-RSA *rsa;
+int RSA_verify_ASN1_OCTET_STRING(int dtype, unsigned char *m,
+ unsigned int m_len, unsigned char *sigbuf, unsigned int siglen,
+ RSA *rsa)
{
int i,ret=0;
unsigned char *p,*s;
diff --git a/crypto/rsa/rsa_sign.c b/crypto/rsa/rsa_sign.c
index e389111..31cdb4a 100644
--- a/crypto/rsa/rsa_sign.c
+++ b/crypto/rsa/rsa_sign.c
@@ -63,13 +63,8 @@
#include "objects.h"
#include "x509.h"
-int RSA_sign(type,m,m_len,sigret,siglen,rsa)
-int type;
-unsigned char *m;
-unsigned int m_len;
-unsigned char *sigret;
-unsigned int *siglen;
-RSA *rsa;
+int RSA_sign(int type, unsigned char *m, unsigned int m_len,
+ unsigned char *sigret, unsigned int *siglen, RSA *rsa)
{
X509_SIG sig;
ASN1_TYPE parameter;
@@ -124,13 +119,8 @@ RSA *rsa;
return(ret);
}
-int RSA_verify(dtype, m, m_len, sigbuf, siglen, rsa)
-int dtype;
-unsigned char *m;
-unsigned int m_len;
-unsigned char *sigbuf;
-unsigned int siglen;
-RSA *rsa;
+int RSA_verify(int dtype, unsigned char *m, unsigned int m_len,
+ unsigned char *sigbuf, unsigned int siglen, RSA *rsa)
{
int i,ret=0,sigtype;
unsigned char *p,*s;
diff --git a/crypto/rsa/rsa_ssl.c b/crypto/rsa/rsa_ssl.c
index 42ee076..e1bbbe7 100644
--- a/crypto/rsa/rsa_ssl.c
+++ b/crypto/rsa/rsa_ssl.c
@@ -62,11 +62,8 @@
#include "rsa.h"
#include "rand.h"
-int RSA_padding_add_SSLv23(to,tlen,from,flen)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
+int RSA_padding_add_SSLv23(unsigned char *to, int tlen, unsigned char *from,
+ int flen)
{
int i,j;
unsigned char *p;
@@ -103,12 +100,8 @@ int flen;
return(1);
}
-int RSA_padding_check_SSLv23(to,tlen,from,flen,num)
-unsigned char *to;
-int tlen;
-unsigned char *from;
-int flen;
-int num;
+int RSA_padding_check_SSLv23(unsigned char *to, int tlen, unsigned char *from,
+ int flen, int num)
{
int i,j,k;
unsigned char *p;