uplink-common.pl 1.1 KB

12345678910111213141516171819202122232425262728
  1. #! /usr/bin/env perl
  2. # Copyright 2008-2016 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
  8. # pull APPLINK_MAX value from applink.c...
  9. $applink_c=$0;
  10. $applink_c=~s|[^/\\]+$||g;
  11. $applink_c.="applink.c";
  12. open(INPUT,$applink_c) || die "can't open $applink_c: $!";
  13. @max=grep {/APPLINK_MAX\s+(\d+)/} <INPUT>;
  14. close(INPUT);
  15. ($#max==0) or die "can't find APPLINK_MAX in $applink_c";
  16. $max[0]=~/APPLINK_MAX\s+(\d+)/;
  17. $N=$1; # number of entries in OPENSSL_UplinkTable not including
  18. # OPENSSL_UplinkTable[0], which contains this value...
  19. 1;
  20. # Idea is to fill the OPENSSL_UplinkTable with pointers to stubs
  21. # which invoke 'void OPENSSL_Uplink (ULONG_PTR *table,int index)';
  22. # and then dereference themselves. Latter shall result in endless
  23. # loop *unless* OPENSSL_Uplink does not replace 'table[index]' with
  24. # something else, e.g. as 'table[index]=unimplemented;'...