1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl/ossl_bn.c: More documentation.

* ext/openssl/lib/ossl_{pkey,pkey_ec}.[ch]: Add elliptic curves.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
technorama 2007-04-03 07:02:44 +00:00
parent eed46ac633
commit 8b95ee24de
7 changed files with 1477 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Tue Apr 3 02:48:48 2007 Technorama <oss-ruby@technorama.net>
* ext/openssl/ossl_bn.c: More documentation.
* ext/openssl/lib/ossl_{pkey,pkey_ec}.[ch]: Add elliptic curves.
Tue Apr 3 15:50:41 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/socket/socket.c (s_recv, s_recvfrom): some systems (such as

View file

@ -40,7 +40,7 @@ VALUE eBNError;
* Public
*/
VALUE
ossl_bn_new(BIGNUM *bn)
ossl_bn_new(const BIGNUM *bn)
{
BIGNUM *newbn;
VALUE obj;
@ -100,6 +100,12 @@ ossl_bn_alloc(VALUE klass)
return obj;
}
/*
* call-seq:
* BN.new => aBN
* BN.new(bn) => aBN
* BN.new(string, 0 | 2 | 10 | 16) => aBN
*/
static VALUE
ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
{
@ -189,6 +195,10 @@ ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
return str;
}
/*
* call-seq:
* bn.to_i => integer
*/
static VALUE
ossl_bn_to_i(VALUE self)
{

View file

@ -14,9 +14,12 @@
extern VALUE cBN;
extern VALUE eBNError;
VALUE ossl_bn_new(BIGNUM *);
extern BN_CTX *ossl_bn_ctx;
VALUE ossl_bn_new(const BIGNUM *);
BIGNUM *GetBNPtr(VALUE);
void Init_ossl_bn(void);
#endif /* _OSS_BN_H_ */

View file

@ -54,6 +54,10 @@ ossl_pkey_new(EVP_PKEY *pkey)
#if !defined(OPENSSL_NO_DH)
case EVP_PKEY_DH:
return ossl_dh_new(pkey);
#endif
#if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
case EVP_PKEY_EC:
return ossl_ec_new(pkey);
#endif
default:
ossl_raise(ePKeyError, "unsupported key type");
@ -226,10 +230,11 @@ Init_ossl_pkey()
id_private_q = rb_intern("private?");
/*
* INIT rsa, dsa
* INIT rsa, dsa, dh, ec
*/
Init_ossl_rsa();
Init_ossl_dsa();
Init_ossl_dh();
Init_ossl_ec();
}

View file

@ -77,6 +77,19 @@ extern DH *OSSL_DEFAULT_DH_1024;
VALUE ossl_dh_new(EVP_PKEY *);
void Init_ossl_dh(void);
/*
* EC
*/
extern VALUE cEC;
extern VALUE eECError;
extern VALUE cEC_GROUP;
extern VALUE eEC_GROUP;
extern VALUE cEC_POINT;
extern VALUE eEC_POINT;
VALUE ossl_ec_new(EVP_PKEY *);
void Init_ossl_ec(void);
#define OSSL_PKEY_BN(keytype, name) \
/* \
* call-seq: \

1438
ext/openssl/ossl_pkey_ec.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -493,7 +493,6 @@ ossl_rsa_to_public_key(VALUE self)
/*
* TODO: Test me
extern BN_CTX *ossl_bn_ctx;
static VALUE
ossl_rsa_blinding_on(VALUE self)