834 */ 835 const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { 836 // create input type (domain) 837 int num_args = 3; 838 int argcnt = num_args; 839 const Type** fields = TypeTuple::fields(argcnt); 840 int argp = TypeFunc::Parms; 841 fields[argp++] = TypeInt::INT; // crc 842 fields[argp++] = TypePtr::NOTNULL; // src 843 fields[argp++] = TypeInt::INT; // len 844 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 845 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 846 847 // result type needed 848 fields = TypeTuple::fields(1); 849 fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result 850 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 851 return TypeFunc::make(domain, range); 852 } 853 854 // for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int 855 const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { 856 // create input type (domain) 857 int num_args = 5; 858 if (Matcher::pass_original_key_for_aes()) { 859 num_args = 6; 860 } 861 int argcnt = num_args; 862 const Type** fields = TypeTuple::fields(argcnt); 863 int argp = TypeFunc::Parms; 864 fields[argp++] = TypePtr::NOTNULL; // src 865 fields[argp++] = TypePtr::NOTNULL; // dest 866 fields[argp++] = TypePtr::NOTNULL; // k array 867 fields[argp++] = TypePtr::NOTNULL; // r array 868 fields[argp++] = TypeInt::INT; // src len 869 if (Matcher::pass_original_key_for_aes()) { 870 fields[argp++] = TypePtr::NOTNULL; // original k array 871 } 872 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 873 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); | 834 */ 835 const TypeFunc* OptoRuntime::updateBytesCRC32_Type() { 836 // create input type (domain) 837 int num_args = 3; 838 int argcnt = num_args; 839 const Type** fields = TypeTuple::fields(argcnt); 840 int argp = TypeFunc::Parms; 841 fields[argp++] = TypeInt::INT; // crc 842 fields[argp++] = TypePtr::NOTNULL; // src 843 fields[argp++] = TypeInt::INT; // len 844 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 845 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 846 847 // result type needed 848 fields = TypeTuple::fields(1); 849 fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result 850 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 851 return TypeFunc::make(domain, range); 852 } 853 854 /** 855 * int updateBytesCRC32C(int crc, byte* buf, int len, int* table) 856 */ 857 const TypeFunc* OptoRuntime::updateBytesCRC32C_Type() { 858 // create input type (domain) 859 int num_args = 4; 860 int argcnt = num_args; 861 const Type** fields = TypeTuple::fields(argcnt); 862 int argp = TypeFunc::Parms; 863 fields[argp++] = TypeInt::INT; // crc 864 fields[argp++] = TypePtr::NOTNULL; // buf 865 fields[argp++] = TypeInt::INT; // len 866 fields[argp++] = TypePtr::NOTNULL; // table 867 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 868 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 869 870 // result type needed 871 fields = TypeTuple::fields(1); 872 fields[TypeFunc::Parms+0] = TypeInt::INT; // crc result 873 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 874 return TypeFunc::make(domain, range); 875 } 876 877 // for cipherBlockChaining calls of aescrypt encrypt/decrypt, four pointers and a length, returning int 878 const TypeFunc* OptoRuntime::cipherBlockChaining_aescrypt_Type() { 879 // create input type (domain) 880 int num_args = 5; 881 if (Matcher::pass_original_key_for_aes()) { 882 num_args = 6; 883 } 884 int argcnt = num_args; 885 const Type** fields = TypeTuple::fields(argcnt); 886 int argp = TypeFunc::Parms; 887 fields[argp++] = TypePtr::NOTNULL; // src 888 fields[argp++] = TypePtr::NOTNULL; // dest 889 fields[argp++] = TypePtr::NOTNULL; // k array 890 fields[argp++] = TypePtr::NOTNULL; // r array 891 fields[argp++] = TypeInt::INT; // src len 892 if (Matcher::pass_original_key_for_aes()) { 893 fields[argp++] = TypePtr::NOTNULL; // original k array 894 } 895 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 896 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); |