Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
support ./src/crypt/*.c
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Aug 5, 2022
1 parent 5429cfe commit dab3ae6
Show file tree
Hide file tree
Showing 12 changed files with 1,551 additions and 93 deletions.
2 changes: 2 additions & 0 deletions c2go.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"__pthread_self"
],
"files": [
"./src/crypt/crypt_blowfish.c",
"./src/unistd/dup3.c",
"./src/unistd/faccessat.c",
"./src/unistd/ftruncate.c",
Expand Down Expand Up @@ -73,6 +74,7 @@
]
},
"dirs": [
"./src/crypt",
"./src/unistd",
"./src/misc",
"./src/math",
Expand Down
6 changes: 6 additions & 0 deletions c2go_autogen.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ func Mbtowc(*uint32, *int8, uint64) int32 {
func Pipe2(fd *int32, flag int32) int32 {
panic("notimpl")
}
func Strtoul(*int8, **int8, int32) uint64 {
panic("notimpl")
}
func Vfscanf(*Struct__IO_FILE, *int8, []interface {
}) int32 {
panic("notimpl")
Expand All @@ -50,6 +53,9 @@ func __aio_close(int32) int32 {
func __block_all_sigs(unsafe.Pointer) {
panic("notimpl")
}
func __crypt_blowfish(*int8, *int8, *int8) *int8 {
panic("notimpl")
}
func __futexwait(addr unsafe.Pointer, val int32, priv int32) {
panic("notimpl")
}
Expand Down
152 changes: 81 additions & 71 deletions c2go_header.i.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,61 +15,61 @@ type Pthread_t = *Struct___pthread
type Pthread_once_t = int32
type Pthread_key_t = uint32
type Pthread_spinlock_t = int32
type _cgoa_1__exit struct {
type _cgoa_1_crypt struct {
X__attr uint32
}
type Pthread_mutexattr_t = _cgoa_1__exit
type _cgoa_2__exit struct {
type Pthread_mutexattr_t = _cgoa_1_crypt
type _cgoa_2_crypt struct {
X__attr uint32
}
type Pthread_condattr_t = _cgoa_2__exit
type _cgoa_3__exit struct {
type Pthread_condattr_t = _cgoa_2_crypt
type _cgoa_3_crypt struct {
X__attr uint32
}
type Pthread_barrierattr_t = _cgoa_3__exit
type _cgoa_4__exit struct {
type Pthread_barrierattr_t = _cgoa_3_crypt
type _cgoa_4_crypt struct {
X__attr [2]uint32
}
type Pthread_rwlockattr_t = _cgoa_4__exit
type Pthread_rwlockattr_t = _cgoa_4_crypt
type Struct___sigset_t struct {
X__bits [16]uint64
}
type Sigset_t = Struct___sigset_t
type _cgoa_6__exit struct {
type _cgoa_6_crypt struct {
X__i [14]int32
}
type _cgoa_5__exit struct {
X__u _cgoa_6__exit
type _cgoa_5_crypt struct {
X__u _cgoa_6_crypt
}
type Pthread_attr_t = _cgoa_5__exit
type _cgoa_8__exit struct {
type Pthread_attr_t = _cgoa_5_crypt
type _cgoa_8_crypt struct {
X__i [10]int32
}
type _cgoa_7__exit struct {
X__u _cgoa_8__exit
type _cgoa_7_crypt struct {
X__u _cgoa_8_crypt
}
type Pthread_mutex_t = _cgoa_7__exit
type _cgoa_10__exit struct {
type Pthread_mutex_t = _cgoa_7_crypt
type _cgoa_10_crypt struct {
X__i [12]int32
}
type _cgoa_9__exit struct {
X__u _cgoa_10__exit
type _cgoa_9_crypt struct {
X__u _cgoa_10_crypt
}
type Pthread_cond_t = _cgoa_9__exit
type _cgoa_12__exit struct {
type Pthread_cond_t = _cgoa_9_crypt
type _cgoa_12_crypt struct {
X__i [14]int32
}
type _cgoa_11__exit struct {
X__u _cgoa_12__exit
type _cgoa_11_crypt struct {
X__u _cgoa_12_crypt
}
type Pthread_rwlock_t = _cgoa_11__exit
type _cgoa_14__exit struct {
type Pthread_rwlock_t = _cgoa_11_crypt
type _cgoa_14_crypt struct {
X__i [8]int32
}
type _cgoa_13__exit struct {
X__u _cgoa_14__exit
type _cgoa_13_crypt struct {
X__u _cgoa_14_crypt
}
type Pthread_barrier_t = _cgoa_13__exit
type Pthread_barrier_t = _cgoa_13_crypt
type Pid_t = int32
type struct_sched_param struct {
sched_priority int32
Expand Down Expand Up @@ -103,21 +103,21 @@ type struct___ptcb struct {
__next *struct___ptcb
}
type Wchar_t = uint32
type _cgoa_15__exit struct {
type _cgoa_15_crypt struct {
Quot int32
Rem int32
}
type Div_t = _cgoa_15__exit
type _cgoa_16__exit struct {
type Div_t = _cgoa_15_crypt
type _cgoa_16_crypt struct {
Quot int64
Rem int64
}
type Ldiv_t = _cgoa_16__exit
type _cgoa_17__exit struct {
type Ldiv_t = _cgoa_16_crypt
type _cgoa_17_crypt struct {
Quot int64
Rem int64
}
type Lldiv_t = _cgoa_17__exit
type Lldiv_t = _cgoa_17_crypt
type Ssize_t = int64
type Off_t = int64
type FILE = Struct__IO_FILE
Expand Down Expand Up @@ -164,6 +164,52 @@ type Intptr_t = int64
type Uid_t = uint32
type Gid_t = uint32
type Useconds_t = uint32
type struct_crypt_data struct {
initialized int32
__buf [256]int8
}
type Uintptr_t = uint64
type Int8_t = int8
type Int16_t = int16
type Int32_t = int32
type Int64_t = int64
type Intmax_t = int64
type Uint8_t = uint8
type Uint16_t = uint16
type Uint32_t = uint32
type Uint64_t = uint64
type Uintmax_t = uint64
type int_fast8_t = int8
type int_fast64_t = int64
type int_least8_t = int8
type int_least16_t = int16
type int_least32_t = int32
type int_least64_t = int64
type uint_fast8_t = uint8
type uint_fast64_t = uint64
type uint_least8_t = uint8
type uint_least16_t = uint16
type uint_least32_t = uint32
type uint_least64_t = uint64
type int_fast16_t = int32
type int_fast32_t = int32
type uint_fast16_t = uint32
type uint_fast32_t = uint32
type struct_expanded_key struct {
l [16]uint32
r [16]uint32
}

func X__isspace(_c int32) int32 {
return func() int32 {
if _c == ' ' || uint32(_c)-uint32('\t') < uint32(5) {
return 1
} else {
return 0
}
}()
}

type Mode_t = uint32
type struct_flock struct {
l_type int16
Expand Down Expand Up @@ -392,7 +438,7 @@ type struct_sigaction struct {
}
type _cgoa_33_setxid struct {
sigev_notify_function func(union_sigval)
sigev_notify_attributes *_cgoa_5__exit
sigev_notify_attributes *_cgoa_5_crypt
}
type _cgoa_32_setxid struct {
__pad [48]int8
Expand All @@ -418,33 +464,6 @@ type struct_termios struct {
__c_ispeed uint32
__c_ospeed uint32
}
type Uintptr_t = uint64
type Int8_t = int8
type Int16_t = int16
type Int32_t = int32
type Int64_t = int64
type Intmax_t = int64
type Uint8_t = uint8
type Uint16_t = uint16
type Uint32_t = uint32
type Uint64_t = uint64
type Uintmax_t = uint64
type int_fast8_t = int8
type int_fast64_t = int64
type int_least8_t = int8
type int_least16_t = int16
type int_least32_t = int32
type int_least64_t = int64
type uint_fast8_t = uint8
type uint_fast64_t = uint64
type uint_least8_t = uint8
type uint_least16_t = uint16
type uint_least32_t = uint32
type uint_least64_t = uint64
type int_fast16_t = int32
type int_fast32_t = int32
type uint_fast16_t = uint32
type uint_fast32_t = uint32

func a_fetch_and(p *int32, v int32) int32 {
var old int32
Expand Down Expand Up @@ -2627,15 +2646,6 @@ func do_putc(c int32, f *Struct__IO_FILE) int32 {
}
return locking_putc(c, f)
}
func X__isspace(_c int32) int32 {
return func() int32 {
if _c == ' ' || uint32(_c)-uint32('\t') < uint32(5) {
return 1
} else {
return 0
}
}()
}

type struct_kstat struct {
st_dev uint64
Expand Down
9 changes: 9 additions & 0 deletions crypt.c.i.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package libc

import unsafe "unsafe"

func crypt(key *int8, salt *int8) *int8 {
return __crypt_r(key, salt, (*struct_crypt_data)(unsafe.Pointer((*int8)(unsafe.Pointer(&_cgos_buf_crypt)))))
}

var _cgos_buf_crypt [128]int8
434 changes: 434 additions & 0 deletions crypt_des.c.i.go

Large diffs are not rendered by default.

Loading

0 comments on commit dab3ae6

Please sign in to comment.