[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/5] curve25519: Small libgcrypt bignum fix


* src/curve25519.c (ssh_client_curve25519_init): Make use of the
gcrypt-variant of 'bignum_bin2bn'.

Signed-off-by: Justus Winter <justus@xxxxxxxxxxx>
---
 src/curve25519.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/curve25519.c b/src/curve25519.c
index 43783e8..77fab2d 100644
--- a/src/curve25519.c
+++ b/src/curve25519.c
@@ -71,11 +71,14 @@ int ssh_client_curve25519_init(ssh_session session){
 
 static int ssh_curve25519_build_k(ssh_session session) {
   ssh_curve25519_pubkey k;
+
+#ifdef HAVE_LIBCRYPTO
   session->next_crypto->k = bignum_new();
 
   if (session->next_crypto->k == NULL) {
     return SSH_ERROR;
   }
+#endif
 
   if (session->server)
 	  crypto_scalarmult(k, session->next_crypto->curve25519_privkey,
@@ -84,7 +87,11 @@ static int ssh_curve25519_build_k(ssh_session session) {
 	  crypto_scalarmult(k, session->next_crypto->curve25519_privkey,
 			  session->next_crypto->curve25519_server_pubkey);
 
+#ifdef HAVE_LIBGCRYPT
+  bignum_bin2bn(k, CURVE25519_PUBKEY_SIZE, &session->next_crypto->k);
+#elif defined HAVE_LIBCRYPTO
   bignum_bin2bn(k, CURVE25519_PUBKEY_SIZE, session->next_crypto->k);
+#endif
 
 #ifdef DEBUG_CRYPTO
     ssh_print_hexa("Session server cookie",
-- 
2.8.1


Follow-Ups:
[PATCH 3/5] libgcrypt: Implement the 'evp' interfaceJustus Winter <justus@xxxxxxxxxxx>
[PATCH 4/5] pki_gcrypt: Handle ECDSA keys and signaturesJustus Winter <justus@xxxxxxxxxxx>
[PATCH 5/5] ecdh: Implement ECDH using libgcryptJustus Winter <justus@xxxxxxxxxxx>
[PATCH 2/5] pki_gcrypt: Add a little more ASN1 infrastructureJustus Winter <justus@xxxxxxxxxxx>
Re: [PATCH 1/5] curve25519: Small libgcrypt bignum fixJustus Winter <justus@xxxxxxxxxxx>
References:
Re: [PATCH 2/3] pki_gcrypt: Handle ECDSA keys and signaturesAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org