Subversion Repositories oidinfo_api

Compare Revisions

Regard whitespace Rev 6 → Rev 7

/trunk/oid_illegality_rules
150,6 → 150,7
1.(40+) -- According to Rec. ITU-T X.660 | ISO/IEC 9834-1, "the arcs beneath root arcs 0 and 1 are restricted to forty arcs numbered 0 to 39"
1.0.1 -- International Standard ISO 1:2002 is about "Geometrical Product Specifications (GPS) -- Standard reference temperature for geometrical product specification and verification", hence does not define OIDs
1.0.16 -- International Standard ISO 16:1975 is about "Acoustics -- Standard tuning frequency (Standard musical pitch)", hence does not define OIDs
2.25.(340282366920938463463374607431768211456+) -- UUIDs cannot be greater than 2^128-1
 
-- CATEGORY: Cancelled, withdrawn and rejected OIDs
1.0.29192.2.2.3 -- This OID was allocated to the "Speck" family of block ciphers in ISO/IEC 29192-2 PDAM1 in 2017 but this proposed amendment has been cancelled
/trunk/oidinfo_api.inc.phps
506,16 → 506,21
$bak_oid = $oid;
$oid = self::trySanitizeOID($oid);
if ($oid === false) {
fwrite(STDERR,"Ignored '$bak_oid', because it is not a valid OID\n");
fwrite(STDERR,"<!-- ERROR: Ignored '$bak_oid', because it is not a valid OID -->\n");
return $err;
}
 
if ($params['creation_allowed_check']) {
if (!$this->oidMayCreate($oid, $params['do_online_check'], $params['do_simpleping_check'], $params['do_illegality_check'])) {
fwrite(STDERR,"Creation of $oid disallowed\n");
fwrite(STDERR,"<!-- ERROR: Creation of $oid disallowed -->\n");
return $err;
}
} else {
if ($params['do_illegality_check'] && ($this->illegalOid($oid))) {
fwrite(STDERR,"<!-- ERROR: Creation of $oid disallowed -->\n");
return $err;
}
}
 
$elements['description'] = $this->correctDesc($elements['description'], $params, self::OIDINFO_CORRECT_DESC_DISALLOW_ENDING_DOT, true);
$elements['information'] = $this->correctDesc($elements['information'], $params, self::OIDINFO_CORRECT_DESC_ENFORCE_ENDING_DOT, true);
717,6 → 722,20
$this->illegality_rules[] = $rule;
}
 
private static function bigint_cmp($a, $b) {
if (function_exists('bccomp')) {
return bccomp($a, $b);
}
 
if (function_exists('gmp_cmp')) {
return gmp_cmp($a, $b);
}
 
if ($a > $b) return 1;
if ($a < $b) return -1;
return 0;
}
 
public function illegalOID($oid, &$illegal_root='') {
$bak = $oid;
$oid = self::trySanitizeOID($oid);
754,21 → 773,26
if ($startchar == '!') { // added in ver 2
$vararcs++;
$relem = substr($relem, 1, strlen($relem)-1); // cut away first char
if ($oelem != $relem) $varsfit++;
$cmp = self::bigint_cmp($oelem, $relem) != 0;
if ($cmp) $varsfit++;
} else if ($endchar == '+') {
$vararcs++;
$relem = substr($relem, 0, strlen($relem)-1); // cut away last char
if ($oelem >= $relem) $varsfit++;
$cmp = self::bigint_cmp($oelem, $relem) >= 0;
if ($cmp) $varsfit++;
} else if ($endchar == '-') {
$vararcs++;
$relem = substr($relem, 0, strlen($relem)-1); // cut away last char
if ($oelem <= $relem) $varsfit++;
$cmp = self::bigint_cmp($oelem, $relem) <= 0;
if ($cmp) $varsfit++;
} else if (strpos($relem, '-') !== false) {
$vararcs++;
$limarr = explode('-', $relem);
$limmin = $limarr[0];
$limmax = $limarr[1];
if (($oelem >= $limmin) && ($oelem <= $limmax)) $varsfit++;
$cmp_min = self::bigint_cmp($oelem, $limmin) >= 0;
$cmp_max = self::bigint_cmp($oelem, $limmax) <= 0;
if ($cmp_min && $cmp_max) $varsfit++;
} else {
if ($relem != $oelem) {
$rulefit = false;