mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-16 01:45:40 +00:00
1074 lines
68 KiB
C
1074 lines
68 KiB
C
/* Generated by Nim Compiler v1.2.6 */
|
|
/* (c) 2020 Andreas Rumpf */
|
|
/* The generated code is subject to the original license. */
|
|
/* Compiled for: Linux, amd64, gcc */
|
|
/* Command for C compiler:
|
|
gcc -c -w -pthread -I/home/runner/work/nim-waku/nim-waku/vendor/nim-libbacktrace -I/home/runner/work/nim-waku/nim-waku/vendor/nim-libbacktrace/install/usr/include -I/home/runner/work/nim-waku/nim-waku/vendor/nim-secp256k1/secp256k1_wrapper -I/home/runner/work/nim-waku/nim-waku/vendor/nim-secp256k1/secp256k1_wrapper/secp256k1 -I/home/runner/work/nim-waku/nim-waku/vendor/nim-secp256k1/secp256k1_wrapper/secp256k1/src -DHAVE_CONFIG_H -DHAVE_BUILTIN_EXPECT -I/home/runner/work/nim-waku/nim-waku/vendor/nim-bearssl/bearssl/csources/src -I/home/runner/work/nim-waku/nim-waku/vendor/nim-bearssl/bearssl/csources/inc -I/home/runner/work/nim-waku/nim-waku/vendor/nim-bearssl/bearssl/csources/tools -DBR_USE_UNIX_TIME=1 -DBR_USE_URANDOM=1 -DBR_LE_UNALIGNED=1 -DBR_64=1 -DBR_amd64=1 -DBR_INT128=1 -I/home/runner/work/nim-waku/nim-waku/vendor/nim-nat-traversal/vendor/miniupnp/miniupnpc -I/home/runner/work/nim-waku/nim-waku/vendor/nim-nat-traversal/vendor/libnatpmp-upstream -DENABLE_STRNATPMPERR -march=native -g3 -Og -O3 -fno-strict-aliasing -fno-ident -I/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib -I/home/runner/work/nim-waku/nim-waku/waku/common -o nimcache/release/wakubridge/@m..@s..@svendor@snim-eth@seth@sp2p@secies.nim.c.o nimcache/release/wakubridge/@m..@s..@svendor@snim-eth@seth@sp2p@secies.nim.c */
|
|
#define NIM_INTBITS 64
|
|
|
|
#include "nimbase.h"
|
|
#include <string.h>
|
|
#include "bearssl_rand.h"
|
|
#include "bearssl_hash.h"
|
|
#undef LANGUAGE_C
|
|
#undef MIPSEB
|
|
#undef MIPSEL
|
|
#undef PPC
|
|
#undef R3000
|
|
#undef R4000
|
|
#undef i386
|
|
#undef linux
|
|
#undef mips
|
|
#undef near
|
|
#undef far
|
|
#undef powerpc
|
|
#undef unix
|
|
#define nimfr_(x, y)
|
|
#define nimln_(x, y)
|
|
typedef struct tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ;
|
|
typedef struct tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w;
|
|
typedef struct tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg;
|
|
typedef struct tyObject_RijndaelContext__P9ctyX6u5ZjparlFDMKF09bg tyObject_RijndaelContext__P9ctyX6u5ZjparlFDMKF09bg;
|
|
typedef struct tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg;
|
|
typedef struct tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w;
|
|
typedef struct tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q;
|
|
typedef struct tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA;
|
|
typedef struct tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ;
|
|
typedef struct tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw;
|
|
typedef struct tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ;
|
|
typedef struct NimStringDesc NimStringDesc;
|
|
typedef struct TGenericSeq TGenericSeq;
|
|
typedef struct tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow;
|
|
typedef struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ tySequence__6H5Oh5UUvVCLiakt9aTwtUQ;
|
|
typedef struct tyObject_MDigest__law9ct65KplMYBvtmjCQxbw tyObject_MDigest__law9ct65KplMYBvtmjCQxbw;
|
|
typedef struct tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g;
|
|
typedef struct TNimType TNimType;
|
|
typedef struct TNimNode TNimNode;
|
|
typedef NU8 tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA;
|
|
struct tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ {NIM_BOOL o;
|
|
union{
|
|
struct {tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA e;
|
|
} _o_1;
|
|
};
|
|
};
|
|
typedef NU8 tyArray__qtqsWM5aXmcpMIVmvq3kAA[16];
|
|
typedef NU64 tyArray__wa4ExhM0I5D0wQQmyrXAHA[120];
|
|
struct tyObject_RijndaelContext__P9ctyX6u5ZjparlFDMKF09bg {tyArray__wa4ExhM0I5D0wQQmyrXAHA skey;
|
|
NI nr;
|
|
};
|
|
typedef NU8 tyArray__vEOa9c5qaE9ajWxR5R4zwfQg[32];
|
|
struct tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg {tyObject_RijndaelContext__P9ctyX6u5ZjparlFDMKF09bg cipher;
|
|
tyArray__vEOa9c5qaE9ajWxR5R4zwfQg iv;
|
|
tyArray__vEOa9c5qaE9ajWxR5R4zwfQg ecount;
|
|
NU num;
|
|
};
|
|
typedef NU32 tyArray__JlnxiR65D9cjJpwi6uBZRtA[2];
|
|
typedef NU32 tyArray__MpWsq9bBH14GsDQQ59cgyxAQ[8];
|
|
typedef NU8 tyArray__w5VB8h5K8DB3oWrO5U2wqg[64];
|
|
struct tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w {tyArray__JlnxiR65D9cjJpwi6uBZRtA count;
|
|
tyArray__MpWsq9bBH14GsDQQ59cgyxAQ state;
|
|
tyArray__w5VB8h5K8DB3oWrO5U2wqg buffer;
|
|
};
|
|
struct tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg {tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w mdctx;
|
|
tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w opadctx;
|
|
tyArray__w5VB8h5K8DB3oWrO5U2wqg ipad;
|
|
tyArray__w5VB8h5K8DB3oWrO5U2wqg opad;
|
|
};
|
|
struct __attribute__((__packed__)) tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q {NU8 version;
|
|
tyArray__w5VB8h5K8DB3oWrO5U2wqg pubkey;
|
|
tyArray__qtqsWM5aXmcpMIVmvq3kAA iv;
|
|
NU8 data;
|
|
};
|
|
struct tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ {tyArray__w5VB8h5K8DB3oWrO5U2wqg data;
|
|
};
|
|
struct tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA {tyObject_secp256k1_pubkey__GYc9aFo1e2qOLdmAqUvIikQ data;
|
|
};
|
|
struct tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw {NIM_BOOL o;
|
|
union{
|
|
struct {tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA e;
|
|
} _o_1;
|
|
struct {tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA v;
|
|
} _o_2;
|
|
};
|
|
};
|
|
typedef struct {
|
|
N_NIMCALL_PTR(tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA, ClP_0) (NCSTRING x_0, void* ClE_0);
|
|
void* ClE_0;
|
|
} tyProc__8d1pWWaisRFfcgOYhZHMkQ;
|
|
struct tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ {NIM_BOOL o;
|
|
union{
|
|
struct {NCSTRING e;
|
|
} _o_1;
|
|
struct {tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA v;
|
|
} _o_2;
|
|
};
|
|
};
|
|
struct TGenericSeq {NI len;
|
|
NI reserved;
|
|
};
|
|
struct NimStringDesc { TGenericSeq Sup;NIM_CHAR data[SEQ_DECL_SIZE];
|
|
};
|
|
typedef N_CLOSURE_PTR(tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA, TM__kEg4jrkuHaBhU9bZeYcj4rg_5) (NCSTRING x_0);
|
|
typedef N_CLOSURE_PTR(tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA, TM__kEg4jrkuHaBhU9bZeYcj4rg_6) (NCSTRING x_0, void* ClE_0);
|
|
struct tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow {tyArray__vEOa9c5qaE9ajWxR5R4zwfQg data;
|
|
};
|
|
struct tyObject_MDigest__law9ct65KplMYBvtmjCQxbw {tyArray__vEOa9c5qaE9ajWxR5R4zwfQg data;
|
|
};
|
|
struct tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w {tyArray__vEOa9c5qaE9ajWxR5R4zwfQg data;
|
|
};
|
|
struct tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g {tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w seckey;
|
|
tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA pubkey;
|
|
};
|
|
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
|
|
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
|
|
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
|
|
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
|
|
struct TNimType {NI size;
|
|
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
|
|
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
|
|
TNimType* base;
|
|
TNimNode* node;
|
|
void* finalizer;
|
|
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
|
|
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
|
|
NCSTRING name;
|
|
TNimType* nextType;
|
|
NI instances;
|
|
NI sizes;
|
|
};
|
|
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
|
|
struct TNimNode {tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
|
|
NI offset;
|
|
TNimType* typ;
|
|
NCSTRING name;
|
|
NI len;
|
|
TNimNode** sons;
|
|
};
|
|
typedef unsigned char tyArray__A1SHJCPZVISPTujoygIPEQ[64];
|
|
typedef N_CDECL_PTR(void, tyProc__3qI9bVHqiq07sTQRU9bkkkYQ) (br_prng_class** ctx, void* params, void* seed, NI seedLen);
|
|
typedef N_CDECL_PTR(void, tyProc__hquUwNr88w4T5ldt8BqLLQ) (br_prng_class** ctx, void* out_0, NI len_0);
|
|
typedef N_CDECL_PTR(void, tyProc__bF2JFxTs1q6Lq365NU79a2Q) (br_hash_class** ctx);
|
|
typedef N_CDECL_PTR(void, tyProc__Dc9br5a6SHw9cxie3cas0KTA) (br_hash_class** ctx, void* data_0, NI len_0);
|
|
typedef N_CDECL_PTR(void, tyProc__JETfgzvEnx6Tz9bYRct9a51g) (br_hash_class** ctx, void* dst);
|
|
typedef N_CDECL_PTR(NU64, tyProc__e9bd9aJH2sCZh75q9aAcv7ylg) (br_hash_class** ctx, void* dst);
|
|
typedef N_CDECL_PTR(void, tyProc__g9c2vH2tlPaPmvfTZ3PeWQQ) (br_hash_class** ctx, void* stb, NU64 count_0);
|
|
struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ { TGenericSeq Sup; NU8 data[SEQ_DECL_SIZE];};static N_INLINE(void, nimZeroMem)(void* p, NI size);
|
|
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
|
|
N_LIB_PRIVATE N_NOINLINE(void, chckNil)(void* p);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw, mapErrTo__QRDjeunFoCK0uGT5kKkpAw)(tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ* r);
|
|
static N_INLINE(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw, mapErr__9cKMmOuwMC2NKhjFSWqDfVwresults)(tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ* self, tyProc__8d1pWWaisRFfcgOYhZHMkQ f);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError)(NimStringDesc* f);
|
|
N_LIB_PRIVATE N_NIMCALL(tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA, colonanonymous___Yod9bgLxEQZOVYdPQgzFckA)(NCSTRING e_0);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ, fromRaw__09bVO0j5Htfp2zQRd1AkcpQ)(NU8* data_0, NI data_0Len_0);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow, ecdhRaw__Z9c2Pt1C0AACD1C2XnBvKAA)(tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w* seckey, tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA* pubkey);
|
|
N_LIB_PRIVATE N_NIMCALL(void, kdf__UAan1eFISH8p9aqSMyCfJdQ)(NU8* data_0, NI data_0Len_0, tyArray__vEOa9c5qaE9ajWxR5R4zwfQg Result);
|
|
N_LIB_PRIVATE N_NIMCALL(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*, newSeq__DpCWN7DIBuAjgoeQ9c29blYQ)(NI len_0);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
|
|
static N_INLINE(NU32, toBE__a09aOtLA9b4piPbGbo9c8yVRgendians2)(NU32 x_0);
|
|
static N_INLINE(NU32, swapBytes__a09aOtLA9b4piPbGbo9c8yVRg_2endians2)(NU32 x_0);
|
|
static N_INLINE(void, init__C8fXqRtxb2ILgkwYRN3qiQsha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx);
|
|
static N_INLINE(void, update__1PtSSXQTRWiCdvYKV9bb9bvAsha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx, NU8* pbytes, NU nbytes);
|
|
static N_INLINE(void, update__JVKV5lsc6z00iHHbNwyg9bAsha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx, NU8* data_0, NI data_0Len_0);
|
|
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size);
|
|
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
|
|
N_LIB_PRIVATE N_NIMCALL(void, sha256Transform__BJNBQtWr9bJwzqbyfKXd38Q)(NU32* state_0, NU8* data_0, NI data_0Len_0);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_MDigest__law9ct65KplMYBvtmjCQxbw, finish__x70ALeeaQ1ry9a63hdOCQWA)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx);
|
|
static N_INLINE(void, clear__C8fXqRtxb2ILgkwYRN3qiQ_3sha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx);
|
|
static N_INLINE(void, burnMem__WQXOjiuy7r6qJs6Q2oUAcgutils)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* a);
|
|
N_LIB_PRIVATE N_NIMCALL(void, burnMem__haAOjkJjOuRy8ux9bV57dXw)(void* p_0, NI size);
|
|
static N_INLINE(void, burnMem__K25lJpnPDUzcRqUMvOo9ckgutils)(tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow* a);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_MDigest__law9ct65KplMYBvtmjCQxbw, digest__y0iFskTLLbZVCJoMR0aipg)(NU8* data_0, NI data_0Len_0);
|
|
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError)(void);
|
|
static N_INLINE(void, burnArray__r09aJbNPNlBz6C6oCg8JTCQutils)(NU8* a, NI aLen_0);
|
|
N_LIB_PRIVATE N_NIMCALL(void, init__XO79cz0G5x9bYWx3NREUG23g)(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg* hmctx, NU8* key_0, NI key_0Len_0);
|
|
static N_INLINE(void, burnMem__k72AWhY8XltJimzMsVr9bdwutils)(tyObject_MDigest__law9ct65KplMYBvtmjCQxbw* a);
|
|
static N_INLINE(void, update__JDQKL6F3d4BVGKvrNMc9bmghmac)(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg* hmctx, NU8* data_0, NI data_0Len_0);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_MDigest__law9ct65KplMYBvtmjCQxbw, finish__cp8Ckr7vep0RujvudVTNTg)(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg* hmctx);
|
|
N_LIB_PRIVATE N_NIMCALL(void, clear__3PkHS3KRpSG9bEaZCBbhR4w)(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg* hmctx);
|
|
static N_INLINE(NIM_BOOL, equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem)(void* a, void* b, NI size);
|
|
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size);
|
|
N_LIB_PRIVATE N_NIMCALL(void, init__A1epXaa8QSPgtdyVzI9aWSw)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx, NU8* key_0, NI key_0Len_0, NU8* iv_0, NI iv_0Len_0);
|
|
static N_INLINE(void, decrypt__GIhSBO9bXAX05gpkiTBcgqw_2bcmode)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx, NU8* input, NI inputLen_0, NU8* output, NI outputLen_0);
|
|
static N_INLINE(void, encrypt__GIhSBO9bXAX05gpkiTBcgqw_3bcmode)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx, NU8* input, NI inputLen_0, NU8* output, NI outputLen_0);
|
|
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
|
|
N_LIB_PRIVATE N_NIMCALL(void, encrypt__5IhSwNYMkLuIObwT9aTBOyQ_2)(tyObject_RijndaelContext__P9ctyX6u5ZjparlFDMKF09bg* ctx, NU8* input, NI inputLen_0, NU8* output, NI outputLen_0);
|
|
N_LIB_PRIVATE N_NIMCALL(void, inc128__vRz5m42fv3XKwSYgATX55Q)(NU8* counter, NI counterLen_0);
|
|
N_LIB_PRIVATE N_NIMCALL(void, inc256__vRz5m42fv3XKwSYgATX55Q_2)(NU8* counter, NI counterLen_0);
|
|
static N_INLINE(void, clear__l59c6Jn7P8eTpi6QyM6SaFgbcmode)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx);
|
|
static N_INLINE(void, burnMem__P9brYVCF23Tby7DqTb3654gutils)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* a);
|
|
N_LIB_PRIVATE N_NIMCALL(void, brHmacDrbgGenerate__jb39atYOOGTT2cdYx6onnSw)(br_hmac_drbg_context* ctx, NU8* outp, NI outpLen_0);
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g, random__HS5tU9cyelo6UXEHvWOYUFg)(br_hmac_drbg_context* rng_0);
|
|
N_LIB_PRIVATE N_NIMCALL(void, clear__Exywi8FRTgke48MrQEzXSw)(tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow* v);
|
|
N_LIB_PRIVATE N_NIMCALL(void, toRaw__W9bYIkOOHQ8dZSTz9aIjEPEQ)(tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA* pubkey, tyArray__w5VB8h5K8DB3oWrO5U2wqg Result);
|
|
N_LIB_PRIVATE N_NIMCALL(void, clear__zR0Ao5CGtmWCyIBiRKQV1A)(tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g* v);
|
|
STRING_LITERAL(TM__kEg4jrkuHaBhU9bZeYcj4rg_3, "\'v\' is not accessible using discriminant \'o\' of type \'Result\'", 61);
|
|
STRING_LITERAL(TM__kEg4jrkuHaBhU9bZeYcj4rg_4, "\'e\' is not accessible using discriminant \'o\' of type \'Result\'", 61);
|
|
STRING_LITERAL(TM__kEg4jrkuHaBhU9bZeYcj4rg_22, "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/"
|
|
"bcmode.nim(503, 9) `len(input) <= len(output)` ", 110);
|
|
STRING_LITERAL(TM__kEg4jrkuHaBhU9bZeYcj4rg_23, "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/"
|
|
"bcmode.nim(504, 9) `ctx.sizeBlock == (128 div 8) or ctx.sizeBloc"
|
|
"k == (256 div 8)` ", 145);
|
|
N_LIB_PRIVATE TNimType NTI__Faslh8ClCPeRXBVFfTATjA_;
|
|
extern TNimType* nimTypeRoot;
|
|
|
|
#line 22 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_;
|
|
#line 24 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
|
|
#line 24 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size)));}
|
|
|
|
#line 33 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
|
|
#line 34 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
|
|
#line 34 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
|
|
}
|
|
|
|
#line 360 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
static N_INLINE(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw, mapErr__9cKMmOuwMC2NKhjFSWqDfVwresults)(tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ* self, tyProc__8d1pWWaisRFfcgOYhZHMkQ f) { tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw result; nimZeroMem((void*)(&result), sizeof(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw));
|
|
#line 363 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
{ if (!(*self).o) goto LA3_;
|
|
|
|
#line 300 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw)); result.o = NIM_TRUE; if (!(((2 &(1U<<((NU)((*self).o)&7U)))!=0))){ raiseFieldError(((NimStringDesc*) &TM__kEg4jrkuHaBhU9bZeYcj4rg_3)); } result._o_2.v = (*self)._o_2.v; }
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
#line 319 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw)); result.o = NIM_FALSE;
|
|
#line 364 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
if (!(((1 &(1U<<((NU)((*self).o)&7U)))!=0))){ raiseFieldError(((NimStringDesc*) &TM__kEg4jrkuHaBhU9bZeYcj4rg_4)); } result._o_1.e = f.ClE_0? f.ClP_0((*self)._o_1.e, f.ClE_0):((TM__kEg4jrkuHaBhU9bZeYcj4rg_5)(f.ClP_0))((*self)._o_1.e); }
|
|
LA1_: ;
|
|
return result;}
|
|
|
|
#line 42 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
N_LIB_PRIVATE N_NIMCALL(tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA, colonanonymous___Yod9bgLxEQZOVYdPQgzFckA)(NCSTRING e_0) { tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA result; result = (tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA)0;
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
result = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 3); return result;}
|
|
|
|
#line 41 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw, mapErrTo__QRDjeunFoCK0uGT5kKkpAw)(tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ* r) { tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw result; tyProc__8d1pWWaisRFfcgOYhZHMkQ T1_; nimZeroMem((void*)(&result), sizeof(tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw));
|
|
#line 42 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
nimZeroMem((void*)(&T1_), sizeof(tyProc__8d1pWWaisRFfcgOYhZHMkQ)); T1_.ClP_0 = ((TM__kEg4jrkuHaBhU9bZeYcj4rg_6) (colonanonymous___Yod9bgLxEQZOVYdPQgzFckA)); T1_.ClE_0 = NIM_NIL;
|
|
#line 42 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
result = mapErr__9cKMmOuwMC2NKhjFSWqDfVwresults(r, T1_); return result;}
|
|
|
|
#line 79 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
static N_INLINE(NU32, swapBytes__a09aOtLA9b4piPbGbo9c8yVRg_2endians2)(NU32 x_0) { NU32 result; result = (NU32)0;
|
|
#line 80 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
|
|
#line 89 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
|
|
#line 89 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
result = __builtin_bswap32(x_0); return result;}
|
|
|
|
#line 161 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
static N_INLINE(NU32, toBE__a09aOtLA9b4piPbGbo9c8yVRgendians2)(NU32 x_0) { NU32 result; result = (NU32)0;
|
|
#line 162 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
|
|
#line 164 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
{ if (!NIM_FALSE) goto LA3_;
|
|
result = x_0; }
|
|
goto LA1_;
|
|
LA3_: ;
|
|
{
|
|
#line 165 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
|
|
#line 165 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/endians2.nim"
|
|
result = swapBytes__a09aOtLA9b4piPbGbo9c8yVRg_2endians2(x_0); }
|
|
LA1_: ;
|
|
return result;}
|
|
|
|
#line 134 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
static N_INLINE(void, init__C8fXqRtxb2ILgkwYRN3qiQsha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx) {
|
|
#line 135 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).count[(((NI) 0))- 0] = ((NU32) 0);
|
|
#line 136 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).count[(((NI) 1))- 0] = ((NU32) 0);
|
|
#line 147 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 0))- 0] = ((NU32) 1779033703);
|
|
#line 148 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 1))- 0] = ((NU32) IL64(3144134277));
|
|
#line 149 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 2))- 0] = ((NU32) 1013904242);
|
|
#line 150 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 3))- 0] = ((NU32) IL64(2773480762));
|
|
#line 151 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 4))- 0] = ((NU32) 1359893119);
|
|
#line 152 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 5))- 0] = ((NU32) IL64(2600822924));
|
|
#line 153 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 6))- 0] = ((NU32) 528734635);
|
|
#line 154 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).state[(((NI) 7))- 0] = ((NU32) 1541459225);}
|
|
|
|
#line 11 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) { void* T1_;
|
|
#line 13 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
|
|
#line 13 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
T1_ = (void*)0; T1_ = memcpy(dest, source, ((size_t) (size)));}
|
|
|
|
#line 2112 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
static N_INLINE(void, copyMem__i80o3k0SgEI5gTRCzYdyWAsystem)(void* dest, void* source, NI size) {
|
|
#line 2113 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
|
|
#line 2113 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
nimCopyMem(dest, source, size);
|
|
}
|
|
|
|
#line 459 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
static N_INLINE(void, update__JVKV5lsc6z00iHHbNwyg9bAsha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx, NU8* data_0, NI data_0Len_0) { NI pos; NI length;
|
|
#line 460 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
pos = ((NI) 0);
|
|
#line 461 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 461 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
length = data_0Len_0; {
|
|
#line 464 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
while (1) { NI offset; NI size; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_9; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_10; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_11; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_12;
|
|
#line 464 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if (!(((NI) 0) < length)) goto LA2;
|
|
|
|
#line 465 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 465 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
offset = ((NI) ((NU32)((*ctx).count[(((NI) 0))- 0] & ((NU32) 63))));
|
|
#line 466 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 466 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 466 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if (nimSubInt(((NI) 64), offset, &TM__kEg4jrkuHaBhU9bZeYcj4rg_9)) { raiseOverflow(); }; size = (((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_9) <= length) ? (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_9) : length);
|
|
#line 417 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
if ((NU)(offset) > (NU)(63)){ raiseIndexError2(offset, 63); } if ((NU)(pos) >= (NU)(data_0Len_0)){ raiseIndexError2(pos,data_0Len_0-1); }
|
|
#line 417 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
if (nimMulInt(size, ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_10)) { raiseOverflow(); }; if (((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_10)) < ((NI) 0) || ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_10)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_10), ((NI) 0), ((NI) IL64(9223372036854775807))); }
|
|
#line 417 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&(*ctx).buffer[(offset)- 0]))), ((void*) ((&data_0[pos]))), ((NI) ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_10))));
|
|
|
|
#line 468 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 468 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if (nimAddInt(pos, size, &TM__kEg4jrkuHaBhU9bZeYcj4rg_11)) { raiseOverflow(); }; pos = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_11);
|
|
#line 469 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 469 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if (nimSubInt(length, size, &TM__kEg4jrkuHaBhU9bZeYcj4rg_12)) { raiseOverflow(); }; length = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_12);
|
|
#line 470 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 470 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).count[(((NI) 0))- 0] = (NU32)((NU32)((*ctx).count[(((NI) 0))- 0]) + (NU32)(((NU32) (size))));
|
|
#line 471 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
{
|
|
#line 471 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if (!((NU32)((*ctx).count[(((NI) 0))- 0]) < (NU32)(((NU32) (size))))) goto LA5_;
|
|
|
|
#line 472 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 472 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
(*ctx).count[(((NI) 1))- 0] = (NU32)((NU32)((*ctx).count[(((NI) 1))- 0]) + (NU32)(((NU32) 1))); }
|
|
LA5_: ;
|
|
|
|
#line 473 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
{
|
|
#line 473 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 473 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if (!((NU32)((*ctx).count[(((NI) 0))- 0] & ((NU32) 63)) == ((NU32) 0))) goto LA9_;
|
|
|
|
#line 474 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 474 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
sha256Transform__BJNBQtWr9bJwzqbyfKXd38Q((*ctx).state, (*ctx).buffer, 64);
|
|
}
|
|
LA9_: ;
|
|
} LA2: ;
|
|
}
|
|
}
|
|
|
|
#line 488 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
static N_INLINE(void, update__1PtSSXQTRWiCdvYKV9bb9bvAsha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx, NU8* pbytes, NU nbytes) { NU8* p_1; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_13;
|
|
#line 489 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
p_1 = ((NU8*) (pbytes));
|
|
#line 490 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 490 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
if ((NI64)(nbytes) < ((NI) (IL64(-9223372036854775807) - IL64(1))) || (NI64)(nbytes) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI(nbytes, ((NI) (IL64(-9223372036854775807) - IL64(1))), ((NI) IL64(9223372036854775807))); } if (nimSubInt(((NI) (nbytes)), ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_13)) { raiseOverflow(); };
|
|
#line 490 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
update__JVKV5lsc6z00iHHbNwyg9bAsha2(ctx, (NU8*)((p_1)+(((NI) 0))), ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_13))-(((NI) 0))+1);
|
|
}
|
|
|
|
#line 194 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
static N_INLINE(void, burnMem__WQXOjiuy7r6qJs6Q2oUAcgutils)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* a) {
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
burnMem__haAOjkJjOuRy8ux9bV57dXw(((void*) (a)), ((NI) 104));
|
|
}
|
|
|
|
#line 192 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
static N_INLINE(void, clear__C8fXqRtxb2ILgkwYRN3qiQ_3sha2)(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w* ctx) {
|
|
#line 219 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
|
|
#line 219 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/sha2.nim"
|
|
burnMem__WQXOjiuy7r6qJs6Q2oUAcgutils(ctx);
|
|
}
|
|
|
|
#line 75 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
N_LIB_PRIVATE N_NIMCALL(void, kdf__UAan1eFISH8p9aqSMyCfJdQ)(NU8* data_0, NI data_0Len_0, tyArray__vEOa9c5qaE9ajWxR5R4zwfQg Result) { tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w ctx; NU32 counter; NU32 counterLe; NI reps; NI offset; tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* storage; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_7; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_8; nimZeroMem((void*)(&ctx), sizeof(tyObject_Sha2Context__5brAquljQjPUyNuIC4vV1w)); counter = (NU32)0; counterLe = (NU32)0;
|
|
#line 80 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
reps = ((NI) 0);
|
|
#line 81 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
offset = ((NI) 0);
|
|
#line 82 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 82 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 82 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(reps, ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_7)) { raiseOverflow(); }; if (nimMulInt(((NI) 32), (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_7), &TM__kEg4jrkuHaBhU9bZeYcj4rg_8)) { raiseOverflow(); }; if (((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_8)) < ((NI) 0) || ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_8)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_8), ((NI) 0), ((NI) IL64(9223372036854775807))); }
|
|
#line 82 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
storage = newSeq__DpCWN7DIBuAjgoeQ9c29blYQ(((NI) ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_8)))); {
|
|
#line 83 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
while (1) { tyObject_MDigest__law9ct65KplMYBvtmjCQxbw hash_1; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_14;
|
|
#line 83 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (!((NU32)(counter) <= (NU32)(((NU32) (reps))))) goto LA2;
|
|
|
|
#line 84 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 84 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
counter = (NU32)((NU32)(counter) + (NU32)(((NU32) 1)));
|
|
#line 85 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 85 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
counterLe = toBE__a09aOtLA9b4piPbGbo9c8yVRgendians2(counter);
|
|
#line 86 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 86 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
init__C8fXqRtxb2ILgkwYRN3qiQsha2((&ctx));
|
|
|
|
#line 87 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 87 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
update__1PtSSXQTRWiCdvYKV9bb9bvAsha2((&ctx), ((NU8*) ((&counterLe))), ((NU) 4));
|
|
|
|
#line 88 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if ((NU)(((NI) 0)) >= (NU)(data_0Len_0)){ raiseIndexError2(((NI) 0),data_0Len_0-1); }
|
|
#line 88 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 88 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
update__1PtSSXQTRWiCdvYKV9bb9bvAsha2((&ctx), (&data_0[((NI) 0)]), ((NU) (data_0Len_0)));
|
|
|
|
#line 89 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 89 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
hash_1 = finish__x70ALeeaQ1ry9a63hdOCQWA((&ctx));
|
|
#line 90 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if ((NU)(offset) >= (NU)(storage ? storage->Sup.len : 0)){ raiseIndexError2(offset,(storage ? storage->Sup.len : 0)-1); }
|
|
#line 90 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&storage->data[offset]))), ((void*) ((&hash_1.data[(((NI) 0))- 0]))), ((NI) 32));
|
|
|
|
#line 91 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(offset, ((NI) 32), &TM__kEg4jrkuHaBhU9bZeYcj4rg_14)) { raiseOverflow(); }; offset = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_14); } LA2: ;
|
|
}
|
|
|
|
#line 92 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 92 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__C8fXqRtxb2ILgkwYRN3qiQ_3sha2((&ctx));
|
|
|
|
#line 93 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if ((NU)(((NI) 0)) >= (NU)(storage ? storage->Sup.len : 0)){ raiseIndexError2(((NI) 0),(storage ? storage->Sup.len : 0)-1); }
|
|
#line 93 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&Result[(((NI) 0))- 0]))), ((void*) ((&storage->data[((NI) 0)]))), ((NI) 32));
|
|
}
|
|
|
|
#line 194 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
static N_INLINE(void, burnMem__K25lJpnPDUzcRqUMvOo9ckgutils)(tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow* a) {
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
burnMem__haAOjkJjOuRy8ux9bV57dXw(((void*) (a)), ((NI) 32));
|
|
}
|
|
|
|
#line 184 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
static N_INLINE(void, burnArray__r09aJbNPNlBz6C6oCg8JTCQutils)(NU8* a, NI aLen_0) {
|
|
#line 185 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
{ NI TM__kEg4jrkuHaBhU9bZeYcj4rg_15;
|
|
#line 185 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
|
|
#line 185 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
if (!(((NI) 0) < aLen_0)) goto LA3_;
|
|
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
if ((NU)(((NI) 0)) >= (NU)(aLen_0)){ raiseIndexError2(((NI) 0),aLen_0-1); }
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
if (nimMulInt(aLen_0, ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_15)) { raiseOverflow(); }; if (((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_15)) < ((NI) 0) || ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_15)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_15), ((NI) 0), ((NI) IL64(9223372036854775807))); }
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
burnMem__haAOjkJjOuRy8ux9bV57dXw(((void*) ((&a[((NI) 0)]))), ((NI) ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_15))));
|
|
}
|
|
LA3_: ;
|
|
}
|
|
|
|
#line 194 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
static N_INLINE(void, burnMem__k72AWhY8XltJimzMsVr9bdwutils)(tyObject_MDigest__law9ct65KplMYBvtmjCQxbw* a) {
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
burnMem__haAOjkJjOuRy8ux9bV57dXw(((void*) (a)), ((NI) 32));
|
|
}
|
|
|
|
#line 158 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/hmac.nim"
|
|
static N_INLINE(void, update__JDQKL6F3d4BVGKvrNMc9bmghmac)(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg* hmctx, NU8* data_0, NI data_0Len_0) {
|
|
#line 175 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/hmac.nim"
|
|
|
|
#line 175 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/hmac.nim"
|
|
update__JVKV5lsc6z00iHHbNwyg9bAsha2((&(*hmctx).mdctx), data_0, data_0Len_0);
|
|
}
|
|
|
|
#line 36 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
static N_INLINE(int, nimCmpMem)(void* a, void* b, NI size) { int result; result = (int)0;
|
|
#line 38 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
|
|
#line 38 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system/memory.nim"
|
|
result = memcmp(a, b, ((size_t) (size))); return result;}
|
|
|
|
#line 2120 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
static N_INLINE(NIM_BOOL, equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem)(void* a, void* b, NI size) { NIM_BOOL result; int T1_; result = (NIM_BOOL)0;
|
|
#line 2121 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
|
|
#line 2121 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
|
|
#line 2121 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
|
|
#line 2121 "/home/runner/work/nim-waku/nim-waku/vendor/nimbus-build-system/vendor/Nim/lib/system.nim"
|
|
T1_ = (int)0; T1_ = nimCmpMem(a, b, size); result = (T1_ == ((NI32) 0)); return result;}
|
|
|
|
#line 495 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
static N_INLINE(void, encrypt__GIhSBO9bXAX05gpkiTBcgqw_3bcmode)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx, NU8* input, NI inputLen_0, NU8* output, NI outputLen_0) { NI offset; NU n_1;
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
{
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
if (!!((inputLen_0 <= outputLen_0))) goto LA3_;
|
|
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 503 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__kEg4jrkuHaBhU9bZeYcj4rg_22));
|
|
}
|
|
LA3_: ;
|
|
|
|
#line 504 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
{ if (!NIM_FALSE) goto LA7_;
|
|
|
|
#line 504 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 504 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__kEg4jrkuHaBhU9bZeYcj4rg_23));
|
|
}
|
|
LA7_: ;
|
|
|
|
#line 506 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
offset = ((NI) 0);
|
|
#line 507 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
n_1 = (*ctx).num; {
|
|
#line 508 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
while (1) { NI TM__kEg4jrkuHaBhU9bZeYcj4rg_24;
|
|
#line 508 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 508 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
if (!(offset < inputLen_0)) goto LA10;
|
|
|
|
#line 509 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
{
|
|
#line 509 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
if (!(n_1 == ((NU) 0))) goto LA13_;
|
|
|
|
#line 510 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 510 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
encrypt__5IhSwNYMkLuIObwT9aTBOyQ_2((&(*ctx).cipher), (*ctx).iv, 32, (*ctx).ecount, 32);
|
|
|
|
#line 511 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
{ if (!NIM_TRUE) goto LA17_;
|
|
|
|
#line 512 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 512 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
inc128__vRz5m42fv3XKwSYgATX55Q((*ctx).iv, 32);
|
|
}
|
|
goto LA15_;
|
|
LA17_: ;
|
|
{ if (!NIM_FALSE) goto LA20_;
|
|
|
|
#line 514 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 514 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
inc256__vRz5m42fv3XKwSYgATX55Q_2((*ctx).iv, 32);
|
|
}
|
|
goto LA15_;
|
|
LA20_: ;
|
|
LA15_: ;
|
|
}
|
|
LA13_: ;
|
|
if ((NU)(offset) >= (NU)(outputLen_0)){ raiseIndexError2(offset,outputLen_0-1); }
|
|
#line 515 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 515 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
if ((NU)(offset) >= (NU)(inputLen_0)){ raiseIndexError2(offset,inputLen_0-1); } if ((NU)(n_1) > (NU)(31)){ raiseIndexError2(n_1, 31); } output[offset] = (NU8)(input[offset] ^ (*ctx).ecount[(n_1)- 0]);
|
|
#line 516 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
if (nimAddInt(offset, ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_24)) { raiseOverflow(); }; offset = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_24);
|
|
#line 517 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 517 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 517 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
n_1 = (NU)((NU64)((NU)((NU64)(n_1) + (NU64)(((NU) 1)))) % (NU64)(((NU) 16))); } LA10: ;
|
|
}
|
|
|
|
#line 518 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
(*ctx).num = n_1;}
|
|
|
|
#line 543 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
static N_INLINE(void, decrypt__GIhSBO9bXAX05gpkiTBcgqw_2bcmode)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx, NU8* input, NI inputLen_0, NU8* output, NI outputLen_0) {
|
|
#line 550 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 550 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
encrypt__GIhSBO9bXAX05gpkiTBcgqw_3bcmode(ctx, input, inputLen_0, output, outputLen_0);
|
|
}
|
|
|
|
#line 194 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
static N_INLINE(void, burnMem__P9brYVCF23Tby7DqTb3654gutils)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* a) {
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/utils.nim"
|
|
burnMem__haAOjkJjOuRy8ux9bV57dXw(((void*) (a)), ((NI) 1040));
|
|
}
|
|
|
|
#line 491 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
static N_INLINE(void, clear__l59c6Jn7P8eTpi6QyM6SaFgbcmode)(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg* ctx) {
|
|
#line 493 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
|
|
#line 493 "/home/runner/work/nim-waku/nim-waku/vendor/nimcrypto/nimcrypto/bcmode.nim"
|
|
burnMem__P9brYVCF23Tby7DqTb3654gutils(ctx);
|
|
}
|
|
|
|
#line 158 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ, eciesDecrypt__x9bP2nGPBI8wYkzRgRLf0EA)(NU8* input, NI inputLen_0, NU8* output, NI outputLen_0, tyObject_SkSecretKey__aKiBFtqo69b60sWLnM5A9c3w* seckey, NU8* sharedmac, NI sharedmacLen_0) { tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ result; tyArray__qtqsWM5aXmcpMIVmvq3kAA encKey; tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg cipher; tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg ctx; tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q* header; tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA pubkey; tyObject_Result__JzqSndqFlegD9a9bJZxDgMhw vX60gensym79610077_; tyObject_Result__ac12d9bB2oPDNrhZXEa1pxQ T17_; tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow secret; tyArray__vEOa9c5qaE9ajWxR5R4zwfQg material; tyObject_MDigest__law9ct65KplMYBvtmjCQxbw macKey; NI macsize; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_16; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_17; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_18; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_19; tyObject_MDigest__law9ct65KplMYBvtmjCQxbw tag; NI datsize; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_21; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_25; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_26;{ nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ));
|
|
#line 162 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
nimZeroMem((void*)encKey, sizeof(tyArray__qtqsWM5aXmcpMIVmvq3kAA)); nimZeroMem((void*)(&cipher), sizeof(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg)); nimZeroMem((void*)(&ctx), sizeof(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg));
|
|
#line 174 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{
|
|
#line 174 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 174 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (!(inputLen_0 <= ((NI) 0))) goto LA3_;
|
|
|
|
#line 175 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 175 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; result._o_1.e = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 5); goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
|
|
#line 177 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if ((NU)(((NI) 0)) >= (NU)(inputLen_0)){ raiseIndexError2(((NI) 0),inputLen_0-1); } header = ((tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q*) ((&input[((NI) 0)])));
|
|
#line 178 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{
|
|
#line 178 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 178 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (!!(((*header).version == ((NU8) 4)))) goto LA7_;
|
|
|
|
#line 179 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 179 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; result._o_1.e = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 2); goto BeforeRet_;
|
|
}
|
|
LA7_: ;
|
|
|
|
#line 180 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{
|
|
#line 180 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 180 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (!(inputLen_0 <= ((NI) 113))) goto LA11_;
|
|
|
|
#line 181 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 181 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; result._o_1.e = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 5); goto BeforeRet_;
|
|
}
|
|
LA11_: ;
|
|
|
|
#line 182 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{ NI TM__kEg4jrkuHaBhU9bZeYcj4rg_2;
|
|
#line 182 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 182 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 182 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 182 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimSubInt(inputLen_0, ((NI) 113), &TM__kEg4jrkuHaBhU9bZeYcj4rg_2)) { raiseOverflow(); }; if (!(outputLen_0 < (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_2))) goto LA15_;
|
|
|
|
#line 183 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 183 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; result._o_1.e = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 0); goto BeforeRet_;
|
|
}
|
|
LA15_: ;
|
|
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 657 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
T17_ = fromRaw__09bVO0j5Htfp2zQRd1AkcpQ((*header).pubkey, 64);
|
|
#line 186 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
vX60gensym79610077_ = mapErrTo__QRDjeunFoCK0uGT5kKkpAw((&T17_));
|
|
#line 658 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
{
|
|
#line 658 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
if (!!(vX60gensym79610077_.o)) goto LA20_;
|
|
|
|
#line 662 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
|
|
#line 662 "/home/runner/work/nim-waku/nim-waku/vendor/nim-stew/stew/results.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; if (!(((1 &(1U<<((NU)(vX60gensym79610077_.o)&7U)))!=0))){ raiseFieldError(((NimStringDesc*) &TM__kEg4jrkuHaBhU9bZeYcj4rg_4)); } result._o_1.e = vX60gensym79610077_._o_1.e; goto BeforeRet_;
|
|
}
|
|
LA20_: ;
|
|
if (!(((2 &(1U<<((NU)(vX60gensym79610077_.o)&7U)))!=0))){ raiseFieldError(((NimStringDesc*) &TM__kEg4jrkuHaBhU9bZeYcj4rg_3)); } pubkey = vX60gensym79610077_._o_2.v;
|
|
#line 187 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 187 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
secret = ecdhRaw__Z9c2Pt1C0AACD1C2XnBvKAA(seckey, (&pubkey)); nimZeroMem((void*)material, sizeof(tyArray__vEOa9c5qaE9ajWxR5R4zwfQg));
|
|
#line 189 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 189 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
kdf__UAan1eFISH8p9aqSMyCfJdQ(secret.data, 32, material);
|
|
|
|
#line 190 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 190 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
burnMem__K25lJpnPDUzcRqUMvOo9ckgutils((&secret));
|
|
|
|
#line 192 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 192 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&encKey[(((NI) 0))- 0]))), ((void*) ((&material[(((NI) 0))- 0]))), ((NI) 16));
|
|
|
|
#line 193 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (((NI) 31)-((NI) 16) != -1 && (((NI) 31)-((NI) 16) < -1 || ((NI) 16) < 0 || ((NI) 16) > 31 || ((NI) 31) < 0 || ((NI) 31) > 31)){ raiseIndexError(); }
|
|
#line 194 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
macKey = digest__y0iFskTLLbZVCJoMR0aipg((NU8*)((material)+(((NI) 16))), (((NI) 31))-(((NI) 16))+1);
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 195 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
burnArray__r09aJbNPNlBz6C6oCg8JTCQutils(material, 32);
|
|
|
|
#line 197 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 197 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 197 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 197 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimSubInt(inputLen_0, ((NI) 113), &TM__kEg4jrkuHaBhU9bZeYcj4rg_16)) { raiseOverflow(); }; if (nimAddInt((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_16), ((NI) 16), &TM__kEg4jrkuHaBhU9bZeYcj4rg_17)) { raiseOverflow(); }; macsize = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_17);
|
|
#line 198 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 198 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
init__XO79cz0G5x9bYWx3NREUG23g((&ctx), macKey.data, 32);
|
|
|
|
#line 199 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 199 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
burnMem__k72AWhY8XltJimzMsVr9bdwutils((&macKey));
|
|
|
|
#line 200 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 200 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 200 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(((NI) 65), macsize, &TM__kEg4jrkuHaBhU9bZeYcj4rg_18)) { raiseOverflow(); }; if (nimSubInt((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_18), ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_19)) { raiseOverflow(); }; if ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_19)-((NI) 65) != -1 && ((NU)(((NI) 65)) >= (NU)(inputLen_0) || (NU)((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_19)) >= (NU)(inputLen_0))){ raiseIndexError(); }
|
|
#line 200 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
update__JDQKL6F3d4BVGKvrNMc9bmghmac((&ctx), (NU8*)(input)+(((NI) 65)), ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_19))-(((NI) 65))+1);
|
|
|
|
#line 201 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{
|
|
#line 201 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 201 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (!(((NI) 0) < sharedmacLen_0)) goto LA24_;
|
|
|
|
#line 202 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 202 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
update__JDQKL6F3d4BVGKvrNMc9bmghmac((&ctx), sharedmac, sharedmacLen_0);
|
|
}
|
|
LA24_: ;
|
|
|
|
#line 203 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 203 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
tag = finish__cp8Ckr7vep0RujvudVTNTg((&ctx));
|
|
#line 204 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 204 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__3PkHS3KRpSG9bEaZCBbhR4w((&ctx));
|
|
|
|
#line 206 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{ NI TM__kEg4jrkuHaBhU9bZeYcj4rg_20; NIM_BOOL T28_;
|
|
#line 206 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 206 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 206 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 206 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimSubInt(inputLen_0, ((NI) 32), &TM__kEg4jrkuHaBhU9bZeYcj4rg_20)) { raiseOverflow(); }; if ((NU)((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_20)) >= (NU)(inputLen_0)){ raiseIndexError2((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_20),inputLen_0-1); }
|
|
#line 206 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
T28_ = (NIM_BOOL)0; T28_ = equalMem__9bGgqEk7RXXl6eqM9c1HdELAsystem(((void*) ((&tag.data[(((NI) 0))- 0]))), ((void*) ((&input[(NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_20)]))), ((NI) 32)); if (!!(T28_)) goto LA29_;
|
|
|
|
#line 208 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 208 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; result._o_1.e = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 4); goto BeforeRet_;
|
|
}
|
|
LA29_: ;
|
|
|
|
#line 210 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 210 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 210 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimSubInt(inputLen_0, ((NI) 113), &TM__kEg4jrkuHaBhU9bZeYcj4rg_21)) { raiseOverflow(); }; datsize = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_21);
|
|
#line 211 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 211 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
init__A1epXaa8QSPgtdyVzI9aWSw((&cipher), encKey, 16, (*header).iv, 16);
|
|
|
|
#line 212 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 212 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
burnArray__r09aJbNPNlBz6C6oCg8JTCQutils(encKey, 16);
|
|
|
|
#line 213 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 214 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 214 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(((NI) 81), datsize, &TM__kEg4jrkuHaBhU9bZeYcj4rg_25)) { raiseOverflow(); }; if (nimSubInt((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_25), ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_26)) { raiseOverflow(); }; if ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_26)-((NI) 81) != -1 && ((NU)(((NI) 81)) >= (NU)(inputLen_0) || (NU)((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_26)) >= (NU)(inputLen_0))){ raiseIndexError(); }
|
|
#line 213 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
decrypt__GIhSBO9bXAX05gpkiTBcgqw_2bcmode((&cipher), (NU8*)(input)+(((NI) 81)), ((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_26))-(((NI) 81))+1, output, outputLen_0);
|
|
|
|
#line 215 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 215 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__l59c6Jn7P8eTpi6QyM6SaFgbcmode((&cipher));
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_TRUE; }BeforeRet_: ;
|
|
return result;}
|
|
|
|
#line 95 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
N_LIB_PRIVATE N_NIMCALL(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ, eciesEncrypt__vFkFWGxiMe4089aD7VwdFJA)(br_hmac_drbg_context* rng_0, NU8* input, NI inputLen_0, NU8* output, NI outputLen_0, tyObject_SkPublicKey__YxxaGK7KOKaWCOaZ44rHMA* pubkey, NU8* sharedmac, NI sharedmacLen_0) { tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ result; tyArray__qtqsWM5aXmcpMIVmvq3kAA encKey; tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg cipher; tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg ctx; tyArray__qtqsWM5aXmcpMIVmvq3kAA iv_1; tyObject_SkKeyPair__11md6PDL9c3Ydro9bo69avH7g ephemeral; tyObject_SharedSecret__bM0XijkI0NMH9cNiAOpJ9aow secret; tyArray__vEOa9c5qaE9ajWxR5R4zwfQg material; tyObject_MDigest__law9ct65KplMYBvtmjCQxbw macKey; tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q* header; NI so; NI eo; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_28; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_29; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_30; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_31; tyObject_MDigest__law9ct65KplMYBvtmjCQxbw tag; NI TM__kEg4jrkuHaBhU9bZeYcj4rg_32;{ nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ));
|
|
#line 98 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
nimZeroMem((void*)encKey, sizeof(tyArray__qtqsWM5aXmcpMIVmvq3kAA)); nimZeroMem((void*)(&cipher), sizeof(tyObject_CTR__CSv7tJ1uWHDvWQ9cM87Zmdg)); nimZeroMem((void*)(&ctx), sizeof(tyObject_HMAC__CxVfcs3qQxev4nVq3Txjyg)); nimZeroMem((void*)iv_1, sizeof(tyArray__qtqsWM5aXmcpMIVmvq3kAA));
|
|
#line 111 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{ NI TM__kEg4jrkuHaBhU9bZeYcj4rg_27;
|
|
#line 111 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 111 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 111 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 111 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(inputLen_0, ((NI) 113), &TM__kEg4jrkuHaBhU9bZeYcj4rg_27)) { raiseOverflow(); }; if (!(outputLen_0 < (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_27))) goto LA3_;
|
|
|
|
#line 112 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 112 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_FALSE; result._o_1.e = ((tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA) 0); goto BeforeRet_;
|
|
}
|
|
LA3_: ;
|
|
|
|
#line 114 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 114 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
brHmacDrbgGenerate__jb39atYOOGTT2cdYx6onnSw(rng_0, iv_1, 16);
|
|
|
|
#line 117 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 117 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
ephemeral = random__HS5tU9cyelo6UXEHvWOYUFg(rng_0);
|
|
#line 118 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 118 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
secret = ecdhRaw__Z9c2Pt1C0AACD1C2XnBvKAA((&ephemeral.seckey), pubkey); nimZeroMem((void*)material, sizeof(tyArray__vEOa9c5qaE9ajWxR5R4zwfQg));
|
|
#line 119 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 119 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
kdf__UAan1eFISH8p9aqSMyCfJdQ(secret.data, 32, material);
|
|
|
|
#line 121 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 121 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__Exywi8FRTgke48MrQEzXSw((&secret));
|
|
|
|
#line 123 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 123 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&encKey[(((NI) 0))- 0]))), ((void*) ((&material[(((NI) 0))- 0]))), ((NI) 16));
|
|
|
|
#line 125 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (((NI) 31)-((NI) 16) != -1 && (((NI) 31)-((NI) 16) < -1 || ((NI) 16) < 0 || ((NI) 16) > 31 || ((NI) 31) < 0 || ((NI) 31) > 31)){ raiseIndexError(); }
|
|
#line 126 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
macKey = digest__y0iFskTLLbZVCJoMR0aipg((NU8*)((material)+(((NI) 16))), (((NI) 31))-(((NI) 16))+1);
|
|
#line 127 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 127 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
burnArray__r09aJbNPNlBz6C6oCg8JTCQutils(material, 32);
|
|
|
|
#line 129 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if ((NU)(((NI) 0)) >= (NU)(outputLen_0)){ raiseIndexError2(((NI) 0),outputLen_0-1); } header = ((tyObject_EciesHeader__hXpXY0X9cHZM3fIUIjzbJ6Q*) ((&output[((NI) 0)])));
|
|
#line 130 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
(*header).version = ((NU8) 4);
|
|
#line 131 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 131 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
toRaw__W9bYIkOOHQ8dZSTz9aIjEPEQ((&ephemeral.pubkey), (*header).pubkey);
|
|
|
|
#line 132 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
nimCopyMem((void*)(*header).iv, (NIM_CONST void*)iv_1, sizeof(tyArray__qtqsWM5aXmcpMIVmvq3kAA));
|
|
#line 134 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 134 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__zR0Ao5CGtmWCyIBiRKQV1A((&ephemeral));
|
|
|
|
#line 136 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
so = ((NI) 81);
|
|
#line 137 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 137 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 137 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(so, inputLen_0, &TM__kEg4jrkuHaBhU9bZeYcj4rg_28)) { raiseOverflow(); }; eo = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_28);
|
|
#line 138 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 138 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
init__A1epXaa8QSPgtdyVzI9aWSw((&cipher), encKey, 16, iv_1, 16);
|
|
|
|
#line 139 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (eo-so != -1 && ((NU)(so) >= (NU)(outputLen_0) || (NU)(eo) >= (NU)(outputLen_0))){ raiseIndexError(); }
|
|
#line 139 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
encrypt__GIhSBO9bXAX05gpkiTBcgqw_3bcmode((&cipher), input, inputLen_0, (NU8*)(output)+(so), (eo)-(so)+1);
|
|
|
|
#line 140 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 140 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
burnArray__r09aJbNPNlBz6C6oCg8JTCQutils(encKey, 16);
|
|
|
|
#line 141 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 141 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__l59c6Jn7P8eTpi6QyM6SaFgbcmode((&cipher));
|
|
|
|
#line 143 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
so = ((NI) 65);
|
|
#line 144 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 144 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 144 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 144 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(so, ((NI) 16), &TM__kEg4jrkuHaBhU9bZeYcj4rg_29)) { raiseOverflow(); };
|
|
#line 144 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_29), inputLen_0, &TM__kEg4jrkuHaBhU9bZeYcj4rg_30)) { raiseOverflow(); }; if (nimSubInt((NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_30), ((NI) 1), &TM__kEg4jrkuHaBhU9bZeYcj4rg_31)) { raiseOverflow(); }; eo = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_31);
|
|
#line 145 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 145 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
init__XO79cz0G5x9bYWx3NREUG23g((&ctx), macKey.data, 32);
|
|
|
|
#line 146 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (eo-so != -1 && ((NU)(so) >= (NU)(outputLen_0) || (NU)(eo) >= (NU)(outputLen_0))){ raiseIndexError(); }
|
|
#line 146 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
update__JDQKL6F3d4BVGKvrNMc9bmghmac((&ctx), (NU8*)(output)+(so), (eo)-(so)+1);
|
|
|
|
#line 147 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
{
|
|
#line 147 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 147 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (!(((NI) 0) < sharedmacLen_0)) goto LA7_;
|
|
|
|
#line 148 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 148 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
update__JDQKL6F3d4BVGKvrNMc9bmghmac((&ctx), sharedmac, sharedmacLen_0);
|
|
}
|
|
LA7_: ;
|
|
|
|
#line 149 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 149 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
tag = finish__cp8Ckr7vep0RujvudVTNTg((&ctx));
|
|
#line 151 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 151 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 151 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if (nimAddInt(((NI) 81), inputLen_0, &TM__kEg4jrkuHaBhU9bZeYcj4rg_32)) { raiseOverflow(); }; so = (NI)(TM__kEg4jrkuHaBhU9bZeYcj4rg_32);
|
|
#line 153 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
if ((NU)(so) >= (NU)(outputLen_0)){ raiseIndexError2(so,outputLen_0-1); }
|
|
#line 153 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
copyMem__i80o3k0SgEI5gTRCzYdyWAsystem(((void*) ((&output[so]))), ((void*) ((&tag.data[(((NI) 0))- 0]))), ((NI) 32));
|
|
|
|
#line 154 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
|
|
#line 154 "/home/runner/work/nim-waku/nim-waku/vendor/nim-eth/eth/p2p/ecies.nim"
|
|
clear__3PkHS3KRpSG9bEaZCBbhR4w((&ctx));
|
|
chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_Result__9cSS9aZywjhUjZ2RChHxYzwQ)); result.o = NIM_TRUE; }BeforeRet_: ;
|
|
return result;}
|
|
N_LIB_PRIVATE N_NIMCALL(void, eth_eciesDatInit000)(void) {
|
|
|
|
#line 999999 "generated_not_to_break_here"
|
|
static TNimNode* TM__kEg4jrkuHaBhU9bZeYcj4rg_33_6[6];
|
|
NI TM__kEg4jrkuHaBhU9bZeYcj4rg_35;
|
|
static char* NIM_CONST TM__kEg4jrkuHaBhU9bZeYcj4rg_34[6] = {
|
|
"ecies: output buffer size is too small",
|
|
"ecies: ECDH shared secret could not be calculated",
|
|
"ecies: header is incorrect",
|
|
"ecies: recovered public key is invalid",
|
|
"ecies: tag verification failed",
|
|
"ecies: decryption needs more data"};
|
|
static TNimNode TM__kEg4jrkuHaBhU9bZeYcj4rg_0[7];NTI__Faslh8ClCPeRXBVFfTATjA_.size = sizeof(tyEnum_EciesError__Faslh8ClCPeRXBVFfTATjA);
|
|
NTI__Faslh8ClCPeRXBVFfTATjA_.kind = 14;
|
|
NTI__Faslh8ClCPeRXBVFfTATjA_.base = 0;
|
|
NTI__Faslh8ClCPeRXBVFfTATjA_.flags = 3;
|
|
NTI__Faslh8ClCPeRXBVFfTATjA_.name = "EciesError";
|
|
NTI__Faslh8ClCPeRXBVFfTATjA_.nextType = nimTypeRoot; nimTypeRoot=&NTI__Faslh8ClCPeRXBVFfTATjA_;
|
|
for (TM__kEg4jrkuHaBhU9bZeYcj4rg_35 = 0; TM__kEg4jrkuHaBhU9bZeYcj4rg_35 < 6; TM__kEg4jrkuHaBhU9bZeYcj4rg_35++) {
|
|
TM__kEg4jrkuHaBhU9bZeYcj4rg_0[TM__kEg4jrkuHaBhU9bZeYcj4rg_35+0].kind = 1;
|
|
TM__kEg4jrkuHaBhU9bZeYcj4rg_0[TM__kEg4jrkuHaBhU9bZeYcj4rg_35+0].offset = TM__kEg4jrkuHaBhU9bZeYcj4rg_35;
|
|
TM__kEg4jrkuHaBhU9bZeYcj4rg_0[TM__kEg4jrkuHaBhU9bZeYcj4rg_35+0].name = TM__kEg4jrkuHaBhU9bZeYcj4rg_34[TM__kEg4jrkuHaBhU9bZeYcj4rg_35];
|
|
TM__kEg4jrkuHaBhU9bZeYcj4rg_33_6[TM__kEg4jrkuHaBhU9bZeYcj4rg_35] = &TM__kEg4jrkuHaBhU9bZeYcj4rg_0[TM__kEg4jrkuHaBhU9bZeYcj4rg_35+0];
|
|
}
|
|
TM__kEg4jrkuHaBhU9bZeYcj4rg_0[6].len = 6; TM__kEg4jrkuHaBhU9bZeYcj4rg_0[6].kind = 2; TM__kEg4jrkuHaBhU9bZeYcj4rg_0[6].sons = &TM__kEg4jrkuHaBhU9bZeYcj4rg_33_6[0];
|
|
NTI__Faslh8ClCPeRXBVFfTATjA_.node = &TM__kEg4jrkuHaBhU9bZeYcj4rg_0[6];
|
|
}
|
|
|