943 fields[argp++] = TypePtr::NOTNULL; // k array
944 fields[argp++] = TypePtr::NOTNULL; // counter array
945 fields[argp++] = TypeInt::INT; // src len
946 fields[argp++] = TypePtr::NOTNULL; // saved_encCounter
947 fields[argp++] = TypePtr::NOTNULL; // saved used addr
948 if (Matcher::pass_original_key_for_aes()) {
949 fields[argp++] = TypePtr::NOTNULL; // original k array
950 }
951 assert(argp == TypeFunc::Parms + argcnt, "correct decoding");
952 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + argcnt, fields);
953 // returning cipher len (int)
954 fields = TypeTuple::fields(1);
955 fields[TypeFunc::Parms + 0] = TypeInt::INT;
956 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields);
957 return TypeFunc::make(domain, range);
958 }
959
960 /*
961 * void implCompress(byte[] buf, int ofs)
962 */
963 const TypeFunc* OptoRuntime::digestBase_implCompress_Type() {
964 // create input type (domain)
965 int num_args = 2;
966 int argcnt = num_args;
967 const Type** fields = TypeTuple::fields(argcnt);
968 int argp = TypeFunc::Parms;
969 fields[argp++] = TypePtr::NOTNULL; // buf
970 fields[argp++] = TypePtr::NOTNULL; // state
971 assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
972 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
973
974 // no result type needed
975 fields = TypeTuple::fields(1);
976 fields[TypeFunc::Parms+0] = NULL; // void
977 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
978 return TypeFunc::make(domain, range);
979 }
980
981 /*
982 * int implCompressMultiBlock(byte[] b, int ofs, int limit)
983 */
984 const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type() {
985 // create input type (domain)
986 int num_args = 4;
987 int argcnt = num_args;
988 const Type** fields = TypeTuple::fields(argcnt);
989 int argp = TypeFunc::Parms;
990 fields[argp++] = TypePtr::NOTNULL; // buf
991 fields[argp++] = TypePtr::NOTNULL; // state
992 fields[argp++] = TypeInt::INT; // ofs
993 fields[argp++] = TypeInt::INT; // limit
994 assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
995 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
996
997 // returning ofs (int)
998 fields = TypeTuple::fields(1);
999 fields[TypeFunc::Parms+0] = TypeInt::INT; // ofs
1000 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
1001 return TypeFunc::make(domain, range);
1002 }
1003
1004 const TypeFunc* OptoRuntime::multiplyToLen_Type() {
1005 // create input type (domain)
1006 int num_args = 6;
1007 int argcnt = num_args;
1008 const Type** fields = TypeTuple::fields(argcnt);
1009 int argp = TypeFunc::Parms;
1010 fields[argp++] = TypePtr::NOTNULL; // x
1011 fields[argp++] = TypeInt::INT; // xlen
|
943 fields[argp++] = TypePtr::NOTNULL; // k array
944 fields[argp++] = TypePtr::NOTNULL; // counter array
945 fields[argp++] = TypeInt::INT; // src len
946 fields[argp++] = TypePtr::NOTNULL; // saved_encCounter
947 fields[argp++] = TypePtr::NOTNULL; // saved used addr
948 if (Matcher::pass_original_key_for_aes()) {
949 fields[argp++] = TypePtr::NOTNULL; // original k array
950 }
951 assert(argp == TypeFunc::Parms + argcnt, "correct decoding");
952 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms + argcnt, fields);
953 // returning cipher len (int)
954 fields = TypeTuple::fields(1);
955 fields[TypeFunc::Parms + 0] = TypeInt::INT;
956 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields);
957 return TypeFunc::make(domain, range);
958 }
959
960 /*
961 * void implCompress(byte[] buf, int ofs)
962 */
963 const TypeFunc* OptoRuntime::digestBase_implCompress_Type(bool is_sha3) {
964 // create input type (domain)
965 int num_args = is_sha3 ? 3 : 2;
966 int argcnt = num_args;
967 const Type** fields = TypeTuple::fields(argcnt);
968 int argp = TypeFunc::Parms;
969 fields[argp++] = TypePtr::NOTNULL; // buf
970 fields[argp++] = TypePtr::NOTNULL; // state
971 if (is_sha3) fields[argp++] = TypeInt::INT; // digest_length
972 assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
973 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
974
975 // no result type needed
976 fields = TypeTuple::fields(1);
977 fields[TypeFunc::Parms+0] = NULL; // void
978 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms, fields);
979 return TypeFunc::make(domain, range);
980 }
981
982 /*
983 * int implCompressMultiBlock(byte[] b, int ofs, int limit)
984 */
985 const TypeFunc* OptoRuntime::digestBase_implCompressMB_Type(bool is_sha3) {
986 // create input type (domain)
987 int num_args = is_sha3 ? 5 : 4;
988 int argcnt = num_args;
989 const Type** fields = TypeTuple::fields(argcnt);
990 int argp = TypeFunc::Parms;
991 fields[argp++] = TypePtr::NOTNULL; // buf
992 fields[argp++] = TypePtr::NOTNULL; // state
993 if (is_sha3) fields[argp++] = TypeInt::INT; // digest_length
994 fields[argp++] = TypeInt::INT; // ofs
995 fields[argp++] = TypeInt::INT; // limit
996 assert(argp == TypeFunc::Parms+argcnt, "correct decoding");
997 const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+argcnt, fields);
998
999 // returning ofs (int)
1000 fields = TypeTuple::fields(1);
1001 fields[TypeFunc::Parms+0] = TypeInt::INT; // ofs
1002 const TypeTuple* range = TypeTuple::make(TypeFunc::Parms+1, fields);
1003 return TypeFunc::make(domain, range);
1004 }
1005
1006 const TypeFunc* OptoRuntime::multiplyToLen_Type() {
1007 // create input type (domain)
1008 int num_args = 6;
1009 int argcnt = num_args;
1010 const Type** fields = TypeTuple::fields(argcnt);
1011 int argp = TypeFunc::Parms;
1012 fields[argp++] = TypePtr::NOTNULL; // x
1013 fields[argp++] = TypeInt::INT; // xlen
|