Loading rsaref/rsaref.c +18 −17 Original line number Original line Diff line number Diff line Loading @@ -66,21 +66,22 @@ static int RSAref_bn2bin(BIGNUM * from, unsigned char* to, int max); static int RSAref_bn2bin(BIGNUM * from, unsigned char* to, int max); #ifdef undef #ifdef undef static BIGNUM* RSAref_bin2bn(unsigned char* from, BIGNUM * to, int max); static BIGNUM* RSAref_bin2bn(const unsigned char* from, BIGNUM * to, int max); #endif #endif static int RSAref_Public_eay2ref(RSA * from, RSArefPublicKey * to); static int RSAref_Public_eay2ref(RSA * from, RSArefPublicKey * to); static int RSAref_Private_eay2ref(RSA * from, RSArefPrivateKey * to); static int RSAref_Private_eay2ref(RSA * from, RSArefPrivateKey * to); int RSA_ref_private_decrypt(int len, unsigned char *from, int RSA_ref_private_decrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); int RSA_ref_private_encrypt(int len, unsigned char *from, int RSA_ref_private_encrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); int RSA_ref_public_encrypt(int len, unsigned char *from, int RSA_ref_public_encrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); int RSA_ref_public_decrypt(int len, unsigned char *from, int RSA_ref_public_decrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); static int BN_ref_mod_exp(BIGNUM *r,BIGNUM *a,const BIGNUM *p,const BIGNUM *m, static int BN_ref_mod_exp(BIGNUM *r,const BIGNUM *a, const BIGNUM *p,const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); BN_CTX *ctx, BN_MONT_CTX *m_ctx); static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa); static int RSA_ref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); static RSA_METHOD rsa_pkcs1_ref_meth={ static RSA_METHOD rsa_pkcs1_ref_meth={ "RSAref PKCS#1 RSA", "RSAref PKCS#1 RSA", RSA_ref_public_encrypt, RSA_ref_public_encrypt, Loading @@ -100,13 +101,13 @@ RSA_METHOD *RSA_PKCS1_RSAref(void) return(&rsa_pkcs1_ref_meth); return(&rsa_pkcs1_ref_meth); } } static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) static int RSA_ref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) { { RSAREFerr(RSAREF_F_RSA_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); RSAREFerr(RSAREF_F_RSA_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return(0); return(0); } } static int BN_ref_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, static int BN_ref_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) { { RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); Loading Loading @@ -201,8 +202,8 @@ static int RSAref_Private_eay2ref(RSA *from, RSArefPrivateKey *to) return(1); return(1); } } int RSA_ref_private_decrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_private_decrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int i,outlen= -1; int i,outlen= -1; RSArefPrivateKey RSAkey; RSArefPrivateKey RSAkey; Loading @@ -219,8 +220,8 @@ err: return(outlen); return(outlen); } } int RSA_ref_private_encrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_private_encrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int i,outlen= -1; int i,outlen= -1; RSArefPrivateKey RSAkey; RSArefPrivateKey RSAkey; Loading @@ -242,8 +243,8 @@ err: return(outlen); return(outlen); } } int RSA_ref_public_decrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_public_decrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int i,outlen= -1; int i,outlen= -1; RSArefPublicKey RSAkey; RSArefPublicKey RSAkey; Loading @@ -260,8 +261,8 @@ err: return(outlen); return(outlen); } } int RSA_ref_public_encrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_public_encrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int outlen= -1; int outlen= -1; int i; int i; Loading rsaref/rsaref.h +10 −5 Original line number Original line Diff line number Diff line Loading @@ -118,17 +118,22 @@ typedef struct RSARandomState_st #define RE_SIGNATURE_ENCODING 0x040c #define RE_SIGNATURE_ENCODING 0x040c #define RE_ENCRYPTION_ALGORITHM 0x040d #define RE_ENCRYPTION_ALGORITHM 0x040d int RSAPrivateDecrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPrivateDecrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPrivateKey *RSAkey); int len, RSArefPrivateKey *RSAkey); int RSAPrivateEncrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPrivateEncrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPrivateKey *RSAkey); int len, RSArefPrivateKey *RSAkey); int RSAPublicDecrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPublicDecrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPublicKey *RSAkey); int len, RSArefPublicKey *RSAkey); int RSAPublicEncrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPublicEncrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPublicKey *RSAkey,RSARandomState *rnd); int len, RSArefPublicKey *RSAkey,RSARandomState *rnd); int R_RandomInit(RSARandomState *rnd); int R_RandomInit(RSARandomState *rnd); int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd); int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd); int R_RandomUpdate(RSARandomState *rnd, unsigned char *data, unsigned int n); int R_RandomUpdate(RSARandomState *rnd, const unsigned char *data, unsigned int n); int R_RandomFinal(RSARandomState *rnd); int R_RandomFinal(RSARandomState *rnd); void ERR_load_RSAREF_strings(void ); void ERR_load_RSAREF_strings(void ); Loading Loading
rsaref/rsaref.c +18 −17 Original line number Original line Diff line number Diff line Loading @@ -66,21 +66,22 @@ static int RSAref_bn2bin(BIGNUM * from, unsigned char* to, int max); static int RSAref_bn2bin(BIGNUM * from, unsigned char* to, int max); #ifdef undef #ifdef undef static BIGNUM* RSAref_bin2bn(unsigned char* from, BIGNUM * to, int max); static BIGNUM* RSAref_bin2bn(const unsigned char* from, BIGNUM * to, int max); #endif #endif static int RSAref_Public_eay2ref(RSA * from, RSArefPublicKey * to); static int RSAref_Public_eay2ref(RSA * from, RSArefPublicKey * to); static int RSAref_Private_eay2ref(RSA * from, RSArefPrivateKey * to); static int RSAref_Private_eay2ref(RSA * from, RSArefPrivateKey * to); int RSA_ref_private_decrypt(int len, unsigned char *from, int RSA_ref_private_decrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); int RSA_ref_private_encrypt(int len, unsigned char *from, int RSA_ref_private_encrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); int RSA_ref_public_encrypt(int len, unsigned char *from, int RSA_ref_public_encrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); int RSA_ref_public_decrypt(int len, unsigned char *from, int RSA_ref_public_decrypt(int len, const unsigned char *from, unsigned char *to, RSA *rsa, int padding); unsigned char *to, RSA *rsa, int padding); static int BN_ref_mod_exp(BIGNUM *r,BIGNUM *a,const BIGNUM *p,const BIGNUM *m, static int BN_ref_mod_exp(BIGNUM *r,const BIGNUM *a, const BIGNUM *p,const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); BN_CTX *ctx, BN_MONT_CTX *m_ctx); static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa); static int RSA_ref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa); static RSA_METHOD rsa_pkcs1_ref_meth={ static RSA_METHOD rsa_pkcs1_ref_meth={ "RSAref PKCS#1 RSA", "RSAref PKCS#1 RSA", RSA_ref_public_encrypt, RSA_ref_public_encrypt, Loading @@ -100,13 +101,13 @@ RSA_METHOD *RSA_PKCS1_RSAref(void) return(&rsa_pkcs1_ref_meth); return(&rsa_pkcs1_ref_meth); } } static int RSA_ref_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) static int RSA_ref_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa) { { RSAREFerr(RSAREF_F_RSA_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); RSAREFerr(RSAREF_F_RSA_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return(0); return(0); } } static int BN_ref_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, static int BN_ref_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx) { { RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); RSAREFerr(RSAREF_F_BN_REF_MOD_EXP,ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); Loading Loading @@ -201,8 +202,8 @@ static int RSAref_Private_eay2ref(RSA *from, RSArefPrivateKey *to) return(1); return(1); } } int RSA_ref_private_decrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_private_decrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int i,outlen= -1; int i,outlen= -1; RSArefPrivateKey RSAkey; RSArefPrivateKey RSAkey; Loading @@ -219,8 +220,8 @@ err: return(outlen); return(outlen); } } int RSA_ref_private_encrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_private_encrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int i,outlen= -1; int i,outlen= -1; RSArefPrivateKey RSAkey; RSArefPrivateKey RSAkey; Loading @@ -242,8 +243,8 @@ err: return(outlen); return(outlen); } } int RSA_ref_public_decrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_public_decrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int i,outlen= -1; int i,outlen= -1; RSArefPublicKey RSAkey; RSArefPublicKey RSAkey; Loading @@ -260,8 +261,8 @@ err: return(outlen); return(outlen); } } int RSA_ref_public_encrypt(int len, unsigned char *from, unsigned char *to, int RSA_ref_public_encrypt(int len, const unsigned char *from, RSA *rsa, int padding) unsigned char *to, RSA *rsa, int padding) { { int outlen= -1; int outlen= -1; int i; int i; Loading
rsaref/rsaref.h +10 −5 Original line number Original line Diff line number Diff line Loading @@ -118,17 +118,22 @@ typedef struct RSARandomState_st #define RE_SIGNATURE_ENCODING 0x040c #define RE_SIGNATURE_ENCODING 0x040c #define RE_ENCRYPTION_ALGORITHM 0x040d #define RE_ENCRYPTION_ALGORITHM 0x040d int RSAPrivateDecrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPrivateDecrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPrivateKey *RSAkey); int len, RSArefPrivateKey *RSAkey); int RSAPrivateEncrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPrivateEncrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPrivateKey *RSAkey); int len, RSArefPrivateKey *RSAkey); int RSAPublicDecrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPublicDecrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPublicKey *RSAkey); int len, RSArefPublicKey *RSAkey); int RSAPublicEncrypt(unsigned char *to, int *outlen, unsigned char *from, int RSAPublicEncrypt(unsigned char *to, int *outlen, const unsigned char *from, int len, RSArefPublicKey *RSAkey,RSARandomState *rnd); int len, RSArefPublicKey *RSAkey,RSARandomState *rnd); int R_RandomInit(RSARandomState *rnd); int R_RandomInit(RSARandomState *rnd); int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd); int R_GetRandomBytesNeeded(unsigned int *,RSARandomState *rnd); int R_RandomUpdate(RSARandomState *rnd, unsigned char *data, unsigned int n); int R_RandomUpdate(RSARandomState *rnd, const unsigned char *data, unsigned int n); int R_RandomFinal(RSARandomState *rnd); int R_RandomFinal(RSARandomState *rnd); void ERR_load_RSAREF_strings(void ); void ERR_load_RSAREF_strings(void ); Loading