Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1430167iog; Thu, 16 Jun 2022 06:17:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sz9UbYYXSLZwIeePWiWYJweRDjOsU3XqIawk4Ptd2V8pdR90VN9dIWA8rR7oI3hzgCkO6R X-Received: by 2002:a65:6887:0:b0:3fc:a5ef:3701 with SMTP id e7-20020a656887000000b003fca5ef3701mr4461646pgt.10.1655385460821; Thu, 16 Jun 2022 06:17:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1655385460; cv=pass; d=google.com; s=arc-20160816; b=jprCgALoFQSyMY7m+6SWX1BTXr0TJQfFgw5PpIjzCB/TuEIc72gCQaUpy8BoARoxok XPnpvFNQC4d9eSHchGgNNyNP/JEWmA88k+3y9AZfluD8IujQ+cQhvMVAK/EJLKA0b7wf oJ/EJleBVI/tLWD+CUwOmX4sYmGs6vgEnaCtUCoZTbDL4kM8eeNHCa5BWcG7EKqFesLo ljN0qB5RST1tTMugEcpFmLbu9Ci6MlOhKNhPJdiUo1iktVfPKGec8SgqdORlpf0/hEHM 4eylr1QXNzoIPpgbSRns/prFYm6Ggzdc0r/r9Akf1z6gEXjgp47J7GPEyY2vWAAcSnV1 n9Iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:dkim-signature:mime-version :content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:date:message-id; bh=j8dxx98kvbQ+XCxejUt0hj1klHQuupHMJ5US9lDZY90=; b=0cSR8MR/fkwiM8iegyz1UIIWXrxPZIxSTShBpWJY6N8G5xhCKTuOvO4UhsfIMojEMI Z3Y3g9UMdChp33f1jzKw2tP88ACI1rZOEe0xut3vYYE4djd8CVmC9sylflFqqMvv0DRZ qDkKfmxhDMVjUEfZQX7V39TPSzz5s8tphY0zg5Bvk4JPEt/MlOnIls/nlX3Dz8h6BPuU xxjPKqB7qh+5vEEznoM+QD1ZrCgNT9uSKtpn/PTlz26jfxDfFXAUpfWClBrkNDoL7uXl aNVbGxIjnQ5Ou2YuUezFLhDF4n3O8stUtuYhy77ZUwP0FjPUrb5xHuJY5joW5v/OLjsA xJjw== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=lTA6sD6n; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dkim=pass dkdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensynergy.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj9-20020a17090b4d8900b001e82e1ec1adsi6680006pjb.3.2022.06.16.06.17.28; Thu, 16 Jun 2022 06:17:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@opensynergy.com header.s=TM-DKIM-20210503141657 header.b=lTA6sD6n; arc=pass (i=1 spf=pass spfdomain=opensynergy.com dkim=pass dkdomain=opensynergy.com dmarc=pass fromdomain=opensynergy.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=opensynergy.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376928AbiFPNOU (ORCPT + 99 others); Thu, 16 Jun 2022 09:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376981AbiFPNON (ORCPT ); Thu, 16 Jun 2022 09:14:13 -0400 X-Greylist: delayed 62 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 16 Jun 2022 06:14:10 PDT Received: from refb02.tmes.trendmicro.eu (refb02.tmes.trendmicro.eu [18.185.115.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA21433A38 for ; Thu, 16 Jun 2022 06:14:10 -0700 (PDT) Received: from 104.47.14.59_.trendmicro.com (unknown [172.21.19.34]) by refb02.tmes.trendmicro.eu (Postfix) with ESMTPS id 6457E102FBE32 for ; Thu, 16 Jun 2022 13:13:09 +0000 (UTC) Received: from 104.47.14.59_.trendmicro.com (unknown [172.21.196.58]) by repost01.tmes.trendmicro.eu (Postfix) with SMTP id 5B54A10000C5A; Thu, 16 Jun 2022 13:13:07 +0000 (UTC) X-TM-MAIL-RECEIVED-TIME: 1655385186.217000 X-TM-MAIL-UUID: 1ea404bf-4bda-4b7a-8368-1a4c928dc36b Received: from EUR04-VI1-obe.outbound.protection.outlook.com (unknown [104.47.14.59]) by repre01.tmes.trendmicro.eu (Trend Micro Email Security) with ESMTPS id 354AE100010A0; Thu, 16 Jun 2022 13:13:06 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NEsjoNqbtDJz/hez477bI9sKIZyVLDccs0Sx0A8EinkTkC8zXEGUTOfLzcBcvIL5Xj6KT9waMQIacxOKTil7AXOdDHYNE4QQ6TJiBG5bN7EIKNEXB40D+Z3wz46JHdifk//CbaoRAtdvGY58JaL/DYOVJZ7l9Sk8lBmWCG2MIK+P5w5hcaSf+jw5OEw9oDgeMI8eZmHoVBTsKFr+iZsdVb/QtXtJX7xZHty8NzBYA8GPvOH+CnDzrTs6dhZvf8aIrt0OJD/f02tk3a1/yFz9p8b7Fba/cih7vcJcjZBf1fr6TY4T5gxx6WNtWbIhia4Wjesiy5rW/nMSm21GtkfhdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=j8dxx98kvbQ+XCxejUt0hj1klHQuupHMJ5US9lDZY90=; b=dl0yp9Fh5rr+94kLA14zNvgfRuV9gi5ej/m2tfj6oPIEr0E0+o5N6Ll+Pgx/hUYJmG06knG+1GWUXhXS3CYYOvjAnbcg/AXLPfJl/d1rzZFoZOKqoiPxInI6ywNjRNAW7NZOwLqs9O+JRjQ7yDPeD7SR6tG/HaGcB4pQpKTkxBM+F76lqeLE32HDV0AMwiumLl/KE43kCyk37mOEuqMPBqb9nOckOjN0y2yjLVOnrj7i/fkqUHwtkiqomGPefsEdGYeUBrP/1CGYPn57sj8ajbQtSUanOCbFrg5RKodDTuZGjJoYuWB6UGWoLuvDK/qZAUQ54FQ0qDkPSD70el686Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=opensynergy.com; dmarc=pass action=none header.from=opensynergy.com; dkim=pass header.d=opensynergy.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=opensynergy.com; Message-ID: Date: Thu, 16 Jun 2022 15:13:02 +0200 Subject: Re: [PATCH v2 4/4] tools rpmb: add RPBM access tool Content-Language: en-US To: =?UTF-8?Q?Alex_Benn=c3=a9e?= , linux-kernel@vger.kernel.org Cc: maxim.uvarov@linaro.org, joakim.bech@linaro.org, ulf.hansson@linaro.org, ilias.apalodimas@linaro.org, arnd@linaro.org, ruchika.gupta@linaro.org, tomas.winkler@intel.com, yang.huang@intel.com, bing.zhu@intel.com, Matti.Moell@opensynergy.com, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, Alexander Usyskin References: <20220405093759.1126835-1-alex.bennee@linaro.org> <20220405093759.1126835-5-alex.bennee@linaro.org> From: Harald Mommer In-Reply-To: <20220405093759.1126835-5-alex.bennee@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AS8PR04CA0044.eurprd04.prod.outlook.com (2603:10a6:20b:312::19) To DB9PR04MB9627.eurprd04.prod.outlook.com (2603:10a6:10:30a::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 172b03f7-0553-4cdb-aa7c-08da4f99f2d2 X-MS-TrafficTypeDiagnostic: DU2PR04MB8759:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uCv+zWfgtnv9sbPbrIlBLCu3avT0Qn6su63reDMooE83vY/Zl7nGk7VuQ1yXfKVLSyDu27Q5XrRLEsEVmy+sHWVbD2lxotFfSywc+ucNO5t1FGXLDcINr+uxExQH3Wizeq43r3ORDocGfIQJoRGHKHimvN6RGyIi72npJjEPgYynAbHrWLVcNPZCJjY0BcyPsDho8Wadh+OiTIPnHN7IW1m5sphYLRcRFObPP8bvRlqJUy3mkKVoF103NNuvKuVQ0q0fsg/X0qYPvucDtI91L1+GDk7F68bSR9tha8HI4aGm6W59UHkwm2DWIWNRRmPsi3JEx9wdj9oGjacmGNqSddrgpi/rYAqVwpvnO/gF/aWldd5uU7wtRRzxu+SDKNTs6mX2DE0kUsg/yrp4h00zxOLCxAGvEzZHaVQcwIn8BW6V0FnHANc0jcKVOBFyDcL5zrtojslMJqoHaa+swRhen10C1cNx9L84nhRv/vibaiYzizXsPFm/0KF6vtCS5njDeuxgMmNF3hn8/Ka4DmPfpXmhqI60I7++GEyinPwhNJxfKfZwLz27h7cUQQPmbdW4tNCjmWNsy9uKX8SyVnC4ldhoTNj4W8sXGWClKVVmZeBfm8KEqef4Tw0064VGIW+zTZfZGlPYY5LDrLQQO2vTMlKfCddmjH8jHfIFVwnbLcMjsNEc0wSao63n5mIZD/Nmlm4FDz+U4UDuLteTC5AyhCZA50exo6n5azUqmgPBPVQ= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB9PR04MB9627.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(366004)(2906002)(31686004)(42186006)(316002)(38100700002)(36756003)(83380400001)(15974865002)(66574015)(2616005)(66946007)(66556008)(66476007)(5660300002)(7416002)(8936002)(26005)(508600001)(186003)(53546011)(4326008)(8676002)(31696002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZnFBTE42QlprVytiR0xDVG15Y2hJcm1CM0ptbjJwUlREbVRiQ1JhZGtHS0dF?= =?utf-8?B?TXRLOVU1WW1VZUphZG5EWkpwOXgzZUoxZlNteEdlWWMwdFpnSnh3T25hdjZN?= =?utf-8?B?ZXlmUi91STYveGpRVGRkK1lpZURwOUp2bXlZbDVKRGxIRUJTU00zS0dkVFBQ?= =?utf-8?B?Ni9JQ2ZQd1ZvL1ZlWThTcmozUFNCTWVtbGZTUUMzR3FaV0tCbmhERHdjRnZT?= =?utf-8?B?MkUrL2QxWDdTa2hwK3FDd2lPUzQxWUZiSFExa0NWNnExSE5jd3cydTRiRERs?= =?utf-8?B?OVpqVUdWdUgxVlBjTHdUZC8zUWRxZ3FMTEZlT3VoTGE1NndtRW5KUGpZRU83?= =?utf-8?B?Vk0yL1dGTUV4dmhXeXZFMnN6TWx2c0paK2M2SitmVndIN3FhdW1iWC90WHQ3?= =?utf-8?B?V04wWUtRUFNDTlYrS1JOTUVxNFVqZGFoREErL1Q5YlFCVlRGa2lLMTV3NURq?= =?utf-8?B?R096Q1hOR0FmYmdadEFLMEhzelYzL3oyaEFFenFZdVB6T2l5MjFRL1VOZldl?= =?utf-8?B?TVNvdmVNWHhTSVc2dDlDRWJYSUgyM05ibXRpeEwyL3lQRGpoRWRmOW1KMU9z?=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network-Message-Id: 172b03f7-0553-4cdb-aa7c-08da4f99f2d2 X-MS-Exchange-CrossTenant-AuthSource: DB9PR04MB9627.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2022 13:13:05.0548 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 800fae25-9b1b-4edc-993d-c939c4e84a64 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 3m3dGi75+Us8/DvGwgjJnmpHPnYP3OYwWmNK++dywi0Zke2c+WtqmT9TTPJM88fb7UBfr1hivzNG0gAia5NCXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8759 X-TM-AS-ERS: 104.47.14.59-0.0.0.0 X-TMASE-Version: StarCloud-1.3-9.0.1004-26958.007 X-TMASE-Result: 10--26.276000-4.000000 X-TMASE-MatchedRID: Jm7Yxmmj9On/9O/B1c/Qy65i3jK3KDOoC/ExpXrHizyOD/YpR7I+IoPc XuILVCbaT+Ssx+cLRQOrlQnbB6G4NwzMLoYOQzD/U+SCBkL7836OQOsE4nDCdEBJWZqYnN7avjN 9OkaN1trzgfRAkJS4G34oUWpcKNWpGU9P+A3Ax1VIK2DGByysypki3iIBA3o/UV7F0kclfoKB97 pzpMZ9Yb5wpZVCbFHLGf8/5qsa+aR/4m4yZXmXb3V7tdtvoiba4SkIdSwphga6pZ/o2Hu2YcvQs fAE10p3PhG3C4bJ9uelztAS7WpJHPnU8bWnyOtNVV4ZZmbE3YzQxDD776KHL44sT3VHmSnEwisn IbO8h0PhJoKhz+mVIpc1ZBri4zqQtfKsnmadsBx+njGZQKtC7ypykp1AmBYaF2J2qC/34DsgaVH 62KJz2wx+wXfgJ2JXPfRUVBjvSwtMnMwEhENCNHAnLUK6q8ZUDVuL2vYqrd4bWHktq2pLiYVYrc Ipy8T8/XVOP8FVfqJftuJwrFEhTbew1twePJJB3QfwsVk0Ubv+efAnnZBiL6nKAIYoU8L4F5iXm 5LZACA= X-TMASE-XGENCLOUD: cec9833c-9309-4bad-8708-4decebf359ac-0-0-200-0 X-TM-Deliver-Signature: 940ACE03D6EF652DAF1FB987B2A911AB DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=opensynergy.com; s=TM-DKIM-20210503141657; t=1655385187; bh=rGGj5KwhUAKraeSfQ6WqjHJfUhEtPuAp0E019tCI2wE=; l=5490; h=Date:To:From; b=lTA6sD6nFivxDl3lFIXdsp7oZG9mdce/zbYYoUojMC49opzCnUXXe0X0vwmt5UsR3 8C6l8wbDQPM+q7BW4IIAIPF6XKIM0IobAt8VYhF7Sd6P7DPMexdAQtAoxlRgsFOyBl jH8IDDg0YDwtRoAP2NXlzxpayxeNjjfdy35ni62b2nHyij1twMUS/kK4+DoFVVrNqh fpkHNEfQIX6Y/77CRgfpVVotedYAYNvdKalVb5Ar67hMaN9+Ukt93D1wRcu1LALe5G 1t+xBFPkf9a/Ly1AZOfK0g2EEZE0MGD/EXLfPFvG5SbsadIpZN0YrGy72kEypMsJli 8FwphdLgbsj0w== X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On 05.04.22 11:37, Alex Bennée wrote: > +/* > + * Utility functions > + */ > +static int open_dev_file(const char *devfile, struct rpmb_ioc_cap_cmd *cap) > +{ > ... > + rpmb_dbg("RPMB rpmb_target = %d\n", cap->target); > + rpmb_dbg("RPMB capacity = %d\n", cap->capacity); > + rpmb_dbg("RPMB block_size = %d\n", cap->block_size); > + rpmb_dbg("RPMB wr_cnt_max = %d\n", cap->wr_cnt_max); > + rpmb_dbg("RPMB rd_cnt_max = %d\n", cap->rd_cnt_max); > + rpmb_dbg("RPMB auth_method = %d\n", cap->auth_method); The previously present device_type has already gone. Do we loose an opportunity to inform the user about anything which may not be virtio RPMB in the future or is this intentional? A new device type VIRTIO_RPMB instead and keeping the door open for UFS, NVMe, eMMC etc.? And if the removal was intentional: rpmb_target, block_size, auth_method: Still needed and if so for what is it good for? > ... > +} > + > +static struct virtio_rpmb_frame * vrpmb_alloc_frames(int n) > +{ > + struct virtio_rpmb_frame *frames; > + > + frames = calloc(n, sizeof(struct virtio_rpmb_frame)); > + if (frames) > + memset(frames, 0, n * sizeof(struct virtio_rpmb_frame)); Very minor: calloc() already zeroes. > + return frames; > +} > + /* + * To read blocks we receive a bunch of frames from the vrpmb device + * which we need to validate and extract the actual data into + * requested buffer. + */ +static int vrpmb_read_blocks(int dev_fd, void *key, int addr, int count, void *data, int len) +{ +... + ret = ioctl(dev_fd, RPMB_IOC_RBLOCKS_CMD, &cmd); + if (ret < 0) { + rpmb_err("rblocks ioctl failure %d: %s.\n", ret, + strerror(errno)); + goto out; + } The (older) rpmb tool always puzzles me with complaining about the mismatch MAC when there was also a result != VIRTIO_RPMB_RES_OK. I guess the ioctl() returns 0 if the ioctl() as such succeeded but there is an error code indicated in the frame. Consider adding to print the result if it indicated a problem. I can remember the old tool used the result of the last frame for this purpose which was probably not a good choice, not sure why this was that way, probably the first frame would be a better choice. + for (i = 0; i < count; i++) { + struct virtio_rpmb_frame *f = &frames[i]; + + vrpmb_dump_frame("block data", f); + + if (key) { + ret = vrpmb_check_mac(key, f, 1); + if (ret) { + rpmb_err("%s: check mac error frame %d/%d\n", __func__, i, ret); + break; + } + } + + memcpy(data, &f->data, RPMB_BLOCK_SIZE); + data += RPMB_BLOCK_SIZE; + } + ret = 0; + + out: + free(frames); + return ret; +} + + +static void *read_key(const char *path) +{ + int key_fd = open_rd_file(path, "key file"); + void *key; + + if (key_fd < 0) + return NULL; + + key = malloc(RPMB_KEY_SIZE); Very minor: There's not a single free() for key in the code. Plays no role here as the program runs only for a fraction of a second, just saw it. You are making your life harder as necessary by using dynamic memory when it can be avoided, all those NULL pointer checks and the free(s) which have to be done... > + > + if (!key) { > + rpmb_err("out of memory for key\n"); > + return NULL; > + } > + > + if (read(key_fd, key, RPMB_KEY_SIZE) != RPMB_KEY_SIZE) { > + rpmb_err("couldn't read key (%s)\n", strerror(errno)); > + return NULL; > + } > + > + close(key_fd); > + return key; > +} > + > > + > +static const struct rpmb_cmd cmds[] = { > + { > + "get-info", > + op_get_info, > + "", > + " Get RPMB device info\n", > + }, > + { > + "program-key", > + op_rpmb_program_key, > + " ", > + " Program authentication KEYFILE\n" > + " NOTE: This is a one-time programmable irreversible change.\n", > + }, > + { > + "write-counter", > + op_rpmb_get_write_counter, > + "", > + " Rertrive write counter value from the to stdout.\n" Optional parameter explanation [KEYFILE] got lost in write-counter. > + }, > + { > + "write-blocks", > + op_rpmb_write_blocks, > + "
", > + " of 256 bytes will be written from the DATA_FILE\n" > + " to the at block offset
.\n" > + " When DATA_FILE is -, read from standard input.\n", Puzzling naming change. The KEYID is indeed the . > + }, > + { > + "read-blocks", > + op_rpmb_read_blocks, > + "
", > + " of 256 bytes will be read from \n" > + " to the OUTPUT_FILE\n" > + " When OUTPUT_FILE is -, write to standard output\n", Here also the optional parameter explanation [KEYFILE] got lost in read-blocks. For people not knowing the tool trying to get into RPMB a complete and consistent help is helpful I can still remember when I was in the situation to understand more playing around with the (older) tool. > + }, > + > + { NULL, NULL, NULL, NULL } > +}; -- Dipl.-Ing. Harald Mommer Senior Software Engineer OpenSynergy GmbH Rotherstr. 20, 10245 Berlin Phone: +49 (30) 60 98 540-0 <== Zentrale Fax: +49 (30) 60 98 540-99 E-Mail: harald.mommer@opensynergy.com www.opensynergy.com Handelsregister: Amtsgericht Charlottenburg, HRB 108616B Geschäftsführer/Managing Director: Regis Adjamah