--- sys/src/libsec/port/tlshand.c
+++ sys/src/libsec/port/tlshand.c
@@ -90,6 +90,14 @@ typedef struct TlsConnection{
Finished finished;
int serverSignFlags; /* AlgRsaSign|AlgEcSign; gates okCipher */
int serverCurve; /* negotiated ECDHE group, 0 = none */
+ char *sni; /* RFC 6066 server-side observed SNI */
+ int extSniAck; /* server used the presented name; gates the ack */
+ int extEcPointFormatsSeen; /* client offered ext; gates ack */
+ Ints *peerSigAlgs; /* RFC 5246 7.4.1.4.1 sigalgs from peer */
+ /* Client-side: extension types we advertised, for unsupported_extension(110)
+ * detection on ServerHello (RFC 5246 Section 7.4.1.4). */
+ int nClientOffered;
+ int clientOffered[16];
} TlsConnection;
typedef struct Msg{
@@ -206,6 +214,7 @@ enum {
EInternalError = 80,
EUserCanceled = 90,
ENoRenegotiation = 100,
+ EUnsupportedExtension = 110, /* RFC 5246 Section 7.4.1.4 */
EMax = 256
};
@@ -429,18 +438,49 @@ static Ints* newints(int len);
static Bytes* makebytes(uchar* buf, int len);
static void freebytes(Bytes* b);
static Ints* newints(int len);
-static Ints* makeints(int* buf, int len);
static void freeints(Ints* b);
static int isECDHE(int tlsid);
static int isTLS12Only(int tlsid);
static Bytes* findExtension(Bytes *ext, int type);
-static Bytes* clientHelloExtensions(char *serverName);
+static Bytes* clientHelloExtensions(TlsConnection *c, char *serverName);
static uchar* tlsSecECDHEc(TlsSec *sec, Bytes *Ys, int *npub);
static uchar* tlsSecECDHEcNist(TlsSec *sec, void (*curveinit)(mpint*,mpint*,mpint*,mpint*,mpint*,mpint*,mpint*), Bytes *Ys, int *npub);
static int cipherSignAlg(int tlsid);
static char* verifyDHparams(TlsSec *sec, Msg *m, Bytes *cert, int cipher);
+/*
+ * Extension framework (RFC 5246 Section 7.4.1.4, RFC 8446 Section 4.2).
+ * Each ExtAlg entry pairs a wire type with a build callback (emits the
+ * payload, w/o the type+length header) and a parse callback (consumes a
+ * received payload). Builders that decline to advertise this connection
+ * return -1; the dispatch helper skips them. Parsers return 0 on
+ * success, -1 to abort the handshake. The caller presets ctx->alert
+ * to decode_error; a parser whose RFC names a different alert assigns
+ * ctx->alert before returning -1.
+ *
+ * Per-direction tables (clientHelloBuilders, clientHelloParsers,
+ * serverHelloBuilders, serverHelloParsers) and their dispatch wrappers
+ * are defined together near the bottom of this file. Adding a new
+ * extension means adding one entry to the relevant table plus the
+ * matching build/parse function -- no other plumbing.
+ */
+typedef struct ExtAlg ExtAlg;
+typedef struct ExtCtx ExtCtx;
+struct ExtCtx {
+ char *serverName; /* SNI; nil on server, may be nil on client */
+ int alert; /* alert sent if a parser aborts; caller presets it */
+};
+struct ExtAlg {
+ int type;
+ int (*build)(TlsConnection*, ExtCtx*, uchar*, int);
+ int (*parse)(TlsConnection*, ExtCtx*, uchar*, int);
+};
+static int clientHelloBuildExt(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize);
+static int clientHelloParseExt(TlsConnection *c, ExtCtx *ctx, uchar *in, int inlen);
+static int serverHelloBuildExt(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize);
+static int serverHelloParseExt(TlsConnection *c, ExtCtx *ctx, uchar *in, int inlen);
+
//================= client/server ========================
// push TLS onto fd, returning new (application) file descriptor
@@ -680,6 +720,35 @@ tlsServer2(int ctl, int hand, uchar *cert, int ncert,
goto Err;
}
+ /* Walk client's offered extensions through the parser table.
+ * Unknown types are silently skipped per RFC 5246 Section 7.4.1.4. */
+ if(m.u.clientHello.extensions != nil){
+ ExtCtx ctx;
+
+ memset(&ctx, 0, sizeof ctx);
+ ctx.alert = EDecodeError;
+ if(clientHelloParseExt(c, &ctx,
+ m.u.clientHello.extensions->data,
+ m.u.clientHello.extensions->len) < 0){
+ tlsError(c, ctx.alert, "bad clientHello extension");
+ goto Err;
+ }
+ }
+
+ /*
+ * RFC 5246 Section 7.4.1.4.1: a client that sends no
+ * signature_algorithms must be answered as if it had sent
+ * {sha1,rsa}, which signDHparams cannot produce. Only an
+ * ECDHE suite makes us sign a ServerKeyExchange, so refuse
+ * just that case; failing to agree on parameters is
+ * handshake_failure (RFC 5246 Section 7.2.2).
+ */
+ if(isECDHE(cipher) && c->peerSigAlgs == nil){
+ tlsError(c, EHandshakeFailure,
+ "RFC 5246 Section 7.4.1.4.1: no signature_algorithms");
+ goto Err;
+ }
+
csid = m.u.clientHello.sid;
if(trace)
trace(" cipher %d, compressor %d, csidlen %d\n", cipher, compressor, csid->len);
@@ -703,6 +772,20 @@ tlsServer2(int ctl, int hand, uchar *cert, int ncert,
m.u.serverHello.compressor = compressor;
c->sid = makebytes(sid, nsid);
m.u.serverHello.sid = makebytes(c->sid->data, c->sid->len);
+ {
+ uchar extbuf[512];
+ ExtCtx ctx;
+ int extlen;
+
+ memset(&ctx, 0, sizeof ctx);
+ extlen = serverHelloBuildExt(c, &ctx, extbuf, sizeof extbuf);
+ if(extlen < 0){
+ tlsError(c, EInternalError, "can't build serverHello extensions");
+ goto Err;
+ }
+ if(extlen > 0)
+ m.u.serverHello.extensions = makebytes(extbuf, extlen);
+ }
if(!msgSend(c, &m, AQueue))
goto Err;
msgClear(&m);
@@ -889,8 +972,13 @@ tlsClient2(int ctl, int hand, uchar *csid, int ncsid,
m.u.clientHello.sid = makebytes(csid, ncsid);
m.u.clientHello.ciphers = makeciphers();
m.u.clientHello.compressors = makebytes(compressors,sizeof(compressors));
- if(c->clientVersion >= TLS12Version)
- m.u.clientHello.extensions = clientHelloExtensions(serverName);
+ if(c->clientVersion >= TLS12Version){
+ m.u.clientHello.extensions = clientHelloExtensions(c, serverName);
+ if(m.u.clientHello.extensions == nil){
+ tlsError(c, EInternalError, "can't build clientHello extensions");
+ goto Err;
+ }
+ }
if(!msgSend(c, &m, AFlush))
goto Err;
msgClear(&m);
@@ -920,6 +1008,18 @@ tlsClient2(int ctl, int hand, uchar *csid, int ncsid,
if(m.u.serverHello.compressor != CompressionNull) {
tlsError(c, EIllegalParameter, "invalid compression");
goto Err;
+ }
+ if(m.u.serverHello.extensions != nil){
+ ExtCtx ctx;
+
+ memset(&ctx, 0, sizeof ctx);
+ ctx.serverName = serverName;
+ if(serverHelloParseExt(c, &ctx,
+ m.u.serverHello.extensions->data,
+ m.u.serverHello.extensions->len) < 0){
+ tlsError(c, EDecodeError, "malformed serverHello extension");
+ goto Err;
+ }
}
dhx = isECDHE(cipher);
msgClear(&m);
@@ -1951,6 +2051,8 @@ tlsConnectionFree(TlsConnection *c)
tlsSecClose(c->sec);
freebytes(c->sid);
freebytes(c->cert);
+ free(c->sni);
+ freeints(c->peerSigAlgs);
memset(c, 0, sizeof *c);
free(c);
}
@@ -2532,55 +2634,432 @@ findExtension(Bytes *ext, int type)
/*
* Build the ClientHello extensions blob (inner form, without the outer
- * 2-byte length). Contains: server_name (when given, RFC 6066 Section 3),
- * supported_groups = [X25519], ec_point_formats = [uncompressed],
- * signature_algorithms.
+ * 2-byte length). Wire bytes are produced by the table-driven
+ * clientHelloBuildExt; this is a thin Bytes* wrapper for the call site
+ * in tlsClient2.
*/
static Bytes*
-clientHelloExtensions(char *serverName)
+clientHelloExtensions(TlsConnection *c, char *serverName)
{
- uchar buf[512], *p;
- int n, snlen, i;
+ uchar buf[512];
+ ExtCtx ctx;
+ int n;
- p = buf;
+ memset(&ctx, 0, sizeof ctx);
+ ctx.serverName = serverName;
+ n = clientHelloBuildExt(c, &ctx, buf, sizeof buf);
+ if(n <= 0)
+ return nil;
+ return makebytes(buf, n);
+}
- if(serverName != nil && *serverName != 0){
- snlen = strlen(serverName);
- put16(p, ExtSni);
- put16(p+2, snlen + 5); /* ext content = list_len(2) + entry(1+2+snlen) */
- put16(p+4, snlen + 3); /* server_name_list length */
- p[6] = 0; /* NameType = host_name */
- put16(p+7, snlen);
- memmove(p+9, serverName, snlen);
- p += 9 + snlen;
- }
+/*
+ * RFC 6066 Section 3 forbids a literal address in server_name: the
+ * field carries a DNS host name only. ':' occurs in an IPv6 literal
+ * and never in a host name, and a name made only of digits and dots
+ * is an IPv4 literal, since the rightmost label of a real host name
+ * cannot be all digits.
+ */
+static int
+okSniName(char *s)
+{
+ char *p;
- put16(p, ExtSupportedGroups);
- put16(p+2, sizeof(supportedGroups) + 2);
- put16(p+4, sizeof(supportedGroups));
- memmove(p+6, supportedGroups, sizeof(supportedGroups));
- p += 6 + sizeof(supportedGroups);
+ if(s == nil || *s == 0)
+ return 0;
+ if(strchr(s, ':') != nil)
+ return 0;
+ for(p = s; *p != 0; p++)
+ if(*p != '.' && (*p < '0' || *p > '9'))
+ return 1;
+ return 0;
+}
- put16(p, ExtEcPointFormats);
- put16(p+2, sizeof(ecPointFormats) + 1);
- p[4] = sizeof(ecPointFormats);
- memmove(p+5, ecPointFormats, sizeof(ecPointFormats));
- p += 5 + sizeof(ecPointFormats);
+/*
+ * SNI (RFC 6066 Section 3): server_name_list with one host_name entry.
+ * Declined when serverName is unset or is an address literal.
+ */
+static int
+buildSni(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ int snlen;
+ USED(c);
+ if(!okSniName(ctx->serverName))
+ return -1;
+ snlen = strlen(ctx->serverName);
+ if(snlen + 5 > outsize)
+ return -1;
+ put16(out, snlen + 3); /* server_name_list length */
+ out[2] = 0; /* NameType = host_name */
+ put16(out+3, snlen);
+ memmove(out+5, ctx->serverName, snlen);
+ return 5 + snlen;
+}
+
+/*
+ * supported_groups (RFC 8422 Section 5.1.1): named-curve list we offer.
+ */
+static int
+buildSupportedGroups(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ USED(c); USED(ctx);
+ if((int)(sizeof(supportedGroups) + 2) > outsize)
+ return -1;
+ put16(out, sizeof(supportedGroups));
+ memmove(out+2, supportedGroups, sizeof(supportedGroups));
+ return 2 + sizeof(supportedGroups);
+}
+
+/*
+ * ec_point_formats (RFC 4492 Section 5.1.2): uncompressed only.
+ */
+static int
+buildEcPointFormats(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ USED(c); USED(ctx);
+ if((int)(sizeof(ecPointFormats) + 1) > outsize)
+ return -1;
+ out[0] = sizeof(ecPointFormats);
+ memmove(out+1, ecPointFormats, sizeof(ecPointFormats));
+ return 1 + sizeof(ecPointFormats);
+}
+
+/*
+ * signature_algorithms (RFC 5246 Section 7.4.1.4.1).
+ */
+static int
+buildSigalgs(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ int i, n;
+
+ USED(c); USED(ctx);
n = nelem(sigAlgs);
- put16(p, ExtSigalgs);
- put16(p+2, 2*n + 2);
- put16(p+4, 2*n);
- p += 6;
- for(i = 0; i < n; i++){
- put16(p, sigAlgs[i]);
- p += 2;
+ if(2*n + 2 > outsize)
+ return -1;
+ put16(out, 2*n);
+ for(i = 0; i < n; i++)
+ put16(out + 2 + 2*i, sigAlgs[i]);
+ return 2 + 2*n;
+}
+
+/*
+ * server_name parser, server-side (RFC 6066 Section 3). Records the
+ * presented host_name on c->sni. No ack is emitted from here: RFC 6066
+ * ties the ack to acting on the name, not to receiving it. Unknown
+ * name_types are silently ignored per the RFC.
+ */
+static int
+parseSniServer(TlsConnection *c, ExtCtx *ctx, uchar *in, int inlen)
+{
+ int listlen, namelen;
+
+ USED(ctx);
+ if(inlen < 5)
+ return -1;
+ listlen = get16(in);
+ if(listlen + 2 != inlen)
+ return -1;
+ if(in[2] != 0) /* host_name == 0; unknown name_type */
+ return 0;
+ namelen = get16(in + 3);
+ /*
+ * RFC 6066 Section 3: the list may hold further entries of other
+ * name_types. Bound the host_name and ignore whatever follows it
+ * rather than failing a well-formed ClientHello.
+ */
+ if(namelen + 5 > inlen)
+ return -1;
+ free(c->sni);
+ c->sni = emalloc(namelen + 1);
+ memmove(c->sni, in + 5, namelen);
+ c->sni[namelen] = 0;
+ return 0;
+}
+
+/*
+ * ec_point_formats parser, server-side (RFC 4492 Section 5.1.2). We do
+ * not store the formats themselves; we only record that the client
+ * offered the extension so the ack builder can echo uncompressed when
+ * an ECDHE suite is selected.
+ */
+static int
+parseEcPointFormatsServer(TlsConnection *c, ExtCtx *ctx,
+ uchar *in, int inlen)
+{
+ int listlen, i, hasUncompressed;
+
+ if(inlen < 1)
+ return -1;
+ listlen = in[0];
+ if(listlen < 1 || listlen + 1 != inlen)
+ return -1;
+ /*
+ * RFC 8422 Section 5.1.2: a client offering point formats without
+ * pointFormatUncompressed (0x00) gets illegal_parameter, since every
+ * EC point we put on the wire is uncompressed. The suite is already
+ * chosen here, so only abort when an EC point will actually be sent.
+ */
+ hasUncompressed = 0;
+ for(i = 0; i < listlen; i++)
+ if(in[1 + i] == 0)
+ hasUncompressed = 1;
+ if(!hasUncompressed && isECDHE(c->cipher)){
+ ctx->alert = EIllegalParameter;
+ return -1;
}
+ c->extEcPointFormatsSeen = 1;
+ return 0;
+}
- return makebytes(buf, p - buf);
+/*
+ * signature_algorithms parser, server-side (RFC 5246 Section 7.4.1.4.1,
+ * RFC 9155). Stash the offered SignatureAndHashAlgorithm list on
+ * c->peerSigAlgs so the SKE-sign path can pick a hash the client will
+ * accept. signDHparams hardcodes rsa_pkcs1_sha256; this parser
+ * stores the offered list for the defense-in-depth check below and
+ * for any future sigalg picker.
+ */
+static int
+parseSigalgsServer(TlsConnection *c, ExtCtx *ctx, uchar *in, int inlen)
+{
+ int listlen, n, i, hasRsaSha256;
+
+ if(inlen < 2)
+ return -1;
+ listlen = get16(in);
+ if(listlen < 2 || (listlen & 1) != 0 || listlen + 2 != inlen)
+ return -1;
+ n = listlen / 2;
+ freeints(c->peerSigAlgs);
+ c->peerSigAlgs = newints(n);
+ hasRsaSha256 = 0;
+ for(i = 0; i < n; i++){
+ c->peerSigAlgs->data[i] = get16(in + 2 + 2*i);
+ if(c->peerSigAlgs->data[i] == RSA_PKCS1_SHA256)
+ hasRsaSha256 = 1;
+ }
+ /*
+ * Only ECDHE makes us sign a ServerKeyExchange, and signDHparams
+ * hardcodes rsa_pkcs1_sha256. The suite is already chosen here, so
+ * a client that omits rsa_pkcs1_sha256 costs nothing unless we owe
+ * it a signature. Failing to agree on parameters is
+ * handshake_failure, not decode_error (RFC 5246 Section 7.2.2).
+ */
+ if(!hasRsaSha256 && isECDHE(c->cipher)){
+ ctx->alert = EHandshakeFailure;
+ return -1;
+ }
+ return 0;
}
/*
+ * server_name ack (RFC 6066 Section 3): an empty server_name extension
+ * in ServerHello tells the client the server acted on the presented
+ * name. Receiving the extension is not acting on it, so the entry is
+ * declined unless something consumed c->sni and set c->extSniAck.
+ */
+static int
+buildSniAck(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ USED(ctx); USED(out); USED(outsize);
+ if(!c->extSniAck)
+ return -1; /* skip extension entirely */
+ return 0; /* zero-length payload */
+}
+
+/*
+ * ec_point_formats ack (RFC 4492 Section 5.1.2): the server echoes
+ * uncompressed when an ECDHE suite is selected AND the client offered
+ * the extension. Some older clients refuse the handshake if not
+ * present; this is interop, not just spec compliance.
+ */
+static int
+buildEcPointFormatsAck(TlsConnection *c, ExtCtx *ctx,
+ uchar *out, int outsize)
+{
+ USED(ctx);
+ if(!c->extEcPointFormatsSeen || !isECDHE(c->cipher))
+ return -1;
+ if(outsize < 2)
+ return -1;
+ out[0] = 1; /* list length: one format follows */
+ out[1] = 0; /* pointFormatUncompressed */
+ return 2;
+}
+
+static ExtAlg clientHelloBuilders[] = {
+ { ExtSni, buildSni, nil },
+ { ExtSupportedGroups, buildSupportedGroups, nil },
+ { ExtEcPointFormats, buildEcPointFormats, nil },
+ { ExtSigalgs, buildSigalgs, nil },
+};
+static ExtAlg clientHelloParsers[] = {
+ { ExtSni, nil, parseSniServer },
+ { ExtEcPointFormats, nil, parseEcPointFormatsServer },
+ { ExtSigalgs, nil, parseSigalgsServer },
+};
+static ExtAlg serverHelloBuilders[] = {
+ { ExtSni, buildSniAck, nil },
+ { ExtEcPointFormats, buildEcPointFormatsAck, nil },
+};
+/*
+ * serverHelloParsers is empty in this baseline -- the client side has
+ * no extensions that require state beyond what's already validated by
+ * the framing code in parseExtensionBlock. When a future patch needs
+ * to consume a ServerHello extension (e.g., extended_master_secret,
+ * RFC 7627), it adds an entry here plus the matching parse function.
+ */
+static ExtAlg serverHelloParsers[1]; /* unused; nServerHelloParsers == 0 */
+
+/*
+ * Walk the table; for each entry that wants to be sent emit
+ * (type, length, payload). Returns total bytes written, or -1 on
+ * buffer overflow.
+ */
+static int
+buildExtensionBlock(TlsConnection *c, ExtCtx *ctx, ExtAlg *table,
+ int tableLen, uchar *out, int outsize)
+{
+ uchar *p, *e;
+ int i, n;
+
+ p = out;
+ e = out + outsize;
+ for(i = 0; i < tableLen; i++){
+ if(table[i].build == nil)
+ continue;
+ if(p + 4 > e)
+ return -1;
+ n = (*table[i].build)(c, ctx, p + 4, e - (p + 4));
+ if(n < 0)
+ continue; /* declined */
+ if(n > e - (p + 4))
+ return -1;
+ put16(p, table[i].type);
+ put16(p+2, n);
+ p += 4 + n;
+ /*
+ * RFC 5246 Section 7.4.1.4: the client tracks advertised
+ * types so the ServerHello parser can reject unsolicited
+ * extensions. Dropping a type here would make the server's
+ * legitimate answer look unsolicited, so a full table fails
+ * the build instead. The server side tracks nothing.
+ */
+ if(c != nil && c->isClient){
+ if(c->nClientOffered >= (int)nelem(c->clientOffered))
+ return -1;
+ c->clientOffered[c->nClientOffered++] = table[i].type;
+ }
+ }
+ return p - out;
+}
+
+/*
+ * Walk a received extension block (sequence of type|length|payload
+ * triples). For each known type call its parse(); unknown types are
+ * silently skipped (RFC 5246 Section 7.4.1.4). Returns 0 on success,
+ * -1 on malformed framing (caller should abort).
+ */
+static int
+parseExtensionBlock(TlsConnection *c, ExtCtx *ctx, ExtAlg *table,
+ int tableLen, uchar *in, int inlen)
+{
+ uchar *p, *e;
+ int i, t, nn, nseen;
+ int seen[32]; /* RFC 5246 Section 7.4.1.4: types must be unique */
+
+ p = in;
+ e = in + inlen;
+ nseen = 0;
+ while(p + 4 <= e){
+ t = get16(p);
+ nn = get16(p+2);
+ p += 4;
+ if(p + nn > e)
+ return -1;
+ for(i = 0; i < nseen; i++)
+ if(seen[i] == t)
+ return -1;
+ if(nseen >= (int)nelem(seen))
+ return -1;
+ seen[nseen++] = t;
+ for(i = 0; i < tableLen; i++){
+ if(table[i].type == t && table[i].parse != nil){
+ if((*table[i].parse)(c, ctx, p, nn) < 0)
+ return -1;
+ break;
+ }
+ }
+ p += nn;
+ }
+ if(p != e)
+ return -1;
+ return 0;
+}
+
+static int
+clientHelloBuildExt(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ return buildExtensionBlock(c, ctx, clientHelloBuilders,
+ nelem(clientHelloBuilders), out, outsize);
+}
+
+static int
+clientHelloParseExt(TlsConnection *c, ExtCtx *ctx, uchar *in, int inlen)
+{
+ return parseExtensionBlock(c, ctx, clientHelloParsers,
+ nelem(clientHelloParsers), in, inlen);
+}
+
+static int
+serverHelloBuildExt(TlsConnection *c, ExtCtx *ctx, uchar *out, int outsize)
+{
+ return buildExtensionBlock(c, ctx, serverHelloBuilders,
+ nelem(serverHelloBuilders), out, outsize);
+}
+
+/*
+ * RFC 5246 Section 7.4.1.4: client MUST abort with
+ * unsupported_extension(110) if the server's ServerHello carries any
+ * extension type the client did not advertise. This implementation
+ * tracks advertised types and rejects unsolicited extensions strictly.
+ */
+static int
+serverHelloParseExt(TlsConnection *c, ExtCtx *ctx, uchar *in, int inlen)
+{
+ uchar *p, *e;
+ int i, t, nn, offered;
+
+ p = in;
+ e = in + inlen;
+ while(p + 4 <= e){
+ t = get16(p);
+ nn = get16(p+2);
+ p += 4;
+ if(p + nn > e)
+ return -1;
+ offered = 0;
+ for(i = 0; i < c->nClientOffered; i++)
+ if(c->clientOffered[i] == t){
+ offered = 1;
+ break;
+ }
+ if(!offered){
+ /* the caller sends the alert; a tlsError here
+ * would put a second one on the wire. */
+ if(c->trace)
+ c->trace("unsolicited extension %#x\n", t);
+ ctx->alert = EUnsupportedExtension;
+ return -1;
+ }
+ p += nn;
+ }
+ return parseExtensionBlock(c, ctx, serverHelloParsers,
+ nelem(serverHelloParsers), in, inlen);
+}
+
+/*
* Strict DER-form check on an ECDSA-Sig-Value (RFC 5480 + X9.62):
* SEQUENCE { INTEGER r, INTEGER s }
* Definite short or long-form length, INTEGER tags, no leading zero
@@ -3597,17 +4076,6 @@ newints(int len)
ans = (Ints*)malloc(OFFSET(data[0], Ints) + len*sizeof(int));
ans->len = len;
- return ans;
-}
-
-static Ints*
-makeints(int* buf, int len)
-{
- Ints* ans;
-
- ans = newints(len);
- if(len > 0)
- memmove(ans->data, buf, len*sizeof(int));
return ans;
}
|