id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c11500 | p.arena.Free()
p.params = nil
p.arena = nil
} | |
c11501 | sLen: C.CK_ULONG(saltLength),
}
return C.GoBytes(unsafe.Pointer(&p), C.int(unsafe.Sizeof(p)))
} | |
c11502 | mgf,
SourceType: sourceType,
SourceData: sourceData,
}
} | |
c11503 |
SharedData: sharedData,
PublicKeyData: publicKeyData,
}
} | |
c11504 | C.Initialize(c.ctx)
return toError(e)
} | |
c11505 | e := C.Finalize(c.ctx)
return toError(e)
} | |
c11506 | uint(p.flags),
LibraryDescription: strings.TrimRight(string(C.GoBytes(unsafe.Pointer(&p.libraryDescription[0]), 32)), " "),
LibraryVersion: toVersion(p.libraryVersion),
}
return i, toError(e)
} | |
c11507 |
if toError(e) != nil {
return nil, toError(e)
}
l := toList(slotList, ulCount)
return l, nil
} | |
c11508 | " "),
Flags: uint(csi.flags),
HardwareVersion: toVersion(csi.hardwareVersion),
FirmwareVersion: toVersion(csi.firmwareVersion),
}
return s, toError(e)
} | |
c11509 | uint(cti.ulMinPinLen),
TotalPublicMemory: uint(cti.ulTotalPublicMemory),
FreePublicMemory: uint(cti.ulFreePublicMemory),
TotalPrivateMemory: uint(cti.ulTotalPrivateMemory),
FreePrivateMemory: uint(cti.ulFreePrivateMemory),
HardwareVersion: toVersion(cti.hardwareVersion),
FirmwareVersion: toVers... | |
c11510 | if toError(e) != nil {
return nil, toError(e)
}
// Although the function returns only type, cast them back into real
// attributes as this is used in other functions.
m := make([]*Mechanism, int(mechlen))
for i, typ := range toList(mech, mechlen) {
m[i] = NewMechanism(typ, nil)
}
return m, nil
} | |
c11511 | MinKeySize: uint(cm.ulMinKeySize),
MaxKeySize: uint(cm.ulMaxKeySize),
Flags: uint(cm.flags),
}
return mi, toError(e)
} | |
c11512 | l := C.CString(label[:32])
defer C.free(unsafe.Pointer(l))
e := C.InitToken(c.ctx, C.CK_ULONG(slotID), p, C.CK_ULONG(len(pin)), l)
return toError(e)
} | |
c11513 | C.InitPIN(c.ctx, C.CK_SESSION_HANDLE(sh), p, C.CK_ULONG(len(pin)))
return toError(e)
} | |
c11514 | := C.SetPIN(c.ctx, C.CK_SESSION_HANDLE(sh), old, C.CK_ULONG(len(oldpin)), new, C.CK_ULONG(len(newpin)))
return toError(e)
} | |
c11515 | e := C.CloseAllSessions(c.ctx, C.CK_ULONG(slotID))
return toError(e)
} | |
c11516 |
s := SessionInfo{SlotID: uint(csi.slotID),
State: uint(csi.state),
Flags: uint(csi.flags),
DeviceError: uint(csi.ulDeviceError),
}
return s, toError(e)
} | |
c11517 | != nil {
return nil, toError(e)
}
b := C.GoBytes(unsafe.Pointer(state), C.int(statelen))
return b, nil
} | |
c11518 | C.CK_ULONG(len(state)), C.CK_OBJECT_HANDLE(encryptKey), C.CK_OBJECT_HANDLE(authKey))
return toError(e)
} | |
c11519 | C.Login(c.ctx, C.CK_SESSION_HANDLE(sh), C.CK_USER_TYPE(userType), p, C.CK_ULONG(len(pin)))
return toError(e)
} | |
c11520 | e := C.Logout(c.ctx, C.CK_SESSION_HANDLE(sh))
return toError(e)
} | |
c11521 | tcount, C.CK_OBJECT_HANDLE_PTR(&obj))
e1 := toError(e)
if e1 == nil {
return ObjectHandle(obj), nil
}
return 0, e1
} | |
c11522 | C.GetObjectSize(c.ctx, C.CK_SESSION_HANDLE(sh), C.CK_OBJECT_HANDLE(oh), &size)
return uint(size), toError(e)
} | |
c11523 | C.CK_SESSION_HANDLE(sh), C.CK_OBJECT_HANDLE(o), pa, palen)
return toError(e)
} | |
c11524 | toError(e) != nil {
return nil, false, toError(e)
}
l := toList(C.CK_ULONG_PTR(unsafe.Pointer(objectList)), ulCount)
// Make again a new list of the correct type.
// This is copying data, but this is not an often used function.
o := make([]ObjectHandle, len(l))
for i, v := range l {
o[i] = ObjectHandle(v)
}... | |
c11525 | {
return nil, toError(e)
}
s := C.GoBytes(unsafe.Pointer(enc), C.int(enclen))
C.free(unsafe.Pointer(enc))
return s, nil
} | |
c11526 | &plain, &plainlen)
if toError(e) != nil {
return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(plain), C.int(plainlen))
C.free(unsafe.Pointer(plain))
return h, nil
} | |
c11527 | := cMechanism(m)
defer arena.Free()
e := C.DigestInit(c.ctx, C.CK_SESSION_HANDLE(sh), mech)
return toError(e)
} | |
c11528 | C.CK_ULONG(len(message)))
if toError(e) != nil {
return toError(e)
}
return nil
} | |
c11529 |
if toError(e) != nil {
return toError(e)
}
return nil
} | |
c11530 | &hash, &hashlen)
if toError(e) != nil {
return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(hash), C.int(hashlen))
C.free(unsafe.Pointer(hash))
return h, nil
} | |
c11531 | nil {
return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(sig), C.int(siglen))
C.free(unsafe.Pointer(sig))
return h, nil
} | |
c11532 | cMessage(part), C.CK_ULONG(len(part)))
return toError(e)
} | |
c11533 | C.CK_SESSION_HANDLE(sh), cMessage(signature), C.CK_ULONG(len(signature)))
return toError(e)
} | |
c11534 | nil {
return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(data), C.int(datalen))
C.free(unsafe.Pointer(data))
return h, nil
} | |
c11535 | nil {
return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(part), C.int(partlen))
C.free(unsafe.Pointer(part))
return h, nil
} | |
c11536 | nil {
return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(enc), C.int(enclen))
C.free(unsafe.Pointer(enc))
return h, nil
} | |
c11537 | cAttributeList(a)
defer attrarena.Free()
mecharena, mech := cMechanism(m)
defer mecharena.Free()
e := C.DeriveKey(c.ctx, C.CK_SESSION_HANDLE(sh), mech, C.CK_OBJECT_HANDLE(basekey), ac, aclen, &key)
return ObjectHandle(key), toError(e)
} | |
c11538 | C.CK_SESSION_HANDLE(sh), C.CK_BYTE_PTR(unsafe.Pointer(&seed[0])), C.CK_ULONG(len(seed)))
return toError(e)
} | |
c11539 | return nil, toError(e)
}
h := C.GoBytes(unsafe.Pointer(rand), C.int(length))
C.free(unsafe.Pointer(rand))
return h, nil
} | |
c11540 | s.ctx.GetSlotInfo(s.id)
} | |
c11541 | s.ctx.GetTokenInfo(s.id)
} | |
c11542 | result[i] = Mechanism{
mechanism: mech,
slot: s,
}
}
return result, nil
} | |
c11543 | {
return m.slot.ctx.GetMechanismInfo(m.slot.id, []*pkcs11.Mechanism{m.mechanism})
} | |
c11544 |
return nil, err
}
out, err := s.ctx.Sign(s.handle, message)
if err != nil {
return nil, err
}
return out, nil
} | |
c11545 | {
return err
}
err = s.ctx.Verify(s.handle, message, signature)
if err != nil {
return err
}
return nil
} | |
c11546 | return nil, err
}
out, err := s.ctx.Encrypt(s.handle, plaintext)
if err != nil {
return nil, err
}
return out, nil
} | |
c11547 |
return C.CK_BBOOL(C.CK_FALSE)
} | |
c11548 | a.Value = []byte{0}
}
case int:
a.Value = uintToBytes(uint64(v))
case uint:
a.Value = uintToBytes(uint64(v))
case string:
a.Value = []byte(v)
case []byte:
a.Value = v
case time.Time: // for CKA_DATE
a.Value = cDate(v)
default:
panic("pkcs11: unhandled attribute type")
}
return a
} | |
c11549 | len := arena.Allocate(attr.Value)
// field is unaligned on windows so this has to call into C
C.putAttributePval(&pa[i], buf)
pa[i].ulValueLen = len
}
}
return arena, &pa[0], C.CK_ULONG(len(a))
} | |
c11550 |
m.Parameter = p
default:
panic("parameter must be one of type: []byte, *GCMParams, *OAEPParams, *ECDH1DeriveParams")
}
return m
} | |
c11551 |
if err != nil {
return "", err
}
return string(labelBytes), nil
} | |
c11552 | o.objectHandle,
[]*pkcs11.Attribute{pkcs11.NewAttribute(attributeType, value)})
if err != nil {
return err
}
return nil
} | |
c11553 | nil {
return Object{}, err
}
return Object{
session: s,
objectHandle: newHandle,
}, nil
} | |
c11554 | return s.ctx.DestroyObject(s.handle, o.objectHandle)
} | |
c11555 | err
}
result := make([]Slot, len(ids))
for i, id := range ids {
result[i] = Slot{
ctx: m.ctx,
id: id,
}
}
return result, nil
} | |
c11556 | uint64(d.Inode),
off: uint64(d.Offset),
namelen: uint32(len(d.Name)),
type_: uint32(d.Type),
}
n += copy(buf[n:], (*[direntSize]byte)(unsafe.Pointer(&de))[:])
// Write the name afterward.
n += copy(buf[n:], d.Name)
// Add any necessary padding.
if padLen != 0 {
var padding [direntAlignment]b... | |
c11557 | // 2^64 seconds is well longer than the 2^63 ns range of time.Duration.
d := t.Sub(time.Now())
if d > 0 {
secs = uint64(d / time.Second)
nsecs = uint32((d % time.Second) / time.Nanosecond)
}
return
} | |
c11558 | {
in.contents = in.contents[:intSize]
} else {
padding := make([]byte, intSize-len(in.contents))
in.contents = append(in.contents, padding...)
}
// Update attributes.
in.attrs.Size = *size
}
// Change mode?
if mode != nil {
in.attrs.Mode = *mode
}
// Change mtime?
if mtime != nil {
in.att... | |
c11559 | }
if initOp.Kernel.LT(c.protocol) {
c.protocol = initOp.Kernel
}
// Respond to the init op.
initOp.Library = c.protocol
initOp.MaxReadahead = maxReadahead
initOp.MaxWrite = buffer.MaxWriteSize
initOp.Flags = 0
// Tell the kernel not to use pitifully small 4 KiB writes.
initOp.Flags |= fusekernel.InitBig... | |
c11560 | //
if pe, ok := err.(*os.PathError); ok {
switch pe.Err {
case syscall.ENODEV:
err = io.EOF
case syscall.EINTR:
err = nil
continue
}
}
if err != nil {
c.putInMessage(m)
m = nil
return
}
return
}
} | |
c11561 | {
err = fmt.Errorf("Wrote %d bytes; expected %d", n, len(msg))
return
}
return
} | |
c11562 | err == syscall.ENOENT {
return false
}
case *fuseops.GetXattrOp:
if err == syscall.ENODATA || err == syscall.ERANGE {
return false
}
case *unknownOp:
// Don't bother the user with methods we intentionally don't support.
if err == syscall.ENOSYS {
return false
}
}
return true
} | |
c11563 | log.Panicf(
"header ends at offset %d, but payload starts at offset %d",
a, b)
}
} | |
c11564 | did.
if unsafe.Offsetof(m.payload) != 24 {
panic("unexpected OutMessage layout")
}
a := (*[3]uint64)(unsafe.Pointer(m))
a[0] = 0
a[1] = 0
a[2] = 0
} | |
c11565 | nil {
memclr(p, uintptr(n))
}
return
} | |
c11566 | if len(m.payload)-o < n {
return
}
p = unsafe.Pointer(uintptr(unsafe.Pointer(&m.payload)) + uintptr(o))
m.payloadOffset = o + n
return
} | |
c11567 | := (*reflect.StringHeader)(unsafe.Pointer(&src))
memmove(p, unsafe.Pointer(sh.Data), uintptr(sh.Len))
return
} | |
c11568 |
Data: uintptr(unsafe.Pointer(&m.header)),
Len: l,
Cap: l,
}
return *(*[]byte)(unsafe.Pointer(&sh))
} | |
c11569 | uintptr(n) < headerSize {
err = fmt.Errorf("Unexpectedly read only %d bytes.", n)
return
}
m.remaining = m.storage[headerSize:n]
// Check the header's length.
if int(m.Header().Len) != n {
err = fmt.Errorf(
"Header says %d bytes, but we read %d",
m.Header().Len,
n)
return
}
return
} | |
c11570 | (*fusekernel.InHeader)(unsafe.Pointer(&m.storage[0]))
return
} | |
c11571 | || n > m.Len() {
return
}
p = unsafe.Pointer(&m.remaining[0])
m.remaining = m.remaining[n:]
return
} | |
c11572 |
b = m.remaining[:n]
m.remaining = m.remaining[n:]
return
} | |
c11573 | "Op" from "FooOp".
return strings.TrimSuffix(t.Name(), "Op")
} | |
c11574 | Connection object wrapping the device.
connection, err := newConnection(
cfgCopy,
config.DebugLogger,
config.ErrorLogger,
dev)
if err != nil {
err = fmt.Errorf("newConnection: %v", err)
return
}
// Serve the connection in the background. When done, set the join status.
go func() {
server.ServeOps(... | |
c11575 |
}
// Handle OS X options.
if isDarwin {
if !c.EnableVnodeCaching {
opts["novncache"] = ""
}
if c.VolumeName != "" {
// Cf. https://github.com/osxfuse/osxfuse/wiki/Mount-options#volname
opts["volname"] = c.VolumeName
}
}
// OS X: disable the use of "Apple Double" (._foo and .DS_Store) files, wh... | |
c11576 | fmt.Sprintf("%s=%s", k, v)
}
components = append(components, component)
}
return strings.Join(components, ",")
} | |
c11577 | if l == 0 {
return
}
p = fl.list[l-1]
fl.list = fl.list[:l-1]
return
} | |
c11578 | {
fl.list = append(fl.list, p)
} | |
c11579 | a.Major < b.Major ||
(a.Major == b.Major && a.Minor < b.Minor)
} | |
c11580 | a.Major > b.Major ||
(a.Major == b.Major && a.Minor >= b.Minor)
} | |
c11581 | t.initialize(ti.Ctx)
if err != nil {
panic(err)
}
} | |
c11582 |
cmd := exec.Command(
"go",
"build",
"-o",
toolPath,
"github.com/jacobsa/fuse/samples/mount_sample")
output, err := cmd.CombinedOutput()
if err != nil {
err = fmt.Errorf(
"mount_sample exited with %v, output:\n%s",
err,
string(output))
return
}
// Slurp the tool contents.
contents, err =... | |
c11583 | getToolContents_Err = getToolContentsImpl()
})
contents, err = getToolContents_Contents, getToolContents_Err
return
} | |
c11584 | := &LineScanner{
Reader: br,
}
return ls
} | |
c11585 | io.EOF {
ls.err = nil
}
return false
}
ls.lnum++
return true
} | |
c11586 | {
found = true
lex.tok = &Token{lnum, typ.typ, line}
break
}
}
if !found {
lex.tok = &Token{lnum, DataToken, line}
}
return true
} | |
c11587 | if matchDatarace(line) {
return true
}
}
return false
} | |
c11588 | test.Status == status {
count++
}
}
return count
} | |
c11589 | {
return true
}
}
return false
} | |
c11590 |
s.nodes = append(s.nodes[:s.count], n)
s.count++
} | |
c11591 |
s.count--
return s.nodes[s.count]
} | |
c11592 |
suite: nil,
tests: make(map[string]*Test),
lex: NewGotestLexer(in),
}
} | |
c11593 | && args.xunitnetOut {
return fmt.Errorf("-bamboo and -xunitnet are mutually exclusive")
}
return nil
} | |
c11594 | return os.Stdin, nil
}
return os.Open(filename)
} | |
c11595 | return os.Stdout, nil
}
return os.Create(filename)
} | |
c11596 | != nil {
return nil, nil, fmt.Errorf("can't open %s for writing: %s", outFile, err)
}
return input, output, nil
} | |
c11597 | suite.NumFailed()
r.NumSkipped += suite.NumSkipped()
suiteTime, _ := strconv.ParseFloat(suite.Time, 64)
totalTime += suiteTime
r.Time = fmt.Sprintf("%.3f", totalTime)
}
r.Len = r.NumPassed + r.NumSkipped + r.NumFailed
} | |
c11598 |
Passed: Passed,
Failed: Failed,
}
testsResult.calcTotals()
t := template.New("test template").Funcs(template.FuncMap{
"escape": escapeForXML,
})
t, err := t.Parse(xml.Header + xmlTemplate)
if err != nil {
fmt.Printf("Error in parse %v\n", err)
return
}
err = t.Execute(out, testsResult)
if err !... | |
c11599 | resp, err := client.Do(req.WithContext(ctx))
if err != nil {
return err
}
if resp.StatusCode != 201 {
return fmt.Errorf("Unknown status: %d", resp.StatusCode)
}
return nil
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.