| From: Andrew Cagney <[email protected]>
| > Author: D. Hugh Redelmeier <[email protected]>

| >     lib/libswan/asn1.c: eliminate loop from is_printablestring()

| I have to ask.  Could isprint() be used, or is there ASN.1 magic
| involved in the decision of what is printable?

The definition of ASN1_PRINTABLESTRING specifies exactly the set of
characters listed (unless there was a mistake).

Notice that '*' is not one of those characters.  A number of systems
have bugs where they encode wildcards as PRINTABLESTRINGs.  I think
that we'll accept that but won't generate it.

| (yea, there isn't shunk_strspn())

Some parts of x509.c should use shunks.  Not all.

strspn could be implemented fairly efficiently, at least if strings
are long enough to amortize the cost of building a table subscripted
by the character code (like isprint() before wide characters).

We could build our own table, once, at compile time.  We'd need to
re-introduce the loop to use it, but that's OK.  The loop of strchr's
was a bit rude (but probably didn't get used enough to matter).
_______________________________________________
Swan-dev mailing list
[email protected]
https://lists.libreswan.org/mailman/listinfo/swan-dev

Reply via email to