AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-544947

AwesomeJackify's questions

Martin Hope
AwesomeJackify
Asked: 2022-12-12 17:34:49 +0800 CST

在 ARM 设备上运行 NTPv4(交叉编译)时出现重定位错误

  • 4

在我的 ARM 设备上运行 ntp-keygen(或 ntpd)时收到的错误消息是:

./ntp-keygen: relocation error: ./ntp-keygen: symbol DSA_generate_parameters_ex, version OPENSSL_1_1_0 not defined in file libcrypto.so.1.1 with link time reference

配置、构建和安装 OpenSSL 的脚本如下:

#!/bin/bash



# Build dependencies if any.

depends()

{

   cd $buildDir



   if [ "x${PERL}" = "x" ]; then

      export PERL=`which perl`

   fi



   return $?

}



# Configure software package.

configure()

{

   depends

   cd $packageDir

   

   # Available ciphers:

   #    DES, AES, CAMELLIA, MD2, MDC2, MD4, MD5, HMAC, SHA, RIPEMD, WHIRLPOOL,

   #    RC4, RC5, RC2, IDEA, SEED, BF(blowfish), CAST, RSA, DSA, ECDSA, ECDH

   # We use:

   #    DES, AES, MD4, MD5, HMAC, SHA, RSA, ECDSA, ECDH

   ./Configure shared threads --prefix=$PWD/install-arm linux-armv4



   return $?

}



# Build the software package.

compile()

{ 

   local mmx_machine_type=`echo $MMX_MACHINE_TYPE | tr '[:upper:]' '[:lower:]'`



   depends

   cd $packageDir



   export CFLAGS="$CFLAGS -DCONFIG_MACHINE_${MMX_MACHINE_TYPE}"

   configure

   if [ "$?" -ne "0" ]; then return 1; fi



   make CC=$CC AR=$AR NM=$NM RANLIB=$RANLIB

   if [ "$?" -ne "0" ]; then return 1; fi

  

   make CC=$CC AR=$AR NM=$NM RANLIB=$RANLIB install

   if [ "$?" -ne "0" ]; then return 1; fi

  

   return 0

}



# Clean-up.

clean()

