931 const Type** fields = TypeTuple::fields(argcnt); 932 int argp = TypeFunc::Parms; 933 fields[argp++] = TypePtr::NOTNULL; // src 934 fields[argp++] = TypePtr::NOTNULL; // dest 935 fields[argp++] = TypePtr::NOTNULL; // k array 936 fields[argp++] = TypePtr::NOTNULL; // r array 937 fields[argp++] = TypeInt::INT; // src len 938 if (Matcher::pass_original_key_for_aes()) { 939 fields[argp++] = TypePtr::NOTNULL; // original k array 940 } 941 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 942 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 943 944 // returning cipher len (int) 945 fields = TypeTuple::fields(1); 946 fields[TypeFunc::Parms+0] = TypeInt::INT; 947 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 948 return TypeFunc::make(domain, range); 949 } 950 951 /* 952 * void implCompress(byte[] buf, int ofs) 953 */ 954 const TypeFunc* OptoRuntime::sha_implCompress_Type() { 955 // create input type (domain) 956 int num_args = 2; 957 int argcnt = num_args; 958 const Type** fields = TypeTuple::fields(argcnt); 959 int argp = TypeFunc::Parms; 960 fields[argp++] = TypePtr::NOTNULL; // buf 961 fields[argp++] = TypePtr::NOTNULL; // state 962 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 963 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 964 965 // no result type needed 966 fields = TypeTuple::fields(1); 967 fields[TypeFunc::Parms+0] = NULL; // void 968 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 969 return TypeFunc::make(domain, range); 970 } | 931 const Type** fields = TypeTuple::fields(argcnt); 932 int argp = TypeFunc::Parms; 933 fields[argp++] = TypePtr::NOTNULL; // src 934 fields[argp++] = TypePtr::NOTNULL; // dest 935 fields[argp++] = TypePtr::NOTNULL; // k array 936 fields[argp++] = TypePtr::NOTNULL; // r array 937 fields[argp++] = TypeInt::INT; // src len 938 if (Matcher::pass_original_key_for_aes()) { 939 fields[argp++] = TypePtr::NOTNULL; // original k array 940 } 941 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 942 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 943 944 // returning cipher len (int) 945 fields = TypeTuple::fields(1); 946 fields[TypeFunc::Parms+0] = TypeInt::INT; 947 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields); 948 return TypeFunc::make(domain, range); 949 } 950 951 //for counterMode calls of aescrypt encrypt/decrypt, four pointers and a length, returning int 952 const TypeFunc* OptoRuntime::counterMode_aescrypt_Type() { 953 // create input type (domain) 954 int num_args = 5; 955 if (Matcher::pass_original_key_for_aes()) { 956 num_args = 6; 957 } 958 int argcnt = num_args; 959 const Type** fields = TypeTuple::fields(argcnt); 960 int argp = TypeFunc::Parms; 961 fields[argp++] = TypePtr::NOTNULL; // src 962 fields[argp++] = TypePtr::NOTNULL; // dest 963 fields[argp++] = TypePtr::NOTNULL; // k array 964 fields[argp++] = TypePtr::NOTNULL; // counter array 965 fields[argp++] = TypeInt::INT; // src len 966 if (Matcher::pass_original_key_for_aes()) { 967 fields[argp++] = TypePtr::NOTNULL; // original k array 968 } 969 assert(argp == TypeFunc::Parms + argcnt, "correct decoding"); 970 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + argcnt, fields); 971 // returning cipher len (int) 972 fields = TypeTuple::fields(1); 973 fields[TypeFunc::Parms + 0] = TypeInt::INT; 974 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields); 975 return TypeFunc::make(domain, range); 976 } 977 978 /* 979 * void implCompress(byte[] buf, int ofs) 980 */ 981 const TypeFunc* OptoRuntime::sha_implCompress_Type() { 982 // create input type (domain) 983 int num_args = 2; 984 int argcnt = num_args; 985 const Type** fields = TypeTuple::fields(argcnt); 986 int argp = TypeFunc::Parms; 987 fields[argp++] = TypePtr::NOTNULL; // buf 988 fields[argp++] = TypePtr::NOTNULL; // state 989 assert(argp == TypeFunc::Parms+argcnt, "correct decoding"); 990 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields); 991 992 // no result type needed 993 fields = TypeTuple::fields(1); 994 fields[TypeFunc::Parms+0] = NULL; // void 995 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields); 996 return TypeFunc::make(domain, range); 997 } |