From ce2b22a6a7353d8506ceb0444ac96b747f384dbf Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Fri, 28 May 2021 21:00:54 +0300 Subject: [PATCH] cipurse crypto sketch --- client/src/cipurse/cipursecrypto.c | 23 ++++++++++++++++ client/src/cipurse/cipursecrypto.h | 42 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 client/src/cipurse/cipursecrypto.c create mode 100644 client/src/cipurse/cipursecrypto.h diff --git a/client/src/cipurse/cipursecrypto.c b/client/src/cipurse/cipursecrypto.c new file mode 100644 index 000000000..0f928ea1e --- /dev/null +++ b/client/src/cipurse/cipursecrypto.c @@ -0,0 +1,23 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2021 Merlok +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// CIPURSE crypto primitives +//----------------------------------------------------------------------------- + +#include "cipursecore.h" + +#include "commonutil.h" // ARRAYLEN +#include "comms.h" // DropField +#include "util_posix.h" // msleep + +#include "cmdhf14a.h" +#include "emv/emvcore.h" +#include "emv/emvjson.h" +#include "ui.h" +#include "util.h" + + diff --git a/client/src/cipurse/cipursecrypto.h b/client/src/cipurse/cipursecrypto.h new file mode 100644 index 000000000..f2e0dbfa2 --- /dev/null +++ b/client/src/cipurse/cipursecrypto.h @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2021 Merlok +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// CIPURSE crypto primitives +//----------------------------------------------------------------------------- + +#ifndef __CIPURSECRYPTO_H__ +#define __CIPURSECRYPTO_H__ + +#include "common.h" + +enum CipurseChannelSecurityLevel { + CPSNone, + CPSPlain, + CPSMACed, + CPSEncrypted +} + +struct CipurseSession { + uint8_t keyId, + uint8_t[16] key, + + uint8_t[16] RP, + uint8_t[6] rP, + uint8_t[16] RT, + uint8_t[6] rT, + + uint8_t[16] k0, + uint8_t[16] cP, + + uint8_t[16] frameKey, + uint8_t[16] frameKey1 +} + + + + +#endif /* __CIPURSECRYPTO_H__ */