xref: /minix3/crypto/external/bsd/openssl/dist/ms/uplink-common.pl (revision ebfedea0ce5bbe81e252ddf32d732e40fb633fae)
1*ebfedea0SLionel Sambuc#!/usr/bin/env perl
2*ebfedea0SLionel Sambuc#
3*ebfedea0SLionel Sambuc# pull APPLINK_MAX value from applink.c...
4*ebfedea0SLionel Sambuc$applink_c=$0;
5*ebfedea0SLionel Sambuc$applink_c=~s|[^/\\]+$||g;
6*ebfedea0SLionel Sambuc$applink_c.="applink.c";
7*ebfedea0SLionel Sambucopen(INPUT,$applink_c) || die "can't open $applink_c: $!";
8*ebfedea0SLionel Sambuc@max=grep {/APPLINK_MAX\s+(\d+)/} <INPUT>;
9*ebfedea0SLionel Sambucclose(INPUT);
10*ebfedea0SLionel Sambuc($#max==0) or die "can't find APPLINK_MAX in $applink_c";
11*ebfedea0SLionel Sambuc
12*ebfedea0SLionel Sambuc$max[0]=~/APPLINK_MAX\s+(\d+)/;
13*ebfedea0SLionel Sambuc$N=$1;	# number of entries in OPENSSL_UplinkTable not including
14*ebfedea0SLionel Sambuc	# OPENSSL_UplinkTable[0], which contains this value...
15*ebfedea0SLionel Sambuc
16*ebfedea0SLionel Sambuc1;
17*ebfedea0SLionel Sambuc
18*ebfedea0SLionel Sambuc# Idea is to fill the OPENSSL_UplinkTable with pointers to stubs
19*ebfedea0SLionel Sambuc# which invoke 'void OPENSSL_Uplink (ULONG_PTR *table,int index)';
20*ebfedea0SLionel Sambuc# and then dereference themselves. Latter shall result in endless
21*ebfedea0SLionel Sambuc# loop *unless* OPENSSL_Uplink does not replace 'table[index]' with
22*ebfedea0SLionel Sambuc# something else, e.g. as 'table[index]=unimplemented;'...
23