{

   depends

   cd $packageDir

  

   rm -rf install-arm/*

   rm -rf install-i386/*

   make clean

}



# Install to rootfs the necessary pieces (e.g. directories, links...)

install()

{

   targetPath=${buildDir}/.tmp.rootfs/rootfs

   

   local openssl="bin/openssl"

   local libssl="lib/libssl.so.1.1"

   local libcrypto="lib/libcrypto.so.1.1"



   cd ${packageDir}/install-arm



   if [ -f ${openssl} -a -f ${libssl} -a -f ${libcrypto} ]

   then

      cp ${openssl}   ${targetPath}/sbin/

      cp ${libssl}    ${targetPath}/lib/

      cp ${libcrypto} ${targetPath}/lib/

   else

      printf "  $package not built.\n"

   fi



   return 0

}

对于 ntp 包,对 OpenSSL 的唯一引用是在配置选项中。下面是完整的 ntp 包配置:

#!/bin/sh



# Configure software package.

configure()

{

  cd $packageDir



  ./bootstrap

  ./configure --host=arm-linux --with-yielding-select=yes  --with-crypto=openssl \

    --with-openssl-incdir=$OPENSSL_DIR/install-arm/include/ \

        --with-openssl-libdir=$OPENSSL_DIR/install-arm/lib/ \



  return $?

}



# Build the software package.

compile()

{ 

  cd $packageDir



  # make PROJECT_NAME=$project

  make

  if [ "$?" -ne "0" ]; then return 1; fi

  

  return 0

}



# Clean-up.

clean()

{

  cd $packageDir

  make clean

}



# Install to rootfs the necessary pieces (e.g. directories, links...)

install()

{

  cd $packageDir



  sourcePath=.

  targetPath=$buildDir/.tmp.rootfs/rootfs



  if [[ -f $sourcePath/ntpclient ]]; then

     cp $sourcePath/$package $targetPath/sbin/

  else

     printf "  $package not built.\n"

     return 1

  fi



  return 0

}
ntp
  • 1 个回答
  • 49 Views
Martin Hope
AwesomeJackify
Asked: 2022-12-09 20:12:49 +0800 CST

使用 OpenSSL 为 ARM 编译 NTPv4 时出错

  • 6

错误与“ntp_crypto.c:2248:2: error: unknown type name 'DSA_SIG'; did you mean 'ECDSA_SIG'?”

make 失败,输出如下:

tp_crypto.c: In function 'crypto_alice':

ntp_crypto.c:2188:13: warning: implicit declaration of function 'EVP_PKEY_get0_DSA'; did you mean 'EVP_PKEY_get0_RSA'? [-Wimplicit-function-declaration]

  if ((dsa = EVP_PKEY_get0_DSA(peer->ident_pkey->pkey)) == NULL) {

             ^~~~~~~~~~~~~~~~~

             EVP_PKEY_get0_RSA

ntp_crypto.c:2188:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((dsa = EVP_PKEY_get0_DSA(peer->ident_pkey->pkey)) == NULL) {

           ^

ntp_crypto.c:2199:2: warning: implicit declaration of function 'DSA_get0_pqg'; did you mean 'DH_get0_pqg'? [-Wimplicit-function-declaration]

  DSA_get0_pqg(dsa, NULL, &q, NULL);

  ^~~~~~~~~~~~

  DH_get0_pqg

ntp_crypto.c: In function 'crypto_bob':

ntp_crypto.c:2248:2: error: unknown type name 'DSA_SIG'; did you mean 'ECDSA_SIG'?

  DSA_SIG *sdsa;  /* DSA signature context fake */

  ^~~~~~~

  ECDSA_SIG

ntp_crypto.c:2266:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  dsa = EVP_PKEY_get0_DSA(iffkey_info->pkey);

      ^

ntp_crypto.c:2268:2: warning: implicit declaration of function 'DSA_get0_key'; did you mean 'RSA_get0_key'? [-Wimplicit-function-declaration]

  DSA_get0_key(dsa, NULL, &priv_key);

  ^~~~~~~~~~~~

  RSA_get0_key

ntp_crypto.c:2287:9: warning: implicit declaration of function 'DSA_SIG_new'; did you mean 'ECDSA_SIG_new'? [-Wimplicit-function-declaration]

  sdsa = DSA_SIG_new();

         ^~~~~~~~~~~

         ECDSA_SIG_new

ntp_crypto.c:2287:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  sdsa = DSA_SIG_new();

       ^

ntp_crypto.c:2294:2: warning: implicit declaration of function 'DSA_SIG_set0'; did you mean 'ECDSA_SIG_set0'? [-Wimplicit-function-declaration]

  DSA_SIG_set0(sdsa, bn, bk);

  ^~~~~~~~~~~~

  ECDSA_SIG_set0

ntp_crypto.c:2299:3: warning: implicit declaration of function 'DSA_print_fp'; did you mean 'RSA_print_fp'? [-Wimplicit-function-declaration]

   DSA_print_fp(stdout, dsa, 0);

   ^~~~~~~~~~~~

   RSA_print_fp

ntp_crypto.c:2306:8: warning: implicit declaration of function 'i2d_DSA_SIG'; did you mean 'i2d_ECDSA_SIG'? [-Wimplicit-function-declaration]

  len = i2d_DSA_SIG(sdsa, NULL);

        ^~~~~~~~~~~

        i2d_ECDSA_SIG

ntp_crypto.c:2310:3: warning: implicit declaration of function 'DSA_SIG_free'; did you mean 'ECDSA_SIG_free'? [-Wimplicit-function-declaration]

   DSA_SIG_free(sdsa);

   ^~~~~~~~~~~~

   ECDSA_SIG_free

ntp_crypto.c: In function 'crypto_iff':

ntp_crypto.c:2363:2: error: unknown type name 'DSA_SIG'; did you mean 'ECDSA_SIG'?

  DSA_SIG *sdsa;  /* DSA parameters */

  ^~~~~~~

  ECDSA_SIG

ntp_crypto.c:2385:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((dsa = EVP_PKEY_get0_DSA(peer->ident_pkey->pkey)) == NULL) {

           ^

ntp_crypto.c:2400:14: warning: implicit declaration of function 'd2i_DSA_SIG'; did you mean 'd2i_ECDSA_SIG'? [-Wimplicit-function-declaration]

  if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) {

              ^~~~~~~~~~~

              d2i_ECDSA_SIG

ntp_crypto.c:2400:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) {

            ^

ntp_crypto.c:2412:2: warning: implicit declaration of function 'DSA_SIG_get0'; did you mean 'ECDSA_SIG_get0'? [-Wimplicit-function-declaration]

  DSA_SIG_get0(sdsa, &r, &s);

  ^~~~~~~~~~~~

  ECDSA_SIG_get0

ntp_crypto.c: In function 'crypto_bob2':

ntp_crypto.c:2578:2: error: unknown type name 'DSA_SIG'; did you mean 'ECDSA_SIG'?

  DSA_SIG *sdsa;  /* DSA parameters */

  ^~~~~~~

  ECDSA_SIG

ntp_crypto.c:2616:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  sdsa = DSA_SIG_new();

       ^

ntp_crypto.c: In function 'crypto_gq':

ntp_crypto.c:2686:2: error: unknown type name 'DSA_SIG'; did you mean 'ECDSA_SIG'?

  DSA_SIG *sdsa;  /* RSA signature context fake */

  ^~~~~~~

  ECDSA_SIG

ntp_crypto.c:2726:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((sdsa = d2i_DSA_SIG(NULL, &ptr, len)) == NULL) {

            ^

ntp_crypto.c: In function 'crypto_alice3':

ntp_crypto.c:2862:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((dsa = EVP_PKEY_get0_DSA(peer->ident_pkey->pkey)) == NULL) {

           ^

ntp_crypto.c: In function 'crypto_bob3':

ntp_crypto.c:2940:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  dsa = EVP_PKEY_get0_DSA(mvkey_info->pkey);

      ^

ntp_crypto.c:2962:9: warning: implicit declaration of function 'DSA_new'; did you mean 'RSA_new'? [-Wimplicit-function-declaration]

  sdsa = DSA_new();

         ^~~~~~~

         RSA_new

ntp_crypto.c:2962:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  sdsa = DSA_new();

       ^

ntp_crypto.c:2975:2: warning: implicit declaration of function 'DSA_set0_key'; did you mean 'RSA_set0_key'? [-Wimplicit-function-declaration]

  DSA_set0_key(sdsa, BN_dup(pub_key), NULL);

  ^~~~~~~~~~~~

  RSA_set0_key

ntp_crypto.c:2976:2: warning: implicit declaration of function 'DSA_set0_pqg'; did you mean 'DH_set0_pqg'? [-Wimplicit-function-declaration]

  DSA_set0_pqg(sdsa, sp, sq, sg);

  ^~~~~~~~~~~~

  DH_set0_pqg

ntp_crypto.c:2991:8: warning: implicit declaration of function 'i2d_DSAparams'; did you mean 'i2d_DHxparams'? [-Wimplicit-function-declaration]

  len = i2d_DSAparams(sdsa, NULL);

        ^~~~~~~~~~~~~

        i2d_DHxparams

ntp_crypto.c:2995:3: warning: implicit declaration of function 'DSA_free'; did you mean 'RSA_free'? [-Wimplicit-function-declaration]

   DSA_free(sdsa);

   ^~~~~~~~

   RSA_free

ntp_crypto.c: In function 'crypto_mv':

ntp_crypto.c:3060:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((dsa = EVP_PKEY_get0_DSA(peer->ident_pkey->pkey)) == NULL) {

           ^

ntp_crypto.c:3077:14: warning: implicit declaration of function 'd2i_DSAparams'; did you mean 'd2i_DHxparams'? [-Wimplicit-function-declaration]

  if ((sdsa = d2i_DSAparams(NULL, &ptr, len)) == NULL) {

              ^~~~~~~~~~~~~

              d2i_DHxparams

ntp_crypto.c:3077:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]

  if ((sdsa = d2i_DSAparams(NULL, &ptr, len)) == NULL) {

这些是 ntp_crypto.c 的标头:

/*
 * ntp_crypto.c - NTP version 4 public key routines
 */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#ifdef AUTOKEY
#include <stdio.h>
#include <stdlib.h> /* strtoul */
#include <sys/types.h>
#include <sys/param.h>
#include <unistd.h>
#include <fcntl.h>

#include "ntpd.h"
#include "ntp_stdlib.h"
#include "ntp_unixtime.h"
#include "ntp_string.h"
#include "ntp_random.h"
#include "ntp_assert.h"
#include "ntp_calendar.h"
#include "ntp_leapsec.h"
#include <openssl/dsa.h>

#include "openssl/asn1.h"
#include "openssl/bn.h"
#include "openssl/crypto.h"
#include "openssl/err.h"
#include "openssl/evp.h"
#include "openssl/opensslv.h"
#include "openssl/pem.h"
#include "openssl/rand.h"
#include "openssl/x509.h"
#include "openssl/x509v3.h"
#include "libssl_compat.h"

#ifdef KERNEL_PLL
#include "ntp_syscall.h"
#endif /* KERNEL_PLL */


我正在使用 OpenSSL v1.1.1

这是 ./configure 选项:

#!/bin/sh



# Configure software package.

configure()

{

  cd $packageDir



  ./bootstrap

  ./configure --host=arm-linux --with-yielding-select=yes  --with-crypto=openssl --enable-linuxcaps \

        --with-openssl-incdir=$OPENSSL_DIR/install-arm/include/ \

        --with-openssl-libdir=$OPENSSL_DIR/install-arm/lib/ \



  return $?

}

ntp
  • 1 个回答
  • 23 Views
Martin Hope
AwesomeJackify
Asked: 2022-12-08 19:14:18 +0800 CST

缺少编译 NTP 的功能与安装已构建的功能

  • 5

我发现如果我自己编译 NTP,包 ntp-keygen 缺少自动密钥验证功能。

我编译的ntp的帮助界面如下: 在此处输入图像描述

而如果我只是 apt-get install ntp,ntp-keygen 帮助看起来像这样: 在此处输入图像描述

根据文档,这些功能应该默认启用。当我检查 ./configure --help 时确认了这一点: 在此处输入图像描述

*+号表示默认启用

ntp
  • 1 个回答
  • 38 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve