diff --git a/ttssh2/ttxssh/ed25519.c b/ttssh2/ttxssh/ed25519.c index 9b12d4ce7..f20c7d334 100644 --- a/ttssh2/ttxssh/ed25519.c +++ b/ttssh2/ttxssh/ed25519.c @@ -113,6 +113,7 @@ int crypto_sign_ed25519_open( *mlen = (unsigned long long) -1; if (smlen < 64) return -1; + debug_print(43, sm, smlen); if (ge25519_unpackneg_vartime(&get1, pk)) return -1; @@ -125,6 +126,7 @@ int crypto_sign_ed25519_open( ge25519_double_scalarmult_vartime(&get2, &get1, &schram, &ge25519_base, &scs); ge25519_pack(t2, &get2); + debug_print(44, t2, sizeof(t2)); ret = crypto_verify_32(sm, t2); if (!ret) diff --git a/ttssh2/ttxssh/key.c b/ttssh2/ttxssh/key.c index 7d58b5e1e..81d1b530e 100644 --- a/ttssh2/ttxssh/key.c +++ b/ttssh2/ttxssh/key.c @@ -493,26 +493,23 @@ static int ssh_ed25519_verify(Key *key, unsigned char *signature, unsigned int s ret = -1; b = buffer_init(); - if (b == NULL) { - MessageBox(NULL, "b == NULL", "debug", MB_OK); + if (b == NULL) goto error; - } + debug_print(41, signature, signaturelen); + debug_print(42, data, datalen); buffer_append(b, signature, signaturelen); bptr = buffer_ptr(b); ktype = buffer_get_string(&bptr, NULL); if (strcmp("ssh-ed25519", ktype) != 0) { - MessageBox(NULL, "strcmp(\"ssh-ed25519\", ktype) != 0", "debug", MB_OK); goto error; } sigblob = buffer_get_string(&bptr, &len); rlen = buffer_remain_len(b); if (rlen != 0) { - MessageBox(NULL, "rlen != 0", "debug", MB_OK); goto error; } if (len > crypto_sign_ed25519_BYTES) { - MessageBox(NULL, "len > crypto_sign_ed25519_BYTES", "debug", MB_OK); goto error; } @@ -522,29 +519,15 @@ static int ssh_ed25519_verify(Key *key, unsigned char *signature, unsigned int s memcpy(sm+len, data, datalen); mlen = smlen; m = malloc((size_t)mlen); - - { - char msg[256]; - _snprintf_s(msg, sizeof(msg), _TRUNCATE, - "signaturelen: %d, datalen: %d, len: %d, rlen: %d, smlen: %lld, mlen: %lld", - signaturelen, datalen, len, rlen, smlen, mlen); - MessageBox(NULL, msg, "debug", MB_OK); - } - + if ((ret = crypto_sign_ed25519_open(m, &mlen, sm, smlen, key->ed25519_pk)) != 0) { - char msg[256]; - _snprintf_s(msg, sizeof(msg), _TRUNCATE, - "crypto_sign_ed25519_open failed: %d", - ret); - MessageBox(NULL, msg, "debug", MB_OK); //debug2("%s: crypto_sign_ed25519_open failed: %d", // __func__, ret); } if (ret == 0 && mlen != datalen) { //debug2("%s: crypto_sign_ed25519_open " // "mlen != datalen (%llu != %u)", __func__, mlen, datalen); - MessageBox(NULL, "crypto_sign_ed25519_open(): mlen != datalen", "debug", MB_OK); ret = -1; } /* XXX compare 'm' and 'data' ? */