diff options
Diffstat (limited to 'src/lib/libssl/ssl_srvr.c')
| -rw-r--r-- | src/lib/libssl/ssl_srvr.c | 11 | 
1 files changed, 7 insertions, 4 deletions
| diff --git a/src/lib/libssl/ssl_srvr.c b/src/lib/libssl/ssl_srvr.c index 843d2ee249..e55b6beed1 100644 --- a/src/lib/libssl/ssl_srvr.c +++ b/src/lib/libssl/ssl_srvr.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_srvr.c,v 1.71 2020/01/30 16:25:09 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_srvr.c,v 1.72 2020/02/16 14:33:04 inoguchi Exp $ */ | 
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 
| 3 | * All rights reserved. | 3 | * All rights reserved. | 
| 4 | * | 4 | * | 
| @@ -1408,7 +1408,7 @@ ssl3_send_server_kex_ecdhe_ecp(SSL *s, int nid, CBB *cbb) | |||
| 1408 | static int | 1408 | static int | 
| 1409 | ssl3_send_server_kex_ecdhe_ecx(SSL *s, int nid, CBB *cbb) | 1409 | ssl3_send_server_kex_ecdhe_ecx(SSL *s, int nid, CBB *cbb) | 
| 1410 | { | 1410 | { | 
| 1411 | uint8_t *public_key = NULL; | 1411 | uint8_t *public_key = NULL, *private_key = NULL; | 
| 1412 | int curve_id; | 1412 | int curve_id; | 
| 1413 | CBB ecpoint; | 1413 | CBB ecpoint; | 
| 1414 | int ret = -1; | 1414 | int ret = -1; | 
| @@ -1418,11 +1418,11 @@ ssl3_send_server_kex_ecdhe_ecx(SSL *s, int nid, CBB *cbb) | |||
| 1418 | SSLerror(s, ERR_R_INTERNAL_ERROR); | 1418 | SSLerror(s, ERR_R_INTERNAL_ERROR); | 
| 1419 | goto err; | 1419 | goto err; | 
| 1420 | } | 1420 | } | 
| 1421 | if ((S3I(s)->tmp.x25519 = malloc(X25519_KEY_LENGTH)) == NULL) | 1421 | if ((private_key = malloc(X25519_KEY_LENGTH)) == NULL) | 
| 1422 | goto err; | 1422 | goto err; | 
| 1423 | if ((public_key = malloc(X25519_KEY_LENGTH)) == NULL) | 1423 | if ((public_key = malloc(X25519_KEY_LENGTH)) == NULL) | 
| 1424 | goto err; | 1424 | goto err; | 
| 1425 | X25519_keypair(public_key, S3I(s)->tmp.x25519); | 1425 | X25519_keypair(public_key, private_key); | 
| 1426 | 1426 | ||
| 1427 | /* Serialize public key. */ | 1427 | /* Serialize public key. */ | 
| 1428 | if ((curve_id = tls1_ec_nid2curve_id(nid)) == 0) { | 1428 | if ((curve_id = tls1_ec_nid2curve_id(nid)) == 0) { | 
| @@ -1441,10 +1441,13 @@ ssl3_send_server_kex_ecdhe_ecx(SSL *s, int nid, CBB *cbb) | |||
| 1441 | if (!CBB_flush(cbb)) | 1441 | if (!CBB_flush(cbb)) | 
| 1442 | goto err; | 1442 | goto err; | 
| 1443 | 1443 | ||
| 1444 | S3I(s)->tmp.x25519 = private_key; | ||
| 1445 | private_key = NULL; | ||
| 1444 | ret = 1; | 1446 | ret = 1; | 
| 1445 | 1447 | ||
| 1446 | err: | 1448 | err: | 
| 1447 | free(public_key); | 1449 | free(public_key); | 
| 1450 | freezero(private_key, X25519_KEY_LENGTH); | ||
| 1448 | 1451 | ||
| 1449 | return (ret); | 1452 | return (ret); | 
| 1450 | } | 1453 | } | 
