From patchwork Sun Oct 25 10:56:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Herbert X-Patchwork-Id: 1387175 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.osmocom.org (client-ip=2a01:4f8:191:444b::2:7; helo=lists.osmocom.org; envelope-from=openbsc-bounces@lists.osmocom.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=pp8bxSF8; dkim-atps=neutral Received: from lists.osmocom.org (lists.osmocom.org [IPv6:2a01:4f8:191:444b::2:7]) by ozlabs.org (Postfix) with ESMTP id 4CJw0z0YWGz9sSs for ; Sun, 25 Oct 2020 21:57:54 +1100 (AEDT) Received: from lists.osmocom.org (lists.osmocom.org [144.76.43.76]) by lists.osmocom.org (Postfix) with ESMTP id 6DC3F19D380; Sun, 25 Oct 2020 10:57:39 +0000 (UTC) Authentication-Results: lists.osmocom.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.osmocom.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=pp8bxSF8 X-Original-To: openbsc@lists.osmocom.org Delivered-To: openbsc@lists.osmocom.org Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::531; helo=mail-pg1-x531.google.com; envelope-from=jeremy.006@gmail.com; receiver= Authentication-Results: lists.osmocom.org; dmarc=pass (p=none dis=none) header.from=gmail.com Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lists.osmocom.org (Postfix) with ESMTP id 9DA0F19D378 for ; Sun, 25 Oct 2020 10:57:36 +0000 (UTC) Received: by mail-pg1-x531.google.com with SMTP id h6so4397291pgk.4 for ; Sun, 25 Oct 2020 03:57:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cxFLDYxJTK127VFZaCs7qI73YSJYBCgnweZxtGVas8c=; b=pp8bxSF86tLT2exKERoWmwfA8IZCCB2r2U+DuPY5KvDmG+ZC7BqPG/nVnFTGlUe20w NBRDJosoEjtXH+S5vaJg4QU88XhpndE46ojp5bhZh4uqe0t4iBQZkDiHF3JyMPLC1aKQ xoRX9sFvzwL+ifl9fJtQYnehLxgf03oQ4aZN7mW12JyeOsiZrIIZO5KIBVVecZd0yMIw 2dOLaK50VM248LiwYlNvlnznU/MJyaBJkVLzsShYpPyKtiL5fxKa+jii+BnzBtaNmnGK jbJ2WIn2zVUXWrSyFX6AY70p+nAnK8+vLdOeZzRnlBeFT/8hgb9nrDikwP514j9Mr725 1XKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cxFLDYxJTK127VFZaCs7qI73YSJYBCgnweZxtGVas8c=; b=S5ifYAGzKIIzq9k1LJ+QeSbMWAk7E89JA+vD6tqnZUsrGFBCOIvZxIK21/pJXidBqf bGpp20OMIF5Mo9SRPSJ4hf4FIcNwDPuA6QKGDewMNTdIBIC7pI6TflaHoGUV8GlXrZN3 zmn/FPXCD19Nonu4L+/p2nr8oAnvEzDFgLstGdDsOZnikHr6/9IxFAXtE460sLffP1oW lTpo0bkjZ/anaZ053GU1LgnVyKZzq/kH2FqEFyu3zIMROSMMbfO5YNftBb/G9Fhaa4l4 K5zKXXp3XEW+sHT9ZS5PTfcw7nzrIaPibwDVBsC09oA9bCVC8FnK9NGMUfujWW3HN5hz YRFQ== X-Gm-Message-State: AOAM532T3JCphRvE7/GX9KK9RLlMvo2Gz8Ohr8QUWkSdzG2j2bbHtx7e JxgWGduZ5fhwsK0Q3bgBnro15JwoaQg= X-Google-Smtp-Source: ABdhPJwisvz6Za2YUSr6vSPHCX4PDaEaIx69p8U/piojPX/D9qvTCoA1pum7A0zVJh8gGNuJ23wzbQ== X-Received: by 2002:a63:3fcd:: with SMTP id m196mr11154184pga.412.1603623455468; Sun, 25 Oct 2020 03:57:35 -0700 (PDT) Received: from localhost.localdomain (60-240-120-73.tpgi.com.au. [60.240.120.73]) by smtp.gmail.com with ESMTPSA id n5sm7547538pgm.82.2020.10.25.03.57.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Oct 2020 03:57:34 -0700 (PDT) From: Jeremy Herbert To: openbsc@lists.osmocom.org Cc: Jeremy Herbert Subject: [PATCH 0/1] pysim: make random seed function python3 compatible Date: Sun, 25 Oct 2020 20:56:04 +1000 Message-Id: <20201025105605.5692-1-jeremy.006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: openbsc@lists.osmocom.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Development of OsmoBTS, OpenBSC, OsmoBSC, OsmoNITB, OsmoMSC, OsmoMGW, OsmoSIPconnector" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbsc-bounces@lists.osmocom.org Sender: "OpenBSC" Currently the random seed function _digits is not python3 compatible as it passes a unicode string to the sha1 function. It generates the following exception: Using PC/SC reader interface Card programming failed with an execption: ---------------------8<--------------------- Traceback (most recent call last): File "./pySim-prog.py", line 718, in rc = process_card(opts, first, card_handler) File "./pySim-prog.py", line 643, in process_card cp = gen_parameters(opts) File "./pySim-prog.py", line 342, in gen_parameters iccid += _digits(opts.secret, 'ccid', ml, opts.num) File "./pySim-prog.py", line 228, in _digits s = hashlib.sha1(secret + usage + '%d' % num) TypeError: Unicode-objects must be encoded before hashing ---------------------8<--------------------- This patch fixes this problem. Jeremy Herbert (1): make random seed function python3 compatible pySim-prog.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)