xref: /freebsd/crypto/openssl/fuzz/mkfuzzoids.pl (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1#! /usr/bin/env perl
2# Copyright 1995-2021 The OpenSSL Project Authors. All Rights Reserved.
3#
4# Licensed under the Apache License 2.0 (the "License").  You may not use
5# this file except in compliance with the License.  You can obtain a copy
6# in the file LICENSE in the source distribution or at
7# https://www.openssl.org/source/license.html
8use FindBin;
9use lib "$FindBin::Bin/../util/perl";
10use OpenSSL::copyright;
11
12my $obj_dat_h = $ARGV[0];
13my $YEAR = OpenSSL::copyright::latest(($0, $obj_dat_h));
14print <<"EOF";
15# WARNING: do not edit!
16# Generated by fuzz/mkfuzzoids.pl
17#
18# Copyright 2020-$YEAR The OpenSSL Project Authors. All Rights Reserved.
19#
20# Licensed under the Apache License 2.0 (the "License").  You may not use
21# this file except in compliance with the License.  You can obtain a copy
22# in the file LICENSE in the source distribution or at
23# https://www.openssl.org/source/license.html
24EOF
25
26open IN, '<', $obj_dat_h
27    || die "Couldn't open $obj_dat_h : $!\n";
28
29while(<IN>) {
30    s|\R$||;                    # Better chomp
31
32    next unless m|^\s+((0x[0-9A-F][0-9A-F],)*)\s+/\*\s\[\s*\d+\]\s(OBJ_\w+)\s\*/$|;
33
34    my $OID = $1;
35    my $OBJname = $3;
36
37    $OID =~ s|0x|\\x|g;
38    $OID =~ s|,||g;
39
40    print "$OBJname=\"$OID\"\n";
41}
42close IN;
43