mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
acme: mbedtls: update genrsa apis
This commit is contained in:
parent
fb907e1061
commit
2bc0b97b45
1 changed files with 8 additions and 7 deletions
|
@ -469,7 +469,7 @@ lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
|
|||
int buflen = 0x560;
|
||||
uint8_t *buf = lws_malloc(buflen, "tmp cert buf"), *p = buf, *pkey_asn1;
|
||||
struct lws_genrsa_ctx ctx;
|
||||
struct lws_gencrypto_keyelem el;
|
||||
struct lws_gencrypto_keyelem el[LWS_GENCRYPTO_RSA_KEYEL_COUNT];
|
||||
uint8_t digest[32];
|
||||
struct lws_genhash_ctx hash_ctx;
|
||||
int pkey_asn1_len = 3 * 1024;
|
||||
|
@ -478,9 +478,10 @@ lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
|
|||
if (!buf)
|
||||
return 1;
|
||||
|
||||
n = lws_genrsa_new_keypair(vhost->context, &ctx, &el, keybits);
|
||||
n = lws_genrsa_new_keypair(vhost->context, &ctx, LGRSAM_PKCS1_1_5,
|
||||
&el[0], keybits);
|
||||
if (n < 0) {
|
||||
lws_genrsa_destroy_elements(&el);
|
||||
lws_genrsa_destroy_elements(&el[0]);
|
||||
goto bail1;
|
||||
}
|
||||
|
||||
|
@ -514,8 +515,8 @@ lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
|
|||
/* we need to drop 1 + (keybits / 8) bytes of n in here, 00 + key */
|
||||
|
||||
*p++ = 0x00;
|
||||
memcpy(p, el.e[LWS_GENCRYPTO_RSA_KEYEL_N].buf, el.e[LWS_GENCRYPTO_RSA_KEYEL_N].len);
|
||||
p += el.e[LWS_GENCRYPTO_RSA_KEYEL_N].len;
|
||||
memcpy(p, el[LWS_GENCRYPTO_RSA_KEYEL_N].buf, el[LWS_GENCRYPTO_RSA_KEYEL_N].len);
|
||||
p += el[LWS_GENCRYPTO_RSA_KEYEL_N].len;
|
||||
|
||||
memcpy(p, ss_cert_san_leadin, sizeof(ss_cert_san_leadin));
|
||||
p += sizeof(ss_cert_san_leadin);
|
||||
|
@ -584,7 +585,7 @@ lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
|
|||
}
|
||||
|
||||
lws_genrsa_destroy(&ctx);
|
||||
lws_genrsa_destroy_elements(&el);
|
||||
lws_genrsa_destroy_elements(&el[0]);
|
||||
|
||||
lws_free(buf);
|
||||
|
||||
|
@ -592,7 +593,7 @@ lws_tls_acme_sni_cert_create(struct lws_vhost *vhost, const char *san_a,
|
|||
|
||||
bail2:
|
||||
lws_genrsa_destroy(&ctx);
|
||||
lws_genrsa_destroy_elements(&el);
|
||||
lws_genrsa_destroy_elements(&el[0]);
|
||||
bail1:
|
||||
lws_free(buf);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue