Differences From
Artifact [034fdb64c7]:
81 81 else
82 82 return lib.pk.mbedtls_pk_write_key_pem(key, buf, const.maxpemsz) == 0
83 83 end
84 84 end
85 85
86 86 local binblob = lib.mem.ptr(uint8)
87 87 terra m.der(pub: bool, key: &ctx, buf: &uint8): binblob
88 - var ofs: intptr
88 + var ofs: ptrdiff
89 89 if pub then
90 90 ofs = lib.pk.mbedtls_pk_write_pubkey_der(key, buf, const.maxdersz)
91 91 else
92 92 ofs = lib.pk.mbedtls_pk_write_key_der(key, buf, const.maxdersz)
93 93 end
94 + if ofs < 0 then return binblob.null() end
94 95 return binblob {
95 96 ptr = buf + (const.maxdersz - ofs);
96 97 ct = ofs;
97 98 }
98 99 end
99 100
100 101 m.destroy = lib.dispatch {