625f2aab3c
Everything moved has been manually compiled and submitted to the main apt repo at packages.termux.org. %ci:no-build
35 lines
1.4 KiB
Diff
35 lines
1.4 KiB
Diff
diff --git a/crypto/rsa_pem_openssl.c b/crypto/rsa_pem_openssl.c
|
|
index db653f2..0d9d04c 100644
|
|
--- a/tgl/crypto/rsa_pem_openssl.c
|
|
+++ b/tgl/crypto/rsa_pem_openssl.c
|
|
@@ -38,16 +38,22 @@ TGLC_WRAPPER_ASSOC(bn,BIGNUM)
|
|
|
|
TGLC_rsa *TGLC_rsa_new (unsigned long e, int n_bytes, const unsigned char *n) {
|
|
RSA *ret = RSA_new ();
|
|
- ret->e = unwrap_bn (TGLC_bn_new ());
|
|
- TGLC_bn_set_word (wrap_bn (ret->e), e);
|
|
- ret->n = unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL));
|
|
+ BIGNUM *ret_e = unwrap_bn (TGLC_bn_new ());
|
|
+ BIGNUM *ret_n = unwrap_bn (TGLC_bn_bin2bn (n, n_bytes, NULL));
|
|
+ RSA_set0_key (ret, ret_n, ret_e, NULL);
|
|
+ TGLC_bn_set_word (wrap_bn (ret_e), e);
|
|
return wrap_rsa (ret);
|
|
}
|
|
|
|
-#define RSA_GETTER(M) \
|
|
- TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \
|
|
- return wrap_bn (unwrap_rsa (key)->M); \
|
|
- } \
|
|
+#define RSA_GETTER(M) \
|
|
+TGLC_bn *TGLC_rsa_ ## M (TGLC_rsa *key) { \
|
|
+ BIGNUM *rsa_n, *rsa_e, *rsa_d; \
|
|
+ RSA_get0_key(unwrap_rsa (key), \
|
|
+ (const BIGNUM **) &rsa_n, \
|
|
+ (const BIGNUM **) &rsa_e, \
|
|
+ (const BIGNUM **) &rsa_d); \
|
|
+ return wrap_bn (rsa_ ## M); \
|
|
+}
|
|
|
|
RSA_GETTER(n);
|
|
RSA_GETTER(e);
|