Merge pull request #20 from NodeFactoryIo/fix/prologue

Set prologue to empty buffer
This commit is contained in:
Marin Petrunić 2020-01-30 10:47:01 +01:00 committed by GitHub
commit 2f6cc39888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 10 additions and 10 deletions

View File

@ -31,7 +31,7 @@ type HandshakeParams = {
export class Noise implements INoiseConnection { export class Noise implements INoiseConnection {
public protocol = "/noise"; public protocol = "/noise";
private readonly prologue = Buffer.from(this.protocol); private readonly prologue = Buffer.alloc(0);
private readonly staticKeys: KeyPair; private readonly staticKeys: KeyPair;
private readonly earlyData?: bytes; private readonly earlyData?: bytes;
private useNoisePipes: boolean; private useNoisePipes: boolean;

View File

@ -6,7 +6,7 @@ import {assert, expect} from "chai";
import {generateEd25519Keys} from "../utils"; import {generateEd25519Keys} from "../utils";
describe("Index", () => { describe("Index", () => {
const prologue = Buffer.from("/noise", "utf-8"); const prologue = Buffer.alloc(0);
it("Test complete IK handshake", async () => { it("Test complete IK handshake", async () => {
try { try {

View File

@ -7,7 +7,7 @@ import { generateEd25519Keys } from "../utils";
import {createHandshakePayload, generateKeypair, getHandshakePayload, getHkdf} from "../../src/utils"; import {createHandshakePayload, generateKeypair, getHandshakePayload, getHkdf} from "../../src/utils";
describe("Index", () => { describe("Index", () => {
const prologue = Buffer.from("/noise", "utf-8"); const prologue = Buffer.alloc(0);
it("Test creating new XX session", async () => { it("Test creating new XX session", async () => {
try { try {

View File

@ -20,7 +20,7 @@ describe("IK Handshake", () => {
const connectionFrom = Wrap(duplex[0]); const connectionFrom = Wrap(duplex[0]);
const connectionTo = Wrap(duplex[1]); const connectionTo = Wrap(duplex[1]);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeysInitiator = generateKeypair(); const staticKeysInitiator = generateKeypair();
const staticKeysResponder = generateKeypair(); const staticKeysResponder = generateKeypair();
@ -60,7 +60,7 @@ describe("IK Handshake", () => {
const connectionFrom = Wrap(duplex[0]); const connectionFrom = Wrap(duplex[0]);
const connectionTo = Wrap(duplex[1]); const connectionTo = Wrap(duplex[1]);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeysInitiator = generateKeypair(); const staticKeysInitiator = generateKeypair();
const staticKeysResponder = generateKeypair(); const staticKeysResponder = generateKeypair();
const oldScammyKeys = generateKeypair(); const oldScammyKeys = generateKeypair();

View File

@ -61,7 +61,7 @@ describe("Noise", () => {
noiseInit.secureOutbound(localPeer, outboundConnection, remotePeer), noiseInit.secureOutbound(localPeer, outboundConnection, remotePeer),
(async () => { (async () => {
const wrapped = Wrap(inboundConnection); const wrapped = Wrap(inboundConnection);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeys = generateKeypair(); const staticKeys = generateKeypair();
const xx = new XX(); const xx = new XX();

View File

@ -24,7 +24,7 @@ describe("XX Fallback Handshake", () => {
const connectionFrom = Wrap(duplex[0]); const connectionFrom = Wrap(duplex[0]);
const connectionTo = Wrap(duplex[1]); const connectionTo = Wrap(duplex[1]);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeysInitiator = generateKeypair(); const staticKeysInitiator = generateKeypair();
const staticKeysResponder = generateKeypair(); const staticKeysResponder = generateKeypair();
const ephemeralKeys = generateKeypair(); const ephemeralKeys = generateKeypair();

View File

@ -21,7 +21,7 @@ describe("XX Handshake", () => {
const connectionFrom = Wrap(duplex[0]); const connectionFrom = Wrap(duplex[0]);
const connectionTo = Wrap(duplex[1]); const connectionTo = Wrap(duplex[1]);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeysInitiator = generateKeypair(); const staticKeysInitiator = generateKeypair();
const staticKeysResponder = generateKeypair(); const staticKeysResponder = generateKeypair();
@ -66,7 +66,7 @@ describe("XX Handshake", () => {
const connectionFrom = Wrap(duplex[0]); const connectionFrom = Wrap(duplex[0]);
const connectionTo = Wrap(duplex[1]); const connectionTo = Wrap(duplex[1]);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeysInitiator = generateKeypair(); const staticKeysInitiator = generateKeypair();
const staticKeysResponder = generateKeypair(); const staticKeysResponder = generateKeypair();
@ -94,7 +94,7 @@ describe("XX Handshake", () => {
const connectionFrom = Wrap(duplex[0]); const connectionFrom = Wrap(duplex[0]);
const connectionTo = Wrap(duplex[1]); const connectionTo = Wrap(duplex[1]);
const prologue = Buffer.from('/noise'); const prologue = Buffer.alloc(0);
const staticKeysInitiator = generateKeypair(); const staticKeysInitiator = generateKeypair();
const staticKeysResponder = generateKeypair(); const staticKeysResponder = generateKeypair();