Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1750230229, "reponame":"openssl", "desc":"OpenSSL", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl", "f":3, "items": [ { "schema":"libjg2-1", "oid":{ "oid": "5816586ba45bba05f6d9f0432a408063a42e1012", "alias": []},"tree": [ { "name": "README","mode": "33188", "size":3410}, { "name": "arm-xlate.pl","mode": "33261", "size":4141}, { "name": "cbc.pl","mode": "33188", "size":9395}, { "name": "ppc-xlate.pl","mode": "33261", "size":8304}, { "name": "sparcv9_modes.pl","mode": "33188", "size":39369}, { "name": "x86_64-xlate.pl","mode": "33261", "size":44398}, { "name": "x86asm.pl","mode": "33188", "size":7374}, { "name": "x86gas.pl","mode": "33188", "size":6438}, { "name": "x86masm.pl","mode": "33188", "size":4772}, { "name": "x86nasm.pl","mode": "33188", "size":4513}],"s":{"c":1750230229,"u": 2100}} ,{"schema":"libjg2-1", "cid":"e3a34506fc15ef30ccc3ad0546d14491", "oid":{ "oid": "5816586ba45bba05f6d9f0432a408063a42e1012", "alias": []},"blobname": "crypto/perlasm/README", "blob": "The perl scripts in this directory are my 'hack' to generate\nmultiple different assembler formats via the one original script.\n\nThe way to use this library is to start with adding the path to this directory\nand then include it.\n\npush(@INC,\u0022perlasm\u0022,\u0022../../perlasm\u0022);\nrequire \u0022x86asm.pl\u0022;\n\nThe first thing we do is setup the file and type of assembler\n\n\u0026asm_init($ARGV[0]);\n\nThe first argument is the 'type'. Currently\n'cpp', 'sol', 'a.out', 'elf' or 'win32'.\nArgument 2 is the file name.\n\nThe reciprocal function is\n\u0026asm_finish() which should be called at the end.\n\nThere are 2 main 'packages'. x86ms.pl, which is the Microsoft assembler,\nand x86unix.pl which is the unix (gas) version.\n\nFunctions of interest are:\n\u0026external_label(\u0022des_SPtrans\u0022);\tdeclare and external variable\n\u0026LB(reg);\t\t\tLow byte for a register\n\u0026HB(reg);\t\t\tHigh byte for a register\n\u0026BP(off,base,index,scale)\tByte pointer addressing\n\u0026DWP(off,base,index,scale)\tWord pointer addressing\n\u0026stack_push(num)\t\tBasically a 'sub esp, num*4' with extra\n\u0026stack_pop(num)\t\t\tinverse of stack_push\n\u0026function_begin(name,extra)\tStart a function with pushing of\n\t\t\t\tedi, esi, ebx and ebp. extra is extra win32\n\t\t\t\texternal info that may be required.\n\u0026function_begin_B(name,extra)\tSame as normal function_begin but no pushing.\n\u0026function_end(name)\t\tCall at end of function.\n\u0026function_end_A(name)\t\tStandard pop and ret, for use inside functions\n\u0026function_end_B(name)\t\tCall at end but with poping or 'ret'.\n\u0026swtmp(num)\t\t\tAddress on stack temp word.\n\u0026wparam(num)\t\t\tParameter number num, that was push\n\t\t\t\tin C convention. This all works over pushes\n\t\t\t\tand pops.\n\u0026comment(\u0022hello there\u0022)\t\tPut in a comment.\n\u0026label(\u0022loop\u0022)\t\t\tRefer to a label, normally a jmp target.\n\u0026set_label(\u0022loop\u0022)\t\tSet a label at this point.\n\u0026data_word(word)\t\tPut in a word of data.\n\nSo how does this all hold together? Given\n\nint calc(int len, int *data)\n\t{\n\tint i,j\u003d0;\n\n\tfor (i\u003d0; i\u003clen; i++)\n\t\t{\n\t\tj+\u003dother(data[i]);\n\t\t}\n\t}\n\nSo a very simple version of this function could be coded as\n\n\tpush(@INC,\u0022perlasm\u0022,\u0022../../perlasm\u0022);\n\trequire \u0022x86asm.pl\u0022;\n\t\n\t\u0026asm_init($ARGV[0]);\n\n\t\u0026external_label(\u0022other\u0022);\n\n\t$tmp1\u003d\t\u0022eax\u0022;\n\t$j\u003d\t\u0022edi\u0022;\n\t$data\u003d\t\u0022esi\u0022;\n\t$i\u003d\t\u0022ebp\u0022;\n\n\t\u0026comment(\u0022a simple function\u0022);\n\t\u0026function_begin(\u0022calc\u0022);\n\t\u0026mov(\t$data,\t\t\u0026wparam(1)); # data\n\t\u0026xor(\t$j,\t\t$j);\n\t\u0026xor(\t$i,\t\t$i);\n\n\t\u0026set_label(\u0022loop\u0022);\n\t\u0026cmp(\t$i,\t\t\u0026wparam(0));\n\t\u0026jge(\t\u0026label(\u0022end\u0022));\n\n\t\u0026mov(\t$tmp1,\t\t\u0026DWP(0,$data,$i,4));\n\t\u0026push(\t$tmp1);\n\t\u0026call(\t\u0022other\u0022);\n\t\u0026add(\t$j,\t\t\u0022eax\u0022);\n\t\u0026pop(\t$tmp1);\n\t\u0026inc(\t$i);\n\t\u0026jmp(\t\u0026label(\u0022loop\u0022));\n\n\t\u0026set_label(\u0022end\u0022);\n\t\u0026mov(\t\u0022eax\u0022,\t\t$j);\n\n\t\u0026function_end(\u0022calc\u0022);\n\n\t\u0026asm_finish();\n\nThe above example is very very unoptimised but gives an idea of how\nthings work.\n\nThere is also a cbc mode function generator in cbc.pl\n\n\u0026cbc(\t$name,\n\t$encrypt_function_name,\n\t$decrypt_function_name,\n\t$true_if_byte_swap_needed,\n\t$parameter_number_for_iv,\n\t$parameter_number_for_encrypt_flag,\n\t$first_parameter_to_pass,\n\t$second_parameter_to_pass,\n\t$third_parameter_to_pass);\n\nSo for example, given\nvoid BF_encrypt(BF_LONG *data,BF_KEY *key);\nvoid BF_decrypt(BF_LONG *data,BF_KEY *key);\nvoid BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length,\n BF_KEY *ks, unsigned char *iv, int enc);\n\n\u0026cbc(\u0022BF_cbc_encrypt\u0022,\u0022BF_encrypt\u0022,\u0022BF_encrypt\u0022,1,4,5,3,-1,-1);\n\n\u0026cbc(\u0022des_ncbc_encrypt\u0022,\u0022des_encrypt\u0022,\u0022des_encrypt\u0022,0,4,5,3,5,-1);\n\u0026cbc(\u0022des_ede3_cbc_encrypt\u0022,\u0022des_encrypt3\u0022,\u0022des_decrypt3\u0022,0,6,7,3,4,5);\n\n","s":{"c":1750230229,"u": 129}} ],"g": 4258,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 1, "si": 0, "db":0, "di":1, "sat":0, "lfc": "0000"}