2016-04-20 10:10:43 +08:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
# this file except in compliance with the License. You can obtain a copy
|
|
|
|
# in the file LICENSE in the source distribution or at
|
|
|
|
# https://www.openssl.org/source/license.html
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
$NUMBER=0x01;
|
|
|
|
$UPPER=0x02;
|
|
|
|
$LOWER=0x04;
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
$UNDER=0x100;
|
|
|
|
$PUNCTUATION=0x200;
|
1998-12-21 18:52:47 +08:00
|
|
|
$WS=0x10;
|
|
|
|
$ESC=0x20;
|
|
|
|
$QUOTE=0x40;
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
$DQUOTE=0x400;
|
1998-12-21 18:52:47 +08:00
|
|
|
$COMMENT=0x80;
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
$FCOMMENT=0x800;
|
|
|
|
$EOF=0x08;
|
2002-01-02 19:06:02 +08:00
|
|
|
$HIGHBIT=0x1000;
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2002-01-02 19:06:02 +08:00
|
|
|
foreach (0 .. 255)
|
1998-12-21 18:52:47 +08:00
|
|
|
{
|
|
|
|
$v=0;
|
|
|
|
$c=sprintf("%c",$_);
|
|
|
|
$v|=$NUMBER if ($c =~ /[0-9]/);
|
|
|
|
$v|=$UPPER if ($c =~ /[A-Z]/);
|
|
|
|
$v|=$LOWER if ($c =~ /[a-z]/);
|
|
|
|
$v|=$UNDER if ($c =~ /_/);
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
$v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
|
|
|
|
$v|=$WS if ($c =~ /[ \t\r\n]/);
|
1998-12-21 18:52:47 +08:00
|
|
|
$v|=$ESC if ($c =~ /\\/);
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
$v|=$QUOTE if ($c =~ /['`"]/); # for emacs: "`'}/)
|
1998-12-21 18:52:47 +08:00
|
|
|
$v|=$COMMENT if ($c =~ /\#/);
|
|
|
|
$v|=$EOF if ($c =~ /\0/);
|
2002-01-02 19:06:02 +08:00
|
|
|
$v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
|
1998-12-21 18:52:47 +08:00
|
|
|
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
push(@V_def,$v);
|
|
|
|
}
|
|
|
|
|
2002-01-02 19:06:02 +08:00
|
|
|
foreach (0 .. 255)
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
{
|
|
|
|
$v=0;
|
|
|
|
$c=sprintf("%c",$_);
|
|
|
|
$v|=$NUMBER if ($c =~ /[0-9]/);
|
|
|
|
$v|=$UPPER if ($c =~ /[A-Z]/);
|
|
|
|
$v|=$LOWER if ($c =~ /[a-z]/);
|
|
|
|
$v|=$UNDER if ($c =~ /_/);
|
|
|
|
$v|=$PUNCTUATION if ($c =~ /[!\.%&\*\+,\/;\?\@\^\~\|-]/);
|
|
|
|
$v|=$WS if ($c =~ /[ \t\r\n]/);
|
|
|
|
$v|=$DQUOTE if ($c =~ /["]/); # for emacs: "}/)
|
|
|
|
$v|=$FCOMMENT if ($c =~ /;/);
|
|
|
|
$v|=$EOF if ($c =~ /\0/);
|
2002-01-02 19:06:02 +08:00
|
|
|
$v|=$HIGHBIT if ($c =~/[\x80-\xff]/);
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
|
|
|
|
push(@V_w32,$v);
|
1998-12-21 18:52:47 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
print <<"EOF";
|
2016-03-18 02:16:09 +08:00
|
|
|
/*
|
2016-04-20 10:10:43 +08:00
|
|
|
* WARNING: do not edit!
|
|
|
|
* Generated by crypto/conf/keysets.pl
|
|
|
|
*
|
|
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
2016-03-18 02:16:09 +08:00
|
|
|
*/
|
|
|
|
|
2016-03-21 22:49:11 +08:00
|
|
|
#define CONF_NUMBER $NUMBER
|
|
|
|
#define CONF_UPPER $UPPER
|
|
|
|
#define CONF_LOWER $LOWER
|
|
|
|
#define CONF_UNDER $UNDER
|
|
|
|
#define CONF_PUNCTUATION $PUNCTUATION
|
|
|
|
#define CONF_WS $WS
|
|
|
|
#define CONF_ESC $ESC
|
|
|
|
#define CONF_QUOTE $QUOTE
|
|
|
|
#define CONF_DQUOTE $DQUOTE
|
|
|
|
#define CONF_COMMENT $COMMENT
|
|
|
|
#define CONF_FCOMMENT $FCOMMENT
|
|
|
|
#define CONF_EOF $EOF
|
|
|
|
#define CONF_HIGHBIT $HIGHBIT
|
2016-03-18 02:16:09 +08:00
|
|
|
#define CONF_ALPHA (CONF_UPPER|CONF_LOWER)
|
|
|
|
#define CONF_ALPHA_NUMERIC (CONF_ALPHA|CONF_NUMBER|CONF_UNDER)
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
#define CONF_ALPHA_NUMERIC_PUNCT (CONF_ALPHA|CONF_NUMBER|CONF_UNDER| \\
|
2016-03-18 02:16:09 +08:00
|
|
|
CONF_PUNCTUATION)
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
|
2016-03-18 02:16:09 +08:00
|
|
|
#define KEYTYPES(c) ((const unsigned short *)((c)->meth_data))
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
#ifndef CHARSET_EBCDIC
|
2016-03-18 02:16:09 +08:00
|
|
|
# define IS_COMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_COMMENT)
|
|
|
|
# define IS_FCOMMENT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_FCOMMENT)
|
|
|
|
# define IS_EOF(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_EOF)
|
|
|
|
# define IS_ESC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ESC)
|
|
|
|
# define IS_NUMBER(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_NUMBER)
|
|
|
|
# define IS_WS(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_WS)
|
|
|
|
# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC)
|
|
|
|
# define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
|
|
|
|
(KEYTYPES(c)[(a)&0xff]&CONF_ALPHA_NUMERIC_PUNCT)
|
|
|
|
# define IS_QUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_QUOTE)
|
|
|
|
# define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE)
|
|
|
|
# define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT)
|
|
|
|
|
|
|
|
#else /* CHARSET_EBCDIC */
|
|
|
|
|
2016-05-01 21:08:34 +08:00
|
|
|
# define IS_COMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_COMMENT)
|
|
|
|
# define IS_FCOMMENT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_FCOMMENT)
|
|
|
|
# define IS_EOF(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_EOF)
|
|
|
|
# define IS_ESC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ESC)
|
|
|
|
# define IS_NUMBER(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_NUMBER)
|
|
|
|
# define IS_WS(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_WS)
|
|
|
|
# define IS_ALPHA_NUMERIC(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC)
|
2016-03-18 02:16:09 +08:00
|
|
|
# define IS_ALPHA_NUMERIC_PUNCT(c,a) \\
|
2016-05-01 21:08:34 +08:00
|
|
|
(KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_ALPHA_NUMERIC_PUNCT)
|
|
|
|
# define IS_QUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_QUOTE)
|
|
|
|
# define IS_DQUOTE(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_DQUOTE)
|
|
|
|
# define IS_HIGHBIT(c,a) (KEYTYPES(c)[os_toascii[a & 0xff]]&CONF_HIGHBIT)
|
2016-03-18 02:16:09 +08:00
|
|
|
#endif /* CHARSET_EBCDIC */
|
1998-12-21 18:52:47 +08:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2016-03-18 02:16:09 +08:00
|
|
|
print "static const unsigned short CONF_type_default[256] = {";
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
|
2002-01-02 19:06:02 +08:00
|
|
|
for ($i=0; $i<256; $i++)
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
{
|
2016-03-18 02:16:09 +08:00
|
|
|
print "\n " if ($i % 8) == 0;
|
|
|
|
printf " 0x%04X,",$V_def[$i];
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
}
|
|
|
|
|
2016-03-18 02:16:09 +08:00
|
|
|
print "\n};\n\n";
|
I've always wanted to make the CONF library more adaptable. Here's
the result.
I have retained the old behavior of the CONF_* functions, and have
added a more "object oriented" interface through NCONF_* functions
(New CONF, you see :-)), working the same way as, for example, the
BIO interface. Really, the CONF_* are rewritten so they use the
NCONF_* functions internally.
In addition to that, I've split the old conf.c code into two files,
conf_def.c and conf_api.c. conf_def.c contains the default config
object that reads a configuration file the standard OpenSSL way, as
well as configuration file with Win32 registry file syntax (I'm not
sure I got that one right). conf_api.c provides an API to build other
configuration file readers around (can you see a configuraion file in
XML? I can :-)).
Finally, I've changed the name conf_lcl.h to conf_def.h, since it's
made specifically for that "class" and none others.
2000-04-09 20:04:35 +08:00
|
|
|
|
2016-03-18 02:16:09 +08:00
|
|
|
print "static const unsigned short CONF_type_win32[256] = {";
|
1998-12-21 18:52:47 +08:00
|
|
|
|
2002-01-02 19:06:02 +08:00
|
|
|
for ($i=0; $i<256; $i++)
|
1998-12-21 18:52:47 +08:00
|
|
|
{
|
2016-03-18 02:16:09 +08:00
|
|
|
print "\n " if ($i % 8) == 0;
|
|
|
|
printf " 0x%04X,",$V_w32[$i];
|
1998-12-21 18:52:47 +08:00
|
|
|
}
|
|
|
|
|
2016-03-18 02:16:09 +08:00
|
|
|
print "\n};\n";
